API to set tooltip y-margin
Conflicts: libs/gtkmm2ext/gtkmm2ext/persistent_tooltip.h libs/gtkmm2ext/persistent_tooltip.cc
This commit is contained in:
parent
016beaab9b
commit
96078650c9
@ -32,7 +32,7 @@ namespace Gtkmm2ext {
|
|||||||
class LIBGTKMM2EXT_API PersistentTooltip : public sigc::trackable
|
class LIBGTKMM2EXT_API PersistentTooltip : public sigc::trackable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PersistentTooltip (Gtk::Widget *, bool draggable = false);
|
PersistentTooltip (Gtk::Widget *, bool draggable = false, int margin_y = 0);
|
||||||
virtual ~PersistentTooltip ();
|
virtual ~PersistentTooltip ();
|
||||||
|
|
||||||
void set_tip (std::string);
|
void set_tip (std::string);
|
||||||
@ -70,6 +70,7 @@ class LIBGTKMM2EXT_API PersistentTooltip : public sigc::trackable
|
|||||||
std::string _tip;
|
std::string _tip;
|
||||||
Pango::FontDescription _font;
|
Pango::FontDescription _font;
|
||||||
bool _align_to_center;
|
bool _align_to_center;
|
||||||
|
int _margin_y;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,13 +30,14 @@ using namespace Gtk;
|
|||||||
using namespace Gtkmm2ext;
|
using namespace Gtkmm2ext;
|
||||||
|
|
||||||
/** @param target The widget to provide the tooltip for */
|
/** @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)
|
: _target (target)
|
||||||
, _window (0)
|
, _window (0)
|
||||||
, _label (0)
|
, _label (0)
|
||||||
, _draggable (draggable)
|
, _draggable (draggable)
|
||||||
, _maybe_dragging (false)
|
, _maybe_dragging (false)
|
||||||
, _align_to_center (true)
|
, _align_to_center (true)
|
||||||
|
, _margin_y (margin_y)
|
||||||
{
|
{
|
||||||
target->signal_enter_notify_event().connect (sigc::mem_fun (*this, &PersistentTooltip::enter), false);
|
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);
|
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.
|
the screen, so don't show it in the usual place.
|
||||||
*/
|
*/
|
||||||
rx = sw - _window->get_width();
|
rx = sw - _window->get_width();
|
||||||
_window->move (rx, ry + _target->get_height());
|
_window->move (rx, ry + _target->get_height() + _margin_y);
|
||||||
} else {
|
} else {
|
||||||
if (_align_to_center) {
|
if (_align_to_center) {
|
||||||
_window->move (rx + (_target->get_width () - _window->get_width ()) / 2, ry + _target->get_height());
|
_window->move (rx + (_target->get_width () - _window->get_width ()) / 2, ry + _target->get_height());
|
||||||
|
Loading…
Reference in New Issue
Block a user