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