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  = GtkActivatable.html
27  * outPack = gtk
28  * outFile = ActivatableT
29  * strct   = GtkActivatable
30  * realStrct=
31  * ctorStrct=
32  * clss    = ActivatableT
33  * interf  = ActivatableIF
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * 	- TStruct
38  * extend  = 
39  * implements:
40  * prefixes:
41  * 	- gtk_activatable_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- gtk.Action
48  * structWrap:
49  * 	- GtkAction* -> Action
50  * module aliases:
51  * local aliases:
52  * overrides:
53  */
54 
55 module gtk.ActivatableT;
56 
57 public  import gtkc.gtktypes;
58 
59 public import gtkc.gtk;
60 public import glib.ConstructionException;
61 public import gobject.ObjectG;
62 
63 
64 public import gtk.Action;
65 
66 
67 
68 
69 /**
70  * Activatable widgets can be connected to a GtkAction and reflects
71  * the state of its action. A GtkActivatable can also provide feedback
72  * through its action, as they are responsible for activating their
73  * related actions.
74  *
75  * Implementing GtkActivatable
76  *
77  * When extending a class that is already GtkActivatable; it is only
78  * necessary to implement the GtkActivatable->sync_action_properties()
79  * and GtkActivatable->update() methods and chain up to the parent
80  * implementation, however when introducing
81  * a new GtkActivatable class; the "related-action" and
82  * "use-action-appearance" properties need to be handled by
83  * the implementor. Handling these properties is mostly a matter of installing
84  * the action pointer and boolean flag on your instance, and calling
85  * gtk_activatable_do_set_related_action() and
86  * gtk_activatable_sync_action_properties() at the appropriate times.
87  *
88  * $(DDOC_COMMENT example)
89  */
90 public template ActivatableT(TStruct)
91 {
92 	
93 	/** the main Gtk struct */
94 	protected GtkActivatable* gtkActivatable;
95 	
96 	
97 	public GtkActivatable* getActivatableTStruct()
98 	{
99 		return cast(GtkActivatable*)getStruct();
100 	}
101 	
102 	
103 	/**
104 	 */
105 	
106 	/**
107 	 * Warning
108 	 * gtk_activatable_do_set_related_action is deprecated and should not be used in newly-written code. 3.10
109 	 * This is a utility function for GtkActivatable implementors.
110 	 * When implementing GtkActivatable you must call this when
111 	 * handling changes of the "related-action", and
112 	 * you must also use this to break references in GObject->dispose().
113 	 * This function adds a reference to the currently set related
114 	 * action for you, it also makes sure the GtkActivatable->update()
115 	 * method is called when the related GtkAction properties change
116 	 * and registers to the action's proxy list.
117 	 * Note
118 	 * Be careful to call this before setting the local
119 	 * copy of the GtkAction property, since this function uses
120 	 * gtk_activatable_get_related_action() to retrieve the
121 	 * previous action
122 	 * Since 2.16
123 	 * Params:
124 	 * action = the GtkAction to set
125 	 */
126 	public void doSetRelatedAction(Action action)
127 	{
128 		// void gtk_activatable_do_set_related_action  (GtkActivatable *activatable,  GtkAction *action);
129 		gtk_activatable_do_set_related_action(getActivatableTStruct(), (action is null) ? null : action.getActionStruct());
130 	}
131 	
132 	/**
133 	 * Warning
134 	 * gtk_activatable_get_related_action is deprecated and should not be used in newly-written code. 3.10
135 	 * Gets the related GtkAction for activatable.
136 	 * Since 2.16
137 	 * Returns: the related GtkAction if one is set. [transfer none]
138 	 */
139 	public Action getRelatedAction()
140 	{
141 		// GtkAction * gtk_activatable_get_related_action (GtkActivatable *activatable);
142 		auto p = gtk_activatable_get_related_action(getActivatableTStruct());
143 		
144 		if(p is null)
145 		{
146 			return null;
147 		}
148 		
149 		return ObjectG.getDObject!(Action)(cast(GtkAction*) p);
150 	}
151 	
152 	/**
153 	 * Warning
154 	 * gtk_activatable_get_use_action_appearance is deprecated and should not be used in newly-written code. 3.10
155 	 * Gets whether this activatable should reset its layout
156 	 * and appearance when setting the related action or when
157 	 * the action changes appearance.
158 	 * Since 2.16
159 	 * Returns: whether activatable uses its actions appearance.
160 	 */
161 	public int getUseActionAppearance()
162 	{
163 		// gboolean gtk_activatable_get_use_action_appearance  (GtkActivatable *activatable);
164 		return gtk_activatable_get_use_action_appearance(getActivatableTStruct());
165 	}
166 	
167 	/**
168 	 * Warning
169 	 * gtk_activatable_sync_action_properties is deprecated and should not be used in newly-written code. 3.10
170 	 * This is called to update the activatable completely, this is called
171 	 * internally when the "related-action" property is set
172 	 * or unset and by the implementing class when
173 	 * "use-action-appearance" changes.
174 	 * Since 2.16
175 	 * Params:
176 	 * action = the related GtkAction or NULL. [allow-none]
177 	 */
178 	public void syncActionProperties(Action action)
179 	{
180 		// void gtk_activatable_sync_action_properties  (GtkActivatable *activatable,  GtkAction *action);
181 		gtk_activatable_sync_action_properties(getActivatableTStruct(), (action is null) ? null : action.getActionStruct());
182 	}
183 	
184 	/**
185 	 * Warning
186 	 * gtk_activatable_set_related_action is deprecated and should not be used in newly-written code. 3.10
187 	 * Sets the related action on the activatable object.
188 	 * Note
189 	 * GtkActivatable implementors need to handle the "related-action"
190 	 * property and call gtk_activatable_do_set_related_action() when it changes.
191 	 * Since 2.16
192 	 * Params:
193 	 * action = the GtkAction to set
194 	 */
195 	public void setRelatedAction(Action action)
196 	{
197 		// void gtk_activatable_set_related_action (GtkActivatable *activatable,  GtkAction *action);
198 		gtk_activatable_set_related_action(getActivatableTStruct(), (action is null) ? null : action.getActionStruct());
199 	}
200 	
201 	/**
202 	 * Warning
203 	 * gtk_activatable_set_use_action_appearance is deprecated and should not be used in newly-written code. 3.10
204 	 * Sets whether this activatable should reset its layout and appearance
205 	 * when setting the related action or when the action changes appearance
206 	 * Note
207 	 * GtkActivatable implementors need to handle the
208 	 * "use-action-appearance" property and call
209 	 * gtk_activatable_sync_action_properties() to update activatable
210 	 * if needed.
211 	 * Since 2.16
212 	 * Params:
213 	 * useAppearance = whether to use the actions appearance
214 	 */
215 	public void setUseActionAppearance(int useAppearance)
216 	{
217 		// void gtk_activatable_set_use_action_appearance  (GtkActivatable *activatable,  gboolean use_appearance);
218 		gtk_activatable_set_use_action_appearance(getActivatableTStruct(), useAppearance);
219 	}
220 }