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 = gtk-Stock-Items.html
28 * strct = GtkStockItem
50 * - GtkStockItem* -> StockItem
61 import tango
.io
.Stdout
; // use the tango loging?
65 private import gtkc
.gtktypes
;
67 private import gtkc
.gtk
;
70 private import glib
.Str
;
71 private import gtk
.StockItem
;
72 private import glib
.ListSG
;
79 * Stock items represent commonly-used menu or toolbar items such as
80 * "Open" or "Exit". Each stock item is identified by a stock ID;
81 * stock IDs are just strings, but macros such as GTK_STOCK_OPEN are
82 * provided to avoid typing mistakes in the strings.
83 * Applications can register their own stock items in addition to those
85 * Each stock ID can be associated with a GtkStockItem, which contains
86 * the user-visible label, keyboard accelerator, and translation domain
87 * of the menu or toolbar item; and/or with an icon stored in a
88 * GtkIconFactory. See GtkIconFactory for
89 * more information on stock icons. The connection between a
90 * GtkStockItem and stock icons is purely conventional (by virtue of
91 * using the same stock ID); it's possible to register a stock item but
92 * no icon, and vice versa. Stock icons may have a RTL variant which gets
93 * used for right-to-left locales.
95 public class StockItem
98 /** the main Gtk struct */
99 protected GtkStockItem
* gtkStockItem
;
102 public GtkStockItem
* getStockItemStruct()
108 /** the main Gtk struct as a void* */
109 protected void* getStruct()
111 return cast(void*)gtkStockItem
;
115 * Sets our main struct and passes it to the parent class
117 public this (GtkStockItem
* gtkStockItem
)
121 if ( gtkStockItem
is null )
126 Stdout("struct gtkStockItem is null on constructor").newline
;
130 printf("struct gtkStockItem is null on constructor");
137 assert(gtkStockItem
!is null, "struct gtkStockItem is null on constructor");
139 this.gtkStockItem
= gtkStockItem
;
147 * Registers each of the stock items in items. If an item already
148 * exists with the same stock ID as one of the items, the old item
149 * gets replaced. The stock items are copied, so GTK+ does not hold
150 * any pointer into items and items can be freed. Use
151 * gtk_stock_add_static() if items is persistent and GTK+ need not
154 * a GtkStockItem or array of items
156 * number of GtkStockItem in items
158 public void add(uint nItems
)
160 // void gtk_stock_add (const GtkStockItem *items, guint n_items);
161 gtk_stock_add(gtkStockItem
, nItems
);
165 * Same as gtk_stock_add(), but doesn't copy items, so
166 * items must persist until application exit.
168 * a GtkStockItem or array of GtkStockItem
172 public void addStatic(uint nItems
)
174 // void gtk_stock_add_static (const GtkStockItem *items, guint n_items);
175 gtk_stock_add_static(gtkStockItem
, nItems
);
179 * Copies a stock item, mostly useful for language bindings and not in applications.
185 public StockItem
itemCopy()
187 // GtkStockItem* gtk_stock_item_copy (const GtkStockItem *item);
188 return new StockItem( gtk_stock_item_copy(gtkStockItem
) );
192 * Frees a stock item allocated on the heap, such as one returned by
193 * gtk_stock_item_copy(). Also frees the fields inside the stock item,
194 * if they are not NULL.
198 public void itemFree()
200 // void gtk_stock_item_free (GtkStockItem *item);
201 gtk_stock_item_free(gtkStockItem
);
205 * Retrieves a list of all known stock IDs added to a GtkIconFactory
206 * or registered with gtk_stock_add(). The list must be freed with g_slist_free(),
207 * and each string in the list must be freed with g_free().
209 * a list of known stock IDs
211 public static ListSG
listIds()
213 // GSList* gtk_stock_list_ids (void);
214 return new ListSG( gtk_stock_list_ids() );
218 * Fills item with the registered values for stock_id, returning TRUE
219 * if stock_id was known.
223 * stock item to initialize with values
225 * TRUE if item was initialized
227 public static int lookup(char[] stockId
, StockItem item
)
229 // gboolean gtk_stock_lookup (const gchar *stock_id, GtkStockItem *item);
230 return gtk_stock_lookup(Str
.toStringz(stockId
), (item
is null) ?
null : item
.getStockItemStruct());
234 * Sets a function to be used for translating the label of
236 * If no function is registered for a translation domain,
237 * dgettext() is used.
239 * the translation domain for which func shall be used
243 * data to pass to func
245 * a GtkDestroyNotify that is called when data is
249 public static void setTranslateFunc(char[] domain
, GtkTranslateFunc func
, void* data
, GtkDestroyNotify notify
)
251 // void gtk_stock_set_translate_func (const gchar *domain, GtkTranslateFunc func, gpointer data, GtkDestroyNotify notify);
252 gtk_stock_set_translate_func(Str
.toStringz(domain
), func
, data
, notify
);