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