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