Package ch.bailu.gtk.gtk
Class ShortcutTrigger
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.gtk.ShortcutTrigger
- All Implemented Interfaces:
PointerInterface
- Direct Known Subclasses:
AlternativeTrigger
,KeyvalTrigger
,MnemonicTrigger
,NeverTrigger
`GtkShortcutTrigger` tracks how a `GtkShortcut` should be activated.
To find out if a `GtkShortcutTrigger` triggers, you can call
[method@Gtk.ShortcutTrigger.trigger] on a `GdkEvent`.
`GtkShortcutTriggers` contain functions that allow easy presentation
to end users as well as being printed for debugging.
All `GtkShortcutTriggers` are immutable, you can only specify their
properties during construction. If you want to change a trigger, you
have to replace it with a new one.
To find out if a `GtkShortcutTrigger` triggers, you can call
[method@Gtk.ShortcutTrigger.trigger] on a `GdkEvent`.
`GtkShortcutTriggers` contain functions that allow easy presentation
to end users as well as being printed for debugging.
All `GtkShortcutTriggers` are immutable, you can only specify their
properties during construction. If you want to change a trigger, you
have to replace it with a new one.
-
Nested Class Summary
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Field Summary
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
The types of @trigger1 and @trigger2 are `gconstpointer` only to allow
use of this function as a `GCompareFunc`.boolean
Checks if @trigger1 and @trigger2 trigger under the same conditions.static ClassHandler
static int
static long
static TypeSystem.TypeSize
static long
static TypeSystem.TypeSize
int
hash()
Generates a hash value for a `GtkShortcutTrigger`.static ShortcutTrigger
parseStringShortcutTrigger
(Str string) Tries to parse the given string into a trigger.static ShortcutTrigger
parseStringShortcutTrigger
(String string) Tries to parse the given string into a trigger.void
Prints the given trigger into a string for the developer.boolean
printLabel
(Display display, GString string) Prints the given trigger into a string.Gets textual representation for the given trigger.toStr()
Prints the given trigger into a human-readable string.int
Checks if the given @event triggers @self.Methods inherited from class ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Constructor Details
-
ShortcutTrigger
-
-
Method Details
-
getClassHandler
-
parseStringShortcutTrigger
Tries to parse the given string into a trigger.
On success, the parsed trigger is returned.
When parsing failed, %NULL is returned.
The accepted strings are:
- `never`, for `GtkNeverTrigger`
- a string parsed by gtk_accelerator_parse(), for a `GtkKeyvalTrigger`, e.g. `<Control>C`
- underscore, followed by a single character, for `GtkMnemonicTrigger`, e.g. `_l`
- two valid trigger strings, separated by a `|` character, for a
`GtkAlternativeTrigger`: `<Control>q|<Control>w`
Note that you will have to escape the `<` and `>` characters when specifying
triggers in XML files, such as GtkBuilder ui files. Use `<` instead of
`<` and `>` instead of `>`.- Parameters:
string
- the string to parse- Returns:
- a new `GtkShortcutTrigger`
-
parseStringShortcutTrigger
Tries to parse the given string into a trigger.
On success, the parsed trigger is returned.
When parsing failed, %NULL is returned.
The accepted strings are:
- `never`, for `GtkNeverTrigger`
- a string parsed by gtk_accelerator_parse(), for a `GtkKeyvalTrigger`, e.g. `<Control>C`
- underscore, followed by a single character, for `GtkMnemonicTrigger`, e.g. `_l`
- two valid trigger strings, separated by a `|` character, for a
`GtkAlternativeTrigger`: `<Control>q|<Control>w`
Note that you will have to escape the `<` and `>` characters when specifying
triggers in XML files, such as GtkBuilder ui files. Use `<` instead of
`<` and `>` instead of `>`.- Parameters:
string
- the string to parse- Returns:
- a new `GtkShortcutTrigger`
-
compare
The types of @trigger1 and @trigger2 are `gconstpointer` only to allow
use of this function as a `GCompareFunc`.
They must each be a `GtkShortcutTrigger`.- Parameters:
trigger2
- a `GtkShortcutTrigger`- Returns:
- An integer less than, equal to, or greater than zero if @trigger1 is found, respectively, to be less than, to match, or be greater than @trigger2.
-
equal
Checks if @trigger1 and @trigger2 trigger under the same conditions.
The types of @one and @two are `gconstpointer` only to allow use of this
function with `GHashTable`. They must each be a `GtkShortcutTrigger`.- Parameters:
trigger2
- a `GtkShortcutTrigger`- Returns:
- %TRUE if @trigger1 and @trigger2 are equal
-
hash
public int hash()Generates a hash value for a `GtkShortcutTrigger`.
The output of this function is guaranteed to be the same for a given
value only per-process. It may change between different processor
architectures or even different versions of GTK. Do not use this
function as a basis for building protocols or file formats.
The types of @trigger is `gconstpointer` only to allow use of this
function with `GHashTable`. They must each be a `GtkShortcutTrigger`.- Returns:
- a hash value corresponding to @trigger
-
print
Prints the given trigger into a string for the developer.
This is meant for debugging and logging.
The form of the representation may change at any time
and is not guaranteed to stay identical.- Parameters:
string
- a `GString` to print into
-
printLabel
Prints the given trigger into a string.
This function is returning a translated string for presentation
to end users for example in menu items or in help texts.
The @display in use may influence the resulting string in
various forms, such as resolving hardware keycodes or by
causing display-specific modifier names.
The form of the representation may change at any time and is
not guaranteed to stay identical.- Parameters:
display
- `GdkDisplay` to print forstring
- a `GString` to print into- Returns:
- %TRUE if something was printed or %FALSE if the trigger did not have a textual representation suitable for end users.
-
toLabel
Gets textual representation for the given trigger.
This function is returning a translated string for
presentation to end users for example in menu items
or in help texts.
The @display in use may influence the resulting string in
various forms, such as resolving hardware keycodes or by
causing display-specific modifier names.
The form of the representation may change at any time and is
not guaranteed to stay identical.- Parameters:
display
- `GdkDisplay` to print for- Returns:
- a new string
-
toStr
Prints the given trigger into a human-readable string.
This is a small wrapper around [method@Gtk.ShortcutTrigger.print]
to help when debugging.- Returns:
- a new string
-
trigger
Checks if the given @event triggers @self.- Parameters:
event
- the event to checkenable_mnemonics
- %TRUE if mnemonics should trigger. Usually the value of this property is determined by checking that the passed in @event is a Key event and has the right modifiers set.- Returns:
- Whether the event triggered the shortcut
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-