Games-Axmud

 view release on metacpan or  search on metacpan

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

        # Called by $self->objEnable
        #
        # Expected arguments
        #   (none besides $self)
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

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

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

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

        $self->entry->signal_connect('activate' => sub {

            my ($value, $thisFuncRef);

            $value = $self->entry->get_text();
            $thisFuncRef = $self->funcRef;

            if ($thisFuncRef) {

                &$thisFuncRef($self, $self->entry, $self->funcID, $value);
            }

            $self->entry->set_text('');
        });

        return 1;
    }

    # Other functions

    sub drawNotebook {

        # Called by $self->addTab and $self->convertSimpleTab
        # Draws a Gtk3::Notebook whose tabs can each contain a Gtk3::TextView
        #
        # Expected arguments
        #   (none besides $self)
        #
        # Return values
        #   'undef' on improper arguments or if the widget can't be drawn
        #   Otherwise returns the Gtk3::Notebook

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

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

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

        # Create the notebook, stored in $self->notebook
        my $notebook = Gtk3::Notebook->new();
        $notebook->set_scrollable(TRUE);
        $notebook->popup_enable();
        $notebook->set_can_focus(FALSE);

        # Gtk3::Notebook created
        $self->packingBox2->pack_start($notebook, TRUE, TRUE, 0);
        # Set up ->signal_connects
        $self->setSwitchPageEvent($notebook);

        # Update IVs
        $self->ivPoke('notebook', $notebook);

        return $notebook;
    }

    sub addSimpleTab {

        # Called by GA::Session->setDefaultTab, $self->convertTab or any other code
        # Adds a simple tab (containing a standalone textview object, not a page in a notebook)
        #
        # Expected arguments
        #   $session        - The GA::Session that will control the tab (and the textview object
        #                       it contains)
        #
        # Optional arguments
        #   $colourScheme   - If specified, the name of the colour scheme to use. If 'undef' (or if
        #                       the specified colour scheme doesn't exist), the colour scheme
        #                       specified by $self->initHash is used
        #   $sessionFlag    - Flag set to TRUE if this tab was called by
        #                       GA::Session->setDefaultTab, FALSE (or 'undef') if it was called by
        #                       anything else
        #   $defaultFlag    - Flag set to TRUE if this tab will be $session's default tab (where
        #                       text received from the world is usually displayed), FALSE (or
        #                       'undef') otherwise (might be TRUE even if $sessionFlag is FALSE)
        #   $labelText      - The text to use in the tab label, ignored if specified (exists for
        #                       compatibility with other functions in this group)
        #   $oldBuffer      - If a Gtk3::Notebook with a single tab is being replaced by a
        #                       standalone textview object, the old textview object's
        #                       Gtk3::TextBuffer, which is transferred to the new textview object
        #                       ('undef' otherwise)
        #
        # Return values
        #   'undef' on improper arguments or if the simple tab can't be drawn
        #   Otherwise returns the tab object (GA::Obj::Tab) created, which stores (among other
        #       things) the textview object created

        my (
            $self, $session, $colourScheme, $sessionFlag, $defaultFlag, $labelText, $oldBuffer,
            $check,
        ) = @_;

        # Local variables
        my ($textViewObj, $packedObj, $tabObj);

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

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

        # If this pane object has drawn a notebook, not a simple container (a Gtk3::ScrolledWindow
        #   or Gtk3::VPaned), $self->addTab should have been called instead. Show a warning, then



( run in 1.508 second using v1.01-cache-2.11-cpan-364913b4093 )