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 	 * Returns: 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 	 * Returns: 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 	 * Returns: %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 	 * Returns: %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 	 * Returns: %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 	 * Returns: %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 	 * Returns: 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 	 * Returns: 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 	 * Returns: %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 	 * Returns: %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 	 * Returns: %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 	 * Returns: 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 	 * Returns: %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 	 * Returns: %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 		static OnDirectionChangedDelegateWrapper[] listeners;
415 		void delegate(Keymap) dlg;
416 		gulong handlerId;
417 		
418 		this(void delegate(Keymap) dlg)
419 		{
420 			this.dlg = dlg;
421 			this.listeners ~= this;
422 		}
423 		
424 		void remove(OnDirectionChangedDelegateWrapper source)
425 		{
426 			foreach(index, wrapper; listeners)
427 			{
428 				if (wrapper.handlerId == source.handlerId)
429 				{
430 					listeners[index] = null;
431 					listeners = std.algorithm.remove(listeners, index);
432 					break;
433 				}
434 			}
435 		}
436 	}
437 
438 	/**
439 	 * The ::direction-changed signal gets emitted when the direction of
440 	 * the keymap changes.
441 	 *
442 	 * Since: 2.0
443 	 */
444 	gulong addOnDirectionChanged(void delegate(Keymap) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
445 	{
446 		auto wrapper = new OnDirectionChangedDelegateWrapper(dlg);
447 		wrapper.handlerId = Signals.connectData(
448 			this,
449 			"direction-changed",
450 			cast(GCallback)&callBackDirectionChanged,
451 			cast(void*)wrapper,
452 			cast(GClosureNotify)&callBackDirectionChangedDestroy,
453 			connectFlags);
454 		return wrapper.handlerId;
455 	}
456 	
457 	extern(C) static void callBackDirectionChanged(GdkKeymap* keymapStruct, OnDirectionChangedDelegateWrapper wrapper)
458 	{
459 		wrapper.dlg(wrapper.outer);
460 	}
461 	
462 	extern(C) static void callBackDirectionChangedDestroy(OnDirectionChangedDelegateWrapper wrapper, GClosure* closure)
463 	{
464 		wrapper.remove(wrapper);
465 	}
466 
467 	protected class OnKeysChangedDelegateWrapper
468 	{
469 		static OnKeysChangedDelegateWrapper[] listeners;
470 		void delegate(Keymap) dlg;
471 		gulong handlerId;
472 		
473 		this(void delegate(Keymap) dlg)
474 		{
475 			this.dlg = dlg;
476 			this.listeners ~= this;
477 		}
478 		
479 		void remove(OnKeysChangedDelegateWrapper source)
480 		{
481 			foreach(index, wrapper; listeners)
482 			{
483 				if (wrapper.handlerId == source.handlerId)
484 				{
485 					listeners[index] = null;
486 					listeners = std.algorithm.remove(listeners, index);
487 					break;
488 				}
489 			}
490 		}
491 	}
492 
493 	/**
494 	 * The ::keys-changed signal is emitted when the mapping represented by
495 	 * @keymap changes.
496 	 *
497 	 * Since: 2.2
498 	 */
499 	gulong addOnKeysChanged(void delegate(Keymap) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
500 	{
501 		auto wrapper = new OnKeysChangedDelegateWrapper(dlg);
502 		wrapper.handlerId = Signals.connectData(
503 			this,
504 			"keys-changed",
505 			cast(GCallback)&callBackKeysChanged,
506 			cast(void*)wrapper,
507 			cast(GClosureNotify)&callBackKeysChangedDestroy,
508 			connectFlags);
509 		return wrapper.handlerId;
510 	}
511 	
512 	extern(C) static void callBackKeysChanged(GdkKeymap* keymapStruct, OnKeysChangedDelegateWrapper wrapper)
513 	{
514 		wrapper.dlg(wrapper.outer);
515 	}
516 	
517 	extern(C) static void callBackKeysChangedDestroy(OnKeysChangedDelegateWrapper wrapper, GClosure* closure)
518 	{
519 		wrapper.remove(wrapper);
520 	}
521 
522 	protected class OnStateChangedDelegateWrapper
523 	{
524 		static OnStateChangedDelegateWrapper[] listeners;
525 		void delegate(Keymap) dlg;
526 		gulong handlerId;
527 		
528 		this(void delegate(Keymap) dlg)
529 		{
530 			this.dlg = dlg;
531 			this.listeners ~= this;
532 		}
533 		
534 		void remove(OnStateChangedDelegateWrapper source)
535 		{
536 			foreach(index, wrapper; listeners)
537 			{
538 				if (wrapper.handlerId == source.handlerId)
539 				{
540 					listeners[index] = null;
541 					listeners = std.algorithm.remove(listeners, index);
542 					break;
543 				}
544 			}
545 		}
546 	}
547 
548 	/**
549 	 * The ::state-changed signal is emitted when the state of the
550 	 * keyboard changes, e.g when Caps Lock is turned on or off.
551 	 * See gdk_keymap_get_caps_lock_state().
552 	 *
553 	 * Since: 2.16
554 	 */
555 	gulong addOnStateChanged(void delegate(Keymap) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
556 	{
557 		auto wrapper = new OnStateChangedDelegateWrapper(dlg);
558 		wrapper.handlerId = Signals.connectData(
559 			this,
560 			"state-changed",
561 			cast(GCallback)&callBackStateChanged,
562 			cast(void*)wrapper,
563 			cast(GClosureNotify)&callBackStateChangedDestroy,
564 			connectFlags);
565 		return wrapper.handlerId;
566 	}
567 	
568 	extern(C) static void callBackStateChanged(GdkKeymap* keymapStruct, OnStateChangedDelegateWrapper wrapper)
569 	{
570 		wrapper.dlg(wrapper.outer);
571 	}
572 	
573 	extern(C) static void callBackStateChangedDestroy(OnStateChangedDelegateWrapper wrapper, GClosure* closure)
574 	{
575 		wrapper.remove(wrapper);
576 	}
577 
578 	/**
579 	 * Obtains the upper- and lower-case versions of the keyval @symbol.
580 	 * Examples of keyvals are #GDK_KEY_a, #GDK_KEY_Enter, #GDK_KEY_F1, etc.
581 	 *
582 	 * Params:
583 	 *     symbol = a keyval
584 	 *     lower = return location for lowercase version of @symbol
585 	 *     upper = return location for uppercase version of @symbol
586 	 */
587 	public static void keyvalConvertCase(uint symbol, out uint lower, out uint upper)
588 	{
589 		gdk_keyval_convert_case(symbol, &lower, &upper);
590 	}
591 
592 	/**
593 	 * Converts a key name to a key value.
594 	 *
595 	 * The names are the same as those in the
596 	 * `gdk/gdkkeysyms.h` header file
597 	 * but without the leading “GDK_KEY_”.
598 	 *
599 	 * Params:
600 	 *     keyvalName = a key name
601 	 *
602 	 * Returns: the corresponding key value, or %GDK_KEY_VoidSymbol
603 	 *     if the key name is not a valid key
604 	 */
605 	public static uint keyvalFromName(string keyvalName)
606 	{
607 		return gdk_keyval_from_name(Str.toStringz(keyvalName));
608 	}
609 
610 	/**
611 	 * Returns %TRUE if the given key value is in lower case.
612 	 *
613 	 * Params:
614 	 *     keyval = a key value.
615 	 *
616 	 * Returns: %TRUE if @keyval is in lower case, or if @keyval is not
617 	 *     subject to case conversion.
618 	 */
619 	public static bool keyvalIsLower(uint keyval)
620 	{
621 		return gdk_keyval_is_lower(keyval) != 0;
622 	}
623 
624 	/**
625 	 * Returns %TRUE if the given key value is in upper case.
626 	 *
627 	 * Params:
628 	 *     keyval = a key value.
629 	 *
630 	 * Returns: %TRUE if @keyval is in upper case, or if @keyval is not subject to
631 	 *     case conversion.
632 	 */
633 	public static bool keyvalIsUpper(uint keyval)
634 	{
635 		return gdk_keyval_is_upper(keyval) != 0;
636 	}
637 
638 	/**
639 	 * Converts a key value into a symbolic name.
640 	 *
641 	 * The names are the same as those in the
642 	 * `gdk/gdkkeysyms.h` header file
643 	 * but without the leading “GDK_KEY_”.
644 	 *
645 	 * Params:
646 	 *     keyval = a key value
647 	 *
648 	 * Returns: a string containing the name
649 	 *     of the key, or %NULL if @keyval is not a valid key. The string
650 	 *     should not be modified.
651 	 */
652 	public static string keyvalName(uint keyval)
653 	{
654 		return Str.toString(gdk_keyval_name(keyval));
655 	}
656 
657 	/**
658 	 * Converts a key value to lower case, if applicable.
659 	 *
660 	 * Params:
661 	 *     keyval = a key value.
662 	 *
663 	 * Returns: the lower case form of @keyval, or @keyval itself if it is already
664 	 *     in lower case or it is not subject to case conversion.
665 	 */
666 	public static uint keyvalToLower(uint keyval)
667 	{
668 		return gdk_keyval_to_lower(keyval);
669 	}
670 
671 	/**
672 	 * Convert from a GDK key symbol to the corresponding ISO10646 (Unicode)
673 	 * character.
674 	 *
675 	 * Params:
676 	 *     keyval = a GDK key symbol
677 	 *
678 	 * Returns: the corresponding unicode character, or 0 if there
679 	 *     is no corresponding character.
680 	 */
681 	public static uint keyvalToUnicode(uint keyval)
682 	{
683 		return gdk_keyval_to_unicode(keyval);
684 	}
685 
686 	/**
687 	 * Converts a key value to upper case, if applicable.
688 	 *
689 	 * Params:
690 	 *     keyval = a key value.
691 	 *
692 	 * Returns: the upper case form of @keyval, or @keyval itself if it is already
693 	 *     in upper case or it is not subject to case conversion.
694 	 */
695 	public static uint keyvalToUpper(uint keyval)
696 	{
697 		return gdk_keyval_to_upper(keyval);
698 	}
699 
700 	/**
701 	 * Convert from a ISO10646 character to a key symbol.
702 	 *
703 	 * Params:
704 	 *     wc = a ISO10646 encoded character
705 	 *
706 	 * Returns: the corresponding GDK key symbol, if one exists.
707 	 *     or, if there is no corresponding symbol,
708 	 *     wc | 0x01000000
709 	 */
710 	public static uint unicodeToKeyval(uint wc)
711 	{
712 		return gdk_unicode_to_keyval(wc);
713 	}
714 }