1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 /* 25 * Conversion parameters: 26 * inFile = GtkItemFactory.html 27 * outPack = gtk 28 * outFile = ItemFactory 29 * strct = GtkItemFactory 30 * realStrct= 31 * ctorStrct= 32 * clss = ItemFactory 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_item_factory_ 41 * - gtk_ 42 * omit structs: 43 * omit prefixes: 44 * - gtk_item_factory_create_menu_entries 45 * omit code: 46 * omit signals: 47 * imports: 48 * - glib.Str 49 * - gtk.AccelGroup 50 * - gtk.Widget 51 * structWrap: 52 * - GtkAccelGroup* -> AccelGroup 53 * - GtkItemFactory* -> ItemFactory 54 * - GtkWidget* -> Widget 55 * module aliases: 56 * local aliases: 57 * overrides: 58 */ 59 60 module gtk.ItemFactory; 61 62 public import gtkc.gtktypes; 63 64 private import gtkc.gtk; 65 private import glib.ConstructionException; 66 private import gobject.ObjectG; 67 68 69 private import glib.Str; 70 private import gtk.AccelGroup; 71 private import gtk.Widget; 72 73 74 75 private import gtk.ObjectGtk; 76 77 /** 78 * Description 79 * As of GTK+ 2.4, GtkItemFactory has been deprecated in favour of GtkUIManager. 80 */ 81 public class ItemFactory : ObjectGtk 82 { 83 84 /** the main Gtk struct */ 85 protected GtkItemFactory* gtkItemFactory; 86 87 88 public GtkItemFactory* getItemFactoryStruct() 89 { 90 return gtkItemFactory; 91 } 92 93 94 /** the main Gtk struct as a void* */ 95 protected override void* getStruct() 96 { 97 return cast(void*)gtkItemFactory; 98 } 99 100 /** 101 * Sets our main struct and passes it to the parent class 102 */ 103 public this (GtkItemFactory* gtkItemFactory) 104 { 105 super(cast(GtkObject*)gtkItemFactory); 106 this.gtkItemFactory = gtkItemFactory; 107 } 108 109 protected override void setStruct(GObject* obj) 110 { 111 super.setStruct(obj); 112 gtkItemFactory = cast(GtkItemFactory*)obj; 113 } 114 115 /** 116 */ 117 118 /** 119 * Warning 120 * gtk_item_factory_new has been deprecated since version 2.4 and should not be used in newly-written code. Use GtkUIManager instead. 121 * Creates a new GtkItemFactory. 122 * Beware that the returned object does not have a floating reference. 123 * Params: 124 * containerType = the kind of menu to create; can be 125 * GTK_TYPE_MENU_BAR, GTK_TYPE_MENU or GTK_TYPE_OPTION_MENU 126 * path = the factory path of the new item factory, a string of the form 127 * "<name>" 128 * accelGroup = a GtkAccelGroup to which the accelerators for the 129 * menu items will be added, or NULL to create a new one. [allow-none] 130 * Throws: ConstructionException GTK+ fails to create the object. 131 */ 132 public this (GType containerType, string path, AccelGroup accelGroup) 133 { 134 // GtkItemFactory * gtk_item_factory_new (GType container_type, const gchar *path, GtkAccelGroup *accel_group); 135 auto p = gtk_item_factory_new(containerType, Str.toStringz(path), (accelGroup is null) ? null : accelGroup.getAccelGroupStruct()); 136 if(p is null) 137 { 138 throw new ConstructionException("null returned by gtk_item_factory_new(containerType, Str.toStringz(path), (accelGroup is null) ? null : accelGroup.getAccelGroupStruct())"); 139 } 140 this(cast(GtkItemFactory*) p); 141 } 142 143 /** 144 * Warning 145 * gtk_item_factory_construct has been deprecated since version 2.4 and should not be used in newly-written code. Use GtkUIManager instead. 146 * Initializes an item factory. 147 * Params: 148 * containerType = the kind of menu to create; can be 149 * GTK_TYPE_MENU_BAR, GTK_TYPE_MENU or GTK_TYPE_OPTION_MENU 150 * path = the factory path of ifactory, a string of the form 151 * "<name>" 152 * accelGroup = a GtkAccelGroup to which the accelerators for the 153 * menu items will be added, or NULL to create a new one 154 */ 155 public void construct(GType containerType, string path, AccelGroup accelGroup) 156 { 157 // void gtk_item_factory_construct (GtkItemFactory *ifactory, GType container_type, const gchar *path, GtkAccelGroup *accel_group); 158 gtk_item_factory_construct(gtkItemFactory, containerType, Str.toStringz(path), (accelGroup is null) ? null : accelGroup.getAccelGroupStruct()); 159 } 160 161 /** 162 * Warning 163 * 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 164 * gtk_menu_item_set_accel_path() and gtk_widget_set_accel_path(); don't 165 * use gtk_item_factory_add_foreign() in new code, since it is likely to 166 * be removed in the future. 167 * Installs an accelerator for accel_widget in accel_group, that causes 168 * the ::activate signal to be emitted if the accelerator is activated. 169 * This function can be used to make widgets participate in the accel 170 * saving/restoring functionality provided by gtk_accel_map_save() and 171 * gtk_accel_map_load(), even if they haven't been created by an item 172 * factory. 173 * Params: 174 * accelWidget = widget to install an accelerator on 175 * fullPath = the full path for the accel_widget 176 * accelGroup = the accelerator group to install the accelerator in 177 * keyval = key value of the accelerator 178 * modifiers = modifier combination of the accelerator 179 */ 180 public static void addForeign(Widget accelWidget, string fullPath, AccelGroup accelGroup, uint keyval, GdkModifierType modifiers) 181 { 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); 184 } 185 186 /** 187 * Warning 188 * gtk_item_factory_from_widget has been deprecated since version 2.4 and should not be used in newly-written code. Use GtkUIManager instead. 189 * Obtains the item factory from which a widget was created. 190 * Params: 191 * widget = a widget 192 * Returns: the item factory from which widget was created, or NULL. [allow-none] 193 */ 194 public static ItemFactory fromWidget(Widget widget) 195 { 196 // GtkItemFactory * gtk_item_factory_from_widget (GtkWidget *widget); 197 auto p = gtk_item_factory_from_widget((widget is null) ? null : widget.getWidgetStruct()); 198 199 if(p is null) 200 { 201 return null; 202 } 203 204 return ObjectG.getDObject!(ItemFactory)(cast(GtkItemFactory*) p); 205 } 206 207 /** 208 * Warning 209 * gtk_item_factory_path_from_widget has been deprecated since version 2.4 and should not be used in newly-written code. Use GtkUIManager instead. 210 * If widget has been created by an item factory, returns the full path 211 * to it. (The full path of a widget is the concatenation of the factory 212 * path specified in gtk_item_factory_new() with the path specified in the 213 * GtkItemFactoryEntry from which the widget was created.) 214 * Params: 215 * widget = a widget 216 * Returns: the full path to widget if it has been created by an item factory, NULL otherwise. This value is owned by GTK+ and must not be modified or freed. 217 */ 218 public static string pathFromWidget(Widget widget) 219 { 220 // const gchar * gtk_item_factory_path_from_widget (GtkWidget *widget); 221 return Str.toString(gtk_item_factory_path_from_widget((widget is null) ? null : widget.getWidgetStruct())); 222 } 223 224 /** 225 * Warning 226 * gtk_item_factory_get_item has been deprecated since version 2.4 and should not be used in newly-written code. Use GtkUIManager instead. 227 * Obtains the menu item which corresponds to path. 228 * If the widget corresponding to path is a menu item which opens a 229 * submenu, then the item is returned. If you are interested in the submenu, 230 * use gtk_item_factory_get_widget() instead. 231 * Params: 232 * path = the path to the menu item 233 * Returns: the menu item for the given path, or NULL if path doesn't lead to a menu item. [allow-none] 234 */ 235 public Widget getItem(string path) 236 { 237 // GtkWidget * gtk_item_factory_get_item (GtkItemFactory *ifactory, const gchar *path); 238 auto p = gtk_item_factory_get_item(gtkItemFactory, Str.toStringz(path)); 239 240 if(p is null) 241 { 242 return null; 243 } 244 245 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 246 } 247 248 /** 249 * Warning 250 * gtk_item_factory_get_widget has been deprecated since version 2.4 and should not be used in newly-written code. Use GtkUIManager instead. 251 * Obtains the widget which corresponds to path. 252 * If the widget corresponding to path is a menu item which opens a 253 * submenu, then the submenu is returned. If you are interested in the menu 254 * item, use gtk_item_factory_get_item() instead. 255 * Params: 256 * path = the path to the widget 257 * Returns: the widget for the given path, or NULL if path doesn't lead to a widget. [allow-none] 258 */ 259 public Widget getWidget(string path) 260 { 261 // GtkWidget * gtk_item_factory_get_widget (GtkItemFactory *ifactory, const gchar *path); 262 auto p = gtk_item_factory_get_widget(gtkItemFactory, Str.toStringz(path)); 263 264 if(p is null) 265 { 266 return null; 267 } 268 269 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 270 } 271 272 /** 273 * Warning 274 * gtk_item_factory_get_widget_by_action has been deprecated since version 2.4 and should not be used in newly-written code. Use GtkUIManager instead. 275 * Obtains the widget which was constructed from the GtkItemFactoryEntry 276 * with the given action. 277 * If there are multiple items with the same action, the result is 278 * undefined. 279 * Params: 280 * action = an action as specified in the callback_action field 281 * of GtkItemFactoryEntry 282 * Returns: the widget which corresponds to the given action, or NULL if no widget was found. [allow-none] 283 */ 284 public Widget getWidgetByAction(uint action) 285 { 286 // GtkWidget * gtk_item_factory_get_widget_by_action (GtkItemFactory *ifactory, guint action); 287 auto p = gtk_item_factory_get_widget_by_action(gtkItemFactory, action); 288 289 if(p is null) 290 { 291 return null; 292 } 293 294 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 295 } 296 297 /** 298 * Warning 299 * gtk_item_factory_get_item_by_action has been deprecated since version 2.4 and should not be used in newly-written code. Use GtkUIManager instead. 300 * Obtains the menu item which was constructed from the first 301 * GtkItemFactoryEntry with the given action. 302 * Params: 303 * action = an action as specified in the callback_action field 304 * of GtkItemFactoryEntry 305 * Returns: the menu item which corresponds to the given action, or NULL if no menu item was found. [allow-none] 306 */ 307 public Widget getItemByAction(uint action) 308 { 309 // GtkWidget * gtk_item_factory_get_item_by_action (GtkItemFactory *ifactory, guint action); 310 auto p = gtk_item_factory_get_item_by_action(gtkItemFactory, action); 311 312 if(p is null) 313 { 314 return null; 315 } 316 317 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 318 } 319 320 /** 321 * Warning 322 * gtk_item_factory_create_item has been deprecated since version 2.4 and should not be used in newly-written code. Use GtkUIManager instead. 323 * Creates an item for entry. 324 * Params: 325 * entry = the GtkItemFactoryEntry to create an item for 326 * callbackData = data passed to the callback function of entry 327 * callbackType = 1 if the callback function of entry is of type 328 * GtkItemFactoryCallback1, 2 if it is of type GtkItemFactoryCallback2 329 */ 330 public void createItem(GtkItemFactoryEntry* entry, void* callbackData, uint callbackType) 331 { 332 // void gtk_item_factory_create_item (GtkItemFactory *ifactory, GtkItemFactoryEntry *entry, gpointer callback_data, guint callback_type); 333 gtk_item_factory_create_item(gtkItemFactory, entry, callbackData, callbackType); 334 } 335 336 /** 337 * Warning 338 * gtk_item_factory_create_items has been deprecated since version 2.4 and should not be used in newly-written code. Use GtkUIManager instead. 339 * Creates the menu items from the entries. 340 * Params: 341 * nEntries = the length of entries 342 * entries = an array of GtkItemFactoryEntrys whose callback members 343 * must by of type GtkItemFactoryCallback1 344 * callbackData = data passed to the callback functions of all entries 345 */ 346 public void createItems(uint nEntries, GtkItemFactoryEntry* entries, void* callbackData) 347 { 348 // void gtk_item_factory_create_items (GtkItemFactory *ifactory, guint n_entries, GtkItemFactoryEntry *entries, gpointer callback_data); 349 gtk_item_factory_create_items(gtkItemFactory, nEntries, entries, callbackData); 350 } 351 352 /** 353 * Warning 354 * gtk_item_factory_create_items_ac has been deprecated since version 2.4 and should not be used in newly-written code. Use GtkUIManager instead. 355 * Creates the menu items from the entries. 356 * Params: 357 * nEntries = the length of entries 358 * entries = an array of GtkItemFactoryEntrys 359 * callbackData = data passed to the callback functions of all entries 360 * callbackType = 1 if the callback functions in entries are of type 361 * GtkItemFactoryCallback1, 2 if they are of type GtkItemFactoryCallback2 362 */ 363 public void createItemsAc(uint nEntries, GtkItemFactoryEntry* entries, void* callbackData, uint callbackType) 364 { 365 // void gtk_item_factory_create_items_ac (GtkItemFactory *ifactory, guint n_entries, GtkItemFactoryEntry *entries, gpointer callback_data, guint callback_type); 366 gtk_item_factory_create_items_ac(gtkItemFactory, nEntries, entries, callbackData, callbackType); 367 } 368 369 /** 370 * Warning 371 * gtk_item_factory_delete_item has been deprecated since version 2.4 and should not be used in newly-written code. Use GtkUIManager instead. 372 * Deletes the menu item which was created for path by the given 373 * item factory. 374 * Params: 375 * path = a path 376 */ 377 public void deleteItem(string path) 378 { 379 // void gtk_item_factory_delete_item (GtkItemFactory *ifactory, const gchar *path); 380 gtk_item_factory_delete_item(gtkItemFactory, Str.toStringz(path)); 381 } 382 383 /** 384 * Warning 385 * gtk_item_factory_delete_entry has been deprecated since version 2.4 and should not be used in newly-written code. Use GtkUIManager instead. 386 * Deletes the menu item which was created from entry by the given 387 * item factory. 388 * Params: 389 * entry = a GtkItemFactoryEntry 390 */ 391 public void deleteEntry(GtkItemFactoryEntry* entry) 392 { 393 // void gtk_item_factory_delete_entry (GtkItemFactory *ifactory, GtkItemFactoryEntry *entry); 394 gtk_item_factory_delete_entry(gtkItemFactory, entry); 395 } 396 397 /** 398 * Warning 399 * gtk_item_factory_delete_entries has been deprecated since version 2.4 and should not be used in newly-written code. Use GtkUIManager instead. 400 * Deletes the menu items which were created from the entries by the given 401 * item factory. 402 * Params: 403 * nEntries = the length of entries 404 * entries = an array of GtkItemFactoryEntrys 405 */ 406 public void deleteEntries(uint nEntries, GtkItemFactoryEntry* entries) 407 { 408 // void gtk_item_factory_delete_entries (GtkItemFactory *ifactory, guint n_entries, GtkItemFactoryEntry *entries); 409 gtk_item_factory_delete_entries(gtkItemFactory, nEntries, entries); 410 } 411 412 /** 413 * Warning 414 * gtk_item_factory_popup has been deprecated since version 2.4 and should not be used in newly-written code. Use GtkUIManager instead. 415 * Pops up the menu constructed from the item factory at (x, y). 416 * The mouse_button parameter should be the mouse button pressed to initiate 417 * the menu popup. If the menu popup was initiated by something other than 418 * a mouse button press, such as a mouse button release or a keypress, 419 * mouse_button should be 0. 420 * The time_ parameter should be the time stamp of the event that 421 * initiated the popup. If such an event is not available, use 422 * gtk_get_current_event_time() instead. 423 * The operation of the mouse_button and the time_ parameter is the same 424 * as the button and activation_time parameters for gtk_menu_popup(). 425 * Params: 426 * x = the x position 427 * y = the y position 428 * mouseButton = the mouse button which was pressed to initiate the popup 429 * time = the time at which the activation event occurred 430 */ 431 public void popup(uint x, uint y, uint mouseButton, uint time) 432 { 433 // void gtk_item_factory_popup (GtkItemFactory *ifactory, guint x, guint y, guint mouse_button, guint32 time_); 434 gtk_item_factory_popup(gtkItemFactory, x, y, mouseButton, time); 435 } 436 437 /** 438 * Warning 439 * gtk_item_factory_popup_with_data has been deprecated since version 2.4 and should not be used in newly-written code. Use GtkUIManager instead. 440 * Pops up the menu constructed from the item factory at (x, y). Callbacks 441 * can access the popup_data while the menu is posted via 442 * gtk_item_factory_popup_data() and gtk_item_factory_popup_data_from_widget(). 443 * The mouse_button parameter should be the mouse button pressed to initiate 444 * the menu popup. If the menu popup was initiated by something other than 445 * a mouse button press, such as a mouse button release or a keypress, 446 * mouse_button should be 0. 447 * The time_ parameter should be the time stamp of the event that 448 * initiated the popup. If such an event is not available, use 449 * gtk_get_current_event_time() instead. 450 * The operation of the mouse_button and the time_ parameters is the same 451 * as the button and activation_time parameters for gtk_menu_popup(). 452 * Params: 453 * popupData = data available for callbacks while the menu is posted 454 * destroy = a GDestroyNotify function to be called on popup_data when 455 * the menu is unposted 456 * x = the x position 457 * y = the y position 458 * mouseButton = the mouse button which was pressed to initiate the popup 459 * time = the time at which the activation event occurred 460 */ 461 public void popupWithData(void* popupData, GDestroyNotify destroy, uint x, uint y, uint mouseButton, uint time) 462 { 463 // void gtk_item_factory_popup_with_data (GtkItemFactory *ifactory, gpointer popup_data, GDestroyNotify destroy, guint x, guint y, guint mouse_button, guint32 time_); 464 gtk_item_factory_popup_with_data(gtkItemFactory, popupData, destroy, x, y, mouseButton, time); 465 } 466 467 /** 468 * Warning 469 * gtk_item_factory_popup_data has been deprecated since version 2.4 and should not be used in newly-written code. Use GtkUIManager instead. 470 * Obtains the popup_data which was passed to 471 * gtk_item_factory_popup_with_data(). This data is available until the menu 472 * is popped down again. 473 * Returns: popup_data associated with ifactory 474 */ 475 public void* popupData() 476 { 477 // gpointer gtk_item_factory_popup_data (GtkItemFactory *ifactory); 478 return gtk_item_factory_popup_data(gtkItemFactory); 479 } 480 481 /** 482 * Warning 483 * gtk_item_factory_popup_data_from_widget has been deprecated since version 2.4 and should not be used in newly-written code. Use GtkUIManager instead. 484 * Obtains the popup_data which was passed to 485 * gtk_item_factory_popup_with_data(). This data is available until the menu 486 * is popped down again. 487 * Params: 488 * widget = a widget 489 * Returns: popup_data associated with the item factory from which widget was created, or NULL if widget wasn't created by an item factory 490 */ 491 public static void* popupDataFromWidget(Widget widget) 492 { 493 // gpointer gtk_item_factory_popup_data_from_widget (GtkWidget *widget); 494 return gtk_item_factory_popup_data_from_widget((widget is null) ? null : widget.getWidgetStruct()); 495 } 496 497 /** 498 * Warning 499 * gtk_item_factory_from_path has been deprecated since version 2.4 and should not be used in newly-written code. Use GtkUIManager instead. 500 * Finds an item factory which has been constructed using the 501 * "<name>" prefix of path as the path argument 502 * for gtk_item_factory_new(). 503 * Params: 504 * path = a string starting with a factory path of the form 505 * "<name>" 506 * Returns: the GtkItemFactory created for the given factory path, or NULL. [allow-none] 507 */ 508 public static ItemFactory fromPath(string path) 509 { 510 // GtkItemFactory * gtk_item_factory_from_path (const gchar *path); 511 auto p = gtk_item_factory_from_path(Str.toStringz(path)); 512 513 if(p is null) 514 { 515 return null; 516 } 517 518 return ObjectG.getDObject!(ItemFactory)(cast(GtkItemFactory*) p); 519 } 520 521 /** 522 * Warning 523 * gtk_item_factories_path_delete has been deprecated since version 2.4 and should not be used in newly-written code. Use GtkUIManager instead. 524 * Deletes all widgets constructed from the specified path. 525 * Params: 526 * ifactoryPath = a factory path to prepend to path. May be NULL if path 527 * starts with a factory path 528 * path = a path 529 */ 530 public static void itemFactoriesPathDelete(string ifactoryPath, string path) 531 { 532 // void gtk_item_factories_path_delete (const gchar *ifactory_path, const gchar *path); 533 gtk_item_factories_path_delete(Str.toStringz(ifactoryPath), Str.toStringz(path)); 534 } 535 536 /** 537 * Warning 538 * gtk_item_factory_set_translate_func has been deprecated since version 2.4 and should not be used in newly-written code. Use GtkUIManager instead. 539 * Sets a function to be used for translating the path elements before they 540 * are displayed. 541 * Params: 542 * func = the GtkTranslateFunc function to be used to translate path elements 543 * data = data to pass to func and notify 544 * notify = a GDestroyNotify function to be called when ifactory is 545 * destroyed and when the translation function is changed again 546 */ 547 public void setTranslateFunc(GtkTranslateFunc func, void* data, GDestroyNotify notify) 548 { 549 // void gtk_item_factory_set_translate_func (GtkItemFactory *ifactory, GtkTranslateFunc func, gpointer data, GDestroyNotify notify); 550 gtk_item_factory_set_translate_func(gtkItemFactory, func, data, notify); 551 } 552 }