Games-Axmud

 view release on metacpan or  search on metacpan

lib/Games/Axmud/OtherWin.pm  view on Meta::CPAN

                if (
                    $self->session->ivExists('currentCageHash', $cageObj->name)
                    && $self->session->ivShow('currentCageHash', $cageObj->name) eq $cageObj
                ) {
                    # The TRUE argument marks this as a current cage
                    $listRef = [TRUE, $cageObj->name];
                    push (@dataList, $listRef);
                }
            }

            $dataHash{$tab} = \@dataList;
        }

        $dataHashRef = \%dataHash;

        # Which function to call if the user double-clicks on a row in the list - in this case, it's
        #   equivalent to the edit button
        $self->ivPoke('notebookSelectRef', sub {

            $self->buttonEdit_cage();
        });

        # Display all of this in the notebook
        return $self->refreshNotebook($tabListRef, $columnListRef, $dataHashRef, $buttonListRef);
    }

    sub activeInterfaceHeader {

        # Called by ->treeViewChanged when the user clicks on the 'Active interfaces' header in the
        #   treeview
        #
        # Expected arguments
        #   $item   - The treeview item that was clicked (i.e. the text it contains)
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $item, $check) = @_;

        # Local variables
        my (
            $tabListRef, $columnListRef, $dataHashRef, $buttonListRef,
            @shortTabList,
            %dataHash,
        );

        # Check for improper arguments
        if (! defined $item || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->activeInterfaceHeader', @_);
        }

        # Prepare the list of tabs
        $tabListRef = [
            'All' => 'A_ll',
            'Dependent' => '_Dependent',
            'Independent' => 'I_ndependent',
            'Trigger' => '_Trigger',
            'Alias' => '_Alias',
            'Macro' => '_Macro',
            'Timer' => 'T_imer',
            'Hook' => '_Hook',
        ];

        @shortTabList = (
            'All', 'Dependent', 'Independent',
            'Trigger', 'Alias', 'Macro', 'Timer', 'Hook',
        );

        # Prepare the list of column headings
        $columnListRef = [
            '#' => 'int',
            'Enab.' => 'bool',
            'Indep.' => 'bool',
            'Cat.' => 'text',
            'Name' => 'text',
        ];

        # Prepare the list of buttons
        $buttonListRef = [
            'Edit', 'Edit the selected interface', 'buttonEdit_activeInterface',
            'Dump', 'Display this list of interfaces in the \'main\' window',
                'buttonDump_activeInterface',
        ];

        # Prepare the data to be displayed
        foreach my $tab (@shortTabList) {

            my (@interfaceList, @dataList);

            @interfaceList = sort {$a->number <=> $b->number}
                ($self->session->ivValues('interfaceNumHash'));

            foreach my $interfaceObj (@interfaceList) {

                my $listRef;

                if (
                    $tab eq 'All'
                    || ($tab eq 'Dependent' && ! $interfaceObj->indepFlag)
                    || ($tab eq 'Independent' && $interfaceObj->indepFlag)
                    || lc($tab) eq $interfaceObj->category
                ) {
                    $listRef = [
                        $interfaceObj->number,
                        $interfaceObj->enabledFlag,
                        $interfaceObj->indepFlag,
                        $interfaceObj->category,
                        $interfaceObj->name,
                    ];

                    push (@dataList, $listRef);
                }
            }

            $dataHash{$tab} = \@dataList;
        }

        $dataHashRef = \%dataHash;

        # Which function to call if the user double-clicks on a row in the list - in this case, it's
        #   equivalent to the edit button
        $self->ivPoke('notebookSelectRef', sub {

            $self->buttonEdit_activeInterface();
        });



( run in 3.403 seconds using v1.01-cache-2.11-cpan-0d23b851a93 )