POE-XUL

 view release on metacpan or  search on metacpan

lib/POE/XUL/Event.pm  view on Meta::CPAN


Called when the users selects a colour in a Colorpicker, Datepicker or other
nodes.  TODO better doco.


=head1 APPLICATION EVENTS

The following events are generated during the life time of the application and
do not have an equivalent in the DOM.

Non-POE::XUL::Application events are not automatically handled;
event listeners must call C<$event->handled> when completed.

=head2 boot

    sub boot {
        my( $self, $event ) = @_[ OBJECT, ARG0 ];
        Window( ... );
        $event->handled;
    }

Called when an application instance is first started.  There is no node
to attach a listener to, however, so this event is posted directly to the
application's session.

A boot event does not have a L</target> node nor a source C</window>.

The application's boot handler is expected to create a Window node.

=head2 close

Called when an application closes, that is when the main window closes.

NOT CURRENTLY IMPLEMENTED.  See L<POE::XUL/timeout> and shutdown.

=head2 connect

Called when the browser opens a sub-window.  Sub-windows are created
with L<"window->open()"|POE::XUL::Window/open>.

POE::XUL::Application's will have a window opened and available via
C<$event->window>.  

    sub connect {
        my( $self, $event ) = @_;

        # add elements to the sub-window
        $event->window->appendChild( Description( "Hello world!" ) );

        # updated the main window also
        window->getElementById( 'message' )->textNode( 'Sub-window opened' );
    }

Other applications  will need to create the
L<POE::XUL::Window> themselves.  C<$event->window> will be the window ID
as passed to C<"window->open()">.

    sub connect {
        my( $self, $event ) = @_[ OBJECT, ARG0 ];
        my $winID = $event->window;
        # create and popuplate the sub-window
        my $win = POE::XUL::Window( id=>$win, 
                                    Description( "Hello world!" ) 
                                  );
        $event->handled;
    }

=head2 disconnect

Called when the users closes a sub-window.

C<$event->window> is the sub-window node.

POE::XUL::Application's will have the sub-window node closed when disconnect
returns.

    sub disconnect {
        my( $self, $event ) = @_;
        my $winID = $event->window->id;
        window->getElementById( 'message' )
                    ->textNode( "Closed window $winID" );
    }

Other applications must get rid of the sub-window explicitly.

    sub disconnect {
        my( $self, $event ) = @_[ OBJECT, ARG0 ];
        $event->window->destroy;
        $event->window( undef() );
        $event->handled;
    }


=head1 AUTHOR

Philip Gwyn E<lt>gwyn-at-cpan.orgE<gt>

=head1 CREDITS

Based on XUL::Node::Event by Ran Eilam.

=head1 COPYRIGHT AND LICENSE

Copyright 2007-2010 by Philip Gwyn.  All rights reserved;

Copyright 2003-2004 Ran Eilam. All rights reserved.

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.


=head1 SEE ALSO

perl(1), L<POE::XUL>, L<POE::XUL::ChangeManager>.

=cut



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