2 * This file is part of duit.
4 * duit 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 2.1 of the License, or
7 * (at your option) any later version.
9 * duit 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.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = gtk-Accelerator-Maps.html
48 * - GtkAccelMap* -> AccelMap
54 private import gtk
.gtktypes
;
56 private import lib
.gtk
;
58 private import glib
.Str
;
59 private import gtk
.AccelMap
;
64 private import gobject
.ObjectG
;
65 public class AccelMap
: ObjectG
68 /** the main Gtk struct */
69 protected GtkAccelMap
* gtkAccelMap
;
72 public GtkAccelMap
* getAccelMapStruct()
78 /** the main Gtk struct as a void* */
79 protected void* getStruct()
81 return cast(void*)gtkAccelMap
;
85 * Sets our main struct and passes it to the parent class
87 public this (GtkAccelMap
* gtkAccelMap
)
89 super(cast(GObject
*)gtkAccelMap
);
90 this.gtkAccelMap
= gtkAccelMap
;
96 // imports for the signal processing
97 private import gobject
.Signals
;
98 private import gdk
.gdktypes
;
99 int[char[]] connectedSignals
;
101 void delegate(char[], guint
, GdkModifierType
, AccelMap
)[] onChangedListeners
;
102 void addOnChanged(void delegate(char[], guint
, GdkModifierType
, AccelMap
) dlg
)
104 if ( !("changed" in connectedSignals
) )
109 cast(GCallback
)&callBackChanged
,
112 cast(ConnectFlags
)0);
113 connectedSignals
["changed"] = 1;
115 onChangedListeners
~= dlg
;
117 extern(C
) static void callBackChanged(GtkAccelMap
* objectStruct
, gchar
* accelPath
, guint accelKey
, GdkModifierType accelMods
, AccelMap accelMap
)
119 bit consumed
= false;
121 foreach ( void delegate(char[], guint
, GdkModifierType
, AccelMap
) dlg
; accelMap
.onChangedListeners
)
123 dlg(Str
.toString(accelPath
), accelKey
, accelMods
, accelMap
);
133 * Registers a new accelerator with the global accelerator map.
134 * This function should only be called once per accel_path
135 * with the canonical accel_key and accel_mods for this path.
136 * To change the accelerator during runtime programatically, use
137 * gtk_accel_map_change_entry().
138 * The accelerator path must consist of "<WINDOWTYPE>/Category1/Category2/.../Action",
139 * where <WINDOWTYPE> should be a unique application-specific identifier, that
140 * corresponds to the kind of window the accelerator is being used in, e.g. "Gimp-Image",
141 * "Abiword-Document" or "Gnumeric-Settings".
142 * The Category1/.../Action portion is most appropriately chosen by the action the
143 * accelerator triggers, i.e. for accelerators on menu items, choose the item's menu path,
144 * e.g. "File/Save As", "Image/View/Zoom" or "Edit/Select All".
145 * So a full valid accelerator path may look like:
146 * "<Gimp-Toolbox>/File/Dialogs/Tool Options...".
148 * valid accelerator path
150 * the accelerator key
152 * the accelerator modifiers
154 public static void addEntry(char[] accelPath
, uint accelKey
, GdkModifierType accelMods
)
156 // void gtk_accel_map_add_entry (const gchar *accel_path, guint accel_key, GdkModifierType accel_mods);
157 gtk_accel_map_add_entry(Str
.toStringz(accelPath
), accelKey
, accelMods
);
161 * Looks up the accelerator entry for accel_path and fills in key.
163 * a valid accelerator path
165 * the accelerator key to be filled in (optional)
167 * TRUE if accel_path is known, FALSE otherwise
169 public static int lookupEntry(char[] accelPath
, GtkAccelKey
* key
)
171 // gboolean gtk_accel_map_lookup_entry (const gchar *accel_path, GtkAccelKey *key);
172 return gtk_accel_map_lookup_entry(Str
.toStringz(accelPath
), key
);
176 * Changes the accel_key and accel_mods currently associated with accel_path.
177 * Due to conflicts with other accelerators, a change may not always be possible,
178 * replace indicates whether other accelerators may be deleted to resolve such
179 * conflicts. A change will only occur if all conflicts could be resolved (which
180 * might not be the case if conflicting accelerators are locked). Successful
181 * changes are indicated by a TRUE return value.
183 * a valid accelerator path
185 * the new accelerator key
187 * the new accelerator modifiers
189 * TRUE if other accelerators may be deleted upon conflicts
191 * TRUE if the accelerator could be changed, FALSE otherwise
193 public static int changeEntry(char[] accelPath
, uint accelKey
, GdkModifierType accelMods
, int replace
)
195 // gboolean gtk_accel_map_change_entry (const gchar *accel_path, guint accel_key, GdkModifierType accel_mods, gboolean replace);
196 return gtk_accel_map_change_entry(Str
.toStringz(accelPath
), accelKey
, accelMods
, replace
);
200 * Parses a file previously saved with gtk_accel_map_save() for
201 * accelerator specifications, and propagates them accordingly.
203 * a file containing accelerator specifications,
204 * in the GLib file name encoding
206 public static void load(char[] fileName
)
208 // void gtk_accel_map_load (const gchar *file_name);
209 gtk_accel_map_load(Str
.toStringz(fileName
));
213 * Saves current accelerator specifications (accelerator path, key
214 * and modifiers) to file_name.
215 * The file is written in a format suitable to be read back in by
216 * gtk_accel_map_load().
218 * the name of the file to contain accelerator specifications,
219 * in the GLib file name encoding
221 public static void save(char[] fileName
)
223 // void gtk_accel_map_save (const gchar *file_name);
224 gtk_accel_map_save(Str
.toStringz(fileName
));
228 * Loops over the entries in the accelerator map whose accel path
229 * doesn't match any of the filters added with gtk_accel_map_add_filter(),
230 * and execute foreach_func on each. The signature of foreach_func is
231 * that of GtkAccelMapForeach, the changed parameter indicates whether
232 * this accelerator was changed during runtime (thus, would need
233 * saving during an accelerator map dump).
235 * data to be passed into foreach_func
237 * function to be executed for each accel map entry which
238 * is not filtered out
240 public static void foreac(void* data
, GtkAccelMapForeach foreachFunc
)
242 // void gtk_accel_map_foreach (gpointer data, GtkAccelMapForeach foreach_func);
243 gtk_accel_map_foreach(data
, foreachFunc
);
247 * Filedescriptor variant of gtk_accel_map_load().
248 * Note that the file descriptor will not be closed by this function.
250 * a valid readable file descriptor
252 public static void loadFd(int fd
)
254 // void gtk_accel_map_load_fd (gint fd);
255 gtk_accel_map_load_fd(fd
);
259 * Filedescriptor variant of gtk_accel_map_save().
260 * Note that the file descriptor will not be closed by this function.
262 * a valid writable file descriptor
264 public static void saveFd(int fd
)
266 // void gtk_accel_map_save_fd (gint fd);
267 gtk_accel_map_save_fd(fd
);
271 * GScanner variant of gtk_accel_map_load().
273 * a GScanner which has already been provided with an input file
275 public static void loadScanner(GScanner
* scanner
)
277 // void gtk_accel_map_load_scanner (GScanner *scanner);
278 gtk_accel_map_load_scanner(scanner
);
282 * Adds a filter to the global list of accel path filters.
283 * Accel map entries whose accel path matches one of the filters
284 * are skipped by gtk_accel_map_foreach().
285 * This function is intended for GTK+ modules that create their own
286 * menus, but don't want them to be saved into the applications accelerator
289 * a pattern (see GPatternSpec)
291 public static void addFilter(char[] filterPattern
)
293 // void gtk_accel_map_add_filter (const gchar *filter_pattern);
294 gtk_accel_map_add_filter(Str
.toStringz(filterPattern
));
298 * Loops over all entries in the accelerator map, and execute
299 * foreach_func on each. The signature of foreach_func is that of
300 * GtkAccelMapForeach, the changed parameter indicates whether
301 * this accelerator was changed during runtime (thus, would need
302 * saving during an accelerator map dump).
304 * data to be passed into foreach_func
306 * function to be executed for each accel map entry
308 public static void foreachUnfiltered(void* data
, GtkAccelMapForeach foreachFunc
)
310 // void gtk_accel_map_foreach_unfiltered (gpointer data, GtkAccelMapForeach foreach_func);
311 gtk_accel_map_foreach_unfiltered(data
, foreachFunc
);
315 * Gets the singleton global GtkAccelMap object. This object
316 * is useful only for notification of changes to the accelerator
317 * map via the ::changed signal; it isn't a parameter to the
318 * other accelerator map functions.
320 * the global GtkAccelMap object
323 public static AccelMap
get()
325 // GtkAccelMap* gtk_accel_map_get (void);
326 return new AccelMap( gtk_accel_map_get() );
330 * Locks the given accelerator path. If the accelerator map doesn't yet contain
331 * an entry for accel_path, a new one is created.
332 * Locking an accelerator path prevents its accelerator from being changed
333 * during runtime. A locked accelerator path can be unlocked by
334 * gtk_accel_map_unlock_path(). Refer to gtk_accel_map_change_entry()
335 * for information about runtime accelerator changes.
336 * If called more than once, accel_path remains locked until
337 * gtk_accel_map_unlock_path() has been called an equivalent number
339 * Note that locking of individual accelerator paths is independent from
340 * locking the GtkAccelGroup containing them. For runtime accelerator
341 * changes to be possible both the accelerator path and its GtkAccelGroup
342 * have to be unlocked.
344 * a valid accelerator path
347 public static void lockPath(char[] accelPath
)
349 // void gtk_accel_map_lock_path (const gchar *accel_path);
350 gtk_accel_map_lock_path(Str
.toStringz(accelPath
));
354 * Undoes the last call to gtk_accel_map_lock_path() on this accel_path.
355 * Refer to gtk_accel_map_lock_path() for information about accelerator path locking.
357 * a valid accelerator path
360 * The "changed" signal
361 * void user_function (GtkAccelMap *object,
364 * GdkModifierType accel_mods,
365 * gpointer user_data) : Run last / Has details
366 * Notifies of a change in the global accelerator map.
367 * The path is also used as the detail for the signal,
368 * so it is possible to connect to
369 * changed::accel_path.
371 * the global accel map object
373 * the path of the accelerator that changed
375 * the key value for the new accelerator
377 * the modifier mask for the new accelerator
379 * user data set when the signal handler was connected.
382 public static void unlockPath(char[] accelPath
)
384 // void gtk_accel_map_unlock_path (const gchar *accel_path);
385 gtk_accel_map_unlock_path(Str
.toStringz(accelPath
));