1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD 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 Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = GtkTooltips.html
27  * outPack = gtk
28  * outFile = Tooltips
29  * strct   = GtkTooltips
30  * realStrct=
31  * ctorStrct=
32  * clss    = Tooltips
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_tooltips_
41  * 	- gtk_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- gtk.Widget
49  * 	- gtk.Window
50  * structWrap:
51  * 	- GtkWidget* -> Widget
52  * 	- GtkWindow* -> Window
53  * module aliases:
54  * local aliases:
55  * overrides:
56  */
57 
58 module gtk.Tooltips;
59 
60 public  import gtkc.gtktypes;
61 
62 private import gtkc.gtk;
63 private import glib.ConstructionException;
64 private import gobject.ObjectG;
65 
66 
67 private import glib.Str;
68 private import gtk.Widget;
69 private import gtk.Window;
70 
71 
72 
73 private import gtk.ObjectGtk;
74 
75 /**
76  * Description
77  * GtkTooltips has been deprecated in GTK+ 2.12, in favor of the new
78  * GtkTooltip API.
79  * Tooltips are the messages that appear next to a widget when the mouse pointer is held over it for a short amount of time. They are especially helpful for adding more verbose descriptions of things such as buttons in a toolbar.
80  * An individual tooltip belongs to a group of tooltips. A group is created with a call to gtk_tooltips_new(). Every tooltip in the group can then be turned off with a call to gtk_tooltips_disable() and enabled with gtk_tooltips_enable().
81  * The length of time the user must keep the mouse over a widget before the tip is shown, can be altered with gtk_tooltips_set_delay(). This is set on a 'per group of tooltips' basis.
82  * To assign a tip to a particular GtkWidget, gtk_tooltips_set_tip() is used.
83  * Note
84  * Tooltips can only be set on widgets which have their own X window and
85  * receive enter and leave events.
86  * To check if a widget has its own window use GTK_WIDGET_NO_WINDOW().
87  * To add a tooltip to a widget that doesn't have its own window, place the
88  * widget inside a GtkEventBox and add a tooltip to that instead.
89  * The default appearance of all tooltips in a program is determined by the current GTK+ theme that the user has selected.
90  * Information about the tooltip (if any) associated with an arbitrary widget can be retrieved using gtk_tooltips_data_get().
91  * $(DDOC_COMMENT example)
92  */
93 public class Tooltips : ObjectGtk
94 {
95 	
96 	/** the main Gtk struct */
97 	protected GtkTooltips* gtkTooltips;
98 	
99 	
100 	public GtkTooltips* getTooltipsStruct()
101 	{
102 		return gtkTooltips;
103 	}
104 	
105 	
106 	/** the main Gtk struct as a void* */
107 	protected override void* getStruct()
108 	{
109 		return cast(void*)gtkTooltips;
110 	}
111 	
112 	/**
113 	 * Sets our main struct and passes it to the parent class
114 	 */
115 	public this (GtkTooltips* gtkTooltips)
116 	{
117 		super(cast(GtkObject*)gtkTooltips);
118 		this.gtkTooltips = gtkTooltips;
119 	}
120 	
121 	protected override void setStruct(GObject* obj)
122 	{
123 		super.setStruct(obj);
124 		gtkTooltips = cast(GtkTooltips*)obj;
125 	}
126 	
127 	/**
128 	 */
129 	
130 	/**
131 	 * Warning
132 	 * gtk_tooltips_new has been deprecated since version 2.12 and should not be used in newly-written code.
133 	 * Creates an empty group of tooltips. This function initialises a GtkTooltips structure. Without at least one such structure, you can not add tips to your application.
134 	 * Throws: ConstructionException GTK+ fails to create the object.
135 	 */
136 	public this ()
137 	{
138 		// GtkTooltips * gtk_tooltips_new (void);
139 		auto p = gtk_tooltips_new();
140 		if(p is null)
141 		{
142 			throw new ConstructionException("null returned by gtk_tooltips_new()");
143 		}
144 		this(cast(GtkTooltips*) p);
145 	}
146 	
147 	/**
148 	 * Warning
149 	 * gtk_tooltips_enable has been deprecated since version 2.12 and should not be used in newly-written code.
150 	 * Allows the user to see your tooltips as they navigate your application.
151 	 */
152 	public void enable()
153 	{
154 		// void gtk_tooltips_enable (GtkTooltips *tooltips);
155 		gtk_tooltips_enable(gtkTooltips);
156 	}
157 	
158 	/**
159 	 * Warning
160 	 * gtk_tooltips_disable has been deprecated since version 2.12 and should not be used in newly-written code.
161 	 * Causes all tooltips in tooltips to become inactive. Any widgets that have tips associated with that group will no longer display their tips until they are enabled again with gtk_tooltips_enable().
162 	 */
163 	public void disable()
164 	{
165 		// void gtk_tooltips_disable (GtkTooltips *tooltips);
166 		gtk_tooltips_disable(gtkTooltips);
167 	}
168 	
169 	/**
170 	 * Warning
171 	 * gtk_tooltips_set_delay has been deprecated since version 2.12 and should not be used in newly-written code.
172 	 * Sets the time between the user moving the mouse over a widget and the widget's tooltip appearing.
173 	 * Params:
174 	 * delay = an integer value representing milliseconds.
175 	 */
176 	public void setDelay(uint delay)
177 	{
178 		// void gtk_tooltips_set_delay (GtkTooltips *tooltips,  guint delay);
179 		gtk_tooltips_set_delay(gtkTooltips, delay);
180 	}
181 	
182 	/**
183 	 * Warning
184 	 * gtk_tooltips_set_tip has been deprecated since version 2.12 and should not be used in newly-written code.
185 	 * Adds a tooltip containing the message tip_text to the specified GtkWidget.
186 	 * Params:
187 	 * widget = the GtkWidget you wish to associate the tip with.
188 	 * tipText = a string containing the tip itself. [allow-none]
189 	 * tipPrivate = a string of any further information that may be useful if the user gets stuck. [allow-none]
190 	 */
191 	public void setTip(Widget widget, string tipText, string tipPrivate)
192 	{
193 		// void gtk_tooltips_set_tip (GtkTooltips *tooltips,  GtkWidget *widget,  const gchar *tip_text,  const gchar *tip_private);
194 		gtk_tooltips_set_tip(gtkTooltips, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(tipText), Str.toStringz(tipPrivate));
195 	}
196 	
197 	/**
198 	 * Warning
199 	 * gtk_tooltips_data_get has been deprecated since version 2.12 and should not be used in newly-written code.
200 	 * Retrieves any GtkTooltipsData previously associated with the given widget.
201 	 * Params:
202 	 * widget = a GtkWidget.
203 	 * Returns: a GtkTooltipsData struct, or NULL if the widget has no tooltip.
204 	 */
205 	public static GtkTooltipsData* dataGet(Widget widget)
206 	{
207 		// GtkTooltipsData * gtk_tooltips_data_get (GtkWidget *widget);
208 		return gtk_tooltips_data_get((widget is null) ? null : widget.getWidgetStruct());
209 	}
210 	
211 	/**
212 	 * Warning
213 	 * gtk_tooltips_force_window has been deprecated since version 2.12 and should not be used in newly-written code.
214 	 * Ensures that the window used for displaying the given tooltips is created.
215 	 * Applications should never have to call this function, since GTK+ takes
216 	 * care of this.
217 	 */
218 	public void forceWindow()
219 	{
220 		// void gtk_tooltips_force_window (GtkTooltips *tooltips);
221 		gtk_tooltips_force_window(gtkTooltips);
222 	}
223 	
224 	/**
225 	 * Warning
226 	 * gtk_tooltips_get_info_from_tip_window has been deprecated since version 2.12 and should not be used in newly-written code.
227 	 * Determines the tooltips and the widget they belong to from the window in
228 	 * which they are displayed.
229 	 * This function is mostly intended for use by accessibility technologies;
230 	 * applications should have little use for it.
231 	 * Since 2.4
232 	 * Params:
233 	 * tipWindow = a GtkWindow
234 	 * tooltips = the return location for the tooltips which are displayed
235 	 * in tip_window, or NULL
236 	 * currentWidget = the return location for the widget whose tooltips
237 	 * are displayed, or NULL
238 	 * Returns: TRUE if tip_window is displaying tooltips, otherwise FALSE.
239 	 */
240 	public static int getInfoFromTipWindow(Window tipWindow, out GtkTooltips* tooltips, out Widget currentWidget)
241 	{
242 		// gboolean gtk_tooltips_get_info_from_tip_window  (GtkWindow *tip_window,  GtkTooltips **tooltips,  GtkWidget **current_widget);
243 		GtkWidget* outcurrentWidget = null;
244 		
245 		auto p = gtk_tooltips_get_info_from_tip_window((tipWindow is null) ? null : tipWindow.getWindowStruct(), &tooltips, &outcurrentWidget);
246 		
247 		currentWidget = ObjectG.getDObject!(Widget)(outcurrentWidget);
248 		return p;
249 	}
250 }