I've no idea here...
[gtkD.git] / src / gtk / ItemFactory.d
blob9842f95e9a72c9500a13e5bfed7ee834c89a73f0
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 = GtkItemFactory.html
26 * outPack = gtk
27 * outFile = ItemFactory
28 * strct = GtkItemFactory
29 * realStrct=
30 * ctorStrct=
31 * clss = ItemFactory
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_item_factory_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * - gtk_item_factory_create_menu_entries
44 * omit code:
45 * imports:
46 * - glib.Str
47 * - gtk.AccelGroup
48 * - gtk.Widget
49 * - gtk.ItemFactory
50 * structWrap:
51 * - GtkAccelGroup* -> AccelGroup
52 * - GtkItemFactory* -> ItemFactory
53 * - GtkWidget* -> Widget
54 * local aliases:
57 module gtk.ItemFactory;
59 private import gtk.gtktypes;
61 private import lib.gtk;
63 private import glib.Str;
64 private import gtk.AccelGroup;
65 private import gtk.Widget;
66 private import gtk.ItemFactory;
68 /**
69 * Description
70 * As of GTK+ 2.4, GtkItemFactory has been deprecated in favour of GtkUIManager.
72 private import gtk.ObjectGtk;
73 public class ItemFactory : ObjectGtk
76 /** the main Gtk struct */
77 protected GtkItemFactory* gtkItemFactory;
80 public GtkItemFactory* getItemFactoryStruct()
82 return gtkItemFactory;
86 /** the main Gtk struct as a void* */
87 protected void* getStruct()
89 return cast(void*)gtkItemFactory;
92 /**
93 * Sets our main struct and passes it to the parent class
95 public this (GtkItemFactory* gtkItemFactory)
97 super(cast(GtkObject*)gtkItemFactory);
98 this.gtkItemFactory = gtkItemFactory;
113 * Warning
114 * gtk_item_factory_new has been deprecated since version 2.4 and should not be used in newly-written code.
115 * Creates a new GtkItemFactory.
116 * Beware that the returned object does not have a floating reference.
117 * container_type:
118 * the kind of menu to create; can be
119 * GTK_TYPE_MENU_BAR, GTK_TYPE_MENU or GTK_TYPE_OPTION_MENU
120 * path:
121 * the factory path of the new item factory, a string of the form
122 * "<name>"
123 * accel_group:
124 * a GtkAccelGroup to which the accelerators for the
125 * menu items will be added, or NULL to create a new one
126 * Returns:
127 * a new GtkItemFactory
129 public this (GType containerType, char[] path, AccelGroup accelGroup)
131 // GtkItemFactory* gtk_item_factory_new (GType container_type, const gchar *path, GtkAccelGroup *accel_group);
132 this(cast(GtkItemFactory*)gtk_item_factory_new(containerType, Str.toStringz(path), (accelGroup is null) ? null : accelGroup.getAccelGroupStruct()) );
136 * Warning
137 * gtk_item_factory_construct has been deprecated since version 2.4 and should not be used in newly-written code.
138 * Initializes an item factory.
139 * ifactory:
140 * a GtkItemFactory
141 * container_type:
142 * the kind of menu to create; can be
143 * GTK_TYPE_MENU_BAR, GTK_TYPE_MENU or GTK_TYPE_OPTION_MENU
144 * path:
145 * the factory path of ifactory, a string of the form
146 * "<name>"
147 * accel_group:
148 * a GtkAccelGroup to which the accelerators for the
149 * menu items will be added, or NULL to create a new one
151 public void construct(GType containerType, char[] path, AccelGroup accelGroup)
153 // void gtk_item_factory_construct (GtkItemFactory *ifactory, GType container_type, const gchar *path, GtkAccelGroup *accel_group);
154 gtk_item_factory_construct(gtkItemFactory, containerType, Str.toStringz(path), (accelGroup is null) ? null : accelGroup.getAccelGroupStruct());
158 * Warning
159 * gtk_item_factory_add_foreign has been deprecated since version 2.4 and should not be used in newly-written code. The recommended API for this purpose are the functions
160 * gtk_menu_item_set_accel_path() and gtk_widget_set_accel_path(); don't
161 * use gtk_item_factory_add_foreign() in new code, since it is likely to
162 * be removed in the future.
163 * Installs an accelerator for accel_widget in accel_group, that causes
164 * the ::activate signal to be emitted if the accelerator is activated.
165 * This function can be used to make widgets participate in the accel
166 * saving/restoring functionality provided by gtk_accel_map_save() and
167 * gtk_accel_map_load(), even if they haven't been created by an item
168 * factory.
169 * accel_widget:
170 * widget to install an accelerator on
171 * full_path:
172 * the full path for the accel_widget
173 * accel_group:
174 * the accelerator group to install the accelerator in
175 * keyval:
176 * key value of the accelerator
177 * modifiers:
178 * modifier combination of the accelerator
180 public static void addForeign(Widget accelWidget, char[] fullPath, AccelGroup accelGroup, uint keyval, GdkModifierType modifiers)
182 // void gtk_item_factory_add_foreign (GtkWidget *accel_widget, const gchar *full_path, GtkAccelGroup *accel_group, guint keyval, GdkModifierType modifiers);
183 gtk_item_factory_add_foreign((accelWidget is null) ? null : accelWidget.getWidgetStruct(), Str.toStringz(fullPath), (accelGroup is null) ? null : accelGroup.getAccelGroupStruct(), keyval, modifiers);
187 * Warning
188 * gtk_item_factory_from_widget is deprecated and should not be used in newly-written code. 2.4
189 * Obtains the item factory from which a widget was created.
190 * widget:
191 * a widget
192 * Returns:
193 * the item factory from which widget was created, or NULL
195 public static ItemFactory fromWidget(Widget widget)
197 // GtkItemFactory* gtk_item_factory_from_widget (GtkWidget *widget);
198 return new ItemFactory( gtk_item_factory_from_widget((widget is null) ? null : widget.getWidgetStruct()) );
202 * Warning
203 * gtk_item_factory_path_from_widget has been deprecated since version 2.4 and should not be used in newly-written code.
204 * If widget has been created by an item factory, returns the full path
205 * to it. (The full path of a widget is the concatenation of the factory
206 * path specified in gtk_item_factory_new() with the path specified in the
207 * GtkItemFactoryEntry from which the widget was created.)
208 * widget:
209 * a widget
210 * Returns:
211 * the full path to widget if it has been created by an item
212 * factory, NULL otherwise. This value is owned by GTK+ and must not be
213 * modified or freed.
215 public static char[] pathFromWidget(Widget widget)
217 // const gchar* gtk_item_factory_path_from_widget (GtkWidget *widget);
218 return Str.toString(gtk_item_factory_path_from_widget((widget is null) ? null : widget.getWidgetStruct()) );
222 * Warning
223 * gtk_item_factory_get_item has been deprecated since version 2.4 and should not be used in newly-written code.
224 * Obtains the menu item which corresponds to path.
225 * If the widget corresponding to path is a menu item which opens a
226 * submenu, then the item is returned. If you are interested in the submenu,
227 * use gtk_item_factory_get_widget() instead.
228 * ifactory:
229 * a GtkItemFactory
230 * path:
231 * the path to the menu item
232 * Returns:
233 * the menu item for the given path, or NULL if path doesn't
234 * lead to a menu item
236 public Widget getItem(char[] path)
238 // GtkWidget* gtk_item_factory_get_item (GtkItemFactory *ifactory, const gchar *path);
239 return new Widget( gtk_item_factory_get_item(gtkItemFactory, Str.toStringz(path)) );
243 * Warning
244 * gtk_item_factory_get_widget has been deprecated since version 2.4 and should not be used in newly-written code.
245 * Obtains the widget which corresponds to path.
246 * If the widget corresponding to path is a menu item which opens a
247 * submenu, then the submenu is returned. If you are interested in the menu
248 * item, use gtk_item_factory_get_item() instead.
249 * ifactory:
250 * a GtkItemFactory
251 * path:
252 * the path to the widget
253 * Returns:
254 * the widget for the given path, or NULL if path doesn't lead
255 * to a widget
257 public Widget getWidget(char[] path)
259 // GtkWidget* gtk_item_factory_get_widget (GtkItemFactory *ifactory, const gchar *path);
260 return new Widget( gtk_item_factory_get_widget(gtkItemFactory, Str.toStringz(path)) );
264 * Warning
265 * gtk_item_factory_get_widget_by_action has been deprecated since version 2.4 and should not be used in newly-written code.
266 * Obtains the widget which was constructed from the GtkItemFactoryEntry
267 * with the given action.
268 * If there are multiple items with the same action, the result is
269 * undefined.
270 * ifactory:
271 * a GtkItemFactory
272 * action:
273 * an action as specified in the callback_action field
274 * of GtkItemFactoryEntry
275 * Returns:
276 * the widget which corresponds to the given action, or NULL
277 * if no widget was found
279 public Widget getWidgetByAction(uint action)
281 // GtkWidget* gtk_item_factory_get_widget_by_action (GtkItemFactory *ifactory, guint action);
282 return new Widget( gtk_item_factory_get_widget_by_action(gtkItemFactory, action) );
286 * Warning
287 * gtk_item_factory_get_item_by_action has been deprecated since version 2.4 and should not be used in newly-written code.
288 * Obtains the menu item which was constructed from the first
289 * GtkItemFactoryEntry with the given action.
290 * ifactory:
291 * a GtkItemFactory
292 * action:
293 * an action as specified in the callback_action field
294 * of GtkItemFactoryEntry
295 * Returns:
296 * the menu item which corresponds to the given action, or NULL
297 * if no menu item was found
299 public Widget getItemByAction(uint action)
301 // GtkWidget* gtk_item_factory_get_item_by_action (GtkItemFactory *ifactory, guint action);
302 return new Widget( gtk_item_factory_get_item_by_action(gtkItemFactory, action) );
306 * Warning
307 * gtk_item_factory_create_item has been deprecated since version 2.4 and should not be used in newly-written code.
308 * Creates an item for entry.
309 * ifactory:
310 * a GtkItemFactory
311 * entry:
312 * the GtkItemFactoryEntry to create an item for
313 * callback_data:
314 * data passed to the callback function of entry
315 * callback_type:
316 * 1 if the callback function of entry is of type
317 * GtkItemFactoryCallback1, 2 if it is of type GtkItemFactoryCallback2
319 public void createItem(GtkItemFactoryEntry* entry, void* callbackData, uint callbackType)
321 // void gtk_item_factory_create_item (GtkItemFactory *ifactory, GtkItemFactoryEntry *entry, gpointer callback_data, guint callback_type);
322 gtk_item_factory_create_item(gtkItemFactory, entry, callbackData, callbackType);
326 * Warning
327 * gtk_item_factory_create_items has been deprecated since version 2.4 and should not be used in newly-written code.
328 * Creates the menu items from the entries.
329 * ifactory:
330 * a GtkItemFactory
331 * n_entries:
332 * the length of entries
333 * entries:
334 * an array of GtkItemFactoryEntrys whose callback members
335 * must by of type GtkItemFactoryCallback1
336 * callback_data:
337 * data passed to the callback functions of all entries
339 public void createItems(uint nEntries, GtkItemFactoryEntry* entries, void* callbackData)
341 // void gtk_item_factory_create_items (GtkItemFactory *ifactory, guint n_entries, GtkItemFactoryEntry *entries, gpointer callback_data);
342 gtk_item_factory_create_items(gtkItemFactory, nEntries, entries, callbackData);
346 * Warning
347 * gtk_item_factory_create_items_ac has been deprecated since version 2.4 and should not be used in newly-written code.
348 * Creates the menu items from the entries.
349 * ifactory:
350 * a GtkItemFactory
351 * n_entries:
352 * the length of entries
353 * entries:
354 * an array of GtkItemFactoryEntrys
355 * callback_data:
356 * data passed to the callback functions of all entries
357 * callback_type:
358 * 1 if the callback functions in entries are of type
359 * GtkItemFactoryCallback1, 2 if they are of type GtkItemFactoryCallback2
361 public void createItemsAc(uint nEntries, GtkItemFactoryEntry* entries, void* callbackData, uint callbackType)
363 // void gtk_item_factory_create_items_ac (GtkItemFactory *ifactory, guint n_entries, GtkItemFactoryEntry *entries, gpointer callback_data, guint callback_type);
364 gtk_item_factory_create_items_ac(gtkItemFactory, nEntries, entries, callbackData, callbackType);
368 * Warning
369 * gtk_item_factory_delete_item has been deprecated since version 2.4 and should not be used in newly-written code.
370 * Deletes the menu item which was created for path by the given
371 * item factory.
372 * ifactory:
373 * a GtkItemFactory
374 * path:
375 * a path
377 public void deleteItem(char[] path)
379 // void gtk_item_factory_delete_item (GtkItemFactory *ifactory, const gchar *path);
380 gtk_item_factory_delete_item(gtkItemFactory, Str.toStringz(path));
384 * Warning
385 * gtk_item_factory_delete_entry has been deprecated since version 2.4 and should not be used in newly-written code.
386 * Deletes the menu item which was created from entry by the given
387 * item factory.
388 * ifactory:
389 * a GtkItemFactory
390 * entry:
391 * a GtkItemFactoryEntry
393 public void deleteEntry(GtkItemFactoryEntry* entry)
395 // void gtk_item_factory_delete_entry (GtkItemFactory *ifactory, GtkItemFactoryEntry *entry);
396 gtk_item_factory_delete_entry(gtkItemFactory, entry);
400 * Warning
401 * gtk_item_factory_delete_entries has been deprecated since version 2.4 and should not be used in newly-written code.
402 * Deletes the menu items which were created from the entries by the given
403 * item factory.
404 * ifactory:
405 * a GtkItemFactory
406 * n_entries:
407 * the length of entries
408 * entries:
409 * an array of GtkItemFactoryEntrys
411 public void deleteEntries(uint nEntries, GtkItemFactoryEntry* entries)
413 // void gtk_item_factory_delete_entries (GtkItemFactory *ifactory, guint n_entries, GtkItemFactoryEntry *entries);
414 gtk_item_factory_delete_entries(gtkItemFactory, nEntries, entries);
418 * Warning
419 * gtk_item_factory_popup has been deprecated since version 2.4 and should not be used in newly-written code.
420 * Pops up the menu constructed from the item factory at (x, y).
421 * The mouse_button parameter should be the mouse button pressed to initiate
422 * the menu popup. If the menu popup was initiated by something other than
423 * a mouse button press, such as a mouse button release or a keypress,
424 * mouse_button should be 0.
425 * The time_ parameter should be the time stamp of the event that
426 * initiated the popup. If such an event is not available, use
427 * gtk_get_current_event_time() instead.
428 * The operation of the mouse_button and the time_ parameter is the same
429 * as the button and activation_time parameters for gtk_menu_popup().
430 * ifactory:
431 * a GtkItemFactory of type GTK_TYPE_MENU (see gtk_item_factory_new())
432 * x:
433 * the x position
434 * y:
435 * the y position
436 * mouse_button:
437 * the mouse button which was pressed to initiate the popup
438 * time_:
439 * the time at which the activation event occurred
441 public void popup(uint x, uint y, uint mouseButton, uint time)
443 // void gtk_item_factory_popup (GtkItemFactory *ifactory, guint x, guint y, guint mouse_button, guint32 time_);
444 gtk_item_factory_popup(gtkItemFactory, x, y, mouseButton, time);
448 * Warning
449 * gtk_item_factory_popup_with_data has been deprecated since version 2.4 and should not be used in newly-written code.
450 * Pops up the menu constructed from the item factory at (x, y). Callbacks
451 * can access the popup_data while the menu is posted via
452 * gtk_item_factory_popup_data() and gtk_item_factory_popup_data_from_widget().
453 * The mouse_button parameter should be the mouse button pressed to initiate
454 * the menu popup. If the menu popup was initiated by something other than
455 * a mouse button press, such as a mouse button release or a keypress,
456 * mouse_button should be 0.
457 * The time_ parameter should be the time stamp of the event that
458 * initiated the popup. If such an event is not available, use
459 * gtk_get_current_event_time() instead.
460 * The operation of the mouse_button and the time_ parameters is the same
461 * as the button and activation_time parameters for gtk_menu_popup().
462 * ifactory:
463 * a GtkItemFactory of type GTK_TYPE_MENU (see gtk_item_factory_new())
464 * popup_data:
465 * data available for callbacks while the menu is posted
466 * destroy:
467 * a GtkDestroyNotify function to be called on popup_data when
468 * the menu is unposted
469 * x:
470 * the x position
471 * y:
472 * the y position
473 * mouse_button:
474 * the mouse button which was pressed to initiate the popup
475 * time_:
476 * the time at which the activation event occurred
478 public void popupWithData(void* popupData, GtkDestroyNotify destroy, uint x, uint y, uint mouseButton, uint time)
480 // void gtk_item_factory_popup_with_data (GtkItemFactory *ifactory, gpointer popup_data, GtkDestroyNotify destroy, guint x, guint y, guint mouse_button, guint32 time_);
481 gtk_item_factory_popup_with_data(gtkItemFactory, popupData, destroy, x, y, mouseButton, time);
485 * Warning
486 * gtk_item_factory_popup_data has been deprecated since version 2.4 and should not be used in newly-written code.
487 * Obtains the popup_data which was passed to
488 * gtk_item_factory_popup_with_data(). This data is available until the menu
489 * is popped down again.
490 * ifactory:
491 * a GtkItemFactory
492 * Returns:
493 * popup_data associated with ifactory
495 public void* popupData()
497 // gpointer gtk_item_factory_popup_data (GtkItemFactory *ifactory);
498 return gtk_item_factory_popup_data(gtkItemFactory);
502 * Warning
503 * gtk_item_factory_popup_data_from_widget has been deprecated since version 2.4 and should not be used in newly-written code.
504 * Obtains the popup_data which was passed to
505 * gtk_item_factory_popup_with_data(). This data is available until the menu
506 * is popped down again.
507 * widget:
508 * a widget
509 * Returns:
510 * popup_data associated with the item factory from
511 * which widget was created, or NULL if widget wasn't created
512 * by an item factory
514 public static void* popupDataFromWidget(Widget widget)
516 // gpointer gtk_item_factory_popup_data_from_widget (GtkWidget *widget);
517 return gtk_item_factory_popup_data_from_widget((widget is null) ? null : widget.getWidgetStruct());
521 * Warning
522 * gtk_item_factory_from_path has been deprecated since version 2.4 and should not be used in newly-written code.
523 * Finds an item factory which has been constructed using the
524 * "<name>" prefix of path as the path argument
525 * for gtk_item_factory_new().
526 * path:
527 * a string starting with a factory path of the form
528 * "<name>"
529 * Returns:
530 * the GtkItemFactory created for the given factory path, or NULL
532 public static ItemFactory fromPath(char[] path)
534 // GtkItemFactory* gtk_item_factory_from_path (const gchar *path);
535 return new ItemFactory( gtk_item_factory_from_path(Str.toStringz(path)) );
540 * Warning
541 * gtk_item_factories_path_delete has been deprecated since version 2.4 and should not be used in newly-written code.
542 * Deletes all widgets constructed from the specified path.
543 * ifactory_path:
544 * a factory path to prepend to path. May be NULL if path
545 * starts with a factory path
546 * path:
547 * a path
549 public static void itemFactoriesPathDelete(char[] ifactoryPath, char[] path)
551 // void gtk_item_factories_path_delete (const gchar *ifactory_path, const gchar *path);
552 gtk_item_factories_path_delete(Str.toStringz(ifactoryPath), Str.toStringz(path));
556 * Warning
557 * gtk_item_factory_set_translate_func has been deprecated since version 2.4 and should not be used in newly-written code.
558 * Sets a function to be used for translating the path elements before they
559 * are displayed.
560 * ifactory:
561 * a GtkItemFactory
562 * func:
563 * the GtkTranslateFunc function to be used to translate path elements
564 * data:
565 * data to pass to func and notify
566 * notify:
567 * a GtkDestroyNotify function to be called when ifactory is
568 * destroyed and when the translation function is changed again
570 public void setTranslateFunc(GtkTranslateFunc func, void* data, GtkDestroyNotify notify)
572 // void gtk_item_factory_set_translate_func (GtkItemFactory *ifactory, GtkTranslateFunc func, gpointer data, GtkDestroyNotify notify);
573 gtk_item_factory_set_translate_func(gtkItemFactory, func, data, notify);