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