2 * This file is part of duit.
4 * duit 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 * duit 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 duit; 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
60 module gtk
.MenuToolButton
;
62 private import gtk
.gtktypes
;
64 private import lib
.gtk
;
66 private import glib
.Str
;
67 private import gtk
.ToolItem
;
68 private import gtk
.Widget
;
69 private import gtk
.Tooltips
;
70 private import gtk
.Menu
;
74 * A GtkMenuToolButton is a GtkToolItem that contains a button and
75 * a small additional button with an arrow. When clicked, the arrow
76 * button pops up a dropdown menu.
77 * Use gtk_menu_tool_button_new() to create a new
78 * GtkMenuToolButton. Use gtk_menu_tool_button_new_from_stock() to
79 * create a new GtkMenuToolButton containing a stock item.
81 private import gtk
.ToolButton
;
82 public class MenuToolButton
: ToolButton
85 /** the main Gtk struct */
86 protected GtkMenuToolButton
* gtkMenuToolButton
;
89 public GtkMenuToolButton
* getMenuToolButtonStruct()
91 return gtkMenuToolButton
;
95 /** the main Gtk struct as a void* */
96 protected void* getStruct()
98 return cast(void*)gtkMenuToolButton
;
102 * Sets our main struct and passes it to the parent class
104 public this (GtkMenuToolButton
* gtkMenuToolButton
)
106 super(cast(GtkToolButton
*)gtkMenuToolButton
);
107 this.gtkMenuToolButton
= gtkMenuToolButton
;
111 * Creates a new GtkMenuToolButton using icon_widget as icon and
114 * a widget that will be used as icon widget, or NULL
116 * a string that will be used as label, or NULL
118 * the new GtkMenuToolButton
121 public this(Widget iconWidget
, char[] label
)
123 // GtkToolItem* gtk_menu_tool_button_new (GtkWidget *icon_widget, const gchar *label);
124 this( cast(GtkMenuToolButton
*)gtk_menu_tool_button_new(
125 (iconWidget
is null) ?
null : iconWidget
.getWidgetStruct(),
126 Str
.toStringz(label
))
131 * Creates a new GtkMenuToolButton.
132 * The new GtkMenuToolButton will contain an icon and label from
133 * the stock item indicated by stock_id.
135 * the name of a stock item
137 * the new GtkMenuToolButton
140 public this(StockID stockId
)
142 // GtkToolItem* gtk_menu_tool_button_new_from_stock (const gchar *stock_id);
144 cast(GtkMenuToolButton
*)gtk_menu_tool_button_new_from_stock(
145 Str
.toStringz(StockDesc
[stockId
]))
150 * Gets the GtkMenu associated with GtkMenuToolButton.
152 * a GtkMenuToolButton
154 * the GtkMenu associated with GtkMenuToolButton
157 public Menu
getMenu()
159 // GtkWidget* gtk_menu_tool_button_get_menu (GtkMenuToolButton *button);
160 return new Menu( cast(GtkMenu
*)gtk_menu_tool_button_get_menu(gtkMenuToolButton
) );
164 * Sets the toolTip for the arrow
169 public void setArrowTooltip(char[] tipText
, char[] tipPrivate
)
171 Tooltips tooltips
= new Tooltips();
172 gtk_menu_tool_button_set_arrow_tooltip(
174 (tooltips
is null) ?
null : tooltips
.getTooltipsStruct(),
175 Str
.toStringz(tipText
),
176 Str
.toStringz(tipPrivate
)
183 // imports for the signal processing
184 private import gobject
.Signals
;
185 private import gdk
.gdktypes
;
186 int[char[]] connectedSignals
;
188 void delegate(MenuToolButton
)[] onShowMenuListeners
;
189 void addOnShowMenu(void delegate(MenuToolButton
) dlg
)
191 if ( !("show-menu" in connectedSignals
) )
196 cast(GCallback
)&callBackShowMenu
,
199 cast(ConnectFlags
)0);
200 connectedSignals
["show-menu"] = 1;
202 onShowMenuListeners
~= dlg
;
204 extern(C
) static void callBackShowMenu(GtkMenuToolButton
* menutoolbuttonStruct
, MenuToolButton menuToolButton
)
206 bit consumed
= false;
208 foreach ( void delegate(MenuToolButton
) dlg
; menuToolButton
.onShowMenuListeners
)
221 * Sets the GtkMenu that is popped up when the user clicks on the arrow.
222 * If menu is NULL, the arrow button becomes insensitive.
224 * a GtkMenuToolButton
226 * the GtkMenu associated with GtkMenuToolButton
229 public void setMenu(Widget menu
)
231 // void gtk_menu_tool_button_set_menu (GtkMenuToolButton *button, GtkWidget *menu);
232 gtk_menu_tool_button_set_menu(gtkMenuToolButton
, (menu
is null) ?
null : menu
.getWidgetStruct());
237 * Sets the GtkTooltips object to be used for arrow button which
238 * pops up the menu. See gtk_tool_item_set_tooltip() for setting
239 * a tooltip on the whole GtkMenuToolButton.
241 * a GtkMenuToolButton
243 * the GtkTooltips object to be used
245 * text to be used as tooltip text for tool_item
247 * text to be used as private tooltip text
250 * The "menu" property
251 * "menu" GtkMenu : Read / Write
254 * The "show-menu" signal
255 * void user_function (GtkMenuToolButton *menutoolbutton,
256 * gpointer user_data) : Run first
258 * the object which received the signal.
260 * user data set when the signal handler was connected.
262 * GtkToolbar, GtkToolButton
264 * The parent class of GtkMenuToolButton. The properties
265 * "label_widget", "label", "icon_widget", and "stock_id" on
266 * GtkToolButton determine the label and icon used on
267 * GtkMenuToolButtons.
269 public void setArrowTooltip(Tooltips tooltips
, char[] tipText
, char[] tipPrivate
)
271 // void gtk_menu_tool_button_set_arrow_tooltip (GtkMenuToolButton *button, GtkTooltips *tooltips, const gchar *tip_text, const gchar *tip_private);
272 gtk_menu_tool_button_set_arrow_tooltip(gtkMenuToolButton
, (tooltips
is null) ?
null : tooltips
.getTooltipsStruct(), Str
.toStringz(tipText
), Str
.toStringz(tipPrivate
));