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 gtk.AccelGroup;
26 
27 private import gdk.Display;
28 private import glib.ConstructionException;
29 private import glib.ListSG;
30 private import glib.Str;
31 private import gobject.Closure;
32 private import gobject.ObjectG;
33 private import gobject.Signals;
34 public  import gtkc.gdktypes;
35 private import gtkc.gtk;
36 public  import gtkc.gtktypes;
37 
38 
39 /**
40  * A #GtkAccelGroup represents a group of keyboard accelerators,
41  * typically attached to a toplevel #GtkWindow (with
42  * gtk_window_add_accel_group()). Usually you won’t need to create a
43  * #GtkAccelGroup directly; instead, when using #GtkUIManager, GTK+
44  * automatically sets up the accelerators for your menus in the ui
45  * manager’s #GtkAccelGroup.
46  * 
47  * Note that “accelerators” are different from
48  * “mnemonics”. Accelerators are shortcuts for
49  * activating a menu item; they appear alongside the menu item they’re a
50  * shortcut for. For example “Ctrl+Q” might appear alongside the “Quit”
51  * menu item. Mnemonics are shortcuts for GUI elements such as text
52  * entries or buttons; they appear as underlined characters. See
53  * gtk_label_new_with_mnemonic(). Menu items can have both accelerators
54  * and mnemonics, of course.
55  */
56 public class AccelGroup : ObjectG
57 {
58 	/** the main Gtk struct */
59 	protected GtkAccelGroup* gtkAccelGroup;
60 
61 	/** Get the main Gtk struct */
62 	public GtkAccelGroup* getAccelGroupStruct()
63 	{
64 		return gtkAccelGroup;
65 	}
66 
67 	/** the main Gtk struct as a void* */
68 	protected override void* getStruct()
69 	{
70 		return cast(void*)gtkAccelGroup;
71 	}
72 
73 	protected override void setStruct(GObject* obj)
74 	{
75 		gtkAccelGroup = cast(GtkAccelGroup*)obj;
76 		super.setStruct(obj);
77 	}
78 
79 	/**
80 	 * Sets our main struct and passes it to the parent class.
81 	 */
82 	public this (GtkAccelGroup* gtkAccelGroup, bool ownedRef = false)
83 	{
84 		this.gtkAccelGroup = gtkAccelGroup;
85 		super(cast(GObject*)gtkAccelGroup, ownedRef);
86 	}
87 
88 
89 	/** */
90 	public static GType getType()
91 	{
92 		return gtk_accel_group_get_type();
93 	}
94 
95 	/**
96 	 * Creates a new #GtkAccelGroup.
97 	 *
98 	 * Return: a new #GtkAccelGroup object
99 	 *
100 	 * Throws: ConstructionException GTK+ fails to create the object.
101 	 */
102 	public this()
103 	{
104 		auto p = gtk_accel_group_new();
105 		
106 		if(p is null)
107 		{
108 			throw new ConstructionException("null returned by new");
109 		}
110 		
111 		this(cast(GtkAccelGroup*) p, true);
112 	}
113 
114 	/**
115 	 * Finds the #GtkAccelGroup to which @closure is connected;
116 	 * see gtk_accel_group_connect().
117 	 *
118 	 * Params:
119 	 *     closure = a #GClosure
120 	 *
121 	 * Return: the #GtkAccelGroup to which @closure
122 	 *     is connected, or %NULL
123 	 */
124 	public static AccelGroup fromAccelClosure(Closure closure)
125 	{
126 		auto p = gtk_accel_group_from_accel_closure((closure is null) ? null : closure.getClosureStruct());
127 		
128 		if(p is null)
129 		{
130 			return null;
131 		}
132 		
133 		return ObjectG.getDObject!(AccelGroup)(cast(GtkAccelGroup*) p);
134 	}
135 
136 	/**
137 	 * Finds the first accelerator in @accel_group that matches
138 	 * @accel_key and @accel_mods, and activates it.
139 	 *
140 	 * Params:
141 	 *     accelQuark = the quark for the accelerator name
142 	 *     acceleratable = the #GObject, usually a #GtkWindow, on which
143 	 *         to activate the accelerator
144 	 *     accelKey = accelerator keyval from a key event
145 	 *     accelMods = keyboard state mask from a key event
146 	 *
147 	 * Return: %TRUE if an accelerator was activated and handled
148 	 *     this keypress
149 	 */
150 	public bool activate(GQuark accelQuark, ObjectG acceleratable, uint accelKey, GdkModifierType accelMods)
151 	{
152 		return gtk_accel_group_activate(gtkAccelGroup, accelQuark, (acceleratable is null) ? null : acceleratable.getObjectGStruct(), accelKey, accelMods) != 0;
153 	}
154 
155 	/**
156 	 * Installs an accelerator in this group. When @accel_group is being
157 	 * activated in response to a call to gtk_accel_groups_activate(),
158 	 * @closure will be invoked if the @accel_key and @accel_mods from
159 	 * gtk_accel_groups_activate() match those of this connection.
160 	 *
161 	 * The signature used for the @closure is that of #GtkAccelGroupActivate.
162 	 *
163 	 * Note that, due to implementation details, a single closure can
164 	 * only be connected to one accelerator group.
165 	 *
166 	 * Params:
167 	 *     accelKey = key value of the accelerator
168 	 *     accelMods = modifier combination of the accelerator
169 	 *     accelFlags = a flag mask to configure this accelerator
170 	 *     closure = closure to be executed upon accelerator activation
171 	 */
172 	public void connect(uint accelKey, GdkModifierType accelMods, GtkAccelFlags accelFlags, Closure closure)
173 	{
174 		gtk_accel_group_connect(gtkAccelGroup, accelKey, accelMods, accelFlags, (closure is null) ? null : closure.getClosureStruct());
175 	}
176 
177 	/**
178 	 * Installs an accelerator in this group, using an accelerator path
179 	 * to look up the appropriate key and modifiers (see
180 	 * gtk_accel_map_add_entry()). When @accel_group is being activated
181 	 * in response to a call to gtk_accel_groups_activate(), @closure will
182 	 * be invoked if the @accel_key and @accel_mods from
183 	 * gtk_accel_groups_activate() match the key and modifiers for the path.
184 	 *
185 	 * The signature used for the @closure is that of #GtkAccelGroupActivate.
186 	 *
187 	 * Note that @accel_path string will be stored in a #GQuark. Therefore,
188 	 * if you pass a static string, you can save some memory by interning it
189 	 * first with g_intern_static_string().
190 	 *
191 	 * Params:
192 	 *     accelPath = path used for determining key and modifiers
193 	 *     closure = closure to be executed upon accelerator activation
194 	 */
195 	public void connectByPath(string accelPath, Closure closure)
196 	{
197 		gtk_accel_group_connect_by_path(gtkAccelGroup, Str.toStringz(accelPath), (closure is null) ? null : closure.getClosureStruct());
198 	}
199 
200 	/**
201 	 * Removes an accelerator previously installed through
202 	 * gtk_accel_group_connect().
203 	 *
204 	 * Since 2.20 @closure can be %NULL.
205 	 *
206 	 * Params:
207 	 *     closure = the closure to remove from this accelerator
208 	 *         group, or %NULL to remove all closures
209 	 *
210 	 * Return: %TRUE if the closure was found and got disconnected
211 	 */
212 	public bool disconnect(Closure closure)
213 	{
214 		return gtk_accel_group_disconnect(gtkAccelGroup, (closure is null) ? null : closure.getClosureStruct()) != 0;
215 	}
216 
217 	/**
218 	 * Removes an accelerator previously installed through
219 	 * gtk_accel_group_connect().
220 	 *
221 	 * Params:
222 	 *     accelKey = key value of the accelerator
223 	 *     accelMods = modifier combination of the accelerator
224 	 *
225 	 * Return: %TRUE if there was an accelerator which could be
226 	 *     removed, %FALSE otherwise
227 	 */
228 	public bool disconnectKey(uint accelKey, GdkModifierType accelMods)
229 	{
230 		return gtk_accel_group_disconnect_key(gtkAccelGroup, accelKey, accelMods) != 0;
231 	}
232 
233 	/**
234 	 * Finds the first entry in an accelerator group for which
235 	 * @find_func returns %TRUE and returns its #GtkAccelKey.
236 	 *
237 	 * Params:
238 	 *     findFunc = a function to filter the entries
239 	 *         of @accel_group with
240 	 *     data = data to pass to @find_func
241 	 *
242 	 * Return: the key of the first entry passing
243 	 *     @find_func. The key is owned by GTK+ and must not be freed.
244 	 */
245 	public GtkAccelKey* find(GtkAccelGroupFindFunc findFunc, void* data)
246 	{
247 		return gtk_accel_group_find(gtkAccelGroup, findFunc, data);
248 	}
249 
250 	/**
251 	 * Locks are added and removed using gtk_accel_group_lock() and
252 	 * gtk_accel_group_unlock().
253 	 *
254 	 * Return: %TRUE if there are 1 or more locks on the @accel_group,
255 	 *     %FALSE otherwise.
256 	 *
257 	 * Since: 2.14
258 	 */
259 	public bool getIsLocked()
260 	{
261 		return gtk_accel_group_get_is_locked(gtkAccelGroup) != 0;
262 	}
263 
264 	/**
265 	 * Gets a #GdkModifierType representing the mask for this
266 	 * @accel_group. For example, #GDK_CONTROL_MASK, #GDK_SHIFT_MASK, etc.
267 	 *
268 	 * Return: the modifier mask for this accel group.
269 	 *
270 	 * Since: 2.14
271 	 */
272 	public GdkModifierType getModifierMask()
273 	{
274 		return gtk_accel_group_get_modifier_mask(gtkAccelGroup);
275 	}
276 
277 	/**
278 	 * Locks the given accelerator group.
279 	 *
280 	 * Locking an acelerator group prevents the accelerators contained
281 	 * within it to be changed during runtime. Refer to
282 	 * gtk_accel_map_change_entry() about runtime accelerator changes.
283 	 *
284 	 * If called more than once, @accel_group remains locked until
285 	 * gtk_accel_group_unlock() has been called an equivalent number
286 	 * of times.
287 	 */
288 	public void lock()
289 	{
290 		gtk_accel_group_lock(gtkAccelGroup);
291 	}
292 
293 	/**
294 	 * Queries an accelerator group for all entries matching @accel_key
295 	 * and @accel_mods.
296 	 *
297 	 * Params:
298 	 *     accelKey = key value of the accelerator
299 	 *     accelMods = modifier combination of the accelerator
300 	 *
301 	 * Return: an array of
302 	 *     @n_entries #GtkAccelGroupEntry elements, or %NULL. The array
303 	 *     is owned by GTK+ and must not be freed.
304 	 */
305 	public GtkAccelGroupEntry[] query(uint accelKey, GdkModifierType accelMods)
306 	{
307 		uint nEntries;
308 		
309 		auto p = gtk_accel_group_query(gtkAccelGroup, accelKey, accelMods, &nEntries);
310 		
311 		return p[0 .. nEntries];
312 	}
313 
314 	/**
315 	 * Undoes the last call to gtk_accel_group_lock() on this @accel_group.
316 	 */
317 	public void unlock()
318 	{
319 		gtk_accel_group_unlock(gtkAccelGroup);
320 	}
321 
322 	int[string] connectedSignals;
323 
324 	bool delegate(ObjectG, uint, GdkModifierType, AccelGroup)[] onAccelActivateListeners;
325 	/**
326 	 * The accel-activate signal is an implementation detail of
327 	 * #GtkAccelGroup and not meant to be used by applications.
328 	 *
329 	 * Params:
330 	 *     acceleratable = the object on which the accelerator was activated
331 	 *     keyval = the accelerator keyval
332 	 *     modifier = the modifier combination of the accelerator
333 	 *
334 	 * Return: %TRUE if the accelerator was activated
335 	 */
336 	void addOnAccelActivate(bool delegate(ObjectG, uint, GdkModifierType, AccelGroup) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
337 	{
338 		if ( "accel-activate" !in connectedSignals )
339 		{
340 			Signals.connectData(
341 				this,
342 				"accel-activate",
343 				cast(GCallback)&callBackAccelActivate,
344 				cast(void*)this,
345 				null,
346 				connectFlags);
347 			connectedSignals["accel-activate"] = 1;
348 		}
349 		onAccelActivateListeners ~= dlg;
350 	}
351 	extern(C) static int callBackAccelActivate(GtkAccelGroup* accelgroupStruct, GObject* acceleratable, uint keyval, GdkModifierType modifier, AccelGroup _accelgroup)
352 	{
353 		foreach ( bool delegate(ObjectG, uint, GdkModifierType, AccelGroup) dlg; _accelgroup.onAccelActivateListeners )
354 		{
355 			if ( dlg(ObjectG.getDObject!(ObjectG)(acceleratable), keyval, modifier, _accelgroup) )
356 			{
357 				return 1;
358 			}
359 		}
360 		
361 		return 0;
362 	}
363 
364 	void delegate(uint, GdkModifierType, Closure, AccelGroup)[] onAccelChangedListeners;
365 	/**
366 	 * The accel-changed signal is emitted when an entry
367 	 * is added to or removed from the accel group.
368 	 *
369 	 * Widgets like #GtkAccelLabel which display an associated
370 	 * accelerator should connect to this signal, and rebuild
371 	 * their visual representation if the @accel_closure is theirs.
372 	 *
373 	 * Params:
374 	 *     keyval = the accelerator keyval
375 	 *     modifier = the modifier combination of the accelerator
376 	 *     accelClosure = the #GClosure of the accelerator
377 	 */
378 	void addOnAccelChanged(void delegate(uint, GdkModifierType, Closure, AccelGroup) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
379 	{
380 		if ( "accel-changed" !in connectedSignals )
381 		{
382 			Signals.connectData(
383 				this,
384 				"accel-changed",
385 				cast(GCallback)&callBackAccelChanged,
386 				cast(void*)this,
387 				null,
388 				connectFlags);
389 			connectedSignals["accel-changed"] = 1;
390 		}
391 		onAccelChangedListeners ~= dlg;
392 	}
393 	extern(C) static void callBackAccelChanged(GtkAccelGroup* accelgroupStruct, uint keyval, GdkModifierType modifier, GClosure* accelClosure, AccelGroup _accelgroup)
394 	{
395 		foreach ( void delegate(uint, GdkModifierType, Closure, AccelGroup) dlg; _accelgroup.onAccelChangedListeners )
396 		{
397 			dlg(keyval, modifier, ObjectG.getDObject!(Closure)(accelClosure), _accelgroup);
398 		}
399 	}
400 
401 	/**
402 	 * Finds the first accelerator in any #GtkAccelGroup attached
403 	 * to @object that matches @accel_key and @accel_mods, and
404 	 * activates that accelerator.
405 	 *
406 	 * Params:
407 	 *     object = the #GObject, usually a #GtkWindow, on which
408 	 *         to activate the accelerator
409 	 *     accelKey = accelerator keyval from a key event
410 	 *     accelMods = keyboard state mask from a key event
411 	 *
412 	 * Return: %TRUE if an accelerator was activated and handled
413 	 *     this keypress
414 	 */
415 	public static bool accelGroupsActivate(ObjectG object, uint accelKey, GdkModifierType accelMods)
416 	{
417 		return gtk_accel_groups_activate((object is null) ? null : object.getObjectGStruct(), accelKey, accelMods) != 0;
418 	}
419 
420 	/**
421 	 * Gets a list of all accel groups which are attached to @object.
422 	 *
423 	 * Params:
424 	 *     object = a #GObject, usually a #GtkWindow
425 	 *
426 	 * Return: a list of
427 	 *     all accel groups which are attached to @object
428 	 */
429 	public static ListSG accelGroupsFromObject(ObjectG object)
430 	{
431 		auto p = gtk_accel_groups_from_object((object is null) ? null : object.getObjectGStruct());
432 		
433 		if(p is null)
434 		{
435 			return null;
436 		}
437 		
438 		return new ListSG(cast(GSList*) p);
439 	}
440 
441 	/**
442 	 * Gets the modifier mask.
443 	 *
444 	 * The modifier mask determines which modifiers are considered significant
445 	 * for keyboard accelerators. See gtk_accelerator_set_default_mod_mask().
446 	 *
447 	 * Return: the default accelerator modifier mask
448 	 */
449 	public static GdkModifierType acceleratorGetDefaultModMask()
450 	{
451 		return gtk_accelerator_get_default_mod_mask();
452 	}
453 
454 	/**
455 	 * Converts an accelerator keyval and modifier mask into a string
456 	 * which can be used to represent the accelerator to the user.
457 	 *
458 	 * Params:
459 	 *     acceleratorKey = accelerator keyval
460 	 *     acceleratorMods = accelerator modifier mask
461 	 *
462 	 * Return: a newly-allocated string representing the accelerator.
463 	 *
464 	 * Since: 2.6
465 	 */
466 	public static string acceleratorGetLabel(uint acceleratorKey, GdkModifierType acceleratorMods)
467 	{
468 		auto retStr = gtk_accelerator_get_label(acceleratorKey, acceleratorMods);
469 		
470 		scope(exit) Str.freeString(retStr);
471 		return Str.toString(retStr);
472 	}
473 
474 	/**
475 	 * Converts an accelerator keyval and modifier mask
476 	 * into a (possibly translated) string that can be displayed to
477 	 * a user, similarly to gtk_accelerator_get_label(), but handling
478 	 * keycodes.
479 	 *
480 	 * This is only useful for system-level components, applications
481 	 * should use gtk_accelerator_parse() instead.
482 	 *
483 	 * Params:
484 	 *     display = a #GdkDisplay or %NULL to use the default display
485 	 *     acceleratorKey = accelerator keyval
486 	 *     keycode = accelerator keycode
487 	 *     acceleratorMods = accelerator modifier mask
488 	 *
489 	 * Return: a newly-allocated string representing the accelerator.
490 	 *
491 	 * Since: 3.4
492 	 */
493 	public static string acceleratorGetLabelWithKeycode(Display display, uint acceleratorKey, uint keycode, GdkModifierType acceleratorMods)
494 	{
495 		auto retStr = gtk_accelerator_get_label_with_keycode((display is null) ? null : display.getDisplayStruct(), acceleratorKey, keycode, acceleratorMods);
496 		
497 		scope(exit) Str.freeString(retStr);
498 		return Str.toString(retStr);
499 	}
500 
501 	/**
502 	 * Converts an accelerator keyval and modifier mask into a string
503 	 * parseable by gtk_accelerator_parse(). For example, if you pass in
504 	 * #GDK_KEY_q and #GDK_CONTROL_MASK, this function returns “<Control>q”.
505 	 *
506 	 * If you need to display accelerators in the user interface,
507 	 * see gtk_accelerator_get_label().
508 	 *
509 	 * Params:
510 	 *     acceleratorKey = accelerator keyval
511 	 *     acceleratorMods = accelerator modifier mask
512 	 *
513 	 * Return: a newly-allocated accelerator name
514 	 */
515 	public static string acceleratorName(uint acceleratorKey, GdkModifierType acceleratorMods)
516 	{
517 		auto retStr = gtk_accelerator_name(acceleratorKey, acceleratorMods);
518 		
519 		scope(exit) Str.freeString(retStr);
520 		return Str.toString(retStr);
521 	}
522 
523 	/**
524 	 * Converts an accelerator keyval and modifier mask
525 	 * into a string parseable by gtk_accelerator_parse_with_keycode(),
526 	 * similarly to gtk_accelerator_name() but handling keycodes.
527 	 * This is only useful for system-level components, applications
528 	 * should use gtk_accelerator_parse() instead.
529 	 *
530 	 * Params:
531 	 *     display = a #GdkDisplay or %NULL to use the default display
532 	 *     acceleratorKey = accelerator keyval
533 	 *     keycode = accelerator keycode
534 	 *     acceleratorMods = accelerator modifier mask
535 	 *
536 	 * Return: a newly allocated accelerator name.
537 	 *
538 	 * Since: 3.4
539 	 */
540 	public static string acceleratorNameWithKeycode(Display display, uint acceleratorKey, uint keycode, GdkModifierType acceleratorMods)
541 	{
542 		auto retStr = gtk_accelerator_name_with_keycode((display is null) ? null : display.getDisplayStruct(), acceleratorKey, keycode, acceleratorMods);
543 		
544 		scope(exit) Str.freeString(retStr);
545 		return Str.toString(retStr);
546 	}
547 
548 	/**
549 	 * Parses a string representing an accelerator. The format looks like
550 	 * “<Control>a” or “<Shift><Alt>F1” or “<Release>z” (the last one is
551 	 * for key release).
552 	 *
553 	 * The parser is fairly liberal and allows lower or upper case, and also
554 	 * abbreviations such as “<Ctl>” and “<Ctrl>”. Key names are parsed using
555 	 * gdk_keyval_from_name(). For character keys the name is not the symbol,
556 	 * but the lowercase name, e.g. one would use “<Ctrl>minus” instead of
557 	 * “<Ctrl>-”.
558 	 *
559 	 * If the parse fails, @accelerator_key and @accelerator_mods will
560 	 * be set to 0 (zero).
561 	 *
562 	 * Params:
563 	 *     accelerator = string representing an accelerator
564 	 *     acceleratorKey = return location for accelerator
565 	 *         keyval, or %NULL
566 	 *     acceleratorMods = return location for accelerator
567 	 *         modifier mask, %NULL
568 	 */
569 	public static void acceleratorParse(string accelerator, out uint acceleratorKey, out GdkModifierType acceleratorMods)
570 	{
571 		gtk_accelerator_parse(Str.toStringz(accelerator), &acceleratorKey, &acceleratorMods);
572 	}
573 
574 	/**
575 	 * Parses a string representing an accelerator, similarly to
576 	 * gtk_accelerator_parse() but handles keycodes as well. This is only
577 	 * useful for system-level components, applications should use
578 	 * gtk_accelerator_parse() instead.
579 	 *
580 	 * If @accelerator_codes is given and the result stored in it is non-%NULL,
581 	 * the result must be freed with g_free().
582 	 *
583 	 * If a keycode is present in the accelerator and no @accelerator_codes
584 	 * is given, the parse will fail.
585 	 *
586 	 * If the parse fails, @accelerator_key, @accelerator_mods and
587 	 * @accelerator_codes will be set to 0 (zero).
588 	 *
589 	 * Params:
590 	 *     accelerator = string representing an accelerator
591 	 *     acceleratorKey = return location for accelerator
592 	 *         keyval, or %NULL
593 	 *     acceleratorCodes = return location for accelerator keycodes, or %NULL
594 	 *     acceleratorMods = return location for accelerator
595 	 *         modifier mask, %NULL
596 	 *
597 	 * Since: 3.4
598 	 */
599 	public static void acceleratorParseWithKeycode(string accelerator, out uint acceleratorKey, out uint[] acceleratorCodes, out GdkModifierType acceleratorMods)
600 	{
601 		uint* outacceleratorCodes = null;
602 		
603 		gtk_accelerator_parse_with_keycode(Str.toStringz(accelerator), &acceleratorKey, &outacceleratorCodes, &acceleratorMods);
604 		
605 		acceleratorCodes = outacceleratorCodes[0 .. getArrayLength(outacceleratorCodes)];
606 	}
607 
608 	/**
609 	 * Sets the modifiers that will be considered significant for keyboard
610 	 * accelerators. The default mod mask depends on the GDK backend in use,
611 	 * but will typically include #GDK_CONTROL_MASK | #GDK_SHIFT_MASK |
612 	 * #GDK_MOD1_MASK | #GDK_SUPER_MASK | #GDK_HYPER_MASK | #GDK_META_MASK.
613 	 * In other words, Control, Shift, Alt, Super, Hyper and Meta. Other
614 	 * modifiers will by default be ignored by #GtkAccelGroup.
615 	 *
616 	 * You must include at least the three modifiers Control, Shift
617 	 * and Alt in any value you pass to this function.
618 	 *
619 	 * The default mod mask should be changed on application startup,
620 	 * before using any accelerator groups.
621 	 *
622 	 * Params:
623 	 *     defaultModMask = accelerator modifier mask
624 	 */
625 	public static void acceleratorSetDefaultModMask(GdkModifierType defaultModMask)
626 	{
627 		gtk_accelerator_set_default_mod_mask(defaultModMask);
628 	}
629 
630 	/**
631 	 * Determines whether a given keyval and modifier mask constitute
632 	 * a valid keyboard accelerator. For example, the #GDK_KEY_a keyval
633 	 * plus #GDK_CONTROL_MASK is valid - this is a “Ctrl+a” accelerator.
634 	 * But, you can't, for instance, use the #GDK_KEY_Control_L keyval
635 	 * as an accelerator.
636 	 *
637 	 * Params:
638 	 *     keyval = a GDK keyval
639 	 *     modifiers = modifier mask
640 	 *
641 	 * Return: %TRUE if the accelerator is valid
642 	 */
643 	public static bool acceleratorValid(uint keyval, GdkModifierType modifiers)
644 	{
645 		return gtk_accelerator_valid(keyval, modifiers) != 0;
646 	}
647 }