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.ActionableT; 26 27 public import glib.Str; 28 public import glib.Variant; 29 public import glib.c.functions; 30 public import gtk.c.functions; 31 public import gtk.c.types; 32 33 34 /** 35 * The `GtkActionable` interface provides a convenient way of asscociating 36 * widgets with actions. 37 * 38 * It primarily consists of two properties: [property@Gtk.Actionable:action-name] 39 * and [property@Gtk.Actionable:action-target]. There are also some convenience 40 * APIs for setting these properties. 41 * 42 * The action will be looked up in action groups that are found among 43 * the widgets ancestors. Most commonly, these will be the actions with 44 * the “win.” or “app.” prefix that are associated with the 45 * `GtkApplicationWindow` or `GtkApplication`, but other action groups that 46 * are added with [method@Gtk.Widget.insert_action_group] will be consulted 47 * as well. 48 */ 49 public template ActionableT(TStruct) 50 { 51 /** Get the main Gtk struct */ 52 public GtkActionable* getActionableStruct(bool transferOwnership = false) 53 { 54 if (transferOwnership) 55 ownedRef = false; 56 return cast(GtkActionable*)getStruct(); 57 } 58 59 60 /** 61 * Gets the action name for @actionable. 62 * 63 * Returns: the action name, or %NULL if none is set 64 */ 65 public string getActionName() 66 { 67 return Str.toString(gtk_actionable_get_action_name(getActionableStruct())); 68 } 69 70 /** 71 * Gets the current target value of @actionable. 72 * 73 * Returns: the current target value 74 */ 75 public Variant getActionTargetValue() 76 { 77 auto __p = gtk_actionable_get_action_target_value(getActionableStruct()); 78 79 if(__p is null) 80 { 81 return null; 82 } 83 84 return new Variant(cast(GVariant*) __p); 85 } 86 87 /** 88 * Specifies the name of the action with which this widget should be 89 * associated. 90 * 91 * If @action_name is %NULL then the widget will be unassociated from 92 * any previous action. 93 * 94 * Usually this function is used when the widget is located (or will be 95 * located) within the hierarchy of a `GtkApplicationWindow`. 96 * 97 * Names are of the form “win.save” or “app.quit” for actions on the 98 * containing `GtkApplicationWindow` or its associated `GtkApplication`, 99 * respectively. This is the same form used for actions in the `GMenu` 100 * associated with the window. 101 * 102 * Params: 103 * actionName = an action name, or %NULL 104 */ 105 public void setActionName(string actionName) 106 { 107 gtk_actionable_set_action_name(getActionableStruct(), Str.toStringz(actionName)); 108 } 109 110 /** 111 * Sets the target value of an actionable widget. 112 * 113 * If @target_value is %NULL then the target value is unset. 114 * 115 * The target value has two purposes. First, it is used as the parameter 116 * to activation of the action associated with the `GtkActionable` widget. 117 * Second, it is used to determine if the widget should be rendered as 118 * “active” — the widget is active if the state is equal to the given target. 119 * 120 * Consider the example of associating a set of buttons with a `GAction` 121 * with string state in a typical “radio button” situation. Each button 122 * will be associated with the same action, but with a different target 123 * value for that action. Clicking on a particular button will activate 124 * the action with the target of that button, which will typically cause 125 * the action’s state to change to that value. Since the action’s state 126 * is now equal to the target value of the button, the button will now 127 * be rendered as active (and the other buttons, with different targets, 128 * rendered inactive). 129 * 130 * Params: 131 * targetValue = a #GVariant to set as the target value, or %NULL 132 */ 133 public void setActionTargetValue(Variant targetValue) 134 { 135 gtk_actionable_set_action_target_value(getActionableStruct(), (targetValue is null) ? null : targetValue.getVariantStruct()); 136 } 137 138 /** 139 * Sets the action-name and associated string target value of an 140 * actionable widget. 141 * 142 * @detailed_action_name is a string in the format accepted by 143 * g_action_parse_detailed_name(). 144 * 145 * Params: 146 * detailedActionName = the detailed action name 147 */ 148 public void setDetailedActionName(string detailedActionName) 149 { 150 gtk_actionable_set_detailed_action_name(getActionableStruct(), Str.toStringz(detailedActionName)); 151 } 152 }