gi-webkit2-4.0.29: WebKit2 bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.WebKit2.Objects.WindowProperties

Description

Window properties of a WebView.

The content of a WebView 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 WebView fullscreen.

The WebView::readyToShow signal handler is the proper place to apply the initial window properties. Then you can monitor the WindowProperties by connecting to notify signal.

c code

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

Exported types

newtype WindowProperties Source #

Memory-managed wrapper type.

Constructors

WindowProperties (ManagedPtr WindowProperties) 

Instances

Instances details
Eq WindowProperties Source # 
Instance details

Defined in GI.WebKit2.Objects.WindowProperties

GObject WindowProperties Source # 
Instance details

Defined in GI.WebKit2.Objects.WindowProperties

ManagedPtrNewtype WindowProperties Source # 
Instance details

Defined in GI.WebKit2.Objects.WindowProperties

TypedObject WindowProperties Source # 
Instance details

Defined in GI.WebKit2.Objects.WindowProperties

Methods

glibType :: IO GType

HasParentTypes WindowProperties Source # 
Instance details

Defined in GI.WebKit2.Objects.WindowProperties

IsGValue (Maybe WindowProperties) Source #

Convert WindowProperties to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.WebKit2.Objects.WindowProperties

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe WindowProperties -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe WindowProperties)

type ParentTypes WindowProperties Source # 
Instance details

Defined in GI.WebKit2.Objects.WindowProperties

type ParentTypes WindowProperties = '[Object]

class (GObject o, IsDescendantOf WindowProperties o) => IsWindowProperties o Source #

Type class for types which can be safely cast to WindowProperties, for instance with toWindowProperties.

Instances

Instances details
(GObject o, IsDescendantOf WindowProperties o) => IsWindowProperties o Source # 
Instance details

Defined in GI.WebKit2.Objects.WindowProperties

toWindowProperties :: (MonadIO m, IsWindowProperties o) => o -> m WindowProperties Source #

Cast to WindowProperties, for types for which this is known to be safe. For general casts, use castTo.

Methods

getFullscreen

windowPropertiesGetFullscreen Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindowProperties a) 
=> a

windowProperties: a WindowProperties

-> m Bool

Returns: True if the window should be fullscreen or False otherwise.

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

getGeometry

windowPropertiesGetGeometry Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindowProperties a) 
=> a

windowProperties: a WindowProperties

-> m Rectangle 

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

getLocationbarVisible

windowPropertiesGetLocationbarVisible Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindowProperties a) 
=> a

windowProperties: a WindowProperties

-> m Bool

Returns: True if locationbar should be visible or False otherwise.

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

getMenubarVisible

windowPropertiesGetMenubarVisible Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindowProperties a) 
=> a

windowProperties: a WindowProperties

-> m Bool

Returns: True if menubar should be visible or False otherwise.

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

getResizable

windowPropertiesGetResizable Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindowProperties a) 
=> a

windowProperties: a WindowProperties

-> m Bool

Returns: True if the window should be resizable or False otherwise.

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

getScrollbarsVisible

windowPropertiesGetScrollbarsVisible Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindowProperties a) 
=> a

windowProperties: a WindowProperties

-> m Bool

Returns: True if scrollbars should be visible or False otherwise.

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

getStatusbarVisible

windowPropertiesGetStatusbarVisible Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindowProperties a) 
=> a

windowProperties: a WindowProperties

-> m Bool

Returns: True if statusbar should be visible or False otherwise.

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

getToolbarVisible

windowPropertiesGetToolbarVisible Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindowProperties a) 
=> a

windowProperties: a WindowProperties

-> m Bool

Returns: True if toolbar should be visible or False otherwise.

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

Properties

fullscreen

Whether window will be displayed fullscreen.

constructWindowPropertiesFullscreen :: (IsWindowProperties o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “fullscreen” property. This is rarely needed directly, but it is used by new.

getWindowPropertiesFullscreen :: (MonadIO m, IsWindowProperties o) => o -> m Bool Source #

Get the value of the “fullscreen” property. When overloading is enabled, this is equivalent to

get windowProperties #fullscreen

geometry

The size and position of the window on the screen.

constructWindowPropertiesGeometry :: (IsWindowProperties o, MonadIO m) => Rectangle -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “geometry” property. This is rarely needed directly, but it is used by new.

getWindowPropertiesGeometry :: (MonadIO m, IsWindowProperties o) => o -> m (Maybe Rectangle) Source #

Get the value of the “geometry” property. When overloading is enabled, this is equivalent to

get windowProperties #geometry

locationbarVisible

Whether the locationbar should be visible for the window.

constructWindowPropertiesLocationbarVisible :: (IsWindowProperties o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “locationbar-visible” property. This is rarely needed directly, but it is used by new.

getWindowPropertiesLocationbarVisible :: (MonadIO m, IsWindowProperties o) => o -> m Bool Source #

Get the value of the “locationbar-visible” property. When overloading is enabled, this is equivalent to

get windowProperties #locationbarVisible

menubarVisible

Whether the menubar should be visible for the window.

constructWindowPropertiesMenubarVisible :: (IsWindowProperties o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “menubar-visible” property. This is rarely needed directly, but it is used by new.

getWindowPropertiesMenubarVisible :: (MonadIO m, IsWindowProperties o) => o -> m Bool Source #

Get the value of the “menubar-visible” property. When overloading is enabled, this is equivalent to

get windowProperties #menubarVisible

resizable

Whether the window can be resized.

constructWindowPropertiesResizable :: (IsWindowProperties o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “resizable” property. This is rarely needed directly, but it is used by new.

getWindowPropertiesResizable :: (MonadIO m, IsWindowProperties o) => o -> m Bool Source #

Get the value of the “resizable” property. When overloading is enabled, this is equivalent to

get windowProperties #resizable

scrollbarsVisible

Whether the scrollbars should be visible for the window.

constructWindowPropertiesScrollbarsVisible :: (IsWindowProperties o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “scrollbars-visible” property. This is rarely needed directly, but it is used by new.

getWindowPropertiesScrollbarsVisible :: (MonadIO m, IsWindowProperties o) => o -> m Bool Source #

Get the value of the “scrollbars-visible” property. When overloading is enabled, this is equivalent to

get windowProperties #scrollbarsVisible

statusbarVisible

Whether the statusbar should be visible for the window.

constructWindowPropertiesStatusbarVisible :: (IsWindowProperties o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “statusbar-visible” property. This is rarely needed directly, but it is used by new.

getWindowPropertiesStatusbarVisible :: (MonadIO m, IsWindowProperties o) => o -> m Bool Source #

Get the value of the “statusbar-visible” property. When overloading is enabled, this is equivalent to

get windowProperties #statusbarVisible

toolbarVisible

Whether the toolbar should be visible for the window.

constructWindowPropertiesToolbarVisible :: (IsWindowProperties o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “toolbar-visible” property. This is rarely needed directly, but it is used by new.

getWindowPropertiesToolbarVisible :: (MonadIO m, IsWindowProperties o) => o -> m Bool Source #

Get the value of the “toolbar-visible” property. When overloading is enabled, this is equivalent to

get windowProperties #toolbarVisible