Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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
- newtype WindowProperties = WindowProperties (ManagedPtr WindowProperties)
- class (GObject o, IsDescendantOf WindowProperties o) => IsWindowProperties o
- toWindowProperties :: (MonadIO m, IsWindowProperties o) => o -> m WindowProperties
- windowPropertiesGetFullscreen :: (HasCallStack, MonadIO m, IsWindowProperties a) => a -> m Bool
- windowPropertiesGetGeometry :: (HasCallStack, MonadIO m, IsWindowProperties a) => a -> m Rectangle
- windowPropertiesGetLocationbarVisible :: (HasCallStack, MonadIO m, IsWindowProperties a) => a -> m Bool
- windowPropertiesGetMenubarVisible :: (HasCallStack, MonadIO m, IsWindowProperties a) => a -> m Bool
- windowPropertiesGetResizable :: (HasCallStack, MonadIO m, IsWindowProperties a) => a -> m Bool
- windowPropertiesGetScrollbarsVisible :: (HasCallStack, MonadIO m, IsWindowProperties a) => a -> m Bool
- windowPropertiesGetStatusbarVisible :: (HasCallStack, MonadIO m, IsWindowProperties a) => a -> m Bool
- windowPropertiesGetToolbarVisible :: (HasCallStack, MonadIO m, IsWindowProperties a) => a -> m Bool
- constructWindowPropertiesFullscreen :: (IsWindowProperties o, MonadIO m) => Bool -> m (GValueConstruct o)
- getWindowPropertiesFullscreen :: (MonadIO m, IsWindowProperties o) => o -> m Bool
- constructWindowPropertiesGeometry :: (IsWindowProperties o, MonadIO m) => Rectangle -> m (GValueConstruct o)
- getWindowPropertiesGeometry :: (MonadIO m, IsWindowProperties o) => o -> m (Maybe Rectangle)
- constructWindowPropertiesLocationbarVisible :: (IsWindowProperties o, MonadIO m) => Bool -> m (GValueConstruct o)
- getWindowPropertiesLocationbarVisible :: (MonadIO m, IsWindowProperties o) => o -> m Bool
- constructWindowPropertiesMenubarVisible :: (IsWindowProperties o, MonadIO m) => Bool -> m (GValueConstruct o)
- getWindowPropertiesMenubarVisible :: (MonadIO m, IsWindowProperties o) => o -> m Bool
- constructWindowPropertiesResizable :: (IsWindowProperties o, MonadIO m) => Bool -> m (GValueConstruct o)
- getWindowPropertiesResizable :: (MonadIO m, IsWindowProperties o) => o -> m Bool
- constructWindowPropertiesScrollbarsVisible :: (IsWindowProperties o, MonadIO m) => Bool -> m (GValueConstruct o)
- getWindowPropertiesScrollbarsVisible :: (MonadIO m, IsWindowProperties o) => o -> m Bool
- constructWindowPropertiesStatusbarVisible :: (IsWindowProperties o, MonadIO m) => Bool -> m (GValueConstruct o)
- getWindowPropertiesStatusbarVisible :: (MonadIO m, IsWindowProperties o) => o -> m Bool
- constructWindowPropertiesToolbarVisible :: (IsWindowProperties o, MonadIO m) => Bool -> m (GValueConstruct o)
- getWindowPropertiesToolbarVisible :: (MonadIO m, IsWindowProperties o) => o -> m Bool
Exported types
newtype WindowProperties Source #
Memory-managed wrapper type.
WindowProperties (ManagedPtr WindowProperties) |
Instances
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
(GObject o, IsDescendantOf WindowProperties o) => IsWindowProperties o Source # | |
Defined in GI.WebKit.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
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getData, getFullscreen, getGeometry, getLocationbarVisible, getMenubarVisible, getProperty, getQdata, getResizable, getScrollbarsVisible, getStatusbarVisible, getToolbarVisible.
Setters
getFullscreen
windowPropertiesGetFullscreen Source #
:: (HasCallStack, MonadIO m, IsWindowProperties a) | |
=> a |
|
-> m Bool | Returns: |
Get whether the window should be shown in fullscreen state or not.
getGeometry
windowPropertiesGetGeometry Source #
:: (HasCallStack, MonadIO m, IsWindowProperties a) | |
=> a |
|
-> m Rectangle |
Get the geometry the window should have on the screen when shown.
getLocationbarVisible
windowPropertiesGetLocationbarVisible Source #
:: (HasCallStack, MonadIO m, IsWindowProperties a) | |
=> a |
|
-> m Bool | Returns: |
Get whether the window should have the locationbar visible or not.
getMenubarVisible
windowPropertiesGetMenubarVisible Source #
:: (HasCallStack, MonadIO m, IsWindowProperties a) | |
=> a |
|
-> m Bool | Returns: |
Get whether the window should have the menubar visible or not.
getResizable
windowPropertiesGetResizable Source #
:: (HasCallStack, MonadIO m, IsWindowProperties a) | |
=> a |
|
-> m Bool | Returns: |
Get whether the window should be resizable by the user or not.
getScrollbarsVisible
windowPropertiesGetScrollbarsVisible Source #
:: (HasCallStack, MonadIO m, IsWindowProperties a) | |
=> a |
|
-> m Bool | Returns: |
Get whether the window should have the scrollbars visible or not.
getStatusbarVisible
windowPropertiesGetStatusbarVisible Source #
:: (HasCallStack, MonadIO m, IsWindowProperties a) | |
=> a |
|
-> m Bool | Returns: |
Get whether the window should have the statusbar visible or not.
getToolbarVisible
windowPropertiesGetToolbarVisible Source #
:: (HasCallStack, MonadIO m, IsWindowProperties a) | |
=> a |
|
-> m Bool | Returns: |
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