Package ch.bailu.gtk.gtk
Class Gtk
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Package
ch.bailu.gtk.gtk.Gtk
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
static interface
static interface
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
Gets the modifier mask.static Str
acceleratorGetLabel
(int accelerator_key, int accelerator_mods) Converts an accelerator keyval and modifier mask into a string
which can be used to represent the accelerator to the user.static Str
acceleratorGetLabelWithKeycode
(Display display, int accelerator_key, int keycode, int accelerator_mods) Converts an accelerator keyval and modifier mask
into a string that can be displayed to the user.static Str
acceleratorName
(int accelerator_key, int accelerator_mods) Converts an accelerator keyval and modifier mask into a string
parseable by gtk_accelerator_parse().static Str
acceleratorNameWithKeycode
(Display display, int accelerator_key, int keycode, int accelerator_mods) Converts an accelerator keyval and modifier mask
into a string parseable by gtk_accelerator_parse_with_keycode().static boolean
acceleratorValid
(int keyval, int modifiers) Determines whether a given keyval and modifier mask constitute
a valid keyboard accelerator.static void
accessiblePropertyInitValue
(int property, Value value) static void
accessibleRelationInitValue
(int relation, Value value) static void
accessibleStateInitValue
(int state, Value value) static int
static Str
checkVersion
(int required_major, int required_minor, int required_micro) Checks that the GTK library in use is compatible with the
given version.static int
static int
static int
static void
Prevents [id@gtk_init] and [id@gtk_init_check] from automatically calling
`setlocale (LC_ALL, "")`.static boolean
editableDelegateGetProperty
(Object object, int prop_id, Value value, ParamSpec pspec) Gets a property of the `GtkEditable` delegate for @object.static boolean
editableDelegateSetProperty
(Object object, int prop_id, Value value, ParamSpec pspec) Sets a property on the `GtkEditable` delegate for @object.static int
editableInstallProperties
(ObjectClass object_class, int first_prop) Overrides the `GtkEditable` properties for @class.static void
enumeratePrinters
(Gtk.OnPrinterFunc func, Pointer data, Gtk.OnDestroyNotify destroy, boolean wait) Calls a function for all `GtkPrinter`s.static int
Registers an error quark for `GtkFileChooser` errors.static int
Returns the binary age as passed to `libtool`.static ClassHandler
static int
Returns the GTK debug flags that are currently active.static Language
Returns the `PangoLanguage` for the default language
currently in effect.static int
Returns the interface age as passed to `libtool`.static int
Get the direction of the current locale.static int
Returns the major version number of the GTK library.static int
Returns the micro version number of the GTK library.static int
Returns the minor version number of the GTK library.static void
Converts a color from HSV space to RGB.static int
static void
init()
Call this function before using any other GTK functions in your GUI
applications.static boolean
This function does the same work as gtk_init() with only a single
change: It does not terminate the program if the windowing system
can’t be initialized.static boolean
Use this function to check if GTK has been initialized with gtk_init()
or gtk_init_check().static Native
nativeGetForSurface
(Surface surface) Finds the `GtkNative` associated with the surface.static int
orderingFromCmpfunc
(int cmpfunc_result) Converts the result of a `GCompareFunc` like strcmp() to a
`GtkOrdering` value.static Str
Returns the name of the default paper size, which
depends on the current locale.static List
paperSizeGetPaperSizes
(boolean include_custom) Creates a list of known paper sizes.static ParamSpec
paramSpecExpression
(Str name, Str nick, Str blurb, int flags) Creates a new `GParamSpec` instance for a property holding a `GtkExpression`.static int
Registers an error quark for `GtkPrintOperation` if necessary.static PageSetup
printRunPageSetupDialog
(Window parent, PageSetup page_setup, PrintSettings settings) Runs a page setup dialog, letting the user modify the values from
@page_setup.static void
printRunPageSetupDialogAsync
(Window parent, PageSetup page_setup, PrintSettings settings, Gtk.OnPageSetupDoneFunc done_cb, Pointer data) Runs a page setup dialog, letting the user modify the values from @page_setup.static int
static void
renderActivity
(StyleContext context, Context cr, double x, double y, double width, double height) Renders an activity indicator (such as in `GtkSpinner`).static void
renderArrow
(StyleContext context, Context cr, double angle, double x, double y, double size) Renders an arrow pointing to @angle.static void
renderBackground
(StyleContext context, Context cr, double x, double y, double width, double height) Renders the background of an element.static void
renderCheck
(StyleContext context, Context cr, double x, double y, double width, double height) Renders a checkmark (as in a `GtkCheckButton`).static void
renderExpander
(StyleContext context, Context cr, double x, double y, double width, double height) Renders an expander (as used in `GtkTreeView` and `GtkExpander`) in the area
defined by @x, @y, @width, @height.static void
renderFocus
(StyleContext context, Context cr, double x, double y, double width, double height) Renders a focus indicator on the rectangle determined by @x, @y, @width, @height.static void
renderFrame
(StyleContext context, Context cr, double x, double y, double width, double height) Renders a frame around the rectangle defined by @x, @y, @width, @height.static void
renderHandle
(StyleContext context, Context cr, double x, double y, double width, double height) Renders a handle (as in `GtkPaned` and `GtkWindow`’s resize grip),
in the rectangle determined by @x, @y, @width, @height.static void
renderIcon
(StyleContext context, Context cr, Texture texture, double x, double y) Renders the icon in @texture at the specified @x and @y coordinates.static void
renderLayout
(StyleContext context, Context cr, double x, double y, Layout layout) Renders @layout on the coordinates @x, @ystatic void
renderLine
(StyleContext context, Context cr, double x0, double y0, double x1, double y1) Renders a line from (x0, y0) to (x1, y1).static void
renderOption
(StyleContext context, Context cr, double x, double y, double width, double height) Renders an option mark (as in a radio button), the %GTK_STATE_FLAG_CHECKED
state will determine whether the option is on or off, and
%GTK_STATE_FLAG_INCONSISTENT whether it should be marked as undefined.static void
Converts a color from RGB space to HSV.static void
setDebugFlags
(int flags) Sets the GTK debug flags.static void
showAboutDialog
(Window parent, Str first_property_name, Object... _elipse) A convenience function for showing an application’s about dialog.static void
This function launches the default application for showing
a given uri, or shows an error dialog if that fails.static void
showUriFull
(Window parent, Str uri, int timestamp, Cancellable cancellable, Gtk.OnAsyncReadyCallback callback, Pointer user_data) This function launches the default application for showing
a given uri.static boolean
showUriFullFinish
(Window parent, AsyncResult result) Finishes the gtk_show_uri() call and returns the result
of the operation.static void
testAccessibleAssertionMessageRole
(Str domain, Str file, int line, Str func, Str expr, Accessible accessible, int expected_role, int actual_role) static Str
testAccessibleCheckProperty
(Accessible accessible, int property, Object... _elipse) Checks whether the accessible @property of @accessible is set to
a specific value.static Str
testAccessibleCheckRelation
(Accessible accessible, int relation, Object... _elipse) Checks whether the accessible @relation of @accessible is set to
a specific value.static Str
testAccessibleCheckState
(Accessible accessible, int state, Object... _elipse) Checks whether the accessible @state of @accessible is set to
a specific value.static boolean
testAccessibleHasProperty
(Accessible accessible, int property) Checks whether the `GtkAccessible` has @property set.static boolean
testAccessibleHasRelation
(Accessible accessible, int relation) Checks whether the `GtkAccessible` has @relation set.static boolean
testAccessibleHasRole
(Accessible accessible, int role) Checks whether the `GtkAccessible:accessible-role` of the accessible
is @role.static boolean
testAccessibleHasState
(Accessible accessible, int state) Checks whether the `GtkAccessible` has @state set.static void
Force registration of all core GTK object types.static void
testWidgetWaitForDraw
(Widget widget) Enters the main loop and waits for @widget to be “drawn”.static ContentProvider
treeCreateRowDragContent
(TreeModel tree_model, TreePath path) Creates a content provider for dragging @path from @tree_model.static void
treeRowReferenceDeleted
(Object proxy, TreePath path) Lets a set of row reference created by
gtk_tree_row_reference_new_proxy() know that the
model emitted the ::row-deleted signal.static void
treeRowReferenceInserted
(Object proxy, TreePath path) Lets a set of row reference created by
gtk_tree_row_reference_new_proxy() know that the
model emitted the ::row-inserted signal.static void
treeRowReferenceReordered
(Object proxy, TreePath path, TreeIter iter, Int new_order) Lets a set of row reference created by
gtk_tree_row_reference_new_proxy() know that the
model emitted the ::rows-reordered signal.static Expression
valueDupExpression
(Value value) Retrieves the `GtkExpression` stored inside the given `value`, and acquires
a reference to it.static Expression
valueGetExpression
(Value value) Retrieves the `GtkExpression` stored inside the given `value`.static void
valueSetExpression
(Value value, Expression expression) Stores the given `GtkExpression` inside `value`.static void
valueTakeExpression
(Value value, Expression expression) Stores the given `GtkExpression` inside `value`.Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
-
Constructor Details
-
Gtk
public Gtk()
-
-
Method Details
-
getClassHandler
-
acceleratorGetDefaultModMask
public static int acceleratorGetDefaultModMask()Gets the modifier mask.
The modifier mask determines which modifiers are considered significant
for keyboard accelerators. This includes all keyboard modifiers except
for %GDK_LOCK_MASK.- Returns:
- the modifier mask for accelerators
-
acceleratorGetLabel
Converts an accelerator keyval and modifier mask into a string
which can be used to represent the accelerator to the user.- Parameters:
accelerator_key
- accelerator keyvalaccelerator_mods
- accelerator modifier mask- Returns:
- a newly-allocated string representing the accelerator
-
acceleratorGetLabelWithKeycode
public static Str acceleratorGetLabelWithKeycode(@Nullable Display display, int accelerator_key, int keycode, int accelerator_mods) Converts an accelerator keyval and modifier mask
into a string that can be displayed to the user.
The string may be translated.
This function is similar to [func@Gtk.accelerator_get_label],
but handling keycodes. This is only useful for system-level
components, applications should use [func@Gtk.accelerator_get_label]
instead.- Parameters:
display
- a `GdkDisplay` or %NULL to use the default displayaccelerator_key
- accelerator keyvalkeycode
- accelerator keycodeaccelerator_mods
- accelerator modifier mask- Returns:
- a newly-allocated string representing the accelerator
-
acceleratorName
Converts an accelerator keyval and modifier mask into a string
parseable by gtk_accelerator_parse().
For example, if you pass in %GDK_KEY_q and %GDK_CONTROL_MASK,
this function returns `<Control>q`.
If you need to display accelerators in the user interface,
see [func@Gtk.accelerator_get_label].- Parameters:
accelerator_key
- accelerator keyvalaccelerator_mods
- accelerator modifier mask- Returns:
- a newly-allocated accelerator name
-
acceleratorNameWithKeycode
public static Str acceleratorNameWithKeycode(@Nullable Display display, int accelerator_key, int keycode, int accelerator_mods) Converts an accelerator keyval and modifier mask
into a string parseable by gtk_accelerator_parse_with_keycode().
This is similar to [func@Gtk.accelerator_name] but handling keycodes.
This is only useful for system-level components, applications
should use [func@Gtk.accelerator_name] instead.- Parameters:
display
- a `GdkDisplay` or %NULL to use the default displayaccelerator_key
- accelerator keyvalkeycode
- accelerator keycodeaccelerator_mods
- accelerator modifier mask- Returns:
- a newly allocated accelerator name.
-
acceleratorValid
public static boolean acceleratorValid(int keyval, int modifiers) Determines whether a given keyval and modifier mask constitute
a valid keyboard accelerator.
For example, the %GDK_KEY_a keyval plus %GDK_CONTROL_MASK mark is valid,
and matches the “Ctrl+a” accelerator. But, you can't, for instance, use
the %GDK_KEY_Control_L keyval as an accelerator.- Parameters:
keyval
- a GDK keyvalmodifiers
- modifier mask- Returns:
- %TRUE if the accelerator is valid
-
accessiblePropertyInitValue
- Parameters:
property
-value
-
-
accessibleRelationInitValue
- Parameters:
relation
-value
-
-
accessibleStateInitValue
- Parameters:
state
-value
-
-
builderErrorQuark
public static int builderErrorQuark()- Returns:
-
checkVersion
Checks that the GTK library in use is compatible with the
given version.
Generally you would pass in the constants %GTK_MAJOR_VERSION,
%GTK_MINOR_VERSION, %GTK_MICRO_VERSION as the three arguments
to this function; that produces a check that the library in
use is compatible with the version of GTK the application or
module was compiled against.
Compatibility is defined by two things: first the version
of the running library is newer than the version
@required_major.required_minor.@required_micro. Second
the running library must be binary compatible with the
version @required_major.required_minor.@required_micro
(same major version.)
This function is primarily for GTK modules; the module
can call this function to check that it wasn’t loaded
into an incompatible version of GTK. However, such a
check isn’t completely reliable, since the module may be
linked against an old version of GTK and calling the
old version of gtk_check_version(), but still get loaded
into an application using a newer version of GTK.- Parameters:
required_major
- the required major versionrequired_minor
- the required minor versionrequired_micro
- the required micro version- Returns:
- %NULL if the GTK library is compatible with the given version, or a string describing the version mismatch. The returned string is owned by GTK and should not be modified or freed.
-
constraintVflParserErrorQuark
public static int constraintVflParserErrorQuark()- Returns:
-
cssParserErrorQuark
public static int cssParserErrorQuark()- Returns:
-
cssParserWarningQuark
public static int cssParserWarningQuark()- Returns:
-
disableSetlocale
public static void disableSetlocale()Prevents [id@gtk_init] and [id@gtk_init_check] from automatically calling
`setlocale (LC_ALL, "")`.
You would want to use this function if you wanted to set the locale for
your program to something other than the user’s locale, or if
you wanted to set different values for different locale categories.
Most programs should not need to call this function. -
editableDelegateGetProperty
public static boolean editableDelegateGetProperty(@Nonnull Object object, int prop_id, @Nonnull Value value, @Nonnull ParamSpec pspec) Gets a property of the `GtkEditable` delegate for @object.
This is helper function that should be called in the `get_property`
function of your `GtkEditable` implementation, before handling your
own properties.- Parameters:
object
- a `GObject`prop_id
- a property IDvalue
- value to setpspec
- the `GParamSpec` for the property- Returns:
- %TRUE if the property was found
-
editableDelegateSetProperty
public static boolean editableDelegateSetProperty(@Nonnull Object object, int prop_id, @Nonnull Value value, @Nonnull ParamSpec pspec) Sets a property on the `GtkEditable` delegate for @object.
This is a helper function that should be called in the `set_property`
function of your `GtkEditable` implementation, before handling your
own properties.- Parameters:
object
- a `GObject`prop_id
- a property IDvalue
- value to setpspec
- the `GParamSpec` for the property- Returns:
- %TRUE if the property was found
-
editableInstallProperties
Overrides the `GtkEditable` properties for @class.
This is a helper function that should be called in class_init,
after installing your own properties.
Note that your class must have "text", "cursor-position",
"selection-bound", "editable", "width-chars", "max-width-chars",
"xalign" and "enable-undo" properties for this function to work.
To handle the properties in your set_property and get_property
functions, you can either use [func@Gtk.Editable.delegate_set_property]
and [func@Gtk.Editable.delegate_get_property] (if you are using
a delegate), or remember the @first_prop offset and add it to the
values in the [enum@Gtk.EditableProperties] enumeration to get the
property IDs for these properties.- Parameters:
object_class
- a `GObjectClass`first_prop
- property ID to use for the first property- Returns:
- the number of properties that were installed
-
enumeratePrinters
public static void enumeratePrinters(Gtk.OnPrinterFunc func, @Nullable Pointer data, Gtk.OnDestroyNotify destroy, boolean wait) Calls a function for all `GtkPrinter`s.
If @func returns %TRUE, the enumeration is stopped.- Parameters:
func
- a function to call for each printerdata
- user data to pass to @funcdestroy
- function to call if @data is no longer neededwait
- if %TRUE, wait in a recursive mainloop until all printers are enumerated; otherwise return early
-
fileChooserErrorQuark
public static int fileChooserErrorQuark()Registers an error quark for `GtkFileChooser` errors.- Returns:
- The error quark used for `GtkFileChooser` errors.
-
getBinaryAge
public static int getBinaryAge()Returns the binary age as passed to `libtool`.
If `libtool` means nothing to you, don't worry about it.- Returns:
- the binary age of the GTK library
-
getDebugFlags
public static int getDebugFlags()Returns the GTK debug flags that are currently active.
This function is intended for GTK modules that want
to adjust their debug output based on GTK debug flags.- Returns:
- the GTK debug flags.
-
getDefaultLanguage
Returns the `PangoLanguage` for the default language
currently in effect.
Note that this can change over the life of an
application.
The default language is derived from the current
locale. It determines, for example, whether GTK uses
the right-to-left or left-to-right text direction.
This function is equivalent to
[func@Pango.Language.get_default].
See that function for details.- Returns:
- the default language as a `PangoLanguage`
-
getInterfaceAge
public static int getInterfaceAge()Returns the interface age as passed to `libtool`.
If `libtool` means nothing to you, don't worry about it.- Returns:
- the interface age of the GTK library
-
getLocaleDirection
public static int getLocaleDirection()Get the direction of the current locale. This is the expected
reading direction for text and UI.
This function depends on the current locale being set with
setlocale() and will default to setting the %GTK_TEXT_DIR_LTR
direction otherwise. %GTK_TEXT_DIR_NONE will never be returned.
GTK sets the default text direction according to the locale
during gtk_init(), and you should normally use
gtk_widget_get_direction() or gtk_widget_get_default_direction()
to obtain the current direction.
This function is only needed rare cases when the locale is
changed after GTK has already been initialized. In this case,
you can use it to update the default text direction as follows:
<!-- language="C" --> #include <locale.h> static void update_locale (const char *new_locale) { setlocale (LC_ALL, new_locale); GtkTextDirection direction = gtk_get_locale_direction (); gtk_widget_set_default_direction (direction); }
- Returns:
- the `GtkTextDirection` of the current locale
-
getMajorVersion
public static int getMajorVersion()Returns the major version number of the GTK library.
For example, in GTK version 3.1.5 this is 3.
This function is in the library, so it represents the GTK library
your code is running against. Contrast with the %GTK_MAJOR_VERSION
macro, which represents the major version of the GTK headers you
have included when compiling your code.- Returns:
- the major version number of the GTK library
-
getMicroVersion
public static int getMicroVersion()Returns the micro version number of the GTK library.
For example, in GTK version 3.1.5 this is 5.
This function is in the library, so it represents the GTK library
your code is are running against. Contrast with the
%GTK_MICRO_VERSION macro, which represents the micro version of the
GTK headers you have included when compiling your code.- Returns:
- the micro version number of the GTK library
-
getMinorVersion
public static int getMinorVersion()Returns the minor version number of the GTK library.
For example, in GTK version 3.1.5 this is 1.
This function is in the library, so it represents the GTK library
your code is are running against. Contrast with the
%GTK_MINOR_VERSION macro, which represents the minor version of the
GTK headers you have included when compiling your code.- Returns:
- the minor version number of the GTK library
-
hsvToRgb
public static void hsvToRgb(float h, float s, float v, @Nonnull Flt r, @Nonnull Flt g, @Nonnull Flt b) Converts a color from HSV space to RGB.
Input values must be in the [0.0, 1.0] range;
output values will be in the same range.- Parameters:
h
- Hues
- Saturationv
- Valuer
- Return value for the red componentg
- Return value for the green componentb
- Return value for the blue component
-
iconThemeErrorQuark
public static int iconThemeErrorQuark()- Returns:
-
init
public static void init()Call this function before using any other GTK functions in your GUI
applications. It will initialize everything needed to operate the
toolkit.
If you are using `GtkApplication`, you don't have to call gtk_init()
or gtk_init_check(); the `GApplication::startup` handler
does it for you.
This function will terminate your program if it was unable to
initialize the windowing system for some reason. If you want
your program to fall back to a textual interface you want to
call gtk_init_check() instead.
GTK calls `signal (SIGPIPE, SIG_IGN)`
during initialization, to ignore SIGPIPE signals, since these are
almost never wanted in graphical applications. If you do need to
handle SIGPIPE for some reason, reset the handler after gtk_init(),
but notice that other libraries (e.g. libdbus or gvfs) might do
similar things. -
initCheck
public static boolean initCheck()This function does the same work as gtk_init() with only a single
change: It does not terminate the program if the windowing system
can’t be initialized. Instead it returns %FALSE on failure.
This way the application can fall back to some other means of
communication with the user - for example a curses or command line
interface.- Returns:
- %TRUE if the windowing system has been successfully initialized, %FALSE otherwise
-
isInitialized
public static boolean isInitialized()Use this function to check if GTK has been initialized with gtk_init()
or gtk_init_check().- Returns:
- the initialization status
-
nativeGetForSurface
Finds the `GtkNative` associated with the surface.- Parameters:
surface
- a `GdkSurface`- Returns:
- the `GtkNative` that is associated with @surface
-
orderingFromCmpfunc
public static int orderingFromCmpfunc(int cmpfunc_result) Converts the result of a `GCompareFunc` like strcmp() to a
`GtkOrdering` value.- Parameters:
cmpfunc_result
- Result of a comparison function- Returns:
- the corresponding `GtkOrdering`
-
paperSizeGetDefault
Returns the name of the default paper size, which
depends on the current locale.- Returns:
- the name of the default paper size. The string is owned by GTK and should not be modified.
-
paperSizeGetPaperSizes
Creates a list of known paper sizes.- Parameters:
include_custom
- whether to include custom paper sizes as defined in the page setup dialog- Returns:
- a newly allocated list of newly allocated `GtkPaperSize` objects
-
paramSpecExpression
public static ParamSpec paramSpecExpression(@Nonnull Str name, @Nonnull Str nick, @Nonnull Str blurb, int flags) Creates a new `GParamSpec` instance for a property holding a `GtkExpression`.
See `g_param_spec_internal()` for details on the property strings.- Parameters:
name
- canonical name of the propertynick
- a user-readable name for the propertyblurb
- a user-readable description of the propertyflags
- flags for the property- Returns:
- a newly created property specification
-
printErrorQuark
public static int printErrorQuark()Registers an error quark for `GtkPrintOperation` if necessary.- Returns:
- The error quark used for `GtkPrintOperation` errors.
-
printRunPageSetupDialog
public static PageSetup printRunPageSetupDialog(@Nullable Window parent, @Nullable PageSetup page_setup, @Nonnull PrintSettings settings) Runs a page setup dialog, letting the user modify the values from
@page_setup. If the user cancels the dialog, the returned `GtkPageSetup`
is identical to the passed in @page_setup, otherwise it contains the
modifications done in the dialog.
Note that this function may use a recursive mainloop to show the page
setup dialog. See gtk_print_run_page_setup_dialog_async() if this is
a problem.- Parameters:
parent
- transient parentpage_setup
- an existing `GtkPageSetup`settings
- a `GtkPrintSettings`- Returns:
- a new `GtkPageSetup`
-
printRunPageSetupDialogAsync
public static void printRunPageSetupDialogAsync(@Nullable Window parent, @Nullable PageSetup page_setup, @Nonnull PrintSettings settings, Gtk.OnPageSetupDoneFunc done_cb, @Nullable Pointer data) Runs a page setup dialog, letting the user modify the values from @page_setup.
In contrast to gtk_print_run_page_setup_dialog(), this function returns after
showing the page setup dialog on platforms that support this, and calls @done_cb
from a signal handler for the ::response signal of the dialog.- Parameters:
parent
- transient parentpage_setup
- an existing `GtkPageSetup`settings
- a `GtkPrintSettings`done_cb
- a function to call when the user saves the modified page setupdata
- user data to pass to @done_cb
-
recentManagerErrorQuark
public static int recentManagerErrorQuark()- Returns:
-
renderActivity
public static void renderActivity(@Nonnull StyleContext context, @Nonnull Context cr, double x, double y, double width, double height) Renders an activity indicator (such as in `GtkSpinner`).
The state %GTK_STATE_FLAG_CHECKED determines whether there is
activity going on.- Parameters:
context
- a `GtkStyleContext`cr
- a `cairo_t`x
- X origin of the rectangley
- Y origin of the rectanglewidth
- rectangle widthheight
- rectangle height
-
renderArrow
public static void renderArrow(@Nonnull StyleContext context, @Nonnull Context cr, double angle, double x, double y, double size) Renders an arrow pointing to @angle.
Typical arrow rendering at 0, 1⁄2 π;, π; and 3⁄2 π:
![](arrows.png)- Parameters:
context
- a `GtkStyleContext`cr
- a `cairo_t`angle
- arrow angle from 0 to 2 * %G_PI, being 0 the arrow pointing to the northx
- X origin of the render areay
- Y origin of the render areasize
- square side for render area
-
renderBackground
public static void renderBackground(@Nonnull StyleContext context, @Nonnull Context cr, double x, double y, double width, double height) Renders the background of an element.
Typical background rendering, showing the effect of
`background-image`, `border-width` and `border-radius`:
![](background.png)- Parameters:
context
- a `GtkStyleContext`cr
- a `cairo_t`x
- X origin of the rectangley
- Y origin of the rectanglewidth
- rectangle widthheight
- rectangle height
-
renderCheck
public static void renderCheck(@Nonnull StyleContext context, @Nonnull Context cr, double x, double y, double width, double height) Renders a checkmark (as in a `GtkCheckButton`).
The %GTK_STATE_FLAG_CHECKED state determines whether the check is
on or off, and %GTK_STATE_FLAG_INCONSISTENT determines whether it
should be marked as undefined.
Typical checkmark rendering:
![](checks.png)- Parameters:
context
- a `GtkStyleContext`cr
- a `cairo_t`x
- X origin of the rectangley
- Y origin of the rectanglewidth
- rectangle widthheight
- rectangle height
-
renderExpander
public static void renderExpander(@Nonnull StyleContext context, @Nonnull Context cr, double x, double y, double width, double height) Renders an expander (as used in `GtkTreeView` and `GtkExpander`) in the area
defined by @x, @y, @width, @height. The state %GTK_STATE_FLAG_CHECKED
determines whether the expander is collapsed or expanded.
Typical expander rendering:
![](expanders.png)- Parameters:
context
- a `GtkStyleContext`cr
- a `cairo_t`x
- X origin of the rectangley
- Y origin of the rectanglewidth
- rectangle widthheight
- rectangle height
-
renderFocus
public static void renderFocus(@Nonnull StyleContext context, @Nonnull Context cr, double x, double y, double width, double height) Renders a focus indicator on the rectangle determined by @x, @y, @width, @height.
Typical focus rendering:
![](focus.png)- Parameters:
context
- a `GtkStyleContext`cr
- a `cairo_t`x
- X origin of the rectangley
- Y origin of the rectanglewidth
- rectangle widthheight
- rectangle height
-
renderFrame
public static void renderFrame(@Nonnull StyleContext context, @Nonnull Context cr, double x, double y, double width, double height) Renders a frame around the rectangle defined by @x, @y, @width, @height.
Examples of frame rendering, showing the effect of `border-image`,
`border-color`, `border-width`, `border-radius` and junctions:
![](frames.png)- Parameters:
context
- a `GtkStyleContext`cr
- a `cairo_t`x
- X origin of the rectangley
- Y origin of the rectanglewidth
- rectangle widthheight
- rectangle height
-
renderHandle
public static void renderHandle(@Nonnull StyleContext context, @Nonnull Context cr, double x, double y, double width, double height) Renders a handle (as in `GtkPaned` and `GtkWindow`’s resize grip),
in the rectangle determined by @x, @y, @width, @height.
Handles rendered for the paned and grip classes:
![](handles.png)- Parameters:
context
- a `GtkStyleContext`cr
- a `cairo_t`x
- X origin of the rectangley
- Y origin of the rectanglewidth
- rectangle widthheight
- rectangle height
-
renderIcon
public static void renderIcon(@Nonnull StyleContext context, @Nonnull Context cr, @Nonnull Texture texture, double x, double y) Renders the icon in @texture at the specified @x and @y coordinates.
This function will render the icon in @texture at exactly its size,
regardless of scaling factors, which may not be appropriate when
drawing on displays with high pixel densities.- Parameters:
context
- a `GtkStyleContext`cr
- a `cairo_t`texture
- a `GdkTexture` containing the icon to drawx
- X position for the @texturey
- Y position for the @texture
-
renderLayout
public static void renderLayout(@Nonnull StyleContext context, @Nonnull Context cr, double x, double y, @Nonnull Layout layout) Renders @layout on the coordinates @x, @y- Parameters:
context
- a `GtkStyleContext`cr
- a `cairo_t`x
- X originy
- Y originlayout
- the `PangoLayout` to render
-
renderLine
public static void renderLine(@Nonnull StyleContext context, @Nonnull Context cr, double x0, double y0, double x1, double y1) Renders a line from (x0, y0) to (x1, y1).- Parameters:
context
- a `GtkStyleContext`cr
- a `cairo_t`x0
- X coordinate for the origin of the liney0
- Y coordinate for the origin of the linex1
- X coordinate for the end of the liney1
- Y coordinate for the end of the line
-
renderOption
public static void renderOption(@Nonnull StyleContext context, @Nonnull Context cr, double x, double y, double width, double height) Renders an option mark (as in a radio button), the %GTK_STATE_FLAG_CHECKED
state will determine whether the option is on or off, and
%GTK_STATE_FLAG_INCONSISTENT whether it should be marked as undefined.
Typical option mark rendering:
![](options.png)- Parameters:
context
- a `GtkStyleContext`cr
- a `cairo_t`x
- X origin of the rectangley
- Y origin of the rectanglewidth
- rectangle widthheight
- rectangle height
-
rgbToHsv
public static void rgbToHsv(float r, float g, float b, @Nonnull Flt h, @Nonnull Flt s, @Nonnull Flt v) Converts a color from RGB space to HSV.
Input values must be in the [0.0, 1.0] range;
output values will be in the same range.- Parameters:
r
- Redg
- Greenb
- Blueh
- Return value for the hue components
- Return value for the saturation componentv
- Return value for the value component
-
setDebugFlags
public static void setDebugFlags(int flags) Sets the GTK debug flags.- Parameters:
flags
- the debug flags to set
-
showAboutDialog
public static void showAboutDialog(@Nullable Window parent, @Nonnull Str first_property_name, Object... _elipse) A convenience function for showing an application’s about dialog.
The constructed dialog is associated with the parent window and
reused for future invocations of this function.- Parameters:
parent
- the parent top-level windowfirst_property_name
- the name of the first property_elipse
- value of first property, followed by more pairs of property name and value, `NULL`-terminated
-
showUri
This function launches the default application for showing
a given uri, or shows an error dialog if that fails.- Parameters:
parent
- parent windowuri
- the uri to showtimestamp
- timestamp from the event that triggered this call, or %GDK_CURRENT_TIME
-
showUriFull
public static void showUriFull(@Nullable Window parent, @Nonnull Str uri, int timestamp, @Nullable Cancellable cancellable, Gtk.OnAsyncReadyCallback callback, @Nullable Pointer user_data) This function launches the default application for showing
a given uri.
The @callback will be called when the launch is completed.
It should call gtk_show_uri_full_finish() to obtain the result.
This is the recommended call to be used as it passes information
necessary for sandbox helpers to parent their dialogs properly.- Parameters:
parent
- parent windowuri
- the uri to showtimestamp
- timestamp from the event that triggered this call, or %GDK_CURRENT_TIMEcancellable
- a `GCancellable` to cancel the launchcallback
- a callback to call when the action is completeuser_data
- data to pass to @callback
-
showUriFullFinish
public static boolean showUriFullFinish(@Nonnull Window parent, @Nonnull AsyncResult result) throws AllocationError Finishes the gtk_show_uri() call and returns the result
of the operation.- Parameters:
parent
- the `GtkWindow` passed to gtk_show_uri()result
- `GAsyncResult` that was passed to @callback- Returns:
- %TRUE if the URI was shown successfully. Otherwise, %FALSE is returned and @error is set
- Throws:
AllocationError
-
testAccessibleAssertionMessageRole
public static void testAccessibleAssertionMessageRole(@Nonnull Str domain, @Nonnull Str file, int line, @Nonnull Str func, @Nonnull Str expr, @Nonnull Accessible accessible, int expected_role, int actual_role) - Parameters:
domain
-file
-line
-func
-expr
-accessible
-expected_role
-actual_role
-
-
testAccessibleCheckProperty
public static Str testAccessibleCheckProperty(@Nonnull Accessible accessible, int property, Object... _elipse) Checks whether the accessible @property of @accessible is set to
a specific value.- Parameters:
accessible
- a `GtkAccessible`property
- a `GtkAccessibleProperty`_elipse
- the expected value of @property- Returns:
- the value of the accessible property
-
testAccessibleCheckRelation
public static Str testAccessibleCheckRelation(@Nonnull Accessible accessible, int relation, Object... _elipse) Checks whether the accessible @relation of @accessible is set to
a specific value.- Parameters:
accessible
- a `GtkAccessible`relation
- a `GtkAccessibleRelation`_elipse
- the expected value of @relation- Returns:
- the value of the accessible relation
-
testAccessibleCheckState
public static Str testAccessibleCheckState(@Nonnull Accessible accessible, int state, Object... _elipse) Checks whether the accessible @state of @accessible is set to
a specific value.- Parameters:
accessible
- a `GtkAccessible`state
- a `GtkAccessibleState`_elipse
- the expected value of @state- Returns:
- the value of the accessible state
-
testAccessibleHasProperty
Checks whether the `GtkAccessible` has @property set.- Parameters:
accessible
- a `GtkAccessible`property
- a `GtkAccessibleProperty`- Returns:
- %TRUE if the @property is set in the @accessible
-
testAccessibleHasRelation
Checks whether the `GtkAccessible` has @relation set.- Parameters:
accessible
- a `GtkAccessible`relation
- a `GtkAccessibleRelation`- Returns:
- %TRUE if the @relation is set in the @accessible
-
testAccessibleHasRole
Checks whether the `GtkAccessible:accessible-role` of the accessible
is @role.- Parameters:
accessible
- a `GtkAccessible`role
- a `GtkAccessibleRole`- Returns:
- %TRUE if the role matches
-
testAccessibleHasState
Checks whether the `GtkAccessible` has @state set.- Parameters:
accessible
- a `GtkAccessible`state
- a `GtkAccessibleState`- Returns:
- %TRUE if the @state is set in the @accessible
-
testRegisterAllTypes
public static void testRegisterAllTypes()Force registration of all core GTK object types.
This allowes to refer to any of those object types via
g_type_from_name() after calling this function. -
testWidgetWaitForDraw
Enters the main loop and waits for @widget to be “drawn”.
In this context that means it waits for the frame clock of
@widget to have run a full styling, layout and drawing cycle.
This function is intended to be used for syncing with actions that
depend on @widget relayouting or on interaction with the display
server.- Parameters:
widget
- the widget to wait for
-
treeCreateRowDragContent
public static ContentProvider treeCreateRowDragContent(@Nonnull TreeModel tree_model, @Nonnull TreePath path) Creates a content provider for dragging @path from @tree_model.- Parameters:
tree_model
- a `GtkTreeModel`path
- a row in @tree_model- Returns:
- a new `GdkContentProvider`
-
treeRowReferenceDeleted
Lets a set of row reference created by
gtk_tree_row_reference_new_proxy() know that the
model emitted the ::row-deleted signal.- Parameters:
proxy
- a `GObject`path
- the path position that was deleted
-
treeRowReferenceInserted
Lets a set of row reference created by
gtk_tree_row_reference_new_proxy() know that the
model emitted the ::row-inserted signal.- Parameters:
proxy
- a `GObject`path
- the row position that was inserted
-
treeRowReferenceReordered
public static void treeRowReferenceReordered(@Nonnull Object proxy, @Nonnull TreePath path, @Nonnull TreeIter iter, @Nonnull Int new_order) Lets a set of row reference created by
gtk_tree_row_reference_new_proxy() know that the
model emitted the ::rows-reordered signal.- Parameters:
proxy
- a `GObject`path
- the parent path of the reordered signaliter
- the iter pointing to the parent of the reorderednew_order
- the new order of rows
-
valueDupExpression
Retrieves the `GtkExpression` stored inside the given `value`, and acquires
a reference to it.- Parameters:
value
- a `GValue` initialized with type `GTK_TYPE_EXPRESSION`- Returns:
- a `GtkExpression`
-
valueGetExpression
Retrieves the `GtkExpression` stored inside the given `value`.- Parameters:
value
- a `GValue` initialized with type `GTK_TYPE_EXPRESSION`- Returns:
- a `GtkExpression`
-
valueSetExpression
Stores the given `GtkExpression` inside `value`.
The `GValue` will acquire a reference to the `expression`.- Parameters:
value
- a `GValue` initialized with type `GTK_TYPE_EXPRESSION`expression
- a `GtkExpression`
-
valueTakeExpression
Stores the given `GtkExpression` inside `value`.
This function transfers the ownership of the `expression` to the `GValue`.- Parameters:
value
- a `GValue` initialized with type `GTK_TYPE_EXPRESSION`expression
- a `GtkExpression`
-