The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Gapp::Moose - Gapp widgets for your Moose classes

SYNOPSIS

  package Foo::Bar;

  use Gapp::Moose;

  widget 'label' => (

    is => 'ro',

    traits => [qw( GappLabel )],

    construct => sub {

        text => 'Hello World!'

    },

    lazy => 1,

  );

  widget 'window' => (

    is => 'ro',

    traits => [qw( GappWindow GappDefault )],

    construct => sub {

        my $self = shift;

        title => 'Gapp Application',

        content => [ $self->label ],

        signal_connect => [

            [ 'delete-event' => sub { Gtk2->main_quit } ]

        ],

    },

  );

 package main;

 Foo::Bar->new->show_all;

 Gapp->main;

DESCRIPTION

Gapp::Moose provides sugar for adding Gapp widgets to your Moose classes.

SUGAR

widget

Internally, this calls &Moose::has to create a new attribute with the GappWidget trait applied.

Alternatively, you could apply the GappWidget trait yourself

 has 'widget' => (

    traits => [qw( GappWidget )],

 );

construct

The GappWidget trait adds the construct property added to the attribute. This property accepts a CodeRef or a 1. The CodeRef must return a list of parameters that will be passed to the Gapp::Widget during construction. $self is passed in as the first parameter to the CodeRef. If construct is set to one, the widget will be constructed in its default state.

AUTHORS

Jeffrey Ray Hallock, <jeffrey dot hallock at gmail dot com>

COPYRIGHT & LICENSE

Copyright 2011-2012 Jeffrey Ray Hallock, All Rights Reserved.

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