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