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