Package ch.bailu.gtk.glib
Class OptionGroup
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.type.Record
ch.bailu.gtk.glib.OptionGroup
- All Implemented Interfaces:
PointerInterface
A `GOptionGroup` struct defines the options in a single
group. The struct has only private fields and should not be directly accessed.
All options in a group share the same translation function. Libraries which
need to parse commandline options are expected to provide a function for
getting a `GOptionGroup` holding their options, which
the application can then add to its #GOptionContext.
group. The struct has only private fields and should not be directly accessed.
All options in a group share the same translation function. Libraries which
need to parse commandline options are expected to provide a function for
getting a `GOptionGroup` holding their options, which
the application can then add to its #GOptionContext.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
static interface
static interface
-
Field Summary
-
Constructor Summary
ConstructorDescriptionOptionGroup
(PointerContainer pointer) OptionGroup
(Str name, Str description, Str help_description, Pointer user_data, OptionGroup.OnDestroyNotify destroy) Creates a new #GOptionGroup.OptionGroup
(String name, String description, String help_description, Pointer user_data, OptionGroup.OnDestroyNotify destroy) Creates a new #GOptionGroup. -
Method Summary
Modifier and TypeMethodDescriptionstatic ClassHandler
static int
static long
static TypeSystem.TypeSize
static long
static TypeSystem.TypeSize
ref()
Increments the reference count of @group by one.void
setErrorHook
(OptionGroup.OnOptionErrorFunc error_func) Associates a function with @group which will be called
from g_option_context_parse() when an error occurs.void
setParseHooks
(OptionGroup.OnOptionParseFunc pre_parse_func, OptionGroup.OnOptionParseFunc post_parse_func) Associates two functions with @group which will be called
from g_option_context_parse() before the first option is parsed
and after the last option has been parsed, respectively.void
setTranslateFunc
(OptionGroup.OnTranslateFunc func, Pointer data, OptionGroup.OnDestroyNotify destroy_notify) Sets the function which is used to translate user-visible strings,
for `--help` output.void
setTranslationDomain
(Str domain) A convenience function to use gettext() for translating
user-visible strings.void
setTranslationDomain
(String domain) A convenience function to use gettext() for translating
user-visible strings.void
unref()
Decrements the reference count of @group by one.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
-
OptionGroup
-
OptionGroup
public OptionGroup(@Nonnull Str name, @Nonnull Str description, @Nonnull Str help_description, @Nullable Pointer user_data, OptionGroup.OnDestroyNotify destroy) Creates a new #GOptionGroup.- Parameters:
name
- the name for the option group, this is used to provide help for the options in this group with `--help-`@namedescription
- a description for this group to be shown in `--help`. This string is translated using the translation domain or translation function of the grouphelp_description
- a description for the `--help-`@name option. This string is translated using the translation domain or translation function of the groupuser_data
- user data that will be passed to the pre- and post-parse hooks, the error hook and to callbacks of %G_OPTION_ARG_CALLBACK options, or %NULLdestroy
- a function that will be called to free @user_data, or %NULL
-
OptionGroup
public OptionGroup(String name, String description, String help_description, @Nullable Pointer user_data, OptionGroup.OnDestroyNotify destroy) Creates a new #GOptionGroup.- Parameters:
name
- the name for the option group, this is used to provide help for the options in this group with `--help-`@namedescription
- a description for this group to be shown in `--help`. This string is translated using the translation domain or translation function of the grouphelp_description
- a description for the `--help-`@name option. This string is translated using the translation domain or translation function of the groupuser_data
- user data that will be passed to the pre- and post-parse hooks, the error hook and to callbacks of %G_OPTION_ARG_CALLBACK options, or %NULLdestroy
- a function that will be called to free @user_data, or %NULL
-
-
Method Details
-
getClassHandler
-
ref
Increments the reference count of @group by one.- Returns:
- a #GOptionGroup
-
setErrorHook
Associates a function with @group which will be called
from g_option_context_parse() when an error occurs.
Note that the user data to be passed to @error_func can be
specified when constructing the group with g_option_group_new().- Parameters:
error_func
- a function to call when an error occurs
-
setParseHooks
public void setParseHooks(OptionGroup.OnOptionParseFunc pre_parse_func, OptionGroup.OnOptionParseFunc post_parse_func) Associates two functions with @group which will be called
from g_option_context_parse() before the first option is parsed
and after the last option has been parsed, respectively.
Note that the user data to be passed to @pre_parse_func and
@post_parse_func can be specified when constructing the group
with g_option_group_new().- Parameters:
pre_parse_func
- a function to call before parsing, or %NULLpost_parse_func
- a function to call after parsing, or %NULL
-
setTranslateFunc
public void setTranslateFunc(OptionGroup.OnTranslateFunc func, @Nullable Pointer data, OptionGroup.OnDestroyNotify destroy_notify) Sets the function which is used to translate user-visible strings,
for `--help` output. Different groups can use different
#GTranslateFuncs. If @func is %NULL, strings are not translated.
If you are using gettext(), you only need to set the translation
domain, see g_option_group_set_translation_domain().- Parameters:
func
- the #GTranslateFunc, or %NULLdata
- user data to pass to @func, or %NULLdestroy_notify
- a function which gets called to free @data, or %NULL
-
setTranslationDomain
A convenience function to use gettext() for translating
user-visible strings.- Parameters:
domain
- the domain to use
-
setTranslationDomain
A convenience function to use gettext() for translating
user-visible strings.- Parameters:
domain
- the domain to use
-
unref
public void unref()Decrements the reference count of @group by one.
If the reference count drops to 0, the @group will be freed.
and all memory allocated by the @group is released. -
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-