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