summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fb9031a)
raw | patch | inline | side by side (parent: fb9031a)
author | gustav_b <gustav_b@users.sourceforge.net> | |
Thu, 20 Sep 2007 08:17:58 +0000 (08:17 +0000) | ||
committer | gustav_b <gustav_b@users.sourceforge.net> | |
Thu, 20 Sep 2007 08:17:58 +0000 (08:17 +0000) |
src/ui/widget/dock-item.cpp | patch | blob | history | |
src/ui/widget/dock.cpp | patch | blob | history | |
src/ui/widget/dock.h | patch | blob | history |
index 372fe5d9d99acd7de286b7192c77f94a396eb951..2187c33e907c2e48fc84071d694aff289c86ae23 100644 (file)
void
DockItem::present()
{
- // iconified or unattached
+
if (isIconified() || !isAttached()) {
show();
}
GTK_WIDGET (_gdl_dock_item));
if (i >= 0)
gtk_notebook_set_current_page (GTK_NOTEBOOK (_gdl_dock_item->parent), i);
- return;
- }
+ }
// always grab focus, even if we're already present
grab_focus();
+
+ if (!isFloating() && getWidget().is_realized())
+ _dock.scrollToItem(*this);
}
diff --git a/src/ui/widget/dock.cpp b/src/ui/widget/dock.cpp
index 0f92f7217eb85add460ea17fe490fe8a93fa996c..f282449dd0994bda824c573b3e4363e953c69630 100644 (file)
--- a/src/ui/widget/dock.cpp
+++ b/src/ui/widget/dock.cpp
#include "dock.h"
+#include <gtkmm/adjustment.h>
+
namespace Inkscape {
namespace UI {
namespace Widget {
}
+void
+Dock::scrollToItem(DockItem& item)
+{
+ int item_x, item_y;
+ item.getWidget().translate_coordinates(getWidget(), 0, 0, item_x, item_y);
+
+ int dock_height = getWidget().get_height(), item_height = item.getWidget().get_height();
+ double vadjustment = _scrolled_window->get_vadjustment()->get_value();
+
+ if (item_y < 0)
+ _scrolled_window->get_vadjustment()->set_value(vadjustment + item_y);
+ else if (item_y + item_height > dock_height)
+ _scrolled_window->get_vadjustment()->set_value(
+ vadjustment + ((item_y + item_height) - dock_height));
+}
+
Glib::SignalProxy0<void>
Dock::signal_layout_changed()
{
diff --git a/src/ui/widget/dock.h b/src/ui/widget/dock.h
index 3b2cb8d772783fbd0616dc166edcd47f38043a0f..3cd29c01f5428b4f99e6ce1d7adf10aaa8022fb3 100644 (file)
--- a/src/ui/widget/dock.h
+++ b/src/ui/widget/dock.h
/** Toggle size of dock between the previous dimensions and the ones sent as parameters */
void toggleDockable(int width=0, int height=0);
+ /** Scrolls the scrolled window container to make the provided dock item visible, if needed */
+ void scrollToItem(DockItem& item);
+
protected:
std::list<const DockItem *> _dock_items; //< added dock items