I've no idea here...
[gtkD.git] / src / gtk / MenuToolButton.d
blob0e784e4af7869e63932f7411644f2dec6761d350
1 /*
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
26 * outPack = gtk
27 * outFile = MenuToolButton
28 * strct = GtkMenuToolButton
29 * realStrct=
30 * ctorStrct=GtkToolItem
31 * clss = MenuToolButton
32 * interf =
33 * class Code: Yes
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_menu_tool_button_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * - gtk_menu_tool_button_new
45 * - gtk_menu_tool_button_new_from_stock
46 * - gtk_menu_tool_button_get_menu
47 * imports:
48 * - glib.Str
49 * - gtk.ToolItem
50 * - gtk.Widget
51 * - gtk.Tooltips
52 * - gtk.Menu
53 * structWrap:
54 * - GtkToolItem* -> ToolItem
55 * - GtkTooltips* -> Tooltips
56 * - GtkWidget* -> Widget
57 * local aliases:
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;
72 /**
73 * Description
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
112 * label as label.
113 * icon_widget:
114 * a widget that will be used as icon widget, or NULL
115 * label:
116 * a string that will be used as label, or NULL
117 * Returns:
118 * the new GtkMenuToolButton
119 * Since 2.6
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.
134 * stock_id:
135 * the name of a stock item
136 * Returns:
137 * the new GtkMenuToolButton
138 * Since 2.6
140 public this(StockID stockId)
142 // GtkToolItem* gtk_menu_tool_button_new_from_stock (const gchar *stock_id);
143 this(
144 cast(GtkMenuToolButton*)gtk_menu_tool_button_new_from_stock(
145 Str.toStringz(StockDesc[stockId]))
150 * Gets the GtkMenu associated with GtkMenuToolButton.
151 * button:
152 * a GtkMenuToolButton
153 * Returns:
154 * the GtkMenu associated with GtkMenuToolButton
155 * Since 2.6
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
165 * Params:
166 * tipText =
167 * tipPrivate =
169 public void setArrowTooltip(char[] tipText, char[] tipPrivate)
171 Tooltips tooltips = new Tooltips();
172 gtk_menu_tool_button_set_arrow_tooltip(
173 gtkMenuToolButton,
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) )
193 Signals.connectData(
194 getStruct(),
195 "show-menu",
196 cast(GCallback)&callBackShowMenu,
197 this,
198 null,
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 )
210 dlg(menuToolButton);
213 return consumed;
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.
223 * button:
224 * a GtkMenuToolButton
225 * menu:
226 * the GtkMenu associated with GtkMenuToolButton
227 * Since 2.6
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.
240 * button:
241 * a GtkMenuToolButton
242 * tooltips:
243 * the GtkTooltips object to be used
244 * tip_text:
245 * text to be used as tooltip text for tool_item
246 * tip_private:
247 * text to be used as private tooltip text
248 * Since 2.6
249 * Property Details
250 * The "menu" property
251 * "menu" GtkMenu : Read / Write
252 * The dropdown menu.
253 * Signal Details
254 * The "show-menu" signal
255 * void user_function (GtkMenuToolButton *menutoolbutton,
256 * gpointer user_data) : Run first
257 * menutoolbutton:
258 * the object which received the signal.
259 * user_data:
260 * user data set when the signal handler was connected.
261 * See Also
262 * GtkToolbar, GtkToolButton
263 * The toolbar widget
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));