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 = GtkMenuToolButton.html
27 * outFile = MenuToolButton
28 * strct = GtkMenuToolButton
30 * ctorStrct=GtkToolItem
31 * clss = MenuToolButton
39 * - gtk_menu_tool_button_
44 * - gtk_menu_tool_button_new
45 * - gtk_menu_tool_button_new_from_stock
46 * - gtk_menu_tool_button_get_menu
54 * - GtkToolItem* -> ToolItem
55 * - GtkTooltips* -> Tooltips
56 * - GtkWidget* -> Widget
61 module gtk
.MenuToolButton
;
67 import tango
.io
.Stdout
; // use the tango loging?
71 private import gtkc
.gtktypes
;
73 private import gtkc
.gtk
;
76 private import glib
.Str
;
77 private import gtk
.ToolItem
;
78 private import gtk
.Widget
;
79 private import gtk
.Tooltips
;
80 private import gtk
.Menu
;
87 * A GtkMenuToolButton is a GtkToolItem that contains a button and
88 * a small additional button with an arrow. When clicked, the arrow
89 * button pops up a dropdown menu.
90 * Use gtk_menu_tool_button_new() to create a new
91 * GtkMenuToolButton. Use gtk_menu_tool_button_new_from_stock() to
92 * create a new GtkMenuToolButton containing a stock item.
94 private import gtk
.ToolButton
;
95 public class MenuToolButton
: ToolButton
98 /** the main Gtk struct */
99 protected GtkMenuToolButton
* gtkMenuToolButton
;
102 public GtkMenuToolButton
* getMenuToolButtonStruct()
104 return gtkMenuToolButton
;
108 /** the main Gtk struct as a void* */
109 protected void* getStruct()
111 return cast(void*)gtkMenuToolButton
;
115 * Sets our main struct and passes it to the parent class
117 public this (GtkMenuToolButton
* gtkMenuToolButton
)
121 if ( gtkMenuToolButton
is null )
126 Stdout("struct gtkMenuToolButton is null on constructor").newline
;
130 printf("struct gtkMenuToolButton is null on constructor");
137 assert(gtkMenuToolButton
!is null, "struct gtkMenuToolButton is null on constructor");
139 super(cast(GtkToolButton
*)gtkMenuToolButton
);
140 this.gtkMenuToolButton
= gtkMenuToolButton
;
144 * Creates a new GtkMenuToolButton using icon_widget as icon and
147 * a widget that will be used as icon widget, or NULL
149 * a string that will be used as label, or NULL
151 * the new GtkMenuToolButton
154 public this(Widget iconWidget
, char[] label
)
156 // GtkToolItem* gtk_menu_tool_button_new (GtkWidget *icon_widget, const gchar *label);
157 this( cast(GtkMenuToolButton
*)gtk_menu_tool_button_new(
158 (iconWidget
is null) ?
null : iconWidget
.getWidgetStruct(),
159 Str
.toStringz(label
))
164 * Creates a new GtkMenuToolButton.
165 * The new GtkMenuToolButton will contain an icon and label from
166 * the stock item indicated by stock_id.
168 * the name of a stock item
170 * the new GtkMenuToolButton
173 public this(StockID stockId
)
175 // GtkToolItem* gtk_menu_tool_button_new_from_stock (const gchar *stock_id);
177 cast(GtkMenuToolButton
*)gtk_menu_tool_button_new_from_stock(
178 Str
.toStringz(StockDesc
[stockId
]))
183 * Gets the GtkMenu associated with GtkMenuToolButton.
185 * a GtkMenuToolButton
187 * the GtkMenu associated with GtkMenuToolButton
190 public Menu
getMenu()
192 // GtkWidget* gtk_menu_tool_button_get_menu (GtkMenuToolButton *button);
193 return new Menu( cast(GtkMenu
*)gtk_menu_tool_button_get_menu(gtkMenuToolButton
) );
197 * Sets the toolTip for the arrow
202 public void setArrowTooltip(char[] tipText
, char[] tipPrivate
)
204 Tooltips tooltips
= new Tooltips();
205 gtk_menu_tool_button_set_arrow_tooltip(
207 (tooltips
is null) ?
null : tooltips
.getTooltipsStruct(),
208 Str
.toStringz(tipText
),
209 Str
.toStringz(tipPrivate
)
216 // imports for the signal processing
217 private import gobject
.Signals
;
218 private import gtkc
.gdktypes
;
219 int[char[]] connectedSignals
;
221 void delegate(MenuToolButton
)[] onShowMenuListeners
;
222 void addOnShowMenu(void delegate(MenuToolButton
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
224 if ( !("show-menu" in connectedSignals
) )
229 cast(GCallback
)&callBackShowMenu
,
233 connectedSignals
["show-menu"] = 1;
235 onShowMenuListeners
~= dlg
;
237 extern(C
) static void callBackShowMenu(GtkMenuToolButton
* menutoolbuttonStruct
, MenuToolButton menuToolButton
)
239 bool consumed
= false;
241 foreach ( void delegate(MenuToolButton
) dlg
; menuToolButton
.onShowMenuListeners
)
254 * Sets the GtkMenu that is popped up when the user clicks on the arrow.
255 * If menu is NULL, the arrow button becomes insensitive.
257 * a GtkMenuToolButton
259 * the GtkMenu associated with GtkMenuToolButton
262 public void setMenu(Widget menu
)
264 // void gtk_menu_tool_button_set_menu (GtkMenuToolButton *button, GtkWidget *menu);
265 gtk_menu_tool_button_set_menu(gtkMenuToolButton
, (menu
is null) ?
null : menu
.getWidgetStruct());
270 * Sets the GtkTooltips object to be used for arrow button which
271 * pops up the menu. See gtk_tool_item_set_tooltip() for setting
272 * a tooltip on the whole GtkMenuToolButton.
274 * a GtkMenuToolButton
276 * the GtkTooltips object to be used
278 * text to be used as tooltip text for tool_item
280 * text to be used as private tooltip text
283 * The "menu" property
284 * "menu" GtkMenu : Read / Write
287 * The "show-menu" signal
288 * void user_function (GtkMenuToolButton *menutoolbutton,
289 * gpointer user_data) : Run First
291 * the object which received the signal.
293 * user data set when the signal handler was connected.
295 * GtkToolbar, GtkToolButton
297 * The parent class of GtkMenuToolButton. The properties
298 * "label_widget", "label", "icon_widget", and "stock_id" on
299 * GtkToolButton determine the label and icon used on
300 * GtkMenuToolButtons.
302 public void setArrowTooltip(Tooltips tooltips
, char[] tipText
, char[] tipPrivate
)
304 // void gtk_menu_tool_button_set_arrow_tooltip (GtkMenuToolButton *button, GtkTooltips *tooltips, const gchar *tip_text, const gchar *tip_private);
305 gtk_menu_tool_button_set_arrow_tooltip(gtkMenuToolButton
, (tooltips
is null) ?
null : tooltips
.getTooltipsStruct(), Str
.toStringz(tipText
), Str
.toStringz(tipPrivate
));