source: appstream-generator/build/girepo/glib/Hook.d @ 4841

Last change on this file since 4841 was 4841, checked in by Juanma, 2 years ago

Initial release

File size: 10.3 KB
Line 
1/*
2 * Licensed under the GNU Lesser General Public License Version 3
3 *
4 * This library is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the license, or
7 * (at your option) any later version.
8 *
9 * This software is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18// generated automatically - do not change
19
20
21module glib.Hook;
22
23private import gi.glib;
24public  import gi.glibtypes;
25private import glib.HookList;
26
27
28/**
29 * The #GHook struct represents a single hook function in a #GHookList.
30 */
31public class Hook
32{
33        /** the main Gtk struct */
34        protected GHook* gHook;
35        protected bool ownedRef;
36
37        /** Get the main Gtk struct */
38        public GHook* getHookStruct()
39        {
40                return gHook;
41        }
42
43        /** the main Gtk struct as a void* */
44        protected void* getStruct()
45        {
46                return cast(void*)gHook;
47        }
48
49        /**
50         * Sets our main struct and passes it to the parent class.
51         */
52        public this (GHook* gHook, bool ownedRef = false)
53        {
54                this.gHook = gHook;
55                this.ownedRef = ownedRef;
56        }
57
58
59        /**
60         * Compares the ids of two #GHook elements, returning a negative value
61         * if the second id is greater than the first.
62         *
63         * Params:
64         *     sibling = a #GHook to compare with @new_hook
65         *
66         * Returns: a value <= 0 if the id of @sibling is >= the id of @new_hook
67         */
68        public int compareIds(Hook sibling)
69        {
70                return g_hook_compare_ids(gHook, (sibling is null) ? null : sibling.getHookStruct());
71        }
72
73        /**
74         * Allocates space for a #GHook and initializes it.
75         *
76         * Params:
77         *     hookList = a #GHookList
78         *
79         * Returns: a new #GHook
80         */
81        public static Hook alloc(HookList hookList)
82        {
83                auto p = g_hook_alloc((hookList is null) ? null : hookList.getHookListStruct());
84               
85                if(p is null)
86                {
87                        return null;
88                }
89               
90                return new Hook(cast(GHook*) p);
91        }
92
93        /**
94         * Destroys a #GHook, given its ID.
95         *
96         * Params:
97         *     hookList = a #GHookList
98         *     hookId = a hook ID
99         *
100         * Returns: %TRUE if the #GHook was found in the #GHookList and destroyed
101         */
102        public static bool destroy(HookList hookList, gulong hookId)
103        {
104                return g_hook_destroy((hookList is null) ? null : hookList.getHookListStruct(), hookId) != 0;
105        }
106
107        /**
108         * Removes one #GHook from a #GHookList, marking it
109         * inactive and calling g_hook_unref() on it.
110         *
111         * Params:
112         *     hookList = a #GHookList
113         *     hook = the #GHook to remove
114         */
115        public static void destroyLink(HookList hookList, Hook hook)
116        {
117                g_hook_destroy_link((hookList is null) ? null : hookList.getHookListStruct(), (hook is null) ? null : hook.getHookStruct());
118        }
119
120        /**
121         * Finds a #GHook in a #GHookList using the given function to
122         * test for a match.
123         *
124         * Params:
125         *     hookList = a #GHookList
126         *     needValids = %TRUE if #GHook elements which have been destroyed
127         *         should be skipped
128         *     func = the function to call for each #GHook, which should return
129         *         %TRUE when the #GHook has been found
130         *     data = the data to pass to @func
131         *
132         * Returns: the found #GHook or %NULL if no matching #GHook is found
133         */
134        public static Hook find(HookList hookList, bool needValids, GHookFindFunc func, void* data)
135        {
136                auto p = g_hook_find((hookList is null) ? null : hookList.getHookListStruct(), needValids, func, data);
137               
138                if(p is null)
139                {
140                        return null;
141                }
142               
143                return new Hook(cast(GHook*) p);
144        }
145
146        /**
147         * Finds a #GHook in a #GHookList with the given data.
148         *
149         * Params:
150         *     hookList = a #GHookList
151         *     needValids = %TRUE if #GHook elements which have been destroyed
152         *         should be skipped
153         *     data = the data to find
154         *
155         * Returns: the #GHook with the given @data or %NULL if no matching
156         *     #GHook is found
157         */
158        public static Hook findData(HookList hookList, bool needValids, void* data)
159        {
160                auto p = g_hook_find_data((hookList is null) ? null : hookList.getHookListStruct(), needValids, data);
161               
162                if(p is null)
163                {
164                        return null;
165                }
166               
167                return new Hook(cast(GHook*) p);
168        }
169
170        /**
171         * Finds a #GHook in a #GHookList with the given function.
172         *
173         * Params:
174         *     hookList = a #GHookList
175         *     needValids = %TRUE if #GHook elements which have been destroyed
176         *         should be skipped
177         *     func = the function to find
178         *
179         * Returns: the #GHook with the given @func or %NULL if no matching
180         *     #GHook is found
181         */
182        public static Hook findFunc(HookList hookList, bool needValids, void* func)
183        {
184                auto p = g_hook_find_func((hookList is null) ? null : hookList.getHookListStruct(), needValids, func);
185               
186                if(p is null)
187                {
188                        return null;
189                }
190               
191                return new Hook(cast(GHook*) p);
192        }
193
194        /**
195         * Finds a #GHook in a #GHookList with the given function and data.
196         *
197         * Params:
198         *     hookList = a #GHookList
199         *     needValids = %TRUE if #GHook elements which have been destroyed
200         *         should be skipped
201         *     func = the function to find
202         *     data = the data to find
203         *
204         * Returns: the #GHook with the given @func and @data or %NULL if
205         *     no matching #GHook is found
206         */
207        public static Hook findFuncData(HookList hookList, bool needValids, void* func, void* data)
208        {
209                auto p = g_hook_find_func_data((hookList is null) ? null : hookList.getHookListStruct(), needValids, func, data);
210               
211                if(p is null)
212                {
213                        return null;
214                }
215               
216                return new Hook(cast(GHook*) p);
217        }
218
219        /**
220         * Returns the first #GHook in a #GHookList which has not been destroyed.
221         * The reference count for the #GHook is incremented, so you must call
222         * g_hook_unref() to restore it when no longer needed. (Or call
223         * g_hook_next_valid() if you are stepping through the #GHookList.)
224         *
225         * Params:
226         *     hookList = a #GHookList
227         *     mayBeInCall = %TRUE if hooks which are currently running
228         *         (e.g. in another thread) are considered valid. If set to %FALSE,
229         *         these are skipped
230         *
231         * Returns: the first valid #GHook, or %NULL if none are valid
232         */
233        public static Hook firstValid(HookList hookList, bool mayBeInCall)
234        {
235                auto p = g_hook_first_valid((hookList is null) ? null : hookList.getHookListStruct(), mayBeInCall);
236               
237                if(p is null)
238                {
239                        return null;
240                }
241               
242                return new Hook(cast(GHook*) p);
243        }
244
245        /**
246         * Calls the #GHookList @finalize_hook function if it exists,
247         * and frees the memory allocated for the #GHook.
248         *
249         * Params:
250         *     hookList = a #GHookList
251         *     hook = the #GHook to free
252         */
253        public static void free(HookList hookList, Hook hook)
254        {
255                g_hook_free((hookList is null) ? null : hookList.getHookListStruct(), (hook is null) ? null : hook.getHookStruct());
256        }
257
258        /**
259         * Returns the #GHook with the given id, or %NULL if it is not found.
260         *
261         * Params:
262         *     hookList = a #GHookList
263         *     hookId = a hook id
264         *
265         * Returns: the #GHook with the given id, or %NULL if it is not found
266         */
267        public static Hook get(HookList hookList, gulong hookId)
268        {
269                auto p = g_hook_get((hookList is null) ? null : hookList.getHookListStruct(), hookId);
270               
271                if(p is null)
272                {
273                        return null;
274                }
275               
276                return new Hook(cast(GHook*) p);
277        }
278
279        /**
280         * Inserts a #GHook into a #GHookList, before a given #GHook.
281         *
282         * Params:
283         *     hookList = a #GHookList
284         *     sibling = the #GHook to insert the new #GHook before
285         *     hook = the #GHook to insert
286         */
287        public static void insertBefore(HookList hookList, Hook sibling, Hook hook)
288        {
289                g_hook_insert_before((hookList is null) ? null : hookList.getHookListStruct(), (sibling is null) ? null : sibling.getHookStruct(), (hook is null) ? null : hook.getHookStruct());
290        }
291
292        /**
293         * Inserts a #GHook into a #GHookList, sorted by the given function.
294         *
295         * Params:
296         *     hookList = a #GHookList
297         *     hook = the #GHook to insert
298         *     func = the comparison function used to sort the #GHook elements
299         */
300        public static void insertSorted(HookList hookList, Hook hook, GHookCompareFunc func)
301        {
302                g_hook_insert_sorted((hookList is null) ? null : hookList.getHookListStruct(), (hook is null) ? null : hook.getHookStruct(), func);
303        }
304
305        /**
306         * Returns the next #GHook in a #GHookList which has not been destroyed.
307         * The reference count for the #GHook is incremented, so you must call
308         * g_hook_unref() to restore it when no longer needed. (Or continue to call
309         * g_hook_next_valid() until %NULL is returned.)
310         *
311         * Params:
312         *     hookList = a #GHookList
313         *     hook = the current #GHook
314         *     mayBeInCall = %TRUE if hooks which are currently running
315         *         (e.g. in another thread) are considered valid. If set to %FALSE,
316         *         these are skipped
317         *
318         * Returns: the next valid #GHook, or %NULL if none are valid
319         */
320        public static Hook nextValid(HookList hookList, Hook hook, bool mayBeInCall)
321        {
322                auto p = g_hook_next_valid((hookList is null) ? null : hookList.getHookListStruct(), (hook is null) ? null : hook.getHookStruct(), mayBeInCall);
323               
324                if(p is null)
325                {
326                        return null;
327                }
328               
329                return new Hook(cast(GHook*) p);
330        }
331
332        /**
333         * Prepends a #GHook on the start of a #GHookList.
334         *
335         * Params:
336         *     hookList = a #GHookList
337         *     hook = the #GHook to add to the start of @hook_list
338         */
339        public static void prepend(HookList hookList, Hook hook)
340        {
341                g_hook_prepend((hookList is null) ? null : hookList.getHookListStruct(), (hook is null) ? null : hook.getHookStruct());
342        }
343
344        /**
345         * Increments the reference count for a #GHook.
346         *
347         * Params:
348         *     hookList = a #GHookList
349         *     hook = the #GHook to increment the reference count of
350         *
351         * Returns: the @hook that was passed in (since 2.6)
352         */
353        public static Hook doref(HookList hookList, Hook hook)
354        {
355                auto p = g_hook_ref((hookList is null) ? null : hookList.getHookListStruct(), (hook is null) ? null : hook.getHookStruct());
356               
357                if(p is null)
358                {
359                        return null;
360                }
361               
362                return new Hook(cast(GHook*) p);
363        }
364
365        /**
366         * Decrements the reference count of a #GHook.
367         * If the reference count falls to 0, the #GHook is removed
368         * from the #GHookList and g_hook_free() is called to free it.
369         *
370         * Params:
371         *     hookList = a #GHookList
372         *     hook = the #GHook to unref
373         */
374        public static void unref(HookList hookList, Hook hook)
375        {
376                g_hook_unref((hookList is null) ? null : hookList.getHookListStruct(), (hook is null) ? null : hook.getHookStruct());
377        }
378}
Note: See TracBrowser for help on using the repository browser.