2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_TOOLTIP_H
4 #define _GTKMM_TOOLTIP_H
9 /* Copyright (C) 2007 The gtkmm Development Team
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
21 * You should have received a copy of the GNU Library General Public
22 * License along with this library; if not, write to the Free
23 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #include <glibmm/object.h>
27 #include <gdkmm/pixbuf.h>
28 #include <gtkmm/enums.h>
29 #include <gtkmm/widget.h>
32 #ifndef DOXYGEN_SHOULD_SKIP_THIS
33 typedef struct _GtkTooltip GtkTooltip;
34 typedef struct _GtkTooltipClass GtkTooltipClass;
35 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
39 { class Tooltip_Class; } // namespace Gtk
43 /** Add tips to your widgets
45 * Gtk::Tooltip belongs to the new tooltips API that was introduced in GTK+ 2.12
46 * and which deprecates the old Gtk::Tooltips API.
48 * Basic tooltips can be realized simply by using set_tooltip_text()
49 * or set_tooltip_markup() without any explicit tooltip object.
51 * When you need a tooltip with a little more fancy contents, like
52 * adding an image, or you want the tooltip to have different contents
53 * per Gtk::TreeView row or cell, you will have to do a little more work:
55 * - Call Gtk::Widget:set_has_tooltip(); this will
56 * make GTK+ monitor the widget for motion and related events
57 * which are needed to determine when and where to show a tooltip.
59 * - Connect to Gtk::Widget::signal_query_tooltip(). This signal
60 * will be emitted when a tooltip is supposed to be shown. One
61 * of the arguments passed to the signal handler is a Gtk::Tooltip
62 * object. This is the object that we are about to display as a
63 * tooltip, and can be manipulated in your callback using functions
64 * like Gtk::Tooltip::set_icon(). There are functions for setting
65 * the tooltip's markup, setting an image from a stock icon, or
66 * even putting in a custom widget.
68 * - Return true from your query-tooltip handler. This causes
69 * the tooltip to be show. If you return false, it will not be shown.
71 * In the probably rare case where you want to have even more control
72 * over the tooltip that is about to be shown, you can set your own
73 * Window which will be used as tooltip window. This works as follows:
75 * - Do Gtk::Widget::set_has_tooltip() and connect to
76 * Gtk::Widget::signal_query_tooltip() as before.
78 * - Use Gtk::Widget::set_tooltip_window() to set a Gtk::Window created
79 * by you as tooltip window.
81 * - In the query-tooltip callback you can access your window
82 * using Gtk::Widget::get_tooltip_window() and manipulate it as you
83 * wish. The semantics of the return value are exactly as before,
84 * return true to show the window, false to not show it.
89 class Tooltip : public Glib::Object
93 #ifndef DOXYGEN_SHOULD_SKIP_THIS
96 typedef Tooltip CppObjectType;
97 typedef Tooltip_Class CppClassType;
98 typedef GtkTooltip BaseObjectType;
99 typedef GtkTooltipClass BaseClassType;
101 private: friend class Tooltip_Class;
102 static CppClassType tooltip_class_;
106 Tooltip(const Tooltip&);
107 Tooltip& operator=(const Tooltip&);
110 explicit Tooltip(const Glib::ConstructParams& construct_params);
111 explicit Tooltip(GtkTooltip* castitem);
113 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
118 #ifndef DOXYGEN_SHOULD_SKIP_THIS
119 static GType get_type() G_GNUC_CONST;
120 static GType get_base_type() G_GNUC_CONST;
123 ///Provides access to the underlying C GObject.
124 GtkTooltip* gobj() { return reinterpret_cast<GtkTooltip*>(gobject_); }
126 ///Provides access to the underlying C GObject.
127 const GtkTooltip* gobj() const { return reinterpret_cast<GtkTooltip*>(gobject_); }
129 ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
130 GtkTooltip* gobj_copy();
138 /** Sets the text of the tooltip to be @a markup , which is marked up
139 * with the Pango text markup language.
140 * If @a markup is <tt>0</tt>, the label will be hidden.
143 * @param markup A markup string (see Pango markup format) or <tt>0</tt>.
145 void set_markup(const Glib::ustring& markup);
147 /** Sets the text of the tooltip to be @a text . If @a text is <tt>0</tt>, the label
148 * will be hidden. See also gtk_tooltip_set_markup().
151 * @param text A text string or <tt>0</tt>.
153 void set_text(const Glib::ustring& markup);
155 /** Sets the icon of the tooltip (which is in front of the text) to be
156 * @a pixbuf . If @a pixbuf is <tt>0</tt>, the image will be hidden.
159 * @param pixbuf A Gdk::Pixbuf, or <tt>0</tt>.
161 void set_icon(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf);
163 /** Sets the icon of the tooltip (which is in front of the text) to be
164 * the stock item indicated by @a stock_id with the size indicated
165 * by @a size . If @a stock_id is <tt>0</tt>, the image will be hidden.
168 * @param stock_id A stock icon name, or <tt>0</tt>.
169 * @param size A stock icon size.
171 void set_icon_from_stock(const StockID& stock_id, IconSize size);
173 /** Replaces the widget packed into the tooltip with @a custom_widget .
174 * By default a box with a Gtk::Image and Gtk::Label is embedded in
175 * the tooltip, which can be configured using gtk_tooltip_set_markup()
176 * and gtk_tooltip_set_icon().
179 * @param custom_widget A Gtk::Widget.
181 void set_custom(Widget& custom_widget);
183 /** Sets the area of the widget, where the contents of this tooltip apply,
184 * to be @a rect (in widget coordinates). This is especially useful for
185 * properly setting tooltips on Gtk::TreeView rows and cells, Gtk::IconViews,
188 * For setting tooltips on Gtk::TreeView, please refer to the convenience
189 * functions for this: Gtk::TreeView::set_tooltip_row() and
190 * Gtk::TreeView::set_tooltip_cell().
193 * @param rect A Gdk::Rectangle.
195 void set_tip_area(const Gdk::Rectangle& rect);
198 static void trigger_tooltip_query(const Glib::RefPtr<Gdk::Display>& display);
204 //C++ methods used to invoke GTK+ virtual functions:
205 #ifdef GLIBMM_VFUNCS_ENABLED
206 #endif //GLIBMM_VFUNCS_ENABLED
209 //GTK+ Virtual Functions (override these to change behaviour):
210 #ifdef GLIBMM_VFUNCS_ENABLED
211 #endif //GLIBMM_VFUNCS_ENABLED
213 //Default Signal Handlers::
214 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
215 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
225 /** A Glib::wrap() method for this object.
227 * @param object The C instance.
228 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
229 * @result A C++ instance that wraps this C instance.
231 * @relates Gtk::Tooltip
233 Glib::RefPtr<Gtk::Tooltip> wrap(GtkTooltip* object, bool take_copy = false);
237 #endif /* _GTKMM_TOOLTIP_H */