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 gdk.Keymap;
26 
27 private import gdk.Display;
28 private import glib.Str;
29 private import gobject.ObjectG;
30 private import gobject.Signals;
31 private import gtkc.gdk;
32 public  import gtkc.gdktypes;
33 private import std.algorithm;
34 
35 
36 /**
37  * A #GdkKeymap defines the translation from keyboard state
38  * (including a hardware key, a modifier mask, and active keyboard group)
39  * to a keyval. This translation has two phases. The first phase is
40  * to determine the effective keyboard group and level for the keyboard
41  * state; the second phase is to look up the keycode/group/level triplet
42  * in the keymap and see what keyval it corresponds to.
43  */
44 public class Keymap : ObjectG
45 {
46 	/** the main Gtk struct */
47 	protected GdkKeymap* gdkKeymap;
48 
49 	/** Get the main Gtk struct */
50 	public GdkKeymap* getKeymapStruct()
51 	{
52 		return gdkKeymap;
53 	}
54 
55 	/** the main Gtk struct as a void* */
56 	protected override void* getStruct()
57 	{
58 		return cast(void*)gdkKeymap;
59 	}
60 
61 	protected override void setStruct(GObject* obj)
62 	{
63 		gdkKeymap = cast(GdkKeymap*)obj;
64 		super.setStruct(obj);
65 	}
66 
67 	/**
68 	 * Sets our main struct and passes it to the parent class.
69 	 */
70 	public this (GdkKeymap* gdkKeymap, bool ownedRef = false)
71 	{
72 		this.gdkKeymap = gdkKeymap;
73 		super(cast(GObject*)gdkKeymap, ownedRef);
74 	}
75 
76 
77 	/** */
78 	public static GType getType()
79 	{
80 		return gdk_keymap_get_type();
81 	}
82 
83 	/**
84 	 * Returns the #GdkKeymap attached to the default display.
85 	 *
86 	 * Return: the #GdkKeymap attached to the default display.
87 	 */
88 	public static Keymap getDefault()
89 	{
90 		auto p = gdk_keymap_get_default();
91 		
92 		if(p is null)
93 		{
94 			return null;
95 		}
96 		
97 		return ObjectG.getDObject!(Keymap)(cast(GdkKeymap*) p);
98 	}
99 
100 	/**
101 	 * Returns the #GdkKeymap attached to @display.
102 	 *
103 	 * Params:
104 	 *     display = the #GdkDisplay.
105 	 *
106 	 * Return: the #GdkKeymap attached to @display.
107 	 *
108 	 * Since: 2.2
109 	 */
110 	public static Keymap getForDisplay(Display display)
111 	{
112 		auto p = gdk_keymap_get_for_display((display is null) ? null : display.getDisplayStruct());
113 		
114 		if(p is null)
115 		{
116 			return null;
117 		}
118 		
119 		return ObjectG.getDObject!(Keymap)(cast(GdkKeymap*) p);
120 	}
121 
122 	/**
123 	 * Maps the non-virtual modifiers (i.e Mod2, Mod3, ...) which are set
124 	 * in @state to the virtual modifiers (i.e. Super, Hyper and Meta) and
125 	 * set the corresponding bits in @state.
126 	 *
127 	 * GDK already does this before delivering key events, but for
128 	 * compatibility reasons, it only sets the first virtual modifier
129 	 * it finds, whereas this function sets all matching virtual modifiers.
130 	 *
131 	 * This function is useful when matching key events against
132 	 * accelerators.
133 	 *
134 	 * Params:
135 	 *     state = pointer to the modifier mask to change
136 	 *
137 	 * Since: 2.20
138 	 */
139 	public void addVirtualModifiers(ref GdkModifierType state)
140 	{
141 		gdk_keymap_add_virtual_modifiers(gdkKeymap, &state);
142 	}
143 
144 	/**
145 	 * Returns whether the Caps Lock modifer is locked.
146 	 *
147 	 * Return: %TRUE if Caps Lock is on
148 	 *
149 	 * Since: 2.16
150 	 */
151 	public bool getCapsLockState()
152 	{
153 		return gdk_keymap_get_caps_lock_state(gdkKeymap) != 0;
154 	}
155 
156 	/**
157 	 * Returns the direction of effective layout of the keymap.
158 	 *
159 	 * Return: %PANGO_DIRECTION_LTR or %PANGO_DIRECTION_RTL
160 	 *     if it can determine the direction. %PANGO_DIRECTION_NEUTRAL
161 	 *     otherwise.
162 	 */
163 	public PangoDirection getDirection()
164 	{
165 		return gdk_keymap_get_direction(gdkKeymap);
166 	}
167 
168 	/**
169 	 * Returns the keyvals bound to @hardware_keycode.
170 	 * The Nth #GdkKeymapKey in @keys is bound to the Nth
171 	 * keyval in @keyvals. Free the returned arrays with g_free().
172 	 * When a keycode is pressed by the user, the keyval from
173 	 * this list of entries is selected by considering the effective
174 	 * keyboard group and level. See gdk_keymap_translate_keyboard_state().
175 	 *
176 	 * Params:
177 	 *     hardwareKeycode = a keycode
178 	 *     keys = return
179 	 *         location for array of #GdkKeymapKey, or %NULL
180 	 *     keyvals = return
181 	 *         location for array of keyvals, or %NULL
182 	 *     nEntries = length of @keys and @keyvals
183 	 *
184 	 * Return: %TRUE if there were any entries
185 	 */
186 	public bool getEntriesForKeycode(uint hardwareKeycode, out GdkKeymapKey[] keys, out uint[] keyvals)
187 	{
188 		GdkKeymapKey* outkeys = null;
189 		uint* outkeyvals = null;
190 		int nEntries;
191 		
192 		auto p = gdk_keymap_get_entries_for_keycode(gdkKeymap, hardwareKeycode, &outkeys, &outkeyvals, &nEntries) != 0;
193 		
194 		keys = outkeys[0 .. nEntries];
195 		keyvals = outkeyvals[0 .. nEntries];
196 		
197 		return p;
198 	}
199 
200 	/**
201 	 * Obtains a list of keycode/group/level combinations that will
202 	 * generate @keyval. Groups and levels are two kinds of keyboard mode;
203 	 * in general, the level determines whether the top or bottom symbol
204 	 * on a key is used, and the group determines whether the left or
205 	 * right symbol is used. On US keyboards, the shift key changes the
206 	 * keyboard level, and there are no groups. A group switch key might
207 	 * convert a keyboard between Hebrew to English modes, for example.
208 	 * #GdkEventKey contains a %group field that indicates the active
209 	 * keyboard group. The level is computed from the modifier mask.
210 	 * The returned array should be freed
211 	 * with g_free().
212 	 *
213 	 * Params:
214 	 *     keyval = a keyval, such as %GDK_KEY_a, %GDK_KEY_Up, %GDK_KEY_Return, etc.
215 	 *     keys = return location
216 	 *         for an array of #GdkKeymapKey
217 	 *     nKeys = return location for number of elements in returned array
218 	 *
219 	 * Return: %TRUE if keys were found and returned
220 	 */
221 	public bool getEntriesForKeyval(uint keyval, out GdkKeymapKey[] keys)
222 	{
223 		GdkKeymapKey* outkeys = null;
224 		int nKeys;
225 		
226 		auto p = gdk_keymap_get_entries_for_keyval(gdkKeymap, keyval, &outkeys, &nKeys) != 0;
227 		
228 		keys = outkeys[0 .. nKeys];
229 		
230 		return p;
231 	}
232 
233 	/**
234 	 * Returns the modifier mask the @keymap’s windowing system backend
235 	 * uses for a particular purpose.
236 	 *
237 	 * Note that this function always returns real hardware modifiers, not
238 	 * virtual ones (e.g. it will return #GDK_MOD1_MASK rather than
239 	 * #GDK_META_MASK if the backend maps MOD1 to META), so there are use
240 	 * cases where the return value of this function has to be transformed
241 	 * by gdk_keymap_add_virtual_modifiers() in order to contain the
242 	 * expected result.
243 	 *
244 	 * Params:
245 	 *     intent = the use case for the modifier mask
246 	 *
247 	 * Return: the modifier mask used for @intent.
248 	 *
249 	 * Since: 3.4
250 	 */
251 	public GdkModifierType getModifierMask(GdkModifierIntent intent)
252 	{
253 		return gdk_keymap_get_modifier_mask(gdkKeymap, intent);
254 	}
255 
256 	/**
257 	 * Returns the current modifier state.
258 	 *
259 	 * Return: the current modifier state.
260 	 *
261 	 * Since: 3.4
262 	 */
263 	public uint getModifierState()
264 	{
265 		return gdk_keymap_get_modifier_state(gdkKeymap);
266 	}
267 
268 	/**
269 	 * Returns whether the Num Lock modifer is locked.
270 	 *
271 	 * Return: %TRUE if Num Lock is on
272 	 *
273 	 * Since: 3.0
274 	 */
275 	public bool getNumLockState()
276 	{
277 		return gdk_keymap_get_num_lock_state(gdkKeymap) != 0;
278 	}
279 
280 	/**
281 	 * Returns whether the Scroll Lock modifer is locked.
282 	 *
283 	 * Return: %TRUE if Scroll Lock is on
284 	 *
285 	 * Since: 3.18
286 	 */
287 	public bool getScrollLockState()
288 	{
289 		return gdk_keymap_get_scroll_lock_state(gdkKeymap) != 0;
290 	}
291 
292 	/**
293 	 * Determines if keyboard layouts for both right-to-left and left-to-right
294 	 * languages are in use.
295 	 *
296 	 * Return: %TRUE if there are layouts in both directions, %FALSE otherwise
297 	 *
298 	 * Since: 2.12
299 	 */
300 	public bool haveBidiLayouts()
301 	{
302 		return gdk_keymap_have_bidi_layouts(gdkKeymap) != 0;
303 	}
304 
305 	/**
306 	 * Looks up the keyval mapped to a keycode/group/level triplet.
307 	 * If no keyval is bound to @key, returns 0. For normal user input,
308 	 * you want to use gdk_keymap_translate_keyboard_state() instead of
309 	 * this function, since the effective group/level may not be
310 	 * the same as the current keyboard state.
311 	 *
312 	 * Params:
313 	 *     key = a #GdkKeymapKey with keycode, group, and level initialized
314 	 *
315 	 * Return: a keyval, or 0 if none was mapped to the given @key
316 	 */
317 	public uint lookupKey(GdkKeymapKey* key)
318 	{
319 		return gdk_keymap_lookup_key(gdkKeymap, key);
320 	}
321 
322 	/**
323 	 * Maps the virtual modifiers (i.e. Super, Hyper and Meta) which
324 	 * are set in @state to their non-virtual counterparts (i.e. Mod2,
325 	 * Mod3,...) and set the corresponding bits in @state.
326 	 *
327 	 * This function is useful when matching key events against
328 	 * accelerators.
329 	 *
330 	 * Params:
331 	 *     state = pointer to the modifier state to map
332 	 *
333 	 * Return: %FALSE if two virtual modifiers were mapped to the
334 	 *     same non-virtual modifier. Note that %FALSE is also returned
335 	 *     if a virtual modifier is mapped to a non-virtual modifier that
336 	 *     was already set in @state.
337 	 *
338 	 * Since: 2.20
339 	 */
340 	public bool mapVirtualModifiers(ref GdkModifierType state)
341 	{
342 		return gdk_keymap_map_virtual_modifiers(gdkKeymap, &state) != 0;
343 	}
344 
345 	/**
346 	 * Translates the contents of a #GdkEventKey into a keyval, effective
347 	 * group, and level. Modifiers that affected the translation and
348 	 * are thus unavailable for application use are returned in
349 	 * @consumed_modifiers.
350 	 * See [Groups][key-group-explanation] for an explanation of
351 	 * groups and levels. The @effective_group is the group that was
352 	 * actually used for the translation; some keys such as Enter are not
353 	 * affected by the active keyboard group. The @level is derived from
354 	 * @state. For convenience, #GdkEventKey already contains the translated
355 	 * keyval, so this function isn’t as useful as you might think.
356 	 *
357 	 * @consumed_modifiers gives modifiers that should be masked outfrom @state
358 	 * when comparing this key press to a hot key. For instance, on a US keyboard,
359 	 * the `plus` symbol is shifted, so when comparing a key press to a
360 	 * `<Control>plus` accelerator `<Shift>` should be masked out.
361 	 *
362 	 * |[<!-- language="C" -->
363 	 * // We want to ignore irrelevant modifiers like ScrollLock
364 	 * #define ALL_ACCELS_MASK (GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_MOD1_MASK)
365 	 * gdk_keymap_translate_keyboard_state (keymap, event->hardware_keycode,
366 	 * event->state, event->group,
367 	 * &keyval, NULL, NULL, &consumed);
368 	 * if (keyval == GDK_PLUS &&
369 	 * (event->state & ~consumed & ALL_ACCELS_MASK) == GDK_CONTROL_MASK)
370 	 * // Control was pressed
371 	 * ]|
372 	 *
373 	 * An older interpretation @consumed_modifiers was that it contained
374 	 * all modifiers that might affect the translation of the key;
375 	 * this allowed accelerators to be stored with irrelevant consumed
376 	 * modifiers, by doing:
377 	 * |[<!-- language="C" -->
378 	 * // XXX Don’t do this XXX
379 	 * if (keyval == accel_keyval &&
380 	 * (event->state & ~consumed & ALL_ACCELS_MASK) == (accel_mods & ~consumed))
381 	 * // Accelerator was pressed
382 	 * ]|
383 	 *
384 	 * However, this did not work if multi-modifier combinations were
385 	 * used in the keymap, since, for instance, `<Control>` would be
386 	 * masked out even if only `<Control><Alt>` was used in the keymap.
387 	 * To support this usage as well as well as possible, all single
388 	 * modifier combinations that could affect the key for any combination
389 	 * of modifiers will be returned in @consumed_modifiers; multi-modifier
390 	 * combinations are returned only when actually found in @state. When
391 	 * you store accelerators, you should always store them with consumed
392 	 * modifiers removed. Store `<Control>plus`, not `<Control><Shift>plus`,
393 	 *
394 	 * Params:
395 	 *     hardwareKeycode = a keycode
396 	 *     state = a modifier state
397 	 *     group = active keyboard group
398 	 *     keyval = return location for keyval, or %NULL
399 	 *     effectiveGroup = return location for effective
400 	 *         group, or %NULL
401 	 *     level = return location for level, or %NULL
402 	 *     consumedModifiers = return location for modifiers
403 	 *         that were used to determine the group or level, or %NULL
404 	 *
405 	 * Return: %TRUE if there was a keyval bound to the keycode/state/group
406 	 */
407 	public bool translateKeyboardState(uint hardwareKeycode, GdkModifierType state, int group, out uint keyval, out int effectiveGroup, out int level, out GdkModifierType consumedModifiers)
408 	{
409 		return gdk_keymap_translate_keyboard_state(gdkKeymap, hardwareKeycode, state, group, &keyval, &effectiveGroup, &level, &consumedModifiers) != 0;
410 	}
411 
412 	protected class OnDirectionChangedDelegateWrapper
413 	{
414 		void delegate(Keymap) dlg;
415 		gulong handlerId;
416 		ConnectFlags flags;
417 		this(void delegate(Keymap) dlg, gulong handlerId, ConnectFlags flags)
418 		{
419 			this.dlg = dlg;
420 			this.handlerId = handlerId;
421 			this.flags = flags;
422 		}
423 	}
424 	protected OnDirectionChangedDelegateWrapper[] onDirectionChangedListeners;
425 
426 	/**
427 	 * The ::direction-changed signal gets emitted when the direction of
428 	 * the keymap changes.
429 	 *
430 	 * Since: 2.0
431 	 */
432 	gulong addOnDirectionChanged(void delegate(Keymap) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
433 	{
434 		onDirectionChangedListeners ~= new OnDirectionChangedDelegateWrapper(dlg, 0, connectFlags);
435 		onDirectionChangedListeners[onDirectionChangedListeners.length - 1].handlerId = Signals.connectData(
436 			this,
437 			"direction-changed",
438 			cast(GCallback)&callBackDirectionChanged,
439 			cast(void*)onDirectionChangedListeners[onDirectionChangedListeners.length - 1],
440 			cast(GClosureNotify)&callBackDirectionChangedDestroy,
441 			connectFlags);
442 		return onDirectionChangedListeners[onDirectionChangedListeners.length - 1].handlerId;
443 	}
444 	
445 	extern(C) static void callBackDirectionChanged(GdkKeymap* keymapStruct,OnDirectionChangedDelegateWrapper wrapper)
446 	{
447 		wrapper.dlg(wrapper.outer);
448 	}
449 	
450 	extern(C) static void callBackDirectionChangedDestroy(OnDirectionChangedDelegateWrapper wrapper, GClosure* closure)
451 	{
452 		wrapper.outer.internalRemoveOnDirectionChanged(wrapper);
453 	}
454 
455 	protected void internalRemoveOnDirectionChanged(OnDirectionChangedDelegateWrapper source)
456 	{
457 		foreach(index, wrapper; onDirectionChangedListeners)
458 		{
459 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
460 			{
461 				onDirectionChangedListeners[index] = null;
462 				onDirectionChangedListeners = std.algorithm.remove(onDirectionChangedListeners, index);
463 				break;
464 			}
465 		}
466 	}
467 	
468 
469 	protected class OnKeysChangedDelegateWrapper
470 	{
471 		void delegate(Keymap) dlg;
472 		gulong handlerId;
473 		ConnectFlags flags;
474 		this(void delegate(Keymap) dlg, gulong handlerId, ConnectFlags flags)
475 		{
476 			this.dlg = dlg;
477 			this.handlerId = handlerId;
478 			this.flags = flags;
479 		}
480 	}
481 	protected OnKeysChangedDelegateWrapper[] onKeysChangedListeners;
482 
483 	/**
484 	 * The ::keys-changed signal is emitted when the mapping represented by
485 	 * @keymap changes.
486 	 *
487 	 * Since: 2.2
488 	 */
489 	gulong addOnKeysChanged(void delegate(Keymap) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
490 	{
491 		onKeysChangedListeners ~= new OnKeysChangedDelegateWrapper(dlg, 0, connectFlags);
492 		onKeysChangedListeners[onKeysChangedListeners.length - 1].handlerId = Signals.connectData(
493 			this,
494 			"keys-changed",
495 			cast(GCallback)&callBackKeysChanged,
496 			cast(void*)onKeysChangedListeners[onKeysChangedListeners.length - 1],
497 			cast(GClosureNotify)&callBackKeysChangedDestroy,
498 			connectFlags);
499 		return onKeysChangedListeners[onKeysChangedListeners.length - 1].handlerId;
500 	}
501 	
502 	extern(C) static void callBackKeysChanged(GdkKeymap* keymapStruct,OnKeysChangedDelegateWrapper wrapper)
503 	{
504 		wrapper.dlg(wrapper.outer);
505 	}
506 	
507 	extern(C) static void callBackKeysChangedDestroy(OnKeysChangedDelegateWrapper wrapper, GClosure* closure)
508 	{
509 		wrapper.outer.internalRemoveOnKeysChanged(wrapper);
510 	}
511 
512 	protected void internalRemoveOnKeysChanged(OnKeysChangedDelegateWrapper source)
513 	{
514 		foreach(index, wrapper; onKeysChangedListeners)
515 		{
516 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
517 			{
518 				onKeysChangedListeners[index] = null;
519 				onKeysChangedListeners = std.algorithm.remove(onKeysChangedListeners, index);
520 				break;
521 			}
522 		}
523 	}
524 	
525 
526 	protected class OnStateChangedDelegateWrapper
527 	{
528 		void delegate(Keymap) dlg;
529 		gulong handlerId;
530 		ConnectFlags flags;
531 		this(void delegate(Keymap) dlg, gulong handlerId, ConnectFlags flags)
532 		{
533 			this.dlg = dlg;
534 			this.handlerId = handlerId;
535 			this.flags = flags;
536 		}
537 	}
538 	protected OnStateChangedDelegateWrapper[] onStateChangedListeners;
539 
540 	/**
541 	 * The ::state-changed signal is emitted when the state of the
542 	 * keyboard changes, e.g when Caps Lock is turned on or off.
543 	 * See gdk_keymap_get_caps_lock_state().
544 	 *
545 	 * Since: 2.16
546 	 */
547 	gulong addOnStateChanged(void delegate(Keymap) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
548 	{
549 		onStateChangedListeners ~= new OnStateChangedDelegateWrapper(dlg, 0, connectFlags);
550 		onStateChangedListeners[onStateChangedListeners.length - 1].handlerId = Signals.connectData(
551 			this,
552 			"state-changed",
553 			cast(GCallback)&callBackStateChanged,
554 			cast(void*)onStateChangedListeners[onStateChangedListeners.length - 1],
555 			cast(GClosureNotify)&callBackStateChangedDestroy,
556 			connectFlags);
557 		return onStateChangedListeners[onStateChangedListeners.length - 1].handlerId;
558 	}
559 	
560 	extern(C) static void callBackStateChanged(GdkKeymap* keymapStruct,OnStateChangedDelegateWrapper wrapper)
561 	{
562 		wrapper.dlg(wrapper.outer);
563 	}
564 	
565 	extern(C) static void callBackStateChangedDestroy(OnStateChangedDelegateWrapper wrapper, GClosure* closure)
566 	{
567 		wrapper.outer.internalRemoveOnStateChanged(wrapper);
568 	}
569 
570 	protected void internalRemoveOnStateChanged(OnStateChangedDelegateWrapper source)
571 	{
572 		foreach(index, wrapper; onStateChangedListeners)
573 		{
574 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
575 			{
576 				onStateChangedListeners[index] = null;
577 				onStateChangedListeners = std.algorithm.remove(onStateChangedListeners, index);
578 				break;
579 			}
580 		}
581 	}
582 	
583 
584 	/**
585 	 * Obtains the upper- and lower-case versions of the keyval @symbol.
586 	 * Examples of keyvals are #GDK_KEY_a, #GDK_KEY_Enter, #GDK_KEY_F1, etc.
587 	 *
588 	 * Params:
589 	 *     symbol = a keyval
590 	 *     lower = return location for lowercase version of @symbol
591 	 *     upper = return location for uppercase version of @symbol
592 	 */
593 	public static void keyvalConvertCase(uint symbol, out uint lower, out uint upper)
594 	{
595 		gdk_keyval_convert_case(symbol, &lower, &upper);
596 	}
597 
598 	/**
599 	 * Converts a key name to a key value.
600 	 *
601 	 * The names are the same as those in the
602 	 * `gdk/gdkkeysyms.h` header file
603 	 * but without the leading “GDK_KEY_”.
604 	 *
605 	 * Params:
606 	 *     keyvalName = a key name
607 	 *
608 	 * Return: the corresponding key value, or %GDK_KEY_VoidSymbol
609 	 *     if the key name is not a valid key
610 	 */
611 	public static uint keyvalFromName(string keyvalName)
612 	{
613 		return gdk_keyval_from_name(Str.toStringz(keyvalName));
614 	}
615 
616 	/**
617 	 * Returns %TRUE if the given key value is in lower case.
618 	 *
619 	 * Params:
620 	 *     keyval = a key value.
621 	 *
622 	 * Return: %TRUE if @keyval is in lower case, or if @keyval is not
623 	 *     subject to case conversion.
624 	 */
625 	public static bool keyvalIsLower(uint keyval)
626 	{
627 		return gdk_keyval_is_lower(keyval) != 0;
628 	}
629 
630 	/**
631 	 * Returns %TRUE if the given key value is in upper case.
632 	 *
633 	 * Params:
634 	 *     keyval = a key value.
635 	 *
636 	 * Return: %TRUE if @keyval is in upper case, or if @keyval is not subject to
637 	 *     case conversion.
638 	 */
639 	public static bool keyvalIsUpper(uint keyval)
640 	{
641 		return gdk_keyval_is_upper(keyval) != 0;
642 	}
643 
644 	/**
645 	 * Converts a key value into a symbolic name.
646 	 *
647 	 * The names are the same as those in the
648 	 * `gdk/gdkkeysyms.h` header file
649 	 * but without the leading “GDK_KEY_”.
650 	 *
651 	 * Params:
652 	 *     keyval = a key value
653 	 *
654 	 * Return: a string containing the name
655 	 *     of the key, or %NULL if @keyval is not a valid key. The string
656 	 *     should not be modified.
657 	 */
658 	public static string keyvalName(uint keyval)
659 	{
660 		return Str.toString(gdk_keyval_name(keyval));
661 	}
662 
663 	/**
664 	 * Converts a key value to lower case, if applicable.
665 	 *
666 	 * Params:
667 	 *     keyval = a key value.
668 	 *
669 	 * Return: the lower case form of @keyval, or @keyval itself if it is already
670 	 *     in lower case or it is not subject to case conversion.
671 	 */
672 	public static uint keyvalToLower(uint keyval)
673 	{
674 		return gdk_keyval_to_lower(keyval);
675 	}
676 
677 	/**
678 	 * Convert from a GDK key symbol to the corresponding ISO10646 (Unicode)
679 	 * character.
680 	 *
681 	 * Params:
682 	 *     keyval = a GDK key symbol
683 	 *
684 	 * Return: the corresponding unicode character, or 0 if there
685 	 *     is no corresponding character.
686 	 */
687 	public static uint keyvalToUnicode(uint keyval)
688 	{
689 		return gdk_keyval_to_unicode(keyval);
690 	}
691 
692 	/**
693 	 * Converts a key value to upper case, if applicable.
694 	 *
695 	 * Params:
696 	 *     keyval = a key value.
697 	 *
698 	 * Return: the upper case form of @keyval, or @keyval itself if it is already
699 	 *     in upper case or it is not subject to case conversion.
700 	 */
701 	public static uint keyvalToUpper(uint keyval)
702 	{
703 		return gdk_keyval_to_upper(keyval);
704 	}
705 
706 	/**
707 	 * Convert from a ISO10646 character to a key symbol.
708 	 *
709 	 * Params:
710 	 *     wc = a ISO10646 encoded character
711 	 *
712 	 * Return: the corresponding GDK key symbol, if one exists.
713 	 *     or, if there is no corresponding symbol,
714 	 *     wc | 0x01000000
715 	 */
716 	public static uint unicodeToKeyval(uint wc)
717 	{
718 		return gdk_unicode_to_keyval(wc);
719 	}
720 }