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