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