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 = GtkAction.html 27 * outPack = gtk 28 * outFile = Action 29 * strct = GtkAction 30 * realStrct= 31 * ctorStrct= 32 * clss = Action 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * - BuildableIF 40 * prefixes: 41 * - gtk_action_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * - gtk_action_get_stock_id 46 * - gtk_action_create_icon 47 * - gtk_action_create_menu_item 48 * - gtk_action_create_tool_item 49 * - gtk_action_create_menu 50 * omit signals: 51 * imports: 52 * - glib.Str 53 * - gio.Icon 54 * - gio.IconIF 55 * - gobject.Closure 56 * - glib.ListSG 57 * - gtk.AccelGroup 58 * - gtk.Image 59 * - gtk.Menu 60 * - gtk.MenuItem 61 * - gtk.ToolItem 62 * - gtk.Widget 63 * - gtk.BuildableIF 64 * - gtk.BuildableT 65 * structWrap: 66 * - GClosure* -> Closure 67 * - GIcon* -> IconIF 68 * - GSList* -> ListSG 69 * - GtkAccelGroup* -> AccelGroup 70 * - GtkWidget* -> Widget 71 * module aliases: 72 * local aliases: 73 * overrides: 74 */ 75 76 module gtk.Action; 77 78 public import gtkc.gtktypes; 79 80 private import gtkc.gtk; 81 private import glib.ConstructionException; 82 private import gobject.ObjectG; 83 84 private import gobject.Signals; 85 public import gtkc.gdktypes; 86 private import glib.Str; 87 private import gio.Icon; 88 private import gio.IconIF; 89 private import gobject.Closure; 90 private import glib.ListSG; 91 private import gtk.AccelGroup; 92 private import gtk.Image; 93 private import gtk.Menu; 94 private import gtk.MenuItem; 95 private import gtk.ToolItem; 96 private import gtk.Widget; 97 private import gtk.BuildableIF; 98 private import gtk.BuildableT; 99 100 101 private import gobject.ObjectG; 102 103 /** 104 * Warning 105 * 106 * In GTK+ 3.10, GtkAction has been deprecated. Use GAction instead, and 107 * associate actions with GtkActionable widgets. Use GMenuModel for creating 108 * menus with gtk_menu_new_from_model(). 109 * 110 * Actions represent operations that the user can be perform, along with 111 * some information how it should be presented in the interface. Each action 112 * provides methods to create icons, menu items and toolbar items 113 * representing itself. 114 * 115 * As well as the callback that is called when the action gets activated, 116 * the following also gets associated with the action: 117 * 118 * a name (not translated, for path lookup) 119 * 120 * a label (translated, for display) 121 * 122 * an accelerator 123 * 124 * whether label indicates a stock id 125 * 126 * a tooltip (optional, translated) 127 * 128 * a toolbar label (optional, shorter than label) 129 * 130 * The action will also have some state information: 131 * 132 * visible (shown/hidden) 133 * 134 * sensitive (enabled/disabled) 135 * 136 * Apart from regular actions, there are toggle 137 * actions, which can be toggled between two states and radio actions, of which only one in a group 138 * can be in the "active" state. Other actions can be implemented as GtkAction 139 * subclasses. 140 * 141 * Each action can have one or more proxy widgets. To act as an action proxy, 142 * widget needs to implement GtkActivatable interface. Proxies mirror the state 143 * of the action and should change when the action's state changes. Properties 144 * that are always mirrored by proxies are "sensitive" and 145 * "visible". "gicon", "icon-name", "label", 146 * "short-label" and "stock-id" properties are only mirorred 147 * if proxy widget has "use-action-appearance" property set to 148 * TRUE. 149 * 150 * When the proxy is activated, it should activate its action. 151 */ 152 public class Action : ObjectG, BuildableIF 153 { 154 155 /** the main Gtk struct */ 156 protected GtkAction* gtkAction; 157 158 159 /** Get the main Gtk struct */ 160 public GtkAction* getActionStruct() 161 { 162 return gtkAction; 163 } 164 165 166 /** the main Gtk struct as a void* */ 167 protected override void* getStruct() 168 { 169 return cast(void*)gtkAction; 170 } 171 172 /** 173 * Sets our main struct and passes it to the parent class 174 */ 175 public this (GtkAction* gtkAction) 176 { 177 super(cast(GObject*)gtkAction); 178 this.gtkAction = gtkAction; 179 } 180 181 protected override void setStruct(GObject* obj) 182 { 183 super.setStruct(obj); 184 gtkAction = cast(GtkAction*)obj; 185 } 186 187 // add the Buildable capabilities 188 mixin BuildableT!(GtkAction); 189 190 /** 191 * Creates a new GtkAction object. To add the action to a 192 * GtkActionGroup and set the accelerator for the action, 193 * call gtk_action_group_add_action_with_accel(). 194 * See the section called UI Definitions for information on allowed action 195 * names. 196 * Since 2.4 197 * Params: 198 * name = A unique name for the action 199 * label = the label displayed in menu items and on buttons, or NULL 200 * tooltip = a tooltip for the action, or NULL 201 * stockId = the stock icon to display in widgets representing the 202 * action. 203 * Throws: ConstructionException GTK+ fails to create the object. 204 */ 205 public this (string name, string label, string tooltip, StockID stockId) 206 { 207 this(name, label, tooltip, StockDesc[stockId]); 208 } 209 210 /** 211 * Gets the stock id of action. 212 * Since 2.16 213 * Returns: the stock id 214 */ 215 public StockID getStockId() 216 { 217 // const gchar * gtk_action_get_stock_id (GtkAction *action); 218 string id = Str.toString(gtk_action_get_stock_id(gtkAction)); 219 220 foreach(i, desc; StockDesc) 221 { 222 if(desc == id) 223 return cast(StockID)i; 224 } 225 226 return StockID.DISCARD; 227 } 228 229 /** 230 * Sets the stock id on action 231 * Since 2.16 232 * Params: 233 * stockId = the stock id 234 */ 235 public void setStockId(StockID stockId) 236 { 237 setStockId(StockDesc[stockId]); 238 } 239 240 /** 241 * This function is intended for use by action implementations to 242 * create icons displayed in the proxy widgets. 243 * Since 2.4 244 * Params: 245 * iconSize = the size of the icon that should be created. [type int] 246 * Returns: a widget that displays the icon for this action. 247 */ 248 public Image createIcon(GtkIconSize iconSize) 249 { 250 // GtkWidget * gtk_action_create_icon (GtkAction *action, GtkIconSize icon_size); 251 auto p = gtk_action_create_icon(gtkAction, iconSize); 252 if(p is null) 253 { 254 return null; 255 } 256 return new Image(cast(GtkImage*) p); 257 } 258 259 /** 260 * Creates a menu item widget that proxies for the given action. 261 * Since 2.4 262 * Returns: a menu item connected to the action. 263 */ 264 public MenuItem createMenuItem() 265 { 266 // GtkWidget * gtk_action_create_menu_item (GtkAction *action); 267 auto p = gtk_action_create_menu_item(gtkAction); 268 if(p is null) 269 { 270 return null; 271 } 272 return new MenuItem(cast(GtkMenuItem*) p); 273 } 274 275 /** 276 * Creates a toolbar item widget that proxies for the given action. 277 * Since 2.4 278 * Returns: a toolbar item connected to the action. 279 */ 280 public ToolItem createToolItem() 281 { 282 // GtkWidget * gtk_action_create_tool_item (GtkAction *action); 283 auto p = gtk_action_create_tool_item(gtkAction); 284 if(p is null) 285 { 286 return null; 287 } 288 return new ToolItem(cast(GtkToolItem*) p); 289 } 290 291 /** 292 * If action provides a GtkMenu widget as a submenu for the menu 293 * item or the toolbar item it creates, this function returns an 294 * instance of that menu. 295 * Since 2.12 296 * Returns: the menu item provided by the action, or NULL. 297 */ 298 public Menu createMenu() 299 { 300 // GtkWidget * gtk_action_create_menu (GtkAction *action); 301 auto p = gtk_action_create_menu(gtkAction); 302 if(p is null) 303 { 304 return null; 305 } 306 return new Menu(cast(GtkMenu*) p); 307 } 308 309 /** 310 */ 311 int[string] connectedSignals; 312 313 void delegate(Action)[] onActivateListeners; 314 /** 315 * Warning 316 * GtkAction::activate has been deprecated since version 3.10 and should not be used in newly-written code. Use "activate" instead 317 * The "activate" signal is emitted when the action is activated. 318 * Since 2.4 319 * See Also 320 * GtkActionGroup, GtkUIManager, GtkActivatable 321 */ 322 void addOnActivate(void delegate(Action) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 323 { 324 if ( !("activate" in connectedSignals) ) 325 { 326 Signals.connectData( 327 getStruct(), 328 "activate", 329 cast(GCallback)&callBackActivate, 330 cast(void*)this, 331 null, 332 connectFlags); 333 connectedSignals["activate"] = 1; 334 } 335 onActivateListeners ~= dlg; 336 } 337 extern(C) static void callBackActivate(GtkAction* actionStruct, Action _action) 338 { 339 foreach ( void delegate(Action) dlg ; _action.onActivateListeners ) 340 { 341 dlg(_action); 342 } 343 } 344 345 346 /** 347 * Warning 348 * gtk_action_new has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction instead, associating it to a widget with 349 * GtkActionable or creating a GtkMenu with gtk_menu_new_from_model() 350 * Creates a new GtkAction object. To add the action to a 351 * GtkActionGroup and set the accelerator for the action, 352 * call gtk_action_group_add_action_with_accel(). 353 * See the section called “UI Definitions” for information on allowed action 354 * names. 355 * Since 2.4 356 * Params: 357 * name = A unique name for the action 358 * label = the label displayed in menu items and on buttons, 359 * or NULL. [allow-none] 360 * tooltip = a tooltip for the action, or NULL. [allow-none] 361 * stockId = the stock icon to display in widgets representing 362 * the action, or NULL. [allow-none] 363 * Throws: ConstructionException GTK+ fails to create the object. 364 */ 365 public this (string name, string label, string tooltip, string stockId) 366 { 367 // GtkAction * gtk_action_new (const gchar *name, const gchar *label, const gchar *tooltip, const gchar *stock_id); 368 auto p = gtk_action_new(Str.toStringz(name), Str.toStringz(label), Str.toStringz(tooltip), Str.toStringz(stockId)); 369 if(p is null) 370 { 371 throw new ConstructionException("null returned by gtk_action_new(Str.toStringz(name), Str.toStringz(label), Str.toStringz(tooltip), Str.toStringz(stockId))"); 372 } 373 this(cast(GtkAction*) p); 374 } 375 376 /** 377 * Warning 378 * gtk_action_get_name has been deprecated since version 3.10 and should not be used in newly-written code. Use g_action_get_name() on a GAction instead 379 * Returns the name of the action. 380 * Since 2.4 381 * Returns: the name of the action. The string belongs to GTK+ and should not be freed. 382 */ 383 public string getName() 384 { 385 // const gchar * gtk_action_get_name (GtkAction *action); 386 return Str.toString(gtk_action_get_name(gtkAction)); 387 } 388 389 /** 390 * Warning 391 * gtk_action_is_sensitive has been deprecated since version 3.10 and should not be used in newly-written code. Use g_simple_action_get_enabled() on a GSimpleAction 392 * instead 393 * Returns whether the action is effectively sensitive. 394 * Since 2.4 395 * Returns: TRUE if the action and its associated action group are both sensitive. 396 */ 397 public int isSensitive() 398 { 399 // gboolean gtk_action_is_sensitive (GtkAction *action); 400 return gtk_action_is_sensitive(gtkAction); 401 } 402 403 /** 404 * Warning 405 * gtk_action_get_sensitive has been deprecated since version 3.10 and should not be used in newly-written code. Use g_simple_action_get_enabled() on a GSimpleAction 406 * instead 407 * Returns whether the action itself is sensitive. Note that this doesn't 408 * necessarily mean effective sensitivity. See gtk_action_is_sensitive() 409 * for that. 410 * Since 2.4 411 * Returns: TRUE if the action itself is sensitive. 412 */ 413 public int getSensitive() 414 { 415 // gboolean gtk_action_get_sensitive (GtkAction *action); 416 return gtk_action_get_sensitive(gtkAction); 417 } 418 419 /** 420 * Warning 421 * gtk_action_set_sensitive has been deprecated since version 3.10 and should not be used in newly-written code. Use g_simple_action_set_enabled() on a GSimpleAction 422 * instead 423 * Sets the ::sensitive property of the action to sensitive. Note that 424 * this doesn't necessarily mean effective sensitivity. See 425 * gtk_action_is_sensitive() 426 * for that. 427 * Since 2.6 428 * Params: 429 * sensitive = TRUE to make the action sensitive 430 */ 431 public void setSensitive(int sensitive) 432 { 433 // void gtk_action_set_sensitive (GtkAction *action, gboolean sensitive); 434 gtk_action_set_sensitive(gtkAction, sensitive); 435 } 436 437 /** 438 * Warning 439 * gtk_action_is_visible has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction instead, and control and monitor the state of 440 * GtkActionable widgets directly 441 * Returns whether the action is effectively visible. 442 * Since 2.4 443 * Returns: TRUE if the action and its associated action group are both visible. 444 */ 445 public int isVisible() 446 { 447 // gboolean gtk_action_is_visible (GtkAction *action); 448 return gtk_action_is_visible(gtkAction); 449 } 450 451 /** 452 * Warning 453 * gtk_action_get_visible has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction instead, and control and monitor the state of 454 * GtkActionable widgets directly 455 * Returns whether the action itself is visible. Note that this doesn't 456 * necessarily mean effective visibility. See gtk_action_is_sensitive() 457 * for that. 458 * Since 2.4 459 * Returns: TRUE if the action itself is visible. 460 */ 461 public int getVisible() 462 { 463 // gboolean gtk_action_get_visible (GtkAction *action); 464 return gtk_action_get_visible(gtkAction); 465 } 466 467 /** 468 * Warning 469 * gtk_action_set_visible has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction instead, and control and monitor the state of 470 * GtkActionable widgets directly 471 * Sets the ::visible property of the action to visible. Note that 472 * this doesn't necessarily mean effective visibility. See 473 * gtk_action_is_visible() 474 * for that. 475 * Since 2.6 476 * Params: 477 * visible = TRUE to make the action visible 478 */ 479 public void setVisible(int visible) 480 { 481 // void gtk_action_set_visible (GtkAction *action, gboolean visible); 482 gtk_action_set_visible(gtkAction, visible); 483 } 484 485 /** 486 * Warning 487 * gtk_action_activate has been deprecated since version 3.10 and should not be used in newly-written code. Use g_action_group_activate_action() on a GAction instead 488 * Emits the "activate" signal on the specified action, if it isn't 489 * insensitive. This gets called by the proxy widgets when they get 490 * activated. 491 * It can also be used to manually activate an action. 492 * Since 2.4 493 */ 494 public void activate() 495 { 496 // void gtk_action_activate (GtkAction *action); 497 gtk_action_activate(gtkAction); 498 } 499 500 /** 501 * Warning 502 * gtk_action_get_proxies is deprecated and should not be used in newly-written code. 3.10 503 * Returns the proxy widgets for an action. 504 * See also gtk_activatable_get_related_action(). 505 * Since 2.4 506 * Returns: a GSList of proxy widgets. The list is owned by GTK+ and must not be modified. [element-type GtkWidget][transfer none] 507 */ 508 public ListSG getProxies() 509 { 510 // GSList * gtk_action_get_proxies (GtkAction *action); 511 auto p = gtk_action_get_proxies(gtkAction); 512 513 if(p is null) 514 { 515 return null; 516 } 517 518 return ObjectG.getDObject!(ListSG)(cast(GSList*) p); 519 } 520 521 /** 522 * Warning 523 * gtk_action_connect_accelerator has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction and the accelerator group on an associated 524 * GtkMenu instead 525 * Installs the accelerator for action if action has an 526 * accel path and group. See gtk_action_set_accel_path() and 527 * gtk_action_set_accel_group() 528 * Since multiple proxies may independently trigger the installation 529 * of the accelerator, the action counts the number of times this 530 * function has been called and doesn't remove the accelerator until 531 * gtk_action_disconnect_accelerator() has been called as many times. 532 * Since 2.4 533 */ 534 public void connectAccelerator() 535 { 536 // void gtk_action_connect_accelerator (GtkAction *action); 537 gtk_action_connect_accelerator(gtkAction); 538 } 539 540 /** 541 * Warning 542 * gtk_action_disconnect_accelerator has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction and the accelerator group on an associated 543 * GtkMenu instead 544 * Undoes the effect of one call to gtk_action_connect_accelerator(). 545 * Since 2.4 546 */ 547 public void disconnectAccelerator() 548 { 549 // void gtk_action_disconnect_accelerator (GtkAction *action); 550 gtk_action_disconnect_accelerator(gtkAction); 551 } 552 553 /** 554 * Warning 555 * gtk_action_block_activate has been deprecated since version 3.10 and should not be used in newly-written code. Use g_simple_action_set_enabled() to disable the 556 * GSimpleAction instead 557 * Disable activation signals from the action 558 * This is needed when updating the state of your proxy 559 * GtkActivatable widget could result in calling gtk_action_activate(), 560 * this is a convenience function to avoid recursing in those 561 * cases (updating toggle state for instance). 562 * Since 2.16 563 */ 564 public void blockActivate() 565 { 566 // void gtk_action_block_activate (GtkAction *action); 567 gtk_action_block_activate(gtkAction); 568 } 569 570 /** 571 * Warning 572 * gtk_action_unblock_activate has been deprecated since version 3.10 and should not be used in newly-written code. Use g_simple_action_set_enabled() to enable the 573 * GSimpleAction instead 574 * Reenable activation signals from the action 575 * Since 2.16 576 */ 577 public void unblockActivate() 578 { 579 // void gtk_action_unblock_activate (GtkAction *action); 580 gtk_action_unblock_activate(gtkAction); 581 } 582 583 /** 584 * Warning 585 * gtk_action_get_always_show_image has been deprecated since version 3.10 and should not be used in newly-written code. Use g_menu_item_get_attribute_value() on a GMenuItem 586 * instead 587 * Returns whether action's menu item proxies will always 588 * show their image, if available. 589 * Since 2.20 590 * Returns: TRUE if the menu item proxies will always show their image 591 */ 592 public int getAlwaysShowImage() 593 { 594 // gboolean gtk_action_get_always_show_image (GtkAction *action); 595 return gtk_action_get_always_show_image(gtkAction); 596 } 597 598 /** 599 * Warning 600 * gtk_action_set_always_show_image has been deprecated since version 3.10 and should not be used in newly-written code. Use g_menu_item_set_icon() on a GMenuItem instead, if the 601 * item should have an image 602 * Sets whether action's menu item proxies will always show 603 * their image, if available. 604 * Use this if the menu item would be useless or hard to use 605 * without their image. 606 * Since 2.20 607 * Params: 608 * alwaysShow = TRUE if menuitem proxies should always show their image 609 */ 610 public void setAlwaysShowImage(int alwaysShow) 611 { 612 // void gtk_action_set_always_show_image (GtkAction *action, gboolean always_show); 613 gtk_action_set_always_show_image(gtkAction, alwaysShow); 614 } 615 616 /** 617 * Warning 618 * gtk_action_get_accel_path has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction and the accelerator path on an associated 619 * GtkMenu instead 620 * Returns the accel path for this action. 621 * Since 2.6 622 * Returns: the accel path for this action, or NULL if none is set. The returned string is owned by GTK+ and must not be freed or modified. 623 */ 624 public string getAccelPath() 625 { 626 // const gchar * gtk_action_get_accel_path (GtkAction *action); 627 return Str.toString(gtk_action_get_accel_path(gtkAction)); 628 } 629 630 /** 631 * Warning 632 * gtk_action_set_accel_path has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction and the accelerator path on an associated 633 * GtkMenu instead 634 * Sets the accel path for this action. All proxy widgets associated 635 * with the action will have this accel path, so that their 636 * accelerators are consistent. 637 * Note that accel_path string will be stored in a GQuark. Therefore, if you 638 * pass a static string, you can save some memory by interning it first with 639 * g_intern_static_string(). 640 * Since 2.4 641 * Params: 642 * accelPath = the accelerator path 643 */ 644 public void setAccelPath(string accelPath) 645 { 646 // void gtk_action_set_accel_path (GtkAction *action, const gchar *accel_path); 647 gtk_action_set_accel_path(gtkAction, Str.toStringz(accelPath)); 648 } 649 650 /** 651 * Warning 652 * gtk_action_get_accel_closure has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction and GtkMenu instead, which have no 653 * equivalent for getting the accel closure 654 * Returns the accel closure for this action. 655 * Since 2.8 656 * Returns: the accel closure for this action. The returned closure is owned by GTK+ and must not be unreffed or modified. [transfer none] 657 */ 658 public Closure getAccelClosure() 659 { 660 // GClosure * gtk_action_get_accel_closure (GtkAction *action); 661 auto p = gtk_action_get_accel_closure(gtkAction); 662 663 if(p is null) 664 { 665 return null; 666 } 667 668 return ObjectG.getDObject!(Closure)(cast(GClosure*) p); 669 } 670 671 /** 672 * Warning 673 * gtk_action_set_accel_group has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction and the accelerator group on an associated 674 * GtkMenu instead 675 * Sets the GtkAccelGroup in which the accelerator for this action 676 * will be installed. 677 * Since 2.4 678 * Params: 679 * accelGroup = a GtkAccelGroup or NULL. [allow-none] 680 */ 681 public void setAccelGroup(AccelGroup accelGroup) 682 { 683 // void gtk_action_set_accel_group (GtkAction *action, GtkAccelGroup *accel_group); 684 gtk_action_set_accel_group(gtkAction, (accelGroup is null) ? null : accelGroup.getAccelGroupStruct()); 685 } 686 687 /** 688 * Warning 689 * gtk_action_set_label has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction instead, and set a label on a menu item with 690 * g_menu_item_set_label(). For GtkActionable widgets, use the widget-specific 691 * API to set a label 692 * Sets the label of action. 693 * Since 2.16 694 * Params: 695 * label = the label text to set 696 */ 697 public void setLabel(string label) 698 { 699 // void gtk_action_set_label (GtkAction *action, const gchar *label); 700 gtk_action_set_label(gtkAction, Str.toStringz(label)); 701 } 702 703 /** 704 * Warning 705 * gtk_action_get_label has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction instead, and get a label from a menu item 706 * with g_menu_item_get_attribute_value(). For GtkActionable widgets, use the 707 * widget-specific API to get a label 708 * Gets the label text of action. 709 * Since 2.16 710 * Returns: the label text 711 */ 712 public string getLabel() 713 { 714 // const gchar * gtk_action_get_label (GtkAction *action); 715 return Str.toString(gtk_action_get_label(gtkAction)); 716 } 717 718 /** 719 * Warning 720 * gtk_action_set_short_label has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction instead, which has no equivalent of short 721 * labels 722 * Sets a shorter label text on action. 723 * Since 2.16 724 * Params: 725 * shortLabel = the label text to set 726 */ 727 public void setShortLabel(string shortLabel) 728 { 729 // void gtk_action_set_short_label (GtkAction *action, const gchar *short_label); 730 gtk_action_set_short_label(gtkAction, Str.toStringz(shortLabel)); 731 } 732 733 /** 734 * Warning 735 * gtk_action_get_short_label has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction instead, which has no equivalent of short 736 * labels 737 * Gets the short label text of action. 738 * Since 2.16 739 * Returns: the short label text. 740 */ 741 public string getShortLabel() 742 { 743 // const gchar * gtk_action_get_short_label (GtkAction *action); 744 return Str.toString(gtk_action_get_short_label(gtkAction)); 745 } 746 747 /** 748 * Warning 749 * gtk_action_set_tooltip has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction instead, and set tooltips on associated 750 * GActionable widgets with gtk_widget_set_tooltip_text() 751 * Sets the tooltip text on action 752 * Since 2.16 753 * Params: 754 * tooltip = the tooltip text 755 */ 756 public void setTooltip(string tooltip) 757 { 758 // void gtk_action_set_tooltip (GtkAction *action, const gchar *tooltip); 759 gtk_action_set_tooltip(gtkAction, Str.toStringz(tooltip)); 760 } 761 762 /** 763 * Warning 764 * gtk_action_get_tooltip has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction instead, and get tooltips from associated 765 * GActionable widgets with gtk_widget_get_tooltip_text() 766 * Gets the tooltip text of action. 767 * Since 2.16 768 * Returns: the tooltip text 769 */ 770 public string getTooltip() 771 { 772 // const gchar * gtk_action_get_tooltip (GtkAction *action); 773 return Str.toString(gtk_action_get_tooltip(gtkAction)); 774 } 775 776 /** 777 * Warning 778 * gtk_action_set_stock_id has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction instead, which has no equivalent of stock 779 * items 780 * Sets the stock id on action 781 * Since 2.16 782 * Params: 783 * stockId = the stock id 784 */ 785 public void setStockId(string stockId) 786 { 787 // void gtk_action_set_stock_id (GtkAction *action, const gchar *stock_id); 788 gtk_action_set_stock_id(gtkAction, Str.toStringz(stockId)); 789 } 790 791 /** 792 * Warning 793 * gtk_action_set_gicon has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction instead, and g_menu_item_set_icon() to set an 794 * icon on a GMenuItem associated with a GAction, or gtk_container_add() to 795 * add a GtkImage to a GtkButton 796 * Sets the icon of action. 797 * Since 2.16 798 * Params: 799 * icon = the GIcon to set 800 */ 801 public void setGicon(IconIF icon) 802 { 803 // void gtk_action_set_gicon (GtkAction *action, GIcon *icon); 804 gtk_action_set_gicon(gtkAction, (icon is null) ? null : icon.getIconTStruct()); 805 } 806 807 /** 808 * Warning 809 * gtk_action_get_gicon has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction instead, and 810 * g_menu_item_get_attribute_value() to get an icon from a GMenuItem 811 * associated with a GAction 812 * Gets the gicon of action. 813 * Since 2.16 814 * Returns: The action's GIcon if one is set. [transfer none] 815 */ 816 public IconIF getGicon() 817 { 818 // GIcon * gtk_action_get_gicon (GtkAction *action); 819 auto p = gtk_action_get_gicon(gtkAction); 820 821 if(p is null) 822 { 823 return null; 824 } 825 826 return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p); 827 } 828 829 /** 830 * Warning 831 * gtk_action_set_icon_name has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction instead, and g_menu_item_set_icon() to set an 832 * icon on a GMenuItem associated with a GAction, or gtk_container_add() to 833 * add a GtkImage to a GtkButton 834 * Sets the icon name on action 835 * Since 2.16 836 * Params: 837 * iconName = the icon name to set 838 */ 839 public void setIconName(string iconName) 840 { 841 // void gtk_action_set_icon_name (GtkAction *action, const gchar *icon_name); 842 gtk_action_set_icon_name(gtkAction, Str.toStringz(iconName)); 843 } 844 845 /** 846 * Warning 847 * gtk_action_get_icon_name has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction instead, and 848 * g_menu_item_get_attribute_value() to get an icon from a GMenuItem 849 * associated with a GAction 850 * Gets the icon name of action. 851 * Since 2.16 852 * Returns: the icon name 853 */ 854 public string getIconName() 855 { 856 // const gchar * gtk_action_get_icon_name (GtkAction *action); 857 return Str.toString(gtk_action_get_icon_name(gtkAction)); 858 } 859 860 /** 861 * Warning 862 * gtk_action_set_visible_horizontal has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction instead, and control and monitor the 863 * visibility of associated widgets and menu items directly 864 * Sets whether action is visible when horizontal 865 * Since 2.16 866 * Params: 867 * visibleHorizontal = whether the action is visible horizontally 868 */ 869 public void setVisibleHorizontal(int visibleHorizontal) 870 { 871 // void gtk_action_set_visible_horizontal (GtkAction *action, gboolean visible_horizontal); 872 gtk_action_set_visible_horizontal(gtkAction, visibleHorizontal); 873 } 874 875 /** 876 * Warning 877 * gtk_action_get_visible_horizontal has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction instead, and control and monitor the 878 * visibility of associated widgets and menu items directly 879 * Checks whether action is visible when horizontal 880 * Since 2.16 881 * Returns: whether action is visible when horizontal 882 */ 883 public int getVisibleHorizontal() 884 { 885 // gboolean gtk_action_get_visible_horizontal (GtkAction *action); 886 return gtk_action_get_visible_horizontal(gtkAction); 887 } 888 889 /** 890 * Warning 891 * gtk_action_set_visible_vertical has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction instead, and control and monitor the 892 * visibility of associated widgets and menu items directly 893 * Sets whether action is visible when vertical 894 * Since 2.16 895 * Params: 896 * visibleVertical = whether the action is visible vertically 897 */ 898 public void setVisibleVertical(int visibleVertical) 899 { 900 // void gtk_action_set_visible_vertical (GtkAction *action, gboolean visible_vertical); 901 gtk_action_set_visible_vertical(gtkAction, visibleVertical); 902 } 903 904 /** 905 * Warning 906 * gtk_action_get_visible_vertical has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction instead, and control and monitor the 907 * visibility of associated widgets and menu items directly 908 * Checks whether action is visible when horizontal 909 * Since 2.16 910 * Returns: whether action is visible when horizontal 911 */ 912 public int getVisibleVertical() 913 { 914 // gboolean gtk_action_get_visible_vertical (GtkAction *action); 915 return gtk_action_get_visible_vertical(gtkAction); 916 } 917 918 /** 919 * Warning 920 * gtk_action_set_is_important has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction instead, and control and monitor whether 921 * labels are shown directly 922 * Sets whether the action is important, this attribute is used 923 * primarily by toolbar items to decide whether to show a label 924 * or not. 925 * Since 2.16 926 * Params: 927 * isImportant = TRUE to make the action important 928 */ 929 public void setIsImportant(int isImportant) 930 { 931 // void gtk_action_set_is_important (GtkAction *action, gboolean is_important); 932 gtk_action_set_is_important(gtkAction, isImportant); 933 } 934 935 /** 936 * Warning 937 * gtk_action_get_is_important has been deprecated since version 3.10 and should not be used in newly-written code. Use GAction instead, and control and monitor whether 938 * labels are shown directly 939 * Checks whether action is important or not 940 * Since 2.16 941 * Returns: whether action is important 942 */ 943 public int getIsImportant() 944 { 945 // gboolean gtk_action_get_is_important (GtkAction *action); 946 return gtk_action_get_is_important(gtkAction); 947 } 948 }