## WebKitWindowProperties

WebKitWindowProperties — Window properties of a WebKitWebView

## Synopsis

    struct              WebKitWindowProperties;
    void                webkit_window_properties_get_geometry
                                                            (WebKitWindowProperties *window_properties,
                                                             GdkRectangle *geometry);
    gboolean            webkit_window_properties_get_toolbar_visible
                                                            (WebKitWindowProperties *window_properties);
    gboolean            webkit_window_properties_get_statusbar_visible
                                                            (WebKitWindowProperties *window_properties);
    gboolean            webkit_window_properties_get_scrollbars_visible
                                                            (WebKitWindowProperties *window_properties);
    gboolean            webkit_window_properties_get_menubar_visible
                                                            (WebKitWindowProperties *window_properties);
    gboolean            webkit_window_properties_get_locationbar_visible
                                                            (WebKitWindowProperties *window_properties);
    gboolean            webkit_window_properties_get_resizable
                                                            (WebKitWindowProperties *window_properties);
    gboolean            webkit_window_properties_get_fullscreen
                                                            (WebKitWindowProperties *window_properties);

## Object Hierarchy

      GObject
       +----WebKitWindowProperties

## Properties

      "fullscreen"               gboolean              : Read / Write / Construct Only
      "geometry"                 GdkRectangle*         : Read / Write / Construct Only
      "locationbar-visible"      gboolean              : Read / Write / Construct Only
      "menubar-visible"          gboolean              : Read / Write / Construct Only
      "resizable"                gboolean              : Read / Write / Construct Only
      "scrollbars-visible"       gboolean              : Read / Write / Construct Only
      "statusbar-visible"        gboolean              : Read / Write / Construct Only
      "toolbar-visible"          gboolean              : Read / Write / Construct Only

## Description

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 "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.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42

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

## Details

### struct WebKitWindowProperties

    struct WebKitWindowProperties;

### webkit_window_properties_get_geometry ()

    void                webkit_window_properties_get_geometry
                                                            (WebKitWindowProperties *window_properties,
                                                             GdkRectangle *geometry);

Get the geometry the window should have on the screen when shown.

`window_properties` : | a WebKitWindowProperties
`geometry` : | return location for the window geometry. [out]

### webkit_window_properties_get_toolbar_visible ()

    gboolean            webkit_window_properties_get_toolbar_visible
                                                            (WebKitWindowProperties *window_properties);

Get whether the window should have the toolbar visible or not.

`window_properties` : | a WebKitWindowProperties
Returns : | `TRUE` if toolbar should be visible or `FALSE` otherwise.

### webkit_window_properties_get_statusbar_visible ()

    gboolean            webkit_window_properties_get_statusbar_visible
                                                            (WebKitWindowProperties *window_properties);

Get whether the window should have the statusbar visible or not.

`window_properties` : | a WebKitWindowProperties
Returns : | `TRUE` if statusbar should be visible or `FALSE` otherwise.

### webkit_window_properties_get_scrollbars_visible ()

    gboolean            webkit_window_properties_get_scrollbars_visible
                                                            (WebKitWindowProperties *window_properties);

Get whether the window should have the scrollbars visible or not.

`window_properties` : | a WebKitWindowProperties
Returns : | `TRUE` if scrollbars should be visible or `FALSE` otherwise.

### webkit_window_properties_get_menubar_visible ()

    gboolean            webkit_window_properties_get_menubar_visible
                                                            (WebKitWindowProperties *window_properties);

Get whether the window should have the menubar visible or not.

`window_properties` : | a WebKitWindowProperties
Returns : | `TRUE` if menubar should be visible or `FALSE` otherwise.

### webkit_window_properties_get_locationbar_visible ()

    gboolean            webkit_window_properties_get_locationbar_visible
                                                            (WebKitWindowProperties *window_properties);

Get whether the window should have the locationbar visible or not.

`window_properties` : | a WebKitWindowProperties
Returns : | `TRUE` if locationbar should be visible or `FALSE` otherwise.

### webkit_window_properties_get_resizable ()

    gboolean            webkit_window_properties_get_resizable
                                                            (WebKitWindowProperties *window_properties);

Get whether the window should be resizable by the user or not.

`window_properties` : | a WebKitWindowProperties
Returns : | `TRUE` if the window should be resizable or `FALSE` otherwise.

### webkit_window_properties_get_fullscreen ()

    gboolean            webkit_window_properties_get_fullscreen
                                                            (WebKitWindowProperties *window_properties);

Get whether the window should be shown in fullscreen state or not.

`window_properties` : | a WebKitWindowProperties
Returns : | `TRUE` if the window should be fullscreen or `FALSE` otherwise.

## Property Details

### The `"fullscreen"` property

      "fullscreen"               gboolean              : Read / Write / Construct Only

Whether window will be displayed fullscreen.

Default value: FALSE

### The `"geometry"` property

      "geometry"                 GdkRectangle*         : Read / Write / Construct Only

The size and position of the window on the screen.

### The `"locationbar-visible"` property

      "locationbar-visible"      gboolean              : Read / Write / Construct Only

Whether the locationbar should be visible for the window.

Default value: TRUE

### The `"menubar-visible"` property

      "menubar-visible"          gboolean              : Read / Write / Construct Only

Whether the menubar should be visible for the window.

Default value: TRUE

### The `"resizable"` property

      "resizable"                gboolean              : Read / Write / Construct Only

Whether the window can be resized.

Default value: TRUE

### The `"scrollbars-visible"` property

      "scrollbars-visible"       gboolean              : Read / Write / Construct Only

Whether the scrollbars should be visible for the window.

Default value: TRUE

### The `"statusbar-visible"` property

      "statusbar-visible"        gboolean              : Read / Write / Construct Only

Whether the statusbar should be visible for the window.

Default value: TRUE

### The `"toolbar-visible"` property

      "toolbar-visible"          gboolean              : Read / Write / Construct Only

Whether the toolbar should be visible for the window.

Default value: TRUE

## See Also

"ready-to-show"