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