Ardour  9.0-pre0-582-g084a23a80d
persistent_tooltip.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013-2015 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2015-2016 Robin Gareus <robin@gareus.org>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef gtkmm2ext_persistent_tooltip_h
21 #define gtkmm2ext_persistent_tooltip_h
22 
23 #include <sigc++/trackable.h>
24 
25 #include <gtkmm.h>
26 #include "gtkmm2ext/visibility.h"
27 
28 namespace Gtkmm2ext {
29 
33 class LIBGTKMM2EXT_API PersistentTooltip : public sigc::trackable
34 {
35  public:
36  PersistentTooltip (Gtk::Widget *, bool draggable = false, int margin_y = 0);
37  virtual ~PersistentTooltip ();
38 
39  void set_tip (std::string);
40  void set_font (Pango::FontDescription font);
41  void set_center_alignment (bool align_to_center);
42 
43  virtual bool dragging () const;
44  static void set_tooltips_enabled (bool en) { _tooltips_enabled = en; }
45  static bool tooltips_enabled () { return _tooltips_enabled; }
46 
47  private:
48  static bool _tooltips_enabled;
49  static unsigned int _tooltip_timeout;
50  bool timeout ();
51  void show ();
52  void hide ();
57 
64 
67  bool _draggable;
73  sigc::connection _timeout;
75  std::string _tip;
76  Pango::FontDescription _font;
78  int _margin_y;
79 };
80 
81 }
82 
83 #endif
bool release(GdkEventButton *)
bool leave(GdkEventCrossing *)
void set_center_alignment(bool align_to_center)
PersistentTooltip(Gtk::Widget *, bool draggable=false, int margin_y=0)
static unsigned int _tooltip_timeout
bool press(GdkEventButton *)
virtual bool dragging() const
bool enter(GdkEventCrossing *)
static void set_tooltips_enabled(bool en)
Pango::FontDescription _font
void set_tip(std::string)
void set_font(Pango::FontDescription font)
#define LIBGTKMM2EXT_API