Games-Axmud

 view release on metacpan or  search on metacpan

lib/Games/Axmud/Obj/Desktop.pm  view on Meta::CPAN

                push (@list, $winObj);
            }
        }

        return @list;
    }

    sub listSessionFreeWins {

        # Returns an ordered list of 'free' windows used by the specified session (when the
        #   the window's ->session matches the specified session; does not include 'dialogue'
        #   windows)
        #
        # Expected arguments
        #   $session        - The GA::Session which should be matched against 'free' windows
        #
        # Optional arguments
        #   $singleFlag     - If set to TRUE, this functions gives up when it finds the first
        #                       matching window, returning a list containing just that window;
        #                       if set to FALSE (or 'undef'), a list of all matching windows are
        #                       returned
        #
        # Return values
        #   An empty list on improper arguments
        #   Otherwise, returns a list of matching 'free' windows in the order in which they were
        #       created

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

        # Local variables
        my (@emptyList, @list);

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

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

        # Get the list of windows
        foreach my $winObj (sort {$a->number <=> $b->number} ($self->ivValues('freeWinHash'))) {

            if ($winObj->session && $winObj->session eq $session) {

                push (@list, $winObj);

                if ($singleFlag) {

                    # Calling function doesn't care how many matching windows there are, only that
                    #   there is at least one
                    return @list;
                }
            }
        }

        return @list;
    }

    # Widgets

    sub updateWidgets {

        # Can be called by anything. Updates Gtk3's events queue
        # Used for debugging, so that we can track all lines of code like this, if we need to:
        #   Gtk3->main_iteration() while Gtk3->events_pending();
        #
        # Expected arguments
        #   (none besides $self)
        #
        # Optional arguments
        #   $string    - For debugging purposes. Describes the calling function, e.g.
        #                   ->updateWidgets($self->_objClass . '->callingFunction');
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

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

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

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

        # Update Gtk3's events queue
        Gtk3::main_iteration() while Gtk3::events_pending();

        # Any textview objects (GA::Obj::TextView) which is waiting to update its size IVs can now
        #   do so
        foreach my $textViewObj ($self->ivValues('textViewHash')) {

            if ($textViewObj->sizeUpdateFlag) {

                $textViewObj->updateVisibleSize();
            }
        }

        # Optionally, write information about the calling function to the terminal (for debugging)
#        if ($string) {
#
#           print "->updateWidgets() call from " . $string . " at " . $axmud::CLIENT->getTime()
#               . "\n";
#
#        } else {
#
#           print "->updateWidgets() call from unspecified function at " . $axmud::CLIENT->getTime()
#               . "\n";
#        }

        # Handle any Gtk3::TextView scrolling problems (see the comments in GA::Session->new)
        foreach my $session ($axmud::CLIENT->ivValues('sessionHash')) {

            $session->forceScrollTextViews();
        }

        return 1
    }

    sub removeWidget {



( run in 0.817 second using v1.01-cache-2.11-cpan-39bf76dae61 )