From f43998b4da6ce82ed40f6f4505043cd563260002 Mon Sep 17 00:00:00 2001 From: joncruz Date: Sun, 19 Feb 2006 07:43:49 +0000 Subject: [PATCH] Refactoring panel containment. Purged ugly 'X'. --- ChangeLog | 6 ++++++ src/dialogs/iconpreview.cpp | 4 ++-- src/dialogs/swatches.cpp | 2 +- src/ui/widget/panel.cpp | 28 ++++++++++++++++++++++++++-- src/ui/widget/panel.h | 3 +++ 5 files changed, 38 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 47a240965..71b3ec903 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-02-18 Jon A. Cruz + * src/dialogs/swatches.cpp, src/dialogs/iconpreview.cpp, + src/ui/widget/panel.cpp, src/ui/widget/panel.h: + + Refactoring panel containment. Purged ugly 'X'. + 2006-02-18 Jon A. Cruz * src/widgets/desktop-widget.cpp, src/dialogs/swatches.cpp, src/dialogs/swatches.h, src/ui/widget/panel.cpp, diff --git a/src/dialogs/iconpreview.cpp b/src/dialogs/iconpreview.cpp index b3ea55df3..4a3248010 100644 --- a/src/dialogs/iconpreview.cpp +++ b/src/dialogs/iconpreview.cpp @@ -185,7 +185,7 @@ IconPreviewPanel::IconPreviewPanel() : Gtk::HButtonBox* holder = new Gtk::HButtonBox( Gtk::BUTTONBOX_END ); - pack_end( *holder, false, false ); + _getContents()->pack_end( *holder, false, false ); selectionButton = new Gtk::ToggleButton(_("Selection")); // , GTK_RESPONSE_APPLY holder->pack_start( *selectionButton, false, false ); @@ -201,7 +201,7 @@ IconPreviewPanel::IconPreviewPanel() : refreshButton->signal_clicked().connect( sigc::mem_fun(*this, &IconPreviewPanel::refreshPreview) ); - pack_start(iconBox, Gtk::PACK_EXPAND_WIDGET); + _getContents()->pack_start(iconBox, Gtk::PACK_EXPAND_WIDGET); show_all_children(); } diff --git a/src/dialogs/swatches.cpp b/src/dialogs/swatches.cpp index c01217fe6..d55a559d8 100644 --- a/src/dialogs/swatches.cpp +++ b/src/dialogs/swatches.cpp @@ -470,7 +470,7 @@ SwatchesPanel::SwatchesPanel() : } - pack_start(*_holder, Gtk::PACK_EXPAND_WIDGET); + _getContents()->pack_start(*_holder, Gtk::PACK_EXPAND_WIDGET); _setTargetFillable(_holder); show_all_children(); diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index b0a35614d..11235d083 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -113,15 +113,22 @@ void Panel::init() one->signal_activate().connect( sigc::bind( sigc::mem_fun(*this, &Panel::bounceCall), 1, 0) ); two->signal_activate().connect( sigc::bind( sigc::mem_fun(*this, &Panel::bounceCall), 1, 1) ); - closeButton.set_label("X"); + //closeButton.set_label("X"); topBar.pack_start(tabTitle); - topBar.pack_end(closeButton, false, false); + //topBar.pack_end(closeButton, false, false); topBar.pack_end(tabButton, false, false); pack_start( topBar, false, false ); + Gtk::HBox* boxy = manage( new Gtk::HBox() ); + + boxy->pack_start( contents, true, true ); + boxy->pack_start( rightBar, false, true ); + + pack_start( *boxy, true, true ); + show_all_children(); bounceCall (0, panel_size); @@ -139,6 +146,23 @@ void Panel::setOrientation( Gtk::AnchorType how ) if ( _anchor != how ) { _anchor = how; + switch ( _anchor ) + { + case Gtk::ANCHOR_NORTH: + case Gtk::ANCHOR_SOUTH: + { + tabButton.reference(); + topBar.remove(tabButton); + rightBar.pack_start(tabButton, false, false); + tabButton.unreference(); + + topBar.remove(tabTitle); + } + break; + + default: + ; // nothing for now + } } } diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h index 9c53be8bb..fbe52d5f5 100644 --- a/src/ui/widget/panel.h +++ b/src/ui/widget/panel.h @@ -44,6 +44,7 @@ public: void restorePanelPrefs(); protected: + Gtk::Box* _getContents() { return &contents; } void _setTargetFillable( PreviewFillable *target ); void _regItem( Gtk::MenuItem* item, int group, int id ); @@ -58,6 +59,8 @@ private: Glib::ustring label; Gtk::HBox topBar; + Gtk::VBox rightBar; + Gtk::VBox contents; Gtk::Label tabTitle; Gtk::OptionMenu tabButton; Gtk::Menu menu; -- 2.30.2