CONSTRUCTOR
new
Creates a new widget from a .glade file. It accepts the following parameters.
- file => STRING
-
The full path name of the glade file to use.
- widget => STRING
-
the name used in the glade file for the container widget to use.
- name => STRING
-
A name for the widget. This is used to allow more than one widget to be in the same session. The state names are then constructed by concatenating the method name you pass in the states parameter with this name, seperated by an underscore:
$state = "$method\_$name";
It is easy to use the widget name used for the custom widget in the container glade file for this, as this is passed to your constructor.
package FooWidget; use base qw(Glade2::Widget);
sub new { my $class, $name, undef, undef, undef, undef) = @_; my $self = { ... name => $name, }; ... }
The example above also shows that you get String1, String2, Int1 and Int2 fields you can specify in Glade in your constructor as well. Not exactly a great API, but it can be useful for some things.
- states => LISTREF
-
a list of extra POE states to register. These are registered as object states, with the widget as the object.
METHODS
yield (METHODNAME, ARGUMENTS)
This method is used to call a poe event METHODNAME with optional ARGUMENTS. It is mainly useful for calling events on widgets that have more than one instance in a session, as it turns METHODNAME into the proper event name that was autogenerated to avoid duplication.