Acme-Gtk2-Ex-Builder

 view release on metacpan or  search on metacpan

README.mkdn  view on Meta::CPAN

# FUNCTIONS

## build

This function acts like ordinary "new" method.
It is exported by default and returns [Acme::Gtk2::Ex::Builder](http://search.cpan.org/perldoc?Acme::Gtk2::Ex::Builder) object.
It can contains several `widget` functions.

    my $app = build {
        widget Window;
        widget Dialog;
        widget FileChooser;
        widget VBox;
    };

## widget

This function creates the Gtk2 widget.
In fact when you use this, `Gtk2::XXX->new` will be called.
See [Gtk2](http://search.cpan.org/perldoc?Gtk2) and Gtk2 API reference.

README.mkdn  view on Meta::CPAN

Following code create [Gtk2::SimpleList](http://search.cpan.org/perldoc?Gtk2::SimpleList) with
additional `timestamp`, `nick` and `message` parameter.
See [Gtk2](http://search.cpan.org/perldoc?Gtk2) and Gtk2 API reference.

    use Gtk2;
    use Gtk2::SimpleList; # Do NOT forgot!!
    

    my $app = build {
        widget SimpleList => contain {
            info id              => 'logviewer';
            set  headers_visible => FALSE;
            set  rules_hint      => TRUE;
        }, (
            timestamp => 'markup',
            nick      => 'markup',
            message   => 'markup',
        );
    };

It also supports prebuilt widget.

README.mkdn  view on Meta::CPAN

attributes, signal and properties,
so save anything what you want or need.

Currently `id` and `packing` have some special meanings.
`id` is used for `widget` method to find widget.
`packing` is used for [Gtk2::VBox](http://search.cpan.org/perldoc?Gtk2::VBox) and [Gtk2::HBox](http://search.cpan.org/perldoc?Gtk2::HBox).

    my $app = build {
        widget Window => contain {
            info id             => 'window';
            set  title          => 'Seoul.pm irc log viewer';
        };
    

        widget HBox => contain {
            info id      => 'hbox';
            info packing => TRUE, TRUE, 1, 'start';
    

            widget ScrolledWindow => contain {
                set policy => 'never', 'automatic';

lib/Acme/Gtk2/Ex/Builder.pm  view on Meta::CPAN

=head1 FUNCTIONS

=head2 build

This function acts like ordinary "new" method.
It is exported by default and returns L<Acme::Gtk2::Ex::Builder> object.
It can contains several C<widget> functions.

    my $app = build {
        widget Window;
        widget Dialog;
        widget FileChooser;
        widget VBox;
    };

=head2 widget

This function creates the Gtk2 widget.
In fact when you use this, C<< Gtk2::XXX->new >> will be called.
See L<Gtk2> and Gtk2 API reference.

lib/Acme/Gtk2/Ex/Builder.pm  view on Meta::CPAN

then specify additional parameters after the C<widget> block.
Following code create L<Gtk2::SimpleList> with
additional C<timestamp>, C<nick> and C<message> parameter.
See L<Gtk2> and Gtk2 API reference.

    use Gtk2;
    use Gtk2::SimpleList; # Do NOT forgot!!
    
    my $app = build {
        widget SimpleList => contain {
            info id              => 'logviewer';
            set  headers_visible => FALSE;
            set  rules_hint      => TRUE;
        }, (
            timestamp => 'markup',
            nick      => 'markup',
            message   => 'markup',
        );
    };

It also supports prebuilt widget.

lib/Acme/Gtk2/Ex/Builder.pm  view on Meta::CPAN

attributes, signal and properties,
so save anything what you want or need.

Currently C<id> and C<packing> have some special meanings.
C<id> is used for C<widget> method to find widget.
C<packing> is used for L<Gtk2::VBox> and L<Gtk2::HBox>.

    my $app = build {
        widget Window => contain {
            info id             => 'window';
            set  title          => 'Seoul.pm irc log viewer';
        };
    
        widget HBox => contain {
            info id      => 'hbox';
            info packing => TRUE, TRUE, 1, 'start';
    
            widget ScrolledWindow => contain {
                set policy => 'never', 'automatic';
            };
        };



( run in 1.181 second using v1.01-cache-2.11-cpan-49f99fa48dc )