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 gtkc.glib;
28 public  import gtkc.glibtypes;
29 
30 
31 /**
32  * The #GHookList struct represents a list of hook functions.
33  */
34 public class HookList
35 {
36 	/** the main Gtk struct */
37 	protected GHookList* gHookList;
38 	protected bool ownedRef;
39 
40 	/** Get the main Gtk struct */
41 	public GHookList* getHookListStruct(bool transferOwnership = false)
42 	{
43 		if (transferOwnership)
44 			ownedRef = false;
45 		return gHookList;
46 	}
47 
48 	/** the main Gtk struct as a void* */
49 	protected void* getStruct()
50 	{
51 		return cast(void*)gHookList;
52 	}
53 
54 	/**
55 	 * Sets our main struct and passes it to the parent class.
56 	 */
57 	public this (GHookList* gHookList, bool ownedRef = false)
58 	{
59 		this.gHookList = gHookList;
60 		this.ownedRef = ownedRef;
61 	}
62 
63 
64 	/**
65 	 * Removes all the #GHook elements from a #GHookList.
66 	 */
67 	public void clear()
68 	{
69 		g_hook_list_clear(gHookList);
70 	}
71 
72 	/**
73 	 * Initializes a #GHookList.
74 	 * This must be called before the #GHookList is used.
75 	 *
76 	 * Params:
77 	 *     hookSize = the size of each element in the #GHookList,
78 	 *         typically `sizeof (GHook)`.
79 	 */
80 	public void init(uint hookSize)
81 	{
82 		g_hook_list_init(gHookList, hookSize);
83 	}
84 
85 	/**
86 	 * Calls all of the #GHook functions in a #GHookList.
87 	 *
88 	 * Params:
89 	 *     mayRecurse = %TRUE if functions which are already running
90 	 *         (e.g. in another thread) can be called. If set to %FALSE,
91 	 *         these are skipped
92 	 */
93 	public void invoke(bool mayRecurse)
94 	{
95 		g_hook_list_invoke(gHookList, mayRecurse);
96 	}
97 
98 	/**
99 	 * Calls all of the #GHook functions in a #GHookList.
100 	 * Any function which returns %FALSE is removed from the #GHookList.
101 	 *
102 	 * Params:
103 	 *     mayRecurse = %TRUE if functions which are already running
104 	 *         (e.g. in another thread) can be called. If set to %FALSE,
105 	 *         these are skipped
106 	 */
107 	public void invokeCheck(bool mayRecurse)
108 	{
109 		g_hook_list_invoke_check(gHookList, mayRecurse);
110 	}
111 
112 	/**
113 	 * Calls a function on each valid #GHook.
114 	 *
115 	 * Params:
116 	 *     mayRecurse = %TRUE if hooks which are currently running
117 	 *         (e.g. in another thread) are considered valid. If set to %FALSE,
118 	 *         these are skipped
119 	 *     marshaller = the function to call for each #GHook
120 	 *     marshalData = data to pass to @marshaller
121 	 */
122 	public void marshal(bool mayRecurse, GHookMarshaller marshaller, void* marshalData)
123 	{
124 		g_hook_list_marshal(gHookList, mayRecurse, marshaller, marshalData);
125 	}
126 
127 	/**
128 	 * Calls a function on each valid #GHook and destroys it if the
129 	 * function returns %FALSE.
130 	 *
131 	 * Params:
132 	 *     mayRecurse = %TRUE if hooks which are currently running
133 	 *         (e.g. in another thread) are considered valid. If set to %FALSE,
134 	 *         these are skipped
135 	 *     marshaller = the function to call for each #GHook
136 	 *     marshalData = data to pass to @marshaller
137 	 */
138 	public void marshalCheck(bool mayRecurse, GHookCheckMarshaller marshaller, void* marshalData)
139 	{
140 		g_hook_list_marshal_check(gHookList, mayRecurse, marshaller, marshalData);
141 	}
142 }