summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-12-16 16:30:16 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-12-16 16:30:16 +0000
commitc3b55fdf69ce6c71cafd991ebae2fc2b3cfb3d1b (patch)
treec7f37232a158a616500fe8990555fe19fc27784b /perl-install
parentaba3aac607e4be847b5a24bf851655645b1a7033 (diff)
downloaddrakx-backup-do-not-use-c3b55fdf69ce6c71cafd991ebae2fc2b3cfb3d1b.tar
drakx-backup-do-not-use-c3b55fdf69ce6c71cafd991ebae2fc2b3cfb3d1b.tar.gz
drakx-backup-do-not-use-c3b55fdf69ce6c71cafd991ebae2fc2b3cfb3d1b.tar.bz2
drakx-backup-do-not-use-c3b55fdf69ce6c71cafd991ebae2fc2b3cfb3d1b.tar.xz
drakx-backup-do-not-use-c3b55fdf69ce6c71cafd991ebae2fc2b3cfb3d1b.zip
- add DrawingArea
- add text_ref & format for buttons
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/mygtk2.pm26
1 files changed, 23 insertions, 3 deletions
diff --git a/perl-install/mygtk2.pm b/perl-install/mygtk2.pm
index 3d594ab7c..ee90cf5c1 100644
--- a/perl-install/mygtk2.pm
+++ b/perl-install/mygtk2.pm
@@ -129,9 +129,11 @@ sub _gtk_any_Button {
}
if (!$w) {
- $w = $opts->{image} || !exists $opts->{text} ? "Gtk2::$class"->new :
- delete $opts->{mnemonic} ? "Gtk2::$class"->new_with_label(delete $opts->{text}) :
- "Gtk2::$class"->new_with_mnemonic(delete $opts->{text});
+ $w = $opts->{image} ? "Gtk2::$class"->new :
+ delete $opts->{mnemonic} ? "Gtk2::$class"->new_with_mnemonic(delete $opts->{text} || '') :
+ "Gtk2::$class"->new_with_label(delete $opts->{text} || '');
+
+ $w->{format} = delete $opts->{format} if exists $opts->{format};
}
if (my $image = delete $opts->{image}) {
@@ -141,6 +143,14 @@ sub _gtk_any_Button {
$w->set_sensitive(delete $opts->{sensitive}) if exists $opts->{sensitive};
$w->set_relief(delete $opts->{relief}) if exists $opts->{relief};
+ if (my $text_ref = delete $opts->{text_ref}) {
+ my $set = sub {
+ eval { $w->set_label(may_apply($w->{format}, $$text_ref)) };
+ };
+ gtkval_register($w, $text_ref, $set);
+ $set->();
+ }
+
if ($class eq 'Button') {
$w->signal_connect(clicked => delete $opts->{clicked}) if exists $opts->{clicked};
} else {
@@ -210,6 +220,16 @@ sub _gtk__VSeparator { &_gtk_any_simple }
sub _gtk__HSeparator { &_gtk_any_simple }
sub _gtk__Calendar { &_gtk_any_simple }
+sub _gtk__DrawingArea {
+ my ($w, $opts) = @_;
+
+ if (!$w) {
+ $w = Gtk2::DrawingArea->new;
+ }
+ $w->signal_connect(expose_event => delete $opts->{expose_event}) if exists $opts->{expose_event};
+ $w;
+}
+
sub _gtk__Pixbuf {
my ($w, $opts) = @_;