webkit.window_properties

Module for [WindowProperties] class

Types 3

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);
}

Methods
GType _gType() @property
WindowProperties self()Returns `this`, for use in `with` statements.
WindowPropertiesGidBuilder builder()Get builder for [webkit.window_properties.WindowProperties] Returns: New builder object
bool fullscreen() @propertyGet `fullscreen` property. Returns: Whether window will be displayed fullscreen.
gdk.rectangle.Rectangle geometry() @propertyGet `geometry` property. Returns: The size and position of the window on the screen.
bool locationbarVisible() @propertyGet `locationbarVisible` property. Returns: Whether the locationbar should be visible for the window.
bool menubarVisible() @propertyGet `menubarVisible` property. Returns: Whether the menubar should be visible for the window.
bool resizable() @propertyGet `resizable` property. Returns: Whether the window can be resized.
bool scrollbarsVisible() @propertyGet `scrollbarsVisible` property. Returns: Whether the scrollbars should be visible for the window.
bool statusbarVisible() @propertyGet `statusbarVisible` property. Returns: Whether the statusbar should be visible for the window.
bool toolbarVisible() @propertyGet `toolbarVisible` property. Returns: Whether the toolbar should be visible for the window.
bool getFullscreen()Get whether the window should be shown in fullscreen state or not. Returns: true if the window should be fullscreen or false otherwise.
void getGeometry(out gdk.rectangle.Rectangle geometry)Get the geometry the window should have on the screen when shown.
bool getLocationbarVisible()Get whether the window should have the locationbar visible or not. Returns: true if locationbar should be visible or false otherwise.
bool getMenubarVisible()Get whether the window should have the menubar visible or not. Returns: true if menubar should be visible or false otherwise.
bool getResizable()Get whether the window should be resizable by the user or not. Returns: true if the window should be resizable or false otherwise.
bool getScrollbarsVisible()Get whether the window should have the scrollbars visible or not. Returns: true if scrollbars should be visible or false otherwise.
bool getStatusbarVisible()Get whether the window should have the statusbar visible or not. Returns: true if statusbar should be visible or false otherwise.
bool getToolbarVisible()Get whether the window should have the toolbar visible or not. Returns: true if toolbar should be visible or false otherwise.
Constructors
this(void * ptr, Flag!"Take" take)
Methods
T fullscreen(bool propval)Set `fullscreen` property. Params: propval = Whether window will be displayed fullscreen. Returns: Builder instance for fluent chaining
T geometry(gdk.rectangle.Rectangle propval)Set `geometry` property. Params: propval = The size and position of the window on the screen. Returns: Builder instance for fluent chaining
T locationbarVisible(bool propval)Set `locationbarVisible` property. Params: propval = Whether the locationbar should be visible for the window. Returns: Builder instance for fluent chaining
T menubarVisible(bool propval)Set `menubarVisible` property. Params: propval = Whether the menubar should be visible for the window. Returns: Builder instance for fluent chaining
T resizable(bool propval)Set `resizable` property. Params: propval = Whether the window can be resized. Returns: Builder instance for fluent chaining
T scrollbarsVisible(bool propval)Set `scrollbarsVisible` property. Params: propval = Whether the scrollbars should be visible for the window. Returns: Builder instance for fluent chaining
T statusbarVisible(bool propval)Set `statusbarVisible` property. Params: propval = Whether the statusbar should be visible for the window. Returns: Builder instance for fluent chaining
T toolbarVisible(bool propval)Set `toolbarVisible` property. Params: propval = Whether the toolbar should be visible for the window. Returns: Builder instance for fluent chaining

Fluent builder for [webkit.window_properties.WindowProperties]