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 * Conversion parameters: 26 * inFile = GtkActionable.html 27 * outPack = gtk 28 * outFile = ActionableT 29 * strct = GtkActionable 30 * realStrct= 31 * ctorStrct= 32 * clss = ActionableT 33 * interf = ActionableIF 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * - TStruct 38 * extend = 39 * implements: 40 * prefixes: 41 * - gtk_actionable_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - glib.Str 48 * - glib.Variant 49 * structWrap: 50 * - GVariant* -> Variant 51 * module aliases: 52 * local aliases: 53 * overrides: 54 */ 55 56 module gtk.ActionableT; 57 58 public import gtkc.gtktypes; 59 60 public import gtkc.gtk; 61 public import glib.ConstructionException; 62 public import gobject.ObjectG; 63 64 65 public import glib.Str; 66 public import glib.Variant; 67 68 69 70 71 /** 72 * This interface provides a convenient way of associating widgets with 73 * actions on a GtkApplicationWindow or GtkApplication. 74 * 75 * It primarily consists of two properties: "action-name" 76 * and "action-target". There are also some convenience APIs 77 * for setting these properties. 78 * 79 * This interface is presently only meaningful if used on a widget that 80 * is (or will be) located inside of a GtkApplicationWindow and can 81 * only be used to associate the widget with actions on that window, or 82 * its associated GtkApplication. 83 */ 84 public template ActionableT(TStruct) 85 { 86 87 /** the main Gtk struct */ 88 protected GtkActionable* gtkActionable; 89 90 91 public GtkActionable* getActionableTStruct() 92 { 93 return cast(GtkActionable*)getStruct(); 94 } 95 96 97 /** 98 */ 99 100 /** 101 * Gets the action name for actionable. 102 * See gtk_actionable_set_action_name() for more information. 103 * Returns: the action name, or NULL if none is set Since 3.4 104 */ 105 public string getActionName() 106 { 107 // const gchar * gtk_actionable_get_action_name (GtkActionable *actionable); 108 return Str.toString(gtk_actionable_get_action_name(getActionableTStruct())); 109 } 110 111 /** 112 * Specifies the name of the action with which this widget should be 113 * associated. If action_name is NULL then the widget will be 114 * unassociated from any previous action. 115 * Usually this function is used when the widget is located (or will be 116 * located) within the hierarchy of a GtkApplicationWindow. 117 * Names are of the form "win.save" or "app.quit" for actions on the 118 * containing GtkApplicationWindow or its associated GtkApplication, 119 * respectively. This is the same form used for actions in the GMenu 120 * associated with the window. 121 * Params: 122 * actionName = an action name, or NULL 123 * Since 3.4 124 */ 125 public void setActionName(string actionName) 126 { 127 // void gtk_actionable_set_action_name (GtkActionable *actionable, const gchar *action_name); 128 gtk_actionable_set_action_name(getActionableTStruct(), Str.toStringz(actionName)); 129 } 130 131 /** 132 * Gets the current target value of actionabe. 133 * See gtk_actionable_set_action_target_value() for more information. 134 * Returns: the current target value. [transfer none] Since 3.4 135 */ 136 public Variant getActionTargetValue() 137 { 138 // GVariant * gtk_actionable_get_action_target_value (GtkActionable *actionable); 139 auto p = gtk_actionable_get_action_target_value(getActionableTStruct()); 140 141 if(p is null) 142 { 143 return null; 144 } 145 146 return ObjectG.getDObject!(Variant)(cast(GVariant*) p); 147 } 148 149 /** 150 * Sets the target value of an actionable widget. 151 * If target_value is NULL then the target value is unset. 152 * The target value has two purposes. First, it is used as the 153 * parameter to activation of the action associated with the 154 * GtkActionable widget. Second, it is used to determine if the widget 155 * should be rendered as "active" - the widget is active if the state 156 * is equal to the given target. 157 * Consider the example of associating a set of buttons with a GAction 158 * with string state in a typical "radio button" situation. Each button 159 * will be associated with the same action, but with a different target 160 * value for that action. Clicking on a particular button will activate 161 * the action with the target of that button, which will typically cause 162 * the action's state to change to that value. Since the action's state 163 * is now equal to the target value of the button, the button will now 164 * be rendered as active (and the other buttons, with different targets, 165 * rendered inactive). 166 * Params: 167 * targetValue = a GVariant to set as the target value, or NULL 168 * Since 3.4 169 */ 170 public void setActionTargetValue(Variant targetValue) 171 { 172 // void gtk_actionable_set_action_target_value (GtkActionable *actionable, GVariant *target_value); 173 gtk_actionable_set_action_target_value(getActionableTStruct(), (targetValue is null) ? null : targetValue.getVariantStruct()); 174 } 175 176 /** 177 * Sets the action-name and associated string target value of an 178 * actionable widget. 179 * This allows for the effect of both gtk_actionable_set_action_name() 180 * and gtk_actionable_set_action_target_value() in the common case that 181 * the target is string-valued. 182 * detailed_action_name is a string of the form 183 * "action::target" where action 184 * is the action name and target is the string to use 185 * as the target. 186 * Params: 187 * detailedActionName = the detailed action name 188 * Since 3.4 189 */ 190 public void setDetailedActionName(string detailedActionName) 191 { 192 // void gtk_actionable_set_detailed_action_name (GtkActionable *actionable, const gchar *detailed_action_name); 193 gtk_actionable_set_detailed_action_name(getActionableTStruct(), Str.toStringz(detailedActionName)); 194 } 195 }