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 glib.HookList;
26 
27 private import glib.Hook;
28 private import glib.MemorySlice;
29 private import glib.c.functions;
30 public  import glib.c.types;
31 public  import gtkc.glibtypes;
32 private import gtkd.Loader;
33 
34 
35 /**
36  * The #GHookList struct represents a list of hook functions.
37  */
38 public final class HookList
39 {
40 	/** the main Gtk struct */
41 	protected GHookList* gHookList;
42 	protected bool ownedRef;
43 
44 	/** Get the main Gtk struct */
45 	public GHookList* getHookListStruct(bool transferOwnership = false)
46 	{
47 		if (transferOwnership)
48 			ownedRef = false;
49 		return gHookList;
50 	}
51 
52 	/** the main Gtk struct as a void* */
53 	protected void* getStruct()
54 	{
55 		return cast(void*)gHookList;
56 	}
57 
58 	/**
59 	 * Sets our main struct and passes it to the parent class.
60 	 */
61 	public this (GHookList* gHookList, bool ownedRef = false)
62 	{
63 		this.gHookList = gHookList;
64 		this.ownedRef = ownedRef;
65 	}
66 
67 	~this ()
68 	{
69 		if ( Linker.isLoaded(LIBRARY_GLIB) && ownedRef )
70 			sliceFree(gHookList);
71 	}
72 
73 
74 	/**
75 	 * the next free #GHook id
76 	 */
77 	public @property gulong seqId()
78 	{
79 		return gHookList.seqId;
80 	}
81 
82 	/** Ditto */
83 	public @property void seqId(gulong value)
84 	{
85 		gHookList.seqId = value;
86 	}
87 
88 	/**
89 	 * the size of the #GHookList elements, in bytes
90 	 */
91 	public @property uint hookSize()
92 	{
93 		return gHookList.hookSize;
94 	}
95 
96 	/** Ditto */
97 	public @property void hookSize(uint value)
98 	{
99 		gHookList.hookSize = value;
100 	}
101 
102 	/**
103 	 * 1 if the #GHookList has been initialized
104 	 */
105 	public @property uint isSetup()
106 	{
107 		return gHookList.isSetup;
108 	}
109 
110 	/** Ditto */
111 	public @property void isSetup(uint value)
112 	{
113 		gHookList.isSetup = value;
114 	}
115 
116 	/**
117 	 * the first #GHook element in the list
118 	 */
119 	public @property Hook hooks()
120 	{
121 		return new Hook(gHookList.hooks, false);
122 	}
123 
124 	/** Ditto */
125 	public @property void hooks(Hook value)
126 	{
127 		gHookList.hooks = value.getHookStruct();
128 	}
129 
130 	/**
131 	 * the function to call to finalize a #GHook element.
132 	 * The default behaviour is to call the hooks @destroy function
133 	 */
134 	public @property GHookFinalizeFunc finalizeHook()
135 	{
136 		return gHookList.finalizeHook;
137 	}
138 
139 	/** Ditto */
140 	public @property void finalizeHook(GHookFinalizeFunc value)
141 	{
142 		gHookList.finalizeHook = value;
143 	}
144 
145 	/**
146 	 * Removes all the #GHook elements from a #GHookList.
147 	 */
148 	public void clear()
149 	{
150 		g_hook_list_clear(gHookList);
151 	}
152 
153 	/**
154 	 * Initializes a #GHookList.
155 	 * This must be called before the #GHookList is used.
156 	 *
157 	 * Params:
158 	 *     hookSize = the size of each element in the #GHookList,
159 	 *         typically `sizeof (GHook)`.
160 	 */
161 	public void init(uint hookSize)
162 	{
163 		g_hook_list_init(gHookList, hookSize);
164 	}
165 
166 	/**
167 	 * Calls all of the #GHook functions in a #GHookList.
168 	 *
169 	 * Params:
170 	 *     mayRecurse = %TRUE if functions which are already running
171 	 *         (e.g. in another thread) can be called. If set to %FALSE,
172 	 *         these are skipped
173 	 */
174 	public void invoke(bool mayRecurse)
175 	{
176 		g_hook_list_invoke(gHookList, mayRecurse);
177 	}
178 
179 	/**
180 	 * Calls all of the #GHook functions in a #GHookList.
181 	 * Any function which returns %FALSE is removed from the #GHookList.
182 	 *
183 	 * Params:
184 	 *     mayRecurse = %TRUE if functions which are already running
185 	 *         (e.g. in another thread) can be called. If set to %FALSE,
186 	 *         these are skipped
187 	 */
188 	public void invokeCheck(bool mayRecurse)
189 	{
190 		g_hook_list_invoke_check(gHookList, mayRecurse);
191 	}
192 
193 	/**
194 	 * Calls a function on each valid #GHook.
195 	 *
196 	 * Params:
197 	 *     mayRecurse = %TRUE if hooks which are currently running
198 	 *         (e.g. in another thread) are considered valid. If set to %FALSE,
199 	 *         these are skipped
200 	 *     marshaller = the function to call for each #GHook
201 	 *     marshalData = data to pass to @marshaller
202 	 */
203 	public void marshal(bool mayRecurse, GHookMarshaller marshaller, void* marshalData)
204 	{
205 		g_hook_list_marshal(gHookList, mayRecurse, marshaller, marshalData);
206 	}
207 
208 	/**
209 	 * Calls a function on each valid #GHook and destroys it if the
210 	 * function returns %FALSE.
211 	 *
212 	 * Params:
213 	 *     mayRecurse = %TRUE if hooks which are currently running
214 	 *         (e.g. in another thread) are considered valid. If set to %FALSE,
215 	 *         these are skipped
216 	 *     marshaller = the function to call for each #GHook
217 	 *     marshalData = data to pass to @marshaller
218 	 */
219 	public void marshalCheck(bool mayRecurse, GHookCheckMarshaller marshaller, void* marshalData)
220 	{
221 		g_hook_list_marshal_check(gHookList, mayRecurse, marshaller, marshalData);
222 	}
223 }