Code

Refactoring panel containment. Purged ugly 'X'.
authorjoncruz <joncruz@users.sourceforge.net>
Sun, 19 Feb 2006 07:43:49 +0000 (07:43 +0000)
committerjoncruz <joncruz@users.sourceforge.net>
Sun, 19 Feb 2006 07:43:49 +0000 (07:43 +0000)
ChangeLog
src/dialogs/iconpreview.cpp
src/dialogs/swatches.cpp
src/ui/widget/panel.cpp
src/ui/widget/panel.h

index 47a240965d467936fa80f3620de1591e50c71522..71b3ec9032bf836895a55ef31497092be7142860 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-02-18  Jon A. Cruz  <jon@joncruz.org>
+       * 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  <jon@joncruz.org>
        * src/widgets/desktop-widget.cpp, src/dialogs/swatches.cpp,
          src/dialogs/swatches.h, src/ui/widget/panel.cpp,
index b3ea55df333085e363c3080482b1912d58027878..4a3248010a38df2fc0b1c419354650b4b57db75a 100644 (file)
@@ -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();
 }
index c01217fe6cee529d3520385bb7d19aa85d7ebddc..d55a559d8d8aec26a5f7689a7a4fea5fa6800f72 100644 (file)
@@ -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();
index b0a35614df1253770d29b5157c67615eebc80d5f..11235d083948fba78c60b22732a87b6f7bfb9bcb 100644 (file)
@@ -113,15 +113,22 @@ void Panel::init()
     one->signal_activate().connect( sigc::bind<int, int>( sigc::mem_fun(*this, &Panel::bounceCall), 1, 0) );
     two->signal_activate().connect( sigc::bind<int, int>( 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
+        }
     }
 }
 
index 9c53be8bb1951f68238015ad513fb601d7b3cb37..fbe52d5f5f840d00a4178ccf8736840b07a32165 100644 (file)
@@ -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;