summaryrefslogtreecommitdiffstats
path: root/perl-install/ugtk2.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2004-02-13 10:57:19 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2004-02-13 10:57:19 +0000
commitb935ffe652e5c050a3609c0befceba5b908af15a (patch)
tree5b46a55d614b81e878c698a6d98429767a78b3b7 /perl-install/ugtk2.pm
parent3e3f3ea4f326a388793be3afdc02cdff4a1b9b91 (diff)
downloaddrakx-backup-do-not-use-b935ffe652e5c050a3609c0befceba5b908af15a.tar
drakx-backup-do-not-use-b935ffe652e5c050a3609c0befceba5b908af15a.tar.gz
drakx-backup-do-not-use-b935ffe652e5c050a3609c0befceba5b908af15a.tar.bz2
drakx-backup-do-not-use-b935ffe652e5c050a3609c0befceba5b908af15a.tar.xz
drakx-backup-do-not-use-b935ffe652e5c050a3609c0befceba5b908af15a.zip
(Gtk2::Banner) move that widget from mcc into ugtk2 so that all tools
can reuise it for their banners
Diffstat (limited to 'perl-install/ugtk2.pm')
-rw-r--r--perl-install/ugtk2.pm40
1 files changed, 40 insertions, 0 deletions
diff --git a/perl-install/ugtk2.pm b/perl-install/ugtk2.pm
index 70ff15d37..f5686e0a5 100644
--- a/perl-install/ugtk2.pm
+++ b/perl-install/ugtk2.pm
@@ -1605,5 +1605,45 @@ sub new_with_text {
}
+package Gtk2::Banner;
+
+use ugtk2 qw(:helpers :wrappers);
+
+sub set_pixmap {
+ my ($darea) = @_;
+ return if !$darea->realized;
+ my $window = $darea->window;
+ my $pixmap = $darea->{back_pixmap} ||= Gtk2::Gdk::Pixmap->new($window, 1, 2, $window->get_depth);
+
+ my $style = $darea->get_style;
+ $pixmap->draw_points($style->bg_gc('normal'), 0, 0);
+ $pixmap->draw_points($style->base_gc('normal'), 0, 1);
+ $darea->window->set_back_pixmap($pixmap);
+
+ $darea->{layout} = $darea->create_pango_layout($darea->{text});
+ $darea->signal_connect(expose_event => sub {
+ my $height = $darea->{icon}->get_height;
+ $darea->{icon}->render_to_drawable($window, $darea->style->bg_gc('normal'),
+ 0, 0, 10, 10, -1, -1, 'none', 0, 0);
+ $darea->window->draw_layout($style->text_gc('normal'), $height + 20, 25, $darea->{layout});
+ });
+}
+
+
+sub new {
+ my ($_class, $icon, $text) = @_;
+
+ my $darea = Gtk2::DrawingArea->new;
+ $darea->set_size_request(-1, 100);
+ $darea->modify_font(Gtk2::Pango::FontDescription->from_string(common::N("_banner font:\nSans 14")));
+ $darea->{icon} = ugtk2::gtkcreate_pixbuf($icon);
+ $darea->{text} = $text;
+
+ $darea->signal_connect(realize => \&set_pixmap);
+ $darea->signal_connect("style-set" => \&set_pixmap);
+
+ return $darea;
+}
+
1;