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