alternative to assert
[gtkD.git] / src / gtk / ImageMenuItem.d
blob36a673ad4e7470790ffe84e79127d5852cb6a7ac
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 = GtkImageMenuItem.html
26 * outPack = gtk
27 * outFile = ImageMenuItem
28 * strct = GtkImageMenuItem
29 * realStrct=
30 * ctorStrct=
31 * clss = ImageMenuItem
32 * interf =
33 * class Code: Yes
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_image_menu_item_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * - gtk_image_menu_item_new_with_label
45 * - gtk_image_menu_item_new_with_mnemonic
46 * imports:
47 * - glib.Str
48 * - gtk.Widget
49 * - gtk.AccelGroup
50 * structWrap:
51 * - GtkAccelGroup* -> AccelGroup
52 * - GtkWidget* -> Widget
53 * local aliases:
56 module gtk.ImageMenuItem;
58 private import gtk.gtktypes;
60 private import lib.gtk;
62 private import glib.Str;
63 private import gtk.Widget;
64 private import gtk.AccelGroup;
66 /**
67 * Description
68 * A GtkImageMenuItem is a menu item which has an icon next to the text label.
69 * Note that the user can disable display of menu icons, so make sure to still
70 * fill in the text label.
72 private import gtk.MenuItem;
73 public class ImageMenuItem : MenuItem
76 /** the main Gtk struct */
77 protected GtkImageMenuItem* gtkImageMenuItem;
80 public GtkImageMenuItem* getImageMenuItemStruct()
82 return gtkImageMenuItem;
86 /** the main Gtk struct as a void* */
87 protected void* getStruct()
89 return cast(void*)gtkImageMenuItem;
92 /**
93 * Sets our main struct and passes it to the parent class
95 public this (GtkImageMenuItem* gtkImageMenuItem)
97 super(cast(GtkMenuItem*)gtkImageMenuItem);
98 this.gtkImageMenuItem = gtkImageMenuItem;
102 * Creates a new GtkImageMenuItem containing a label.
103 * If mnemonic it true the label
104 * will be created using gtk_label_new_with_mnemonic(), so underscores
105 * in label indicate the mnemonic for the menu item.
106 * label:
107 * the text of the menu item.
108 * Returns:
109 * a new GtkImageMenuItem.
111 public this (char[] label, bit mnemonic=true)
113 if ( mnemonic )
115 // GtkWidget* gtk_image_menu_item_new_with_mnemonic (const gchar *label);
116 this(cast(GtkImageMenuItem*)gtk_image_menu_item_new_with_mnemonic(Str.toStringz(label)) );
118 else
120 // GtkWidget* gtk_image_menu_item_new_with_label (const gchar *label);
121 this(cast(GtkImageMenuItem*)gtk_image_menu_item_new_with_label(Str.toStringz(label)) );
130 * Sets the image of image_menu_item to the given widget.
131 * Note that it depends on the show-menu-images setting whether
132 * the image will be displayed or not.
133 * image_menu_item:
134 * a GtkImageMenuItem.
135 * image:
136 * a widget to set as the image for the menu item.
138 public void setImage(Widget image)
140 // void gtk_image_menu_item_set_image (GtkImageMenuItem *image_menu_item, GtkWidget *image);
141 gtk_image_menu_item_set_image(gtkImageMenuItem, (image is null) ? null : image.getWidgetStruct());
145 * Gets the widget that is currently set as the image of image_menu_item.
146 * See gtk_image_menu_item_set_image().
147 * image_menu_item:
148 * a GtkImageMenuItem.
149 * Returns:
150 * the widget set as image of image_menu_item.
152 public Widget getImage()
154 // GtkWidget* gtk_image_menu_item_get_image (GtkImageMenuItem *image_menu_item);
155 return new Widget( gtk_image_menu_item_get_image(gtkImageMenuItem) );
159 * Creates a new GtkImageMenuItem with an empty label.
160 * Returns:
161 * a new GtkImageMenuItem.
163 public this ()
165 // GtkWidget* gtk_image_menu_item_new (void);
166 this(cast(GtkImageMenuItem*)gtk_image_menu_item_new() );
170 * Creates a new GtkImageMenuItem containing the image and text from a
171 * stock item. Some stock ids have preprocessor macros like GTK_STOCK_OK
172 * and GTK_STOCK_APPLY.
173 * If you want this menu item to have changeable accelerators, then pass in
174 * NULL for accel_group. Next call gtk_menu_item_set_accel_path() with an
175 * appropriate path for the menu item, use gtk_stock_lookup() to look up the
176 * standard accelerator for the stock item, and if one is found, call
177 * gtk_accel_map_add_entry() to register it.
178 * stock_id:
179 * the name of the stock item.
180 * accel_group:
181 * the GtkAccelGroup to add the menu items accelerator to,
182 * or NULL.
183 * Returns:
184 * a new GtkImageMenuItem.
186 public this (char[] stockId, AccelGroup accelGroup)
188 // GtkWidget* gtk_image_menu_item_new_from_stock (const gchar *stock_id, GtkAccelGroup *accel_group);
189 this(cast(GtkImageMenuItem*)gtk_image_menu_item_new_from_stock(Str.toStringz(stockId), (accelGroup is null) ? null : accelGroup.getAccelGroupStruct()) );