view release on metacpan or search on metacpan
object to the Context.
- You can add icons to Notebook tab titles by prefixing the
title with the stock item named in square brackets.
Bugfix:
- Prevent double object update triggering when switching
Notebook tabs and Radiobuttons.
0.60 Mon Mar 27, 2006, joern
Features:
- Gtk2::Ex::FormFactory::Menu
- Add 'active_cond' and 'active_depends' keys to the
menu item definition to control widget activity not
just on a per object basis.
- Gtk2::Ex::FormFactory::Widget:
- active_cond may return not just a boolean but one of
the strings 'insensitive', 'invisible', 'sensitive',
'visible' to get the corresponding state.
- Gtk2::Ex::FormFactory::ExecFlow:
- New widget for displaying Event::ExecFlow job plans
- Gtk2::Ex::FormFactory::VPaned:
- New container widget for Gtk2::VPaned
- Gtk2::Ex::FormFactory::ToggleButton:
- Stock image support added
- Gtk2::Ex::FormFactory::Context
- Some internal cleanup to reduce memory footprint
Bugfixes:
- Gtk2::Ex::FormFactory::Menu
- On cleanup deregistering of objects the menu
depends on was not complete.
- Gtk2::Ex::FormFactory::Context
- Widgets with active_depends => "object.attr" (not just
an object) weren't updated if the object changed.
0.59 Wed Dec 28, 2005, joern
Features:
- Default layout implementaion for width/height now uses
set_size_request() only for non-window widgets and
lib/Gtk2/Ex/FormFactory/GtkWidget.pm
lib/Gtk2/Ex/FormFactory/HBox.pm
lib/Gtk2/Ex/FormFactory/HPaned.pm
lib/Gtk2/Ex/FormFactory/HSeparator.pm
lib/Gtk2/Ex/FormFactory/Image.pm
lib/Gtk2/Ex/FormFactory/Intro.pm
lib/Gtk2/Ex/FormFactory/Label.pm
lib/Gtk2/Ex/FormFactory/Layout.pm
lib/Gtk2/Ex/FormFactory/List.pm
lib/Gtk2/Ex/FormFactory/Loader.pm
lib/Gtk2/Ex/FormFactory/Menu.pm
lib/Gtk2/Ex/FormFactory/Notebook.pm
lib/Gtk2/Ex/FormFactory/Popup.pm
lib/Gtk2/Ex/FormFactory/ProgressBar.pm
lib/Gtk2/Ex/FormFactory/Proxy.pm
lib/Gtk2/Ex/FormFactory/ProxyBuffered.pm
lib/Gtk2/Ex/FormFactory/RadioButton.pm
lib/Gtk2/Ex/FormFactory/Rules.pm
lib/Gtk2/Ex/FormFactory/TextView.pm
lib/Gtk2/Ex/FormFactory/Table.pm
lib/Gtk2/Ex/FormFactory/Timestamp.pm
author: []
license: unknown
distribution_type: module
configure_requires:
ExtUtils::MakeMaker: 0
build_requires:
ExtUtils::MakeMaker: 0
requires:
Gtk2: 0
Gtk2::SimpleList: 0
Gtk2::SimpleMenu: 0
no_index:
directory:
- t
- inc
generated_by: ExtUtils::MakeMaker version 6.55_02
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
Makefile.PL view on Meta::CPAN
use strict;
use ExtUtils::MakeMaker;
WriteMakefile(
'NAME' => 'Gtk2::Ex::FormFactory',
'VERSION_FROM' => 'lib/Gtk2/Ex/FormFactory.pm',
'PREREQ_PM' => {
'Gtk2' => 0,
'Gtk2::SimpleList' => 0,
'Gtk2::SimpleMenu' => 0,
},
'dist' => {
COMPRESS => "gzip",
SUFFIX => "gz",
PREOP => q[tools/genreadme],
POSTOP => q[mkdir -p dist; mv Gtk2-Ex-FormFactory*tar.gz dist/],
},
);
lib/Gtk2/Ex/FormFactory/Layout.pm view on Meta::CPAN
package Gtk2::Ex::FormFactory::Layout;
use strict;
use Gtk2::SimpleList;
use Gtk2::SimpleMenu;
my $DEFAULT_SPACING = 5;
sub new {
my $class = shift;
return bless {}, $class;
}
sub build_widget {
lib/Gtk2/Ex/FormFactory/Layout.pm view on Meta::CPAN
$gtk_window->set_transient_for($gtk_parent_window);
}
1;
}
sub build_menu {
my $self = shift;
my ($menu) = @_;
my $gtk_menu = Gtk2::SimpleMenu->new (
menu_tree => $menu->get_menu_tree,
default_callback => $menu->get_default_callback,
user_data => $menu->get_user_data,
);
$menu->set_gtk_widget($gtk_menu->{widget});
$menu->set_gtk_simple_menu($gtk_menu);
1;
}
lib/Gtk2/Ex/FormFactory/Layout.pm view on Meta::CPAN
$list->set_gtk_widget($slist);
1;
}
sub build_popup {
my $self = shift;
my ($popup) = @_;
my $gtk_popup_menu = Gtk2::Menu->new;
my $gtk_popup = Gtk2::OptionMenu->new;
$gtk_popup->set_menu($gtk_popup_menu);
$popup->set_gtk_widget ( $gtk_popup );
1;
}
sub build_progress_bar {
my $self = shift;
my ($progress_bar) = @_;
lib/Gtk2/Ex/FormFactory/Loader.pm view on Meta::CPAN
@Gtk2::Ex::FormFactory::Entry::ISA = qw( Gtk2::Ex::FormFactory::Loader );
@Gtk2::Ex::FormFactory::Expander::ISA = qw( Gtk2::Ex::FormFactory::Loader );
@Gtk2::Ex::FormFactory::ExecFlow::ISA = qw( Gtk2::Ex::FormFactory::Loader );
@Gtk2::Ex::FormFactory::Form::ISA = qw( Gtk2::Ex::FormFactory::Loader );
@Gtk2::Ex::FormFactory::GtkWidget::ISA = qw( Gtk2::Ex::FormFactory::Loader );
@Gtk2::Ex::FormFactory::HBox::ISA = qw( Gtk2::Ex::FormFactory::Loader );
@Gtk2::Ex::FormFactory::HSeparator::ISA = qw( Gtk2::Ex::FormFactory::Loader );
@Gtk2::Ex::FormFactory::Image::ISA = qw( Gtk2::Ex::FormFactory::Loader );
@Gtk2::Ex::FormFactory::Label::ISA = qw( Gtk2::Ex::FormFactory::Loader );
@Gtk2::Ex::FormFactory::List::ISA = qw( Gtk2::Ex::FormFactory::Loader );
@Gtk2::Ex::FormFactory::Menu::ISA = qw( Gtk2::Ex::FormFactory::Loader );
@Gtk2::Ex::FormFactory::Notebook::ISA = qw( Gtk2::Ex::FormFactory::Loader );
@Gtk2::Ex::FormFactory::Popup::ISA = qw( Gtk2::Ex::FormFactory::Loader );
@Gtk2::Ex::FormFactory::ProgressBar::ISA = qw( Gtk2::Ex::FormFactory::Loader );
@Gtk2::Ex::FormFactory::RadioButton::ISA = qw( Gtk2::Ex::FormFactory::Loader );
@Gtk2::Ex::FormFactory::Table::ISA = qw( Gtk2::Ex::FormFactory::Loader );
@Gtk2::Ex::FormFactory::TextView::ISA = qw( Gtk2::Ex::FormFactory::Loader );
@Gtk2::Ex::FormFactory::Timestamp::ISA = qw( Gtk2::Ex::FormFactory::Loader );
@Gtk2::Ex::FormFactory::ToggleButton::ISA = qw( Gtk2::Ex::FormFactory::Loader );
@Gtk2::Ex::FormFactory::VBox::ISA = qw( Gtk2::Ex::FormFactory::Loader );
@Gtk2::Ex::FormFactory::VSeparator::ISA = qw( Gtk2::Ex::FormFactory::Loader );
lib/Gtk2/Ex/FormFactory/Menu.pm view on Meta::CPAN
package Gtk2::Ex::FormFactory::Menu;
use strict;
use base qw( Gtk2::Ex::FormFactory::Container );
sub get_type { "menu" }
sub get_menu_tree { shift->{menu_tree} }
sub get_default_callback { shift->{default_callback} }
sub get_user_data { shift->{user_data} }
lib/Gtk2/Ex/FormFactory/Menu.pm view on Meta::CPAN
$name =~ s/_//g;
if ( $def->{item_type} eq '<Branch>' ) {
$self->build_active_menu_items (
$def->{children},
"$path/$name",
);
}
if ( $def->{object} || $def->{active_cond} ) {
my $menu_item = Gtk2::Ex::FormFactory::MenuItem->new (
object => $def->{object},
active_cond => $def->{active_cond},
active_depends => $def->{active_depends},
);
$menu_item->set_form_factory($self->get_form_factory);
$menu_item->set_gtk_widget(
$self->get_gtk_simple_menu
->get_widget("$path/$name")
);
push @{$self->get_content}, $menu_item;
}
$i += 2;
}
1;
}
package Gtk2::Ex::FormFactory::MenuItem;
use base qw( Gtk2::Ex::FormFactory::Widget );
sub get_type { "menu_item" }
sub build_widget { 1 }
1;
__END__
=head1 NAME
Gtk2::Ex::FormFactory::Menu - A Menu in a FormFactory framework
=head1 SYNOPSIS
Gtk2::Ex::FormFactory::Menu->new (
menu_tree => Hierarchical definition of the Menu,
default_callback => Default callback for menu items,
user_data => User data for the default callback,
...
Gtk2::Ex::FormFactory::Widget attributes
);
=head1 DESCRIPTION
This class implements a Menu in a Gtk2::Ex::FormFactory framework and
pretty much wraps Gtk2::Ex::Simple::Menu. No application object attributes
are associated with a Menu as a whole.
But you may associate single Menu entries with an object. This way the
correspondent entries will set insensitive automatically if the
underlying object is undef and vice versa are activated once the object
is defined.
=head1 OBJECT HIERARCHY
Gtk2::Ex::FormFactory::Intro
Gtk2::Ex::FormFactory::Widget
+--- Gtk2::Ex::FormFactory::Menu
Gtk2::Ex::FormFactory::Layout
Gtk2::Ex::FormFactory::Rules
Gtk2::Ex::FormFactory::Context
Gtk2::Ex::FormFactory::Proxy
=head1 ATTRIBUTES
Attributes are handled through the common get_ATTR(), set_ATTR()
style accessors, but they are mostly passed once to the object
constructor and must not be altered after the associated FormFactory
was built.
=over 4
=item B<menu_tree> = ARRAYREF [mandatory]
This is a slightly extended menu tree definition in terms of
Gtk2::Ex::Simple::Menu. You may optionally associate each
entry with an application object by specifying its name with
the B<object> key in the item definition hash. This way the
item is active only if the correspondent object is defined.
As well you can control widget activity more detailed using the
B<active_cond> and B<active_depends> keys as described in the
Gtk2::Ex::FormFactory::Widget manpage.
A short example. This is a File menu where the 'Save' and 'Close'
entries are sensitive only if a file was opened. We presume
lib/Gtk2/Ex/FormFactory/Menu.pm view on Meta::CPAN
callback => \&manage_rows,
object => 'worksheet',
active_cond => sub { $worksheet->get_selected_rows_cnt > 3 },
active_depends => "worksheet.rows",
],
},
];
=item B<default_callback> = CODEREF [optional]
The default callback of this menu. Refer to Gtk2::Ex::Simple::Menu
for details.
=item B<user_data> = SCALAR [optional]
User data of the default callback of this menu. Refer to
Gtk2::Ex::Simple::Menu for details.
=back
For more attributes refer to L<Gtk2::Ex::FormFactory::Widget>.
=head1 AUTHORS
Jörn Reder <joern at zyn dot de>
=head1 COPYRIGHT AND LICENSE
lib/Gtk2/Ex/FormFactory/Popup.pm view on Meta::CPAN
sub object_to_widget {
my $self = shift;
my $content = $self->get_items ||
$self->get_proxy->get_attr_list($self->get_attr, $self->get_name);
my $value = $self->get_object_value;
my $gtk_popup = $self->get_gtk_widget;
my $gtk_popup_menu = Gtk2::Menu->new;
$gtk_popup->remove_menu;
$gtk_popup->set_menu($gtk_popup_menu);
my ($history, $i);
if ( ref $content eq 'ARRAY' ) {
my ($item);
$history = $i = 0;
foreach my $text ( @{$content} ) {
if ( ref $text eq 'ARRAY' ) {
$item = Gtk2::MenuItem->new ($text->[1]);
$item->show;
$item->{value} = $text->[0];
$gtk_popup_menu->append($item);
$history = $i if $text->[0] eq $value;
} else {
$item = Gtk2::MenuItem->new ($text);
$item->show;
$item->{value} = $i;
$gtk_popup_menu->append($item);
$history = $i if $i == $value;
}
++$i;
}
} else {
my (@content, $k, $v);
push @content, [ $k, $v ] while ($k,$v) = each %{$content};
my ($item);
$history = $i = 0;
foreach my $c ( sort { $a->[1] cmp $b->[1] } @content ) {
$item = Gtk2::MenuItem->new ($c->[1]);
$item->show;
$item->{value} = $c->[0];
$gtk_popup_menu->append($item);
$history = $i if $value eq $c->[0];
++$i;
}
}
$gtk_popup->set_history ($history);
lib/Gtk2/Ex/FormFactory/Popup.pm view on Meta::CPAN
sub get_widget_value {
my $self = shift;
return $self->get_gtk_widget->get_menu->get_active->{value};
}
sub empty_widget {
my $self = shift;
my $gtk_popup = $self->get_gtk_widget;
my $gtk_popup_menu = Gtk2::Menu->new;
$gtk_popup->remove_menu;
$gtk_popup->set_menu($gtk_popup_menu);
my $item = Gtk2::MenuItem->new (" ");
$item->show;
$gtk_popup_menu->append($item);
$gtk_popup->set_history ( 0 );
1;
}
sub backup_widget_value {
my $self = shift;
lib/Gtk2/Ex/FormFactory/Widget.pm view on Meta::CPAN
+--- Gtk2::Ex::FormFactory::DialogButtons
+--- Gtk2::Ex::FormFactory::Entry
+--- Gtk2::Ex::FormFactory::Expander
+--- Gtk2::Ex::FormFactory::ExecFlow
+--- Gtk2::Ex::FormFactory::GtkWidget
+--- Gtk2::Ex::FormFactory::HPaned
+--- Gtk2::Ex::FormFactory::HSeparator
+--- Gtk2::Ex::FormFactory::Image
+--- Gtk2::Ex::FormFactory::Label
+--- Gtk2::Ex::FormFactory::List
+--- Gtk2::Ex::FormFactory::Menu
+--- Gtk2::Ex::FormFactory::Popup
+--- Gtk2::Ex::FormFactory::ProgressBar
+--- Gtk2::Ex::FormFactory::RadioButton
+--- Gtk2::Ex::FormFactory::TextView
+--- Gtk2::Ex::FormFactory::Timestamp
+--- Gtk2::Ex::FormFactory::ToggleButton
+--- Gtk2::Ex::FormFactory::VPaned
+--- Gtk2::Ex::FormFactory::VSeparator
+--- Gtk2::Ex::FormFactory::YesNo
tutorial/music.pl view on Meta::CPAN
if ( !$self->get_config->get_db_connection_ok ) {
$self->open_preferences;
}
1;
}
sub build_menu {
my $self = shift;
return Gtk2::Ex::FormFactory::Menu->new (
menu_tree => [
"_File" => {
item_type => '<Branch>',
children => [
"_Exit" => {
item_type => '<StockItem>',
extra_data => 'gtk-quit',
callback => sub {
$self->get_form_factory->close;
Gtk2->main_quit;