From 969cbe660355cee44fa392b09fcb15621d6bc211 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 22 Sep 2008 12:56:48 +0000 Subject: (_gtk__MDV_Notebook) implement new sidepanel widget --- perl-install/install/NEWS | 1 + perl-install/install/pixmaps/cadre-blanc_600.png | Bin 0 -> 217753 bytes perl-install/install/pixmaps/cadre-blanc_768.png | Bin 0 -> 404143 bytes .../right-white-background_left_part_600.png | Bin 0 -> 3519 bytes .../right-white-background_left_part_768.png | Bin 0 -> 7287 bytes .../right-white-background_right_part_600.png | Bin 0 -> 190379 bytes .../right-white-background_right_part_768.png | Bin 0 -> 344987 bytes perl-install/install/pixmaps/rollover.png | Bin 0 -> 2335 bytes perl-install/mygtk2.pm | 65 +++++++++++++++++++++ perl-install/pixmaps/steps_on.png | Bin 788 -> 4229 bytes 10 files changed, 66 insertions(+) create mode 100644 perl-install/install/pixmaps/cadre-blanc_600.png create mode 100644 perl-install/install/pixmaps/cadre-blanc_768.png create mode 100644 perl-install/install/pixmaps/right-white-background_left_part_600.png create mode 100644 perl-install/install/pixmaps/right-white-background_left_part_768.png create mode 100644 perl-install/install/pixmaps/right-white-background_right_part_600.png create mode 100644 perl-install/install/pixmaps/right-white-background_right_part_768.png create mode 100644 perl-install/install/pixmaps/rollover.png diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS index be09b2327..78376866f 100644 --- a/perl-install/install/NEWS +++ b/perl-install/install/NEWS @@ -2,6 +2,7 @@ o ethernet: enic, qlge - i18n: o add support for ibus +- new sidepanel style - restore support for right alignement for simple widgets (regression introduced in 11.46 - 17 September 2008) diff --git a/perl-install/install/pixmaps/cadre-blanc_600.png b/perl-install/install/pixmaps/cadre-blanc_600.png new file mode 100644 index 000000000..3e765cf59 Binary files /dev/null and b/perl-install/install/pixmaps/cadre-blanc_600.png differ diff --git a/perl-install/install/pixmaps/cadre-blanc_768.png b/perl-install/install/pixmaps/cadre-blanc_768.png new file mode 100644 index 000000000..580a7b254 Binary files /dev/null and b/perl-install/install/pixmaps/cadre-blanc_768.png differ diff --git a/perl-install/install/pixmaps/right-white-background_left_part_600.png b/perl-install/install/pixmaps/right-white-background_left_part_600.png new file mode 100644 index 000000000..96f9c8f23 Binary files /dev/null and b/perl-install/install/pixmaps/right-white-background_left_part_600.png differ diff --git a/perl-install/install/pixmaps/right-white-background_left_part_768.png b/perl-install/install/pixmaps/right-white-background_left_part_768.png new file mode 100644 index 000000000..461e5daeb Binary files /dev/null and b/perl-install/install/pixmaps/right-white-background_left_part_768.png differ diff --git a/perl-install/install/pixmaps/right-white-background_right_part_600.png b/perl-install/install/pixmaps/right-white-background_right_part_600.png new file mode 100644 index 000000000..8fb21bc24 Binary files /dev/null and b/perl-install/install/pixmaps/right-white-background_right_part_600.png differ diff --git a/perl-install/install/pixmaps/right-white-background_right_part_768.png b/perl-install/install/pixmaps/right-white-background_right_part_768.png new file mode 100644 index 000000000..545dfc0b3 Binary files /dev/null and b/perl-install/install/pixmaps/right-white-background_right_part_768.png differ diff --git a/perl-install/install/pixmaps/rollover.png b/perl-install/install/pixmaps/rollover.png new file mode 100644 index 000000000..0a576193d Binary files /dev/null and b/perl-install/install/pixmaps/rollover.png differ diff --git a/perl-install/mygtk2.pm b/perl-install/mygtk2.pm index cb17db1ff..6b97fb49f 100644 --- a/perl-install/mygtk2.pm +++ b/perl-install/mygtk2.pm @@ -625,6 +625,53 @@ sub _gtk__Expander { $w; } + + +sub _gtk__MDV_Notebook { + my ($w, $opts, $_class, $action) = @_; + if (!$w) { + import_style_ressources(); + + my ($layout, $selection_arrow, $selection_bar); + my $parent_window = delete $opts->{parent_window} || root_window(); + my $root_height = first($parent_window->get_size()); + my $suffix = $::testing || $root_height eq 800 ? '_600' : '_768'; + # the white square is a little bit above the actual left sidepanel: + my $offset = 20; + my $is_flip_needed = text_direction_rtl(); + my $left_background = gtknew('Image', file => 'left-background.png'); + my $right_background = gtknew('Image', file => "right-white-background_left_part$suffix", flip => $is_flip_needed); + my $width1 = $left_background->get_pixbuf->get_width; + my $total_width = $width1 + $right_background->get_pixbuf->get_width; + my $arrow_x = text_direction_rtl() ? $offset/2 -4 : $::stepswidth - $offset -3; + $w = gtknew('HBox', spacing => 0, children => [ + 0, $layout = gtknew('Layout', width => $total_width - $offset, children => [ #Layout Fixed + # stacking order is important for "Z-buffer": + [ $left_background, 0, 0 ], + if_($suffix ne '_600', + [ gtknew('Image', file => 'left-background-filler.png'), 0, $left_background->get_pixbuf->get_height ], + ), + [ $selection_bar = gtknew('Image', file => 'rollover.png'), 0, 0 ], # arbitrary vertical position + ($opts->{children} ? @{ delete $opts->{children} } : ()), + [ $right_background, (text_direction_rtl() ? 0 : $width1 - $offset), 0 ], + # stack on top (vertical position is arbitrary): + [ $selection_arrow = gtknew('Image', file => 'steps_on', flip => $is_flip_needed), $arrow_x, 0, ], + ]), + 0, gtknew('Image', file => "right-white-background_right_part$suffix", flip => $is_flip_needed), + ]); + + bless($w, 'Gtk2::MDV_Notebook'); + add2hash($w, { + arrow_x => $arrow_x, + layout => $layout, + selection_arrow => $selection_arrow, + selection_bar =>$selection_bar, + }); + } + $w; +} + + sub _gtk__Fixed { my ($w, $opts, $_class, $action) = @_; @@ -1347,5 +1394,23 @@ sub text_direction_rtl() { Gtk2::Widget->get_default_direction() eq 'rtl'; } +package Gtk2::MDV_Notebook; # helper functions for installer & mcc +our @ISA = qw(Gtk2::Widget); + +sub hide_selection { + my ($w) = @_; + $_->hide foreach $w->{selection_bar}, $w->{selection_arrow}; +} + +sub move_selection { + my ($w, $y) = @_; + my $layout = $w->{layout}; + $layout->{arrow_ydiff} ||= + ($w->{selection_arrow}->get_pixbuf->get_height - $w->{selection_bar}->get_pixbuf->get_height)/2; + my $bar_y = $y -3; # text's pos_y -3 + $layout->move($w->{selection_bar}, 0, $bar_y); + $layout->move($w->{selection_arrow}, $w->{arrow_x}, $bar_y - $layout->{arrow_ydiff}); # arrow is higer + $_->show foreach $w->{selection_bar}, $w->{selection_arrow}; +} 1; diff --git a/perl-install/pixmaps/steps_on.png b/perl-install/pixmaps/steps_on.png index c760702eb..ebeb5f6ea 100644 Binary files a/perl-install/pixmaps/steps_on.png and b/perl-install/pixmaps/steps_on.png differ -- cgit v1.2.1