Package ch.bailu.gtk.gdk
Class Toplevel
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.type.Interface
ch.bailu.gtk.gdk.Toplevel
- All Implemented Interfaces:
PointerInterface
A `GdkToplevel` is a freestanding toplevel surface.
The `GdkToplevel` interface provides useful APIs for interacting with
the windowing system, such as controlling maximization and size of the
surface, setting icons and transient parents for dialogs.
The `GdkToplevel` interface provides useful APIs for interacting with
the windowing system, such as controlling maximization and size of the
surface, setting icons and transient parents for dialogs.
-
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 TypeMethodDescriptionvoid
Begins an interactive move operation.void
beginResize
(int edge, Device device, int button, double x, double y, int timestamp) Begins an interactive resize operation.void
focus
(int timestamp) Sets keyboard focus to @surface.static ClassHandler
static int
static long
static TypeSystem.TypeSize
int
getState()
Gets the bitwise or of the currently active surface state flags,
from the `GdkToplevelState` enumeration.static long
static TypeSystem.TypeSize
void
inhibitSystemShortcuts
(Event event) Requests that the @toplevel inhibit the system shortcuts.boolean
lower()
Asks to lower the @toplevel below other windows.boolean
minimize()
Asks to minimize the @toplevel.onComputeSize
(Toplevel.OnComputeSize signal) Connect to signal "compute-size".void
present
(ToplevelLayout layout) Present @toplevel after having processed the `GdkToplevelLayout` rules.void
Restore default system keyboard shortcuts which were previously
inhibited.void
setDecorated
(boolean decorated) Sets the toplevel to be decorated.void
setDeletable
(boolean deletable) Sets the toplevel to be deletable.void
setIconList
(List surfaces) Sets a list of icons for the surface.void
setModal
(boolean modal) Sets the toplevel to be modal.void
setStartupId
(Str startup_id) Sets the startup notification ID.void
setStartupId
(String startup_id) Sets the startup notification ID.void
Sets the title of a toplevel surface.void
Sets the title of a toplevel surface.void
setTransientFor
(Surface parent) Sets a transient-for parent.boolean
showWindowMenu
(Event event) Asks the windowing system to show the window menu.boolean
Returns whether the desktop environment supports
tiled window states.boolean
titlebarGesture
(int gesture) 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
-
Field Details
-
SIGNAL_ON_COMPUTE_SIZE
- See Also:
-
-
Constructor Details
-
Toplevel
-
-
Method Details
-
getClassHandler
-
beginMove
Begins an interactive move operation.
You might use this function to implement draggable titlebars.- Parameters:
device
- the device used for the operationbutton
- the button being used to drag, or 0 for a keyboard-initiated dragx
- surface X coordinate of mouse click that began the dragy
- surface Y coordinate of mouse click that began the dragtimestamp
- timestamp of mouse click that began the drag (use [method@Gdk.Event.get_time])
-
beginResize
public void beginResize(int edge, @Nullable Device device, int button, double x, double y, int timestamp) Begins an interactive resize operation.
You might use this function to implement a “window resize grip.”- Parameters:
edge
- the edge or corner from which the drag is starteddevice
- the device used for the operationbutton
- the button being used to drag, or 0 for a keyboard-initiated dragx
- surface X coordinate of mouse click that began the dragy
- surface Y coordinate of mouse click that began the dragtimestamp
- timestamp of mouse click that began the drag (use [method@Gdk.Event.get_time])
-
focus
public void focus(int timestamp) Sets keyboard focus to @surface.
In most cases, [method@Gtk.Window.present_with_time] should be
used on a [class@Gtk.Window], rather than calling this function.- Parameters:
timestamp
- timestamp of the event triggering the surface focus
-
getState
public int getState()Gets the bitwise or of the currently active surface state flags,
from the `GdkToplevelState` enumeration.- Returns:
- surface state bitfield
-
inhibitSystemShortcuts
Requests that the @toplevel inhibit the system shortcuts.
This is asking the desktop environment/windowing system to let all
keyboard events reach the surface, as long as it is focused, instead
of triggering system actions.
If granted, the rerouting remains active until the default shortcuts
processing is restored with [method@Gdk.Toplevel.restore_system_shortcuts],
or the request is revoked by the desktop environment, windowing system
or the user.
A typical use case for this API is remote desktop or virtual machine
viewers which need to inhibit the default system keyboard shortcuts
so that the remote session or virtual host gets those instead of the
local environment.
The windowing system or desktop environment may ask the user to grant
or deny the request or even choose to ignore the request entirely.
The caller can be notified whenever the request is granted or revoked
by listening to the [property@Gdk.Toplevel:shortcuts-inhibited] property.- Parameters:
event
- the `GdkEvent` that is triggering the inhibit request, or %NULL if none is available
-
lower
public boolean lower()Asks to lower the @toplevel below other windows.
The windowing system may choose to ignore the request.- Returns:
- %TRUE if the surface was lowered
-
minimize
public boolean minimize()Asks to minimize the @toplevel.
The windowing system may choose to ignore the request.- Returns:
- %TRUE if the surface was minimized
-
present
Present @toplevel after having processed the `GdkToplevelLayout` rules.
If the toplevel was previously not showing, it will be showed,
otherwise it will change layout according to @layout.
GDK may emit the [signal@Gdk.Toplevel::compute-size] signal to let
the user of this toplevel compute the preferred size of the toplevel
surface.
Presenting is asynchronous and the specified layout parameters are not
guaranteed to be respected.- Parameters:
layout
- the `GdkToplevelLayout` object used to layout
-
restoreSystemShortcuts
public void restoreSystemShortcuts()Restore default system keyboard shortcuts which were previously
inhibited.
This undoes the effect of [method@Gdk.Toplevel.inhibit_system_shortcuts]. -
setDecorated
public void setDecorated(boolean decorated) Sets the toplevel to be decorated.
Setting @decorated to %FALSE hints the desktop environment
that the surface has its own, client-side decorations and
does not need to have window decorations added.- Parameters:
decorated
- %TRUE to request decorations
-
setDeletable
public void setDeletable(boolean deletable) Sets the toplevel to be deletable.
Setting @deletable to %TRUE hints the desktop environment
that it should offer the user a way to close the surface.- Parameters:
deletable
- %TRUE to request a delete button
-
setIconList
Sets a list of icons for the surface.
One of these will be used to represent the surface in iconic form.
The icon may be shown in window lists or task bars. Which icon
size is shown depends on the window manager. The window manager
can scale the icon but setting several size icons can give better
image quality.
Note that some platforms don't support surface icons.- Parameters:
surfaces
- A list of textures to use as icon, of different sizes
-
setModal
public void setModal(boolean modal) Sets the toplevel to be modal.
The application can use this hint to tell the
window manager that a certain surface has modal
behaviour. The window manager can use this information
to handle modal surfaces in a special way.
You should only use this on surfaces for which you have
previously called [method@Gdk.Toplevel.set_transient_for].- Parameters:
modal
- %TRUE if the surface is modal, %FALSE otherwise.
-
setStartupId
Sets the startup notification ID.
When using GTK, typically you should use
[method@Gtk.Window.set_startup_id] instead of this
low-level function.- Parameters:
startup_id
- a string with startup-notification identifier
-
setStartupId
Sets the startup notification ID.
When using GTK, typically you should use
[method@Gtk.Window.set_startup_id] instead of this
low-level function.- Parameters:
startup_id
- a string with startup-notification identifier
-
setTitle
Sets the title of a toplevel surface.
The title maybe be displayed in the titlebar,
in lists of windows, etc.- Parameters:
title
- title of @surface
-
setTitle
Sets the title of a toplevel surface.
The title maybe be displayed in the titlebar,
in lists of windows, etc.- Parameters:
title
- title of @surface
-
setTransientFor
Sets a transient-for parent.
Indicates to the window manager that @surface is a transient
dialog associated with the application surface @parent. This
allows the window manager to do things like center @surface
on @parent and keep @surface above @parent.
See [method@Gtk.Window.set_transient_for] if you’re using
[class@Gtk.Window] or [class@Gtk.Dialog].- Parameters:
parent
- another toplevel `GdkSurface`
-
showWindowMenu
Asks the windowing system to show the window menu.
The window menu is the menu shown when right-clicking the titlebar
on traditional windows managed by the window manager. This is useful
for windows using client-side decorations, activating it with a
right-click on the window decorations.- Parameters:
event
- a `GdkEvent` to show the menu for- Returns:
- %TRUE if the window menu was shown and %FALSE otherwise.
-
supportsEdgeConstraints
public boolean supportsEdgeConstraints()Returns whether the desktop environment supports
tiled window states.- Returns:
- %TRUE if the desktop environment supports tiled window states
-
titlebarGesture
public boolean titlebarGesture(int gesture) - Parameters:
gesture
- a `GdkTitlebarGesture`- Returns:
-
onComputeSize
Connect to signal "compute-size".
SeeToplevel.OnComputeSize.onComputeSize(ch.bailu.gtk.gdk.ToplevelSize)
for signal description.
FieldSIGNAL_ON_COMPUTE_SIZE
contains original signal name and can be used as resource reference.- Parameters:
signal
- callback function (lambda).- Returns:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-