From 96078650c9de7b6508eb65436328b31cbe49dfd7 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 25 Apr 2015 01:16:39 +0200 Subject: [PATCH] API to set tooltip y-margin Conflicts: libs/gtkmm2ext/gtkmm2ext/persistent_tooltip.h libs/gtkmm2ext/persistent_tooltip.cc --- libs/gtkmm2ext/gtkmm2ext/persistent_tooltip.h | 3 ++- libs/gtkmm2ext/persistent_tooltip.cc | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libs/gtkmm2ext/gtkmm2ext/persistent_tooltip.h b/libs/gtkmm2ext/gtkmm2ext/persistent_tooltip.h index 7e8fae47d0..9df2614095 100644 --- a/libs/gtkmm2ext/gtkmm2ext/persistent_tooltip.h +++ b/libs/gtkmm2ext/gtkmm2ext/persistent_tooltip.h @@ -32,7 +32,7 @@ namespace Gtkmm2ext { class LIBGTKMM2EXT_API PersistentTooltip : public sigc::trackable { public: - PersistentTooltip (Gtk::Widget *, bool draggable = false); + PersistentTooltip (Gtk::Widget *, bool draggable = false, int margin_y = 0); virtual ~PersistentTooltip (); void set_tip (std::string); @@ -70,6 +70,7 @@ class LIBGTKMM2EXT_API PersistentTooltip : public sigc::trackable std::string _tip; Pango::FontDescription _font; bool _align_to_center; + int _margin_y; }; } diff --git a/libs/gtkmm2ext/persistent_tooltip.cc b/libs/gtkmm2ext/persistent_tooltip.cc index 44cb953588..367175f3dc 100644 --- a/libs/gtkmm2ext/persistent_tooltip.cc +++ b/libs/gtkmm2ext/persistent_tooltip.cc @@ -30,13 +30,14 @@ using namespace Gtk; using namespace Gtkmm2ext; /** @param target The widget to provide the tooltip for */ -PersistentTooltip::PersistentTooltip (Gtk::Widget* target, bool draggable) +PersistentTooltip::PersistentTooltip (Gtk::Widget* target, bool draggable, int margin_y) : _target (target) , _window (0) , _label (0) , _draggable (draggable) , _maybe_dragging (false) , _align_to_center (true) + , _margin_y (margin_y) { target->signal_enter_notify_event().connect (sigc::mem_fun (*this, &PersistentTooltip::enter), false); target->signal_leave_notify_event().connect (sigc::mem_fun (*this, &PersistentTooltip::leave), false); @@ -157,7 +158,7 @@ PersistentTooltip::show () the screen, so don't show it in the usual place. */ rx = sw - _window->get_width(); - _window->move (rx, ry + _target->get_height()); + _window->move (rx, ry + _target->get_height() + _margin_y); } else { if (_align_to_center) { _window->move (rx + (_target->get_width () - _window->get_width ()) / 2, ry + _target->get_height());