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