2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GtkToolButton.html
27 * outFile = ToolButton
28 * strct = GtkToolButton
30 * ctorStrct=GtkToolItem
49 * - GtkWidget* -> Widget
54 module gtk
.ToolButton
;
60 import tango
.io
.Stdout
; // use the tango loging?
64 private import gtkc
.gtktypes
;
66 private import gtkc
.gtk
;
69 private import glib
.Str
;
70 private import gtk
.ToolItem
;
71 private import gtk
.Widget
;
78 * GtkToolButtons are GtkToolItems containing buttons.
79 * Use gtk_tool_button_new() to create a new GtkToolButton. Use
80 * gtk_tool_button_new_with_stock() to create a GtkToolButton
81 * containing a stock item.
82 * The label of a GtkToolButton is determined by the properties
83 * "label_widget", "label", and "stock_id". If "label_widget" is
84 * non-NULL, then that widget is used as the label. Otherwise, if
85 * "label" is non-NULL, that string is used as the label. Otherwise, if
86 * "stock_id" is non-NULL, the label is determined by the stock
87 * item. Otherwise, the button does not have a label.
88 * The icon of a GtkToolButton is determined by the properties
89 * "icon_widget" and "stock_id". If "icon_widget" is non-NULL, then
90 * that widget is used as the icon. Otherwise, if "stock_id" is
91 * non-NULL, the icon is determined by the stock item. Otherwise,
92 * the button does not have a label.
94 private import gtk
.ToolItem
;
95 public class ToolButton
: ToolItem
98 /** the main Gtk struct */
99 protected GtkToolButton
* gtkToolButton
;
102 public GtkToolButton
* getToolButtonStruct()
104 return gtkToolButton
;
108 /** the main Gtk struct as a void* */
109 protected void* getStruct()
111 return cast(void*)gtkToolButton
;
115 * Sets our main struct and passes it to the parent class
117 public this (GtkToolButton
* gtkToolButton
)
121 if ( gtkToolButton
is null )
126 Stdout("struct gtkToolButton is null on constructor").newline
;
130 printf("struct gtkToolButton is null on constructor");
137 assert(gtkToolButton
!is null, "struct gtkToolButton is null on constructor");
139 super(cast(GtkToolItem
*)gtkToolButton
);
140 this.gtkToolButton
= gtkToolButton
;
143 /** An arbitrary string to be used by the application */
144 private char[] action
;
146 public void setActionName(char[] action
)
148 this.action
= action
.dup
;
151 public char[] getActionName()
156 public this (StockID stockID
)
158 this(StockDesc
[stockID
]);
165 // imports for the signal processing
166 private import gobject
.Signals
;
167 private import gtkc
.gdktypes
;
168 int[char[]] connectedSignals
;
170 void delegate(ToolButton
)[] onClickedListeners
;
171 void addOnClicked(void delegate(ToolButton
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
173 if ( !("clicked" in connectedSignals
) )
178 cast(GCallback
)&callBackClicked
,
182 connectedSignals
["clicked"] = 1;
184 onClickedListeners
~= dlg
;
186 extern(C
) static void callBackClicked(GtkToolButton
* toolbuttonStruct
, ToolButton toolButton
)
188 bool consumed
= false;
190 foreach ( void delegate(ToolButton
) dlg
; toolButton
.onClickedListeners
)
201 * Creates a new GtkToolButton using icon_widget as icon and label as
204 * a widget that will be used as icon widget, or NULL
206 * a string that will be used as label, or NULL
208 * A new GtkToolButton
211 public this (Widget iconWidget
, char[] label
)
213 // GtkToolItem* gtk_tool_button_new (GtkWidget *icon_widget, const gchar *label);
214 this(cast(GtkToolButton
*)gtk_tool_button_new((iconWidget
is null) ?
null : iconWidget
.getWidgetStruct(), Str
.toStringz(label
)) );
218 * Creates a new GtkToolButton containing the image and text from a
219 * stock item. Some stock ids have preprocessor macros like GTK_STOCK_OK
220 * and GTK_STOCK_APPLY.
221 * It is an error if stock_id is not a name of a stock item.
223 * the name of the stock item
225 * A new GtkToolButton
228 public this (char[] stockId
)
230 // GtkToolItem* gtk_tool_button_new_from_stock (const gchar *stock_id);
231 this(cast(GtkToolButton
*)gtk_tool_button_new_from_stock(Str
.toStringz(stockId
)) );
235 * Sets label as the label used for the tool button. The "label" property
236 * only has an effect if not overridden by a non-NULL "label_widget" property.
237 * If both the "label_widget" and "label" properties are NULL, the label
238 * is determined by the "stock_id" property. If the "stock_id" property is also
239 * NULL, button will not have a label.
243 * a string that will be used as label, or NULL.
246 public void setLabel(char[] label
)
248 // void gtk_tool_button_set_label (GtkToolButton *button, const gchar *label);
249 gtk_tool_button_set_label(gtkToolButton
, Str
.toStringz(label
));
253 * Returns the label used by the tool button, or NULL if the tool button
254 * doesn't have a label. or uses a the label from a stock item. The returned
255 * string is owned by GTK+, and must not be modified or freed.
262 public char[] getLabel()
264 // const gchar* gtk_tool_button_get_label (GtkToolButton *button);
265 return Str
.toString(gtk_tool_button_get_label(gtkToolButton
) );
269 * If set, an underline in the label property indicates that the next character
270 * should be used for the mnemonic accelerator key in the overflow menu. For
271 * example, if the label property is "_Open" and use_underline is TRUE,
272 * the label on the tool button will be "Open" and the item on the overflow
273 * menu will have an underlined 'O'.
274 * Labels shown on tool buttons never have mnemonics on them; this property
275 * only affects the menu item on the overflow menu.
279 * whether the button label has the form "_Open"
282 public void setUseUnderline(int useUnderline
)
284 // void gtk_tool_button_set_use_underline (GtkToolButton *button, gboolean use_underline);
285 gtk_tool_button_set_use_underline(gtkToolButton
, useUnderline
);
289 * Returns whether underscores in the label property are used as mnemonics
290 * on menu items on the overflow menu. See gtk_tool_button_set_use_underline().
294 * TRUE if underscores in the label property are used as
295 * mnemonics on menu items on the overflow menu.
298 public int getUseUnderline()
300 // gboolean gtk_tool_button_get_use_underline (GtkToolButton *button);
301 return gtk_tool_button_get_use_underline(gtkToolButton
);
305 * Sets the name of the stock item. See gtk_tool_button_new_from_stock().
306 * The stock_id property only has an effect if not
307 * overridden by non-NULL "label" and "icon_widget" properties.
311 * a name of a stock item, or NULL
314 public void setStockId(char[] stockId
)
316 // void gtk_tool_button_set_stock_id (GtkToolButton *button, const gchar *stock_id);
317 gtk_tool_button_set_stock_id(gtkToolButton
, Str
.toStringz(stockId
));
321 * Returns the name of the stock item. See gtk_tool_button_set_stock_id().
322 * The returned string is owned by GTK+ and must not be freed or modifed.
326 * the name of the stock item for button.
329 public char[] getStockId()
331 // const gchar* gtk_tool_button_get_stock_id (GtkToolButton *button);
332 return Str
.toString(gtk_tool_button_get_stock_id(gtkToolButton
) );
336 * Sets the icon for the tool button from a named themed icon.
337 * See the docs for GtkIconTheme for more details.
338 * The "icon_name" property only has an effect if not
339 * overridden by non-NULL "label", "icon_widget" and "stock_id"
344 * the name of the themed icon
347 public void setIconName(char[] iconName
)
349 // void gtk_tool_button_set_icon_name (GtkToolButton *button, const gchar *icon_name);
350 gtk_tool_button_set_icon_name(gtkToolButton
, Str
.toStringz(iconName
));
354 * Returns the name of the themed icon for the tool button,
355 * see gtk_tool_button_set_icon_name().
359 * the icon name or NULL if the tool button has
363 public char[] getIconName()
365 // const gchar* gtk_tool_button_get_icon_name (GtkToolButton *button);
366 return Str
.toString(gtk_tool_button_get_icon_name(gtkToolButton
) );
370 * Sets icon as the widget used as icon on button. If icon_widget is
371 * NULL the icon is determined by the "stock_id" property. If the
372 * "stock_id" property is also NULL, button will not have an icon.
376 * the widget used as icon, or NULL
379 public void setIconWidget(Widget iconWidget
)
381 // void gtk_tool_button_set_icon_widget (GtkToolButton *button, GtkWidget *icon_widget);
382 gtk_tool_button_set_icon_widget(gtkToolButton
, (iconWidget
is null) ?
null : iconWidget
.getWidgetStruct());
386 * Return the widget used as icon widget on button. See
387 * gtk_tool_button_set_icon_widget().
391 * The widget used as icon on button, or NULL.
394 public Widget
getIconWidget()
396 // GtkWidget* gtk_tool_button_get_icon_widget (GtkToolButton *button);
397 return new Widget( gtk_tool_button_get_icon_widget(gtkToolButton
) );
401 * Sets label_widget as the widget that will be used as the label
402 * for button. If label_widget is NULL the "label" property is used
403 * as label. If "label" is also NULL, the label in the stock item
404 * determined by the "stock_id" property is used as label. If
405 * "stock_id" is also NULL, button does not have a label.
409 * the widget used as label, or NULL
412 public void setLabelWidget(Widget labelWidget
)
414 // void gtk_tool_button_set_label_widget (GtkToolButton *button, GtkWidget *label_widget);
415 gtk_tool_button_set_label_widget(gtkToolButton
, (labelWidget
is null) ?
null : labelWidget
.getWidgetStruct());
419 * Returns the widget used as label on button. See
420 * gtk_tool_button_set_label_widget().
424 * The widget used as label on button, or NULL.
427 * The "icon-name" property
428 * "icon-name" gchararray : Read / Write
429 * The name of the themed icon displayed on the item.
430 * This property only has an effect if not overridden by "label",
431 * "icon_widget" or "stock_id" properties.
432 * Default value: NULL
435 public Widget
getLabelWidget()
437 // GtkWidget* gtk_tool_button_get_label_widget (GtkToolButton *button);
438 return new Widget( gtk_tool_button_get_label_widget(gtkToolButton
) );