diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2006-02-19 05:32:13 +0000 |
|---|---|---|
| committer | joncruz <joncruz@users.sourceforge.net> | 2006-02-19 05:32:13 +0000 |
| commit | bd98ee2549cf40630a6da66bbd994f2cc39b11b3 (patch) | |
| tree | 96ba2f14c0a94aa5031b009d5200bf3eb4ccc3b8 /src/ui | |
| parent | updated PO files (diff) | |
| download | inkscape-bd98ee2549cf40630a6da66bbd994f2cc39b11b3.tar.gz inkscape-bd98ee2549cf40630a6da66bbd994f2cc39b11b3.zip | |
Fixing scrollbar size for embeded color swatches.
(bzr r158)
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/previewholder.cpp | 34 | ||||
| -rw-r--r-- | src/ui/previewholder.h | 3 | ||||
| -rw-r--r-- | src/ui/widget/panel.cpp | 8 | ||||
| -rw-r--r-- | src/ui/widget/panel.h | 3 |
4 files changed, 46 insertions, 2 deletions
diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp index 321b7899f..961c060bb 100644 --- a/src/ui/previewholder.cpp +++ b/src/ui/previewholder.cpp @@ -14,6 +14,8 @@ #include "previewholder.h" #include <gtkmm/scrolledwindow.h> +#include <gtkmm/sizegroup.h> +#include <gtkmm/scrollbar.h> namespace Inkscape { @@ -24,6 +26,9 @@ PreviewHolder::PreviewHolder() : VBox(), PreviewFillable(), _scroller(0), + _zee0(0), + _zee1(0), + _zee2(0), _anchor(Gtk::ANCHOR_CENTER), _baseSize(Gtk::ICON_SIZE_MENU), _view(VIEW_TYPE_LIST) @@ -32,9 +37,15 @@ PreviewHolder::PreviewHolder() : Gtk::Table* stuff = manage(new Gtk::Table( 1, 2 )); stuff->set_col_spacings( 8 ); _insides = stuff; + + // Add a container with the scroller and a spacer + Gtk::Table* spaceHolder = manage( new Gtk::Table(1, 2) ); + _zee0 = manage( new Gtk::VBox() ); _scroller->add(*stuff); + spaceHolder->attach( *_scroller, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); + spaceHolder->attach( *_zee0, 1, 2, 0, 1, Gtk::SHRINK, Gtk::FILL|Gtk::EXPAND ); - pack_start(*_scroller, Gtk::PACK_EXPAND_WIDGET); + pack_start(*spaceHolder, Gtk::PACK_EXPAND_WIDGET); } PreviewHolder::~PreviewHolder() @@ -89,12 +100,31 @@ void PreviewHolder::setOrientation( Gtk::AnchorType how ) { if ( _anchor != how ) { + _anchor = how; switch ( _anchor ) { case Gtk::ANCHOR_NORTH: case Gtk::ANCHOR_SOUTH: { - dynamic_cast<Gtk::ScrolledWindow*>(_scroller)->set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_NEVER ); + //dynamic_cast<Gtk::ScrolledWindow*>(_scroller)->set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_NEVER ); + dynamic_cast<Gtk::ScrolledWindow*>(_scroller)->set_policy( Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC ); + if ( !_zee1 ) + { + _zee1 = manage( new Gtk::VBox() ); + _zee2 = manage( new Gtk::VBox() ); + + // Trick to get the scrolled window to a minimum height larger than the scrollbar + + Gtk::VScrollbar* vs = dynamic_cast<Gtk::ScrolledWindow*>(_scroller)->get_vscrollbar(); + // TODO fix leakage + Glib::RefPtr<Gtk::SizeGroup> sizer = Gtk::SizeGroup::create(Gtk::SIZE_GROUP_VERTICAL); + sizer->add_widget( *_zee1 ); + sizer->add_widget( *_zee2 ); + sizer->add_widget( *vs ); + + _zee0->pack_start( *_zee1 ); + _zee0->pack_start( *_zee2 ); + } } break; diff --git a/src/ui/previewholder.h b/src/ui/previewholder.h index 532aa771f..58d0dba5d 100644 --- a/src/ui/previewholder.h +++ b/src/ui/previewholder.h @@ -40,6 +40,9 @@ private: std::vector<Previewable*> items; Gtk::Bin *_scroller; Gtk::Table *_insides; + Gtk::Box *_zee0; + Gtk::Box *_zee1; + Gtk::Box *_zee2; Gtk::AnchorType _anchor; Gtk::BuiltinIconSize _baseSize; ViewType _view; diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index 67aca690a..b0a35614d 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -134,6 +134,14 @@ void Panel::setLabel(Glib::ustring const &label) tabTitle.set_label(this->label); } +void Panel::setOrientation( Gtk::AnchorType how ) +{ + if ( _anchor != how ) + { + _anchor = how; + } +} + void Panel::_regItem( Gtk::MenuItem* item, int group, int id ) { menu.append( *item ); diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h index 07225b8ce..9c53be8bb 100644 --- a/src/ui/widget/panel.h +++ b/src/ui/widget/panel.h @@ -38,6 +38,8 @@ public: void setLabel(Glib::ustring const &label); Glib::ustring const &getLabel() const; + virtual void setOrientation( Gtk::AnchorType how ); + const gchar *_prefs_path; void restorePanelPrefs(); @@ -47,6 +49,7 @@ protected: virtual void _handleAction( int setId, int itemId ); + Gtk::AnchorType _anchor; private: void init(); |
