summaryrefslogtreecommitdiffstats
path: root/src/ui/widget/dock.cpp
diff options
context:
space:
mode:
authorgustav_b <gustav_b@users.sourceforge.net>2007-09-20 08:17:58 +0000
committergustav_b <gustav_b@users.sourceforge.net>2007-09-20 08:17:58 +0000
commit2253fd51aece1dd179464456822ee8897f9661f8 (patch)
treea1d609e950d363a17f1f7181e72635bb90f507d8 /src/ui/widget/dock.cpp
parentfix typo in 2geom Makefile_insert (diff)
downloadinkscape-2253fd51aece1dd179464456822ee8897f9661f8.tar.gz
inkscape-2253fd51aece1dd179464456822ee8897f9661f8.zip
Add scrolling of dock on DockItem::present.
(bzr r3777)
Diffstat (limited to 'src/ui/widget/dock.cpp')
-rw-r--r--src/ui/widget/dock.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/ui/widget/dock.cpp b/src/ui/widget/dock.cpp
index 0f92f7217..f282449dd 100644
--- a/src/ui/widget/dock.cpp
+++ b/src/ui/widget/dock.cpp
@@ -15,6 +15,8 @@
#include "dock.h"
+#include <gtkmm/adjustment.h>
+
namespace Inkscape {
namespace UI {
namespace Widget {
@@ -196,6 +198,22 @@ Dock::toggleDockable(int width, int height)
}
+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()
{