Package org.webkitgtk
Class WindowProperties
java.lang.Object
org.javagi.base.ProxyInstance
org.gnome.gobject.TypeInstance
org.gnome.gobject.GObject
org.webkitgtk.WindowProperties
- All Implemented Interfaces:
Proxy
Window properties of a
WebKitWebView.
The content of a WebKitWebView can request to change certain
properties of the window containing the view. This can include the x, y position
of the window, the width and height but also if a toolbar,
scrollbar, statusbar, locationbar should be visible to the user,
and the request to show the WebKitWebView fullscreen.
The WebKitWebView::ready-to-show signal handler is the proper place
to apply the initial window properties. Then you can monitor the
WebKitWindowProperties by connecting to ::notify signal.
static void ready_to_show_cb (WebKitWebView *web_view, gpointer user_data)
{
GtkWidget *window;
WebKitWindowProperties *window_properties;
gboolean visible;
// Create the window to contain the WebKitWebView.
window = browser_window_new ();
gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (web_view));
gtk_widget_show (GTK_WIDGET (web_view));
// Get the WebKitWindowProperties of the web view and monitor it.
window_properties = webkit_web_view_get_window_properties (web_view);
g_signal_connect (window_properties, "notify::geometry",
G_CALLBACK (window_geometry_changed), window);
g_signal_connect (window_properties, "notify::toolbar-visible",
G_CALLBACK (window_toolbar_visibility_changed), window);
g_signal_connect (window_properties, "notify::menubar-visible",
G_CALLBACK (window_menubar_visibility_changed), window);
// Apply the window properties before showing the window.
visible = webkit_window_properties_get_toolbar_visible (window_properties);
browser_window_set_toolbar_visible (BROWSER_WINDOW (window), visible);
visible = webkit_window_properties_get_menubar_visible (window_properties);
browser_window_set_menubar_visible (BROWSER_WINDOW (window), visible);
if (webkit_window_properties_get_fullscreen (window_properties)) {
gtk_window_fullscreen (GTK_WINDOW (window));
} else {
GdkRectangle geometry;
gtk_window_set_resizable (GTK_WINDOW (window),
webkit_window_properties_get_resizable (window_properties));
webkit_window_properties_get_geometry (window_properties, &geometry);
gtk_window_move (GTK_WINDOW (window), geometry.x, geometry.y);
gtk_window_resize (GTK_WINDOW (window), geometry.width, geometry.height);
}
gtk_widget_show (window);
}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classWindowProperties.Builder<B extends WindowProperties.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classNested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new WindowProperties.WindowProperties(MemorySegment address) Create a WindowProperties proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected WindowPropertiesasParent()Returns this instance as if it were its parent type.static WindowProperties.Builder<? extends WindowProperties.Builder> builder()AWindowProperties.Builderobject constructs aWindowPropertieswith the specified properties.booleanGet whether the window should be shown in fullscreen state or not.voidgetGeometry(Rectangle geometry) Get the geometry the window should have on the screen when shown.booleanGet whether the window should have the locationbar visible or not.booleanGet whether the window should have the menubar visible or not.booleanGet whether the window should be resizable by the user or not.booleanGet whether the window should have the scrollbars visible or not.booleanGet whether the window should have the statusbar visible or not.booleanGet whether the window should have the toolbar visible or not.static @Nullable TypegetType()Get the GType of the WindowProperties classMethods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getMemoryLayout, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
WindowProperties
Create a WindowProperties proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
WindowProperties
public WindowProperties()Creates a new WindowProperties.
-
-
Method Details
-
getType
Get the GType of the WindowProperties class- Returns:
- the GType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type. -
getFullscreen
public boolean getFullscreen()Get whether the window should be shown in fullscreen state or not.- Returns:
trueif the window should be fullscreen orfalseotherwise.
-
getGeometry
Get the geometry the window should have on the screen when shown.- Parameters:
geometry- return location for the window geometry
-
getLocationbarVisible
public boolean getLocationbarVisible()Get whether the window should have the locationbar visible or not.- Returns:
trueif locationbar should be visible orfalseotherwise.
-
getMenubarVisible
public boolean getMenubarVisible()Get whether the window should have the menubar visible or not.- Returns:
trueif menubar should be visible orfalseotherwise.
-
getResizable
public boolean getResizable()Get whether the window should be resizable by the user or not.- Returns:
trueif the window should be resizable orfalseotherwise.
-
getScrollbarsVisible
public boolean getScrollbarsVisible()Get whether the window should have the scrollbars visible or not.- Returns:
trueif scrollbars should be visible orfalseotherwise.
-
getStatusbarVisible
public boolean getStatusbarVisible()Get whether the window should have the statusbar visible or not.- Returns:
trueif statusbar should be visible orfalseotherwise.
-
getToolbarVisible
public boolean getToolbarVisible()Get whether the window should have the toolbar visible or not.- Returns:
trueif toolbar should be visible orfalseotherwise.
-
builder
AWindowProperties.Builderobject constructs aWindowPropertieswith the specified properties. Use the variousset...()methods to set properties, and finish construction withWindowProperties.Builder.build().- Returns:
- the builder object
-