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