2 * This file is part of gtkD.
4 * gtkD 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 * gtkD 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 gtkD; 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
59 import tango
.io
.Stdout
; // use the tango loging?
63 private import gtkc
.gtktypes
;
65 private import gtkc
.gtk
;
68 private import glib
.Str
;
69 private import gtk
.AccelMap
;
77 private import gobject
.ObjectG
;
78 public class AccelMap
: ObjectG
81 /** the main Gtk struct */
82 protected GtkAccelMap
* gtkAccelMap
;
85 public GtkAccelMap
* getAccelMapStruct()
91 /** the main Gtk struct as a void* */
92 protected void* getStruct()
94 return cast(void*)gtkAccelMap
;
98 * Sets our main struct and passes it to the parent class
100 public this (GtkAccelMap
* gtkAccelMap
)
104 if ( gtkAccelMap
is null )
109 Stdout("struct gtkAccelMap is null on constructor").newline
;
113 printf("struct gtkAccelMap is null on constructor");
120 assert(gtkAccelMap
!is null, "struct gtkAccelMap is null on constructor");
122 super(cast(GObject
*)gtkAccelMap
);
123 this.gtkAccelMap
= gtkAccelMap
;
129 // imports for the signal processing
130 private import gobject
.Signals
;
131 private import gtkc
.gdktypes
;
132 int[char[]] connectedSignals
;
134 void delegate(char[], guint
, GdkModifierType
, AccelMap
)[] onChangedListeners
;
135 void addOnChanged(void delegate(char[], guint
, GdkModifierType
, AccelMap
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
137 if ( !("changed" in connectedSignals
) )
142 cast(GCallback
)&callBackChanged
,
146 connectedSignals
["changed"] = 1;
148 onChangedListeners
~= dlg
;
150 extern(C
) static void callBackChanged(GtkAccelMap
* objectStruct
, gchar
* accelPath
, guint accelKey
, GdkModifierType accelMods
, AccelMap accelMap
)
152 bool consumed
= false;
154 foreach ( void delegate(char[], guint
, GdkModifierType
, AccelMap
) dlg
; accelMap
.onChangedListeners
)
156 dlg(Str
.toString(accelPath
), accelKey
, accelMods
, accelMap
);
166 * Registers a new accelerator with the global accelerator map.
167 * This function should only be called once per accel_path
168 * with the canonical accel_key and accel_mods for this path.
169 * To change the accelerator during runtime programatically, use
170 * gtk_accel_map_change_entry().
171 * The accelerator path must consist of "<WINDOWTYPE>/Category1/Category2/.../Action",
172 * where <WINDOWTYPE> should be a unique application-specific identifier, that
173 * corresponds to the kind of window the accelerator is being used in, e.g. "Gimp-Image",
174 * "Abiword-Document" or "Gnumeric-Settings".
175 * The Category1/.../Action portion is most appropriately chosen by the action the
176 * accelerator triggers, i.e. for accelerators on menu items, choose the item's menu path,
177 * e.g. "File/Save As", "Image/View/Zoom" or "Edit/Select All".
178 * So a full valid accelerator path may look like:
179 * "<Gimp-Toolbox>/File/Dialogs/Tool Options...".
181 * valid accelerator path
183 * the accelerator key
185 * the accelerator modifiers
187 public static void addEntry(char[] accelPath
, uint accelKey
, GdkModifierType accelMods
)
189 // void gtk_accel_map_add_entry (const gchar *accel_path, guint accel_key, GdkModifierType accel_mods);
190 gtk_accel_map_add_entry(Str
.toStringz(accelPath
), accelKey
, accelMods
);
194 * Looks up the accelerator entry for accel_path and fills in key.
196 * a valid accelerator path
198 * the accelerator key to be filled in (optional)
200 * TRUE if accel_path is known, FALSE otherwise
202 public static int lookupEntry(char[] accelPath
, GtkAccelKey
* key
)
204 // gboolean gtk_accel_map_lookup_entry (const gchar *accel_path, GtkAccelKey *key);
205 return gtk_accel_map_lookup_entry(Str
.toStringz(accelPath
), key
);
209 * Changes the accel_key and accel_mods currently associated with accel_path.
210 * Due to conflicts with other accelerators, a change may not always be possible,
211 * replace indicates whether other accelerators may be deleted to resolve such
212 * conflicts. A change will only occur if all conflicts could be resolved (which
213 * might not be the case if conflicting accelerators are locked). Successful
214 * changes are indicated by a TRUE return value.
216 * a valid accelerator path
218 * the new accelerator key
220 * the new accelerator modifiers
222 * TRUE if other accelerators may be deleted upon conflicts
224 * TRUE if the accelerator could be changed, FALSE otherwise
226 public static int changeEntry(char[] accelPath
, uint accelKey
, GdkModifierType accelMods
, int replace
)
228 // gboolean gtk_accel_map_change_entry (const gchar *accel_path, guint accel_key, GdkModifierType accel_mods, gboolean replace);
229 return gtk_accel_map_change_entry(Str
.toStringz(accelPath
), accelKey
, accelMods
, replace
);
233 * Parses a file previously saved with gtk_accel_map_save() for
234 * accelerator specifications, and propagates them accordingly.
236 * a file containing accelerator specifications,
237 * in the GLib file name encoding
239 public static void load(char[] fileName
)
241 // void gtk_accel_map_load (const gchar *file_name);
242 gtk_accel_map_load(Str
.toStringz(fileName
));
246 * Saves current accelerator specifications (accelerator path, key
247 * and modifiers) to file_name.
248 * The file is written in a format suitable to be read back in by
249 * gtk_accel_map_load().
251 * the name of the file to contain accelerator specifications,
252 * in the GLib file name encoding
254 public static void save(char[] fileName
)
256 // void gtk_accel_map_save (const gchar *file_name);
257 gtk_accel_map_save(Str
.toStringz(fileName
));
261 * Loops over the entries in the accelerator map whose accel path
262 * doesn't match any of the filters added with gtk_accel_map_add_filter(),
263 * and execute foreach_func on each. The signature of foreach_func is
264 * that of GtkAccelMapForeach, the changed parameter indicates whether
265 * this accelerator was changed during runtime (thus, would need
266 * saving during an accelerator map dump).
268 * data to be passed into foreach_func
270 * function to be executed for each accel map entry which
271 * is not filtered out
273 public static void foreac(void* data
, GtkAccelMapForeach foreachFunc
)
275 // void gtk_accel_map_foreach (gpointer data, GtkAccelMapForeach foreach_func);
276 gtk_accel_map_foreach(data
, foreachFunc
);
280 * Filedescriptor variant of gtk_accel_map_load().
281 * Note that the file descriptor will not be closed by this function.
283 * a valid readable file descriptor
285 public static void loadFd(int fd
)
287 // void gtk_accel_map_load_fd (gint fd);
288 gtk_accel_map_load_fd(fd
);
292 * Filedescriptor variant of gtk_accel_map_save().
293 * Note that the file descriptor will not be closed by this function.
295 * a valid writable file descriptor
297 public static void saveFd(int fd
)
299 // void gtk_accel_map_save_fd (gint fd);
300 gtk_accel_map_save_fd(fd
);
304 * GScanner variant of gtk_accel_map_load().
306 * a GScanner which has already been provided with an input file
308 public static void loadScanner(GScanner
* scanner
)
310 // void gtk_accel_map_load_scanner (GScanner *scanner);
311 gtk_accel_map_load_scanner(scanner
);
315 * Adds a filter to the global list of accel path filters.
316 * Accel map entries whose accel path matches one of the filters
317 * are skipped by gtk_accel_map_foreach().
318 * This function is intended for GTK+ modules that create their own
319 * menus, but don't want them to be saved into the applications accelerator
322 * a pattern (see GPatternSpec)
324 public static void addFilter(char[] filterPattern
)
326 // void gtk_accel_map_add_filter (const gchar *filter_pattern);
327 gtk_accel_map_add_filter(Str
.toStringz(filterPattern
));
331 * Loops over all entries in the accelerator map, and execute
332 * foreach_func on each. The signature of foreach_func is that of
333 * GtkAccelMapForeach, the changed parameter indicates whether
334 * this accelerator was changed during runtime (thus, would need
335 * saving during an accelerator map dump).
337 * data to be passed into foreach_func
339 * function to be executed for each accel map entry
341 public static void foreachUnfiltered(void* data
, GtkAccelMapForeach foreachFunc
)
343 // void gtk_accel_map_foreach_unfiltered (gpointer data, GtkAccelMapForeach foreach_func);
344 gtk_accel_map_foreach_unfiltered(data
, foreachFunc
);
348 * Gets the singleton global GtkAccelMap object. This object
349 * is useful only for notification of changes to the accelerator
350 * map via the ::changed signal; it isn't a parameter to the
351 * other accelerator map functions.
353 * the global GtkAccelMap object
356 public static AccelMap
get()
358 // GtkAccelMap* gtk_accel_map_get (void);
359 return new AccelMap( gtk_accel_map_get() );
363 * Locks the given accelerator path. If the accelerator map doesn't yet contain
364 * an entry for accel_path, a new one is created.
365 * Locking an accelerator path prevents its accelerator from being changed
366 * during runtime. A locked accelerator path can be unlocked by
367 * gtk_accel_map_unlock_path(). Refer to gtk_accel_map_change_entry()
368 * for information about runtime accelerator changes.
369 * If called more than once, accel_path remains locked until
370 * gtk_accel_map_unlock_path() has been called an equivalent number
372 * Note that locking of individual accelerator paths is independent from
373 * locking the GtkAccelGroup containing them. For runtime accelerator
374 * changes to be possible both the accelerator path and its GtkAccelGroup
375 * have to be unlocked.
377 * a valid accelerator path
380 public static void lockPath(char[] accelPath
)
382 // void gtk_accel_map_lock_path (const gchar *accel_path);
383 gtk_accel_map_lock_path(Str
.toStringz(accelPath
));
387 * Undoes the last call to gtk_accel_map_lock_path() on this accel_path.
388 * Refer to gtk_accel_map_lock_path() for information about accelerator path locking.
390 * a valid accelerator path
393 * The "changed" signal
394 * void user_function (GtkAccelMap *object,
397 * GdkModifierType accel_mods,
398 * gpointer user_data) : Run Last / Has Details
399 * Notifies of a change in the global accelerator map.
400 * The path is also used as the detail for the signal,
401 * so it is possible to connect to
402 * changed::accel_path.
404 * the global accel map object
406 * the path of the accelerator that changed
408 * the key value for the new accelerator
410 * the modifier mask for the new accelerator
412 * user data set when the signal handler was connected.
415 public static void unlockPath(char[] accelPath
)
417 // void gtk_accel_map_unlock_path (const gchar *accel_path);
418 gtk_accel_map_unlock_path(Str
.toStringz(accelPath
));