gi-gtk4-4.0.12: Gtk 4.x bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gtk.Objects.WidgetPaintable

Contents

- Exported types
- Methods
  - getWidget
  - new
  - setWidget
- Properties
  - widget

Description

A `GdkPaintable` that displays the contents of a widget.

`GtkWidgetPaintable` will also take care of the widget not being in a state where it can be drawn (like when it isn't shown) and just draw nothing or where it does not have a size (like when it is hidden) and report no size in that case.

Of course, `GtkWidgetPaintable` allows you to monitor widgets for size changes by emitting the Paintable::invalidateSize signal whenever the size of the widget changes as well as for visual changes by emitting the Paintable::invalidateContents signal whenever the widget changes.

You can use a `GtkWidgetPaintable` everywhere a `GdkPaintable` is allowed, including using it on a `GtkPicture` (or one of its parents) that it was set on itself via `pictureSetPaintable`. The paintable will take care of recursion when this happens. If you do this however, ensure that the Picture:canShrink property is set to `True` or you might end up with an infinitely growing widget.

Synopsis

- newtype WidgetPaintable = WidgetPaintable (ManagedPtr WidgetPaintable)
- class (GObject o, IsDescendantOf WidgetPaintable o) => IsWidgetPaintable o
- toWidgetPaintable :: (MonadIO m, IsWidgetPaintable o) => o -> m WidgetPaintable
- widgetPaintableGetWidget :: (HasCallStack, MonadIO m, IsWidgetPaintable a) => a -> m (Maybe Widget)
- widgetPaintableNew :: (HasCallStack, MonadIO m, IsWidget a) => Maybe a -> m WidgetPaintable
- widgetPaintableSetWidget :: (HasCallStack, MonadIO m, IsWidgetPaintable a, IsWidget b) => a -> Maybe b -> m ()
- clearWidgetPaintableWidget :: (MonadIO m, IsWidgetPaintable o) => o -> m ()
- constructWidgetPaintableWidget :: (IsWidgetPaintable o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o)
- getWidgetPaintableWidget :: (MonadIO m, IsWidgetPaintable o) => o -> m (Maybe Widget)
- setWidgetPaintableWidget :: (MonadIO m, IsWidgetPaintable o, IsWidget a) => o -> a -> m ()

# Exported types

newtype WidgetPaintable Source #

Memory-managed wrapper type.

Constructors

WidgetPaintable (ManagedPtr WidgetPaintable) |

#### Instances

Instances details

Eq WidgetPaintable Source # |
Instance details Defined in GI.Gtk.Objects.WidgetPaintable Methods (==) :: WidgetPaintable -> WidgetPaintable -> Bool Source # (/=) :: WidgetPaintable -> WidgetPaintable -> Bool Source #
GObject WidgetPaintable Source # |
Instance details Defined in GI.Gtk.Objects.WidgetPaintable
ManagedPtrNewtype WidgetPaintable Source # |
Instance details Defined in GI.Gtk.Objects.WidgetPaintable Methods toManagedPtr :: WidgetPaintable -> ManagedPtr WidgetPaintable Source #
TypedObject WidgetPaintable Source # |
Instance details Defined in GI.Gtk.Objects.WidgetPaintable Methods glibType :: IO GType Source #
HasParentTypes WidgetPaintable Source # |
Instance details Defined in GI.Gtk.Objects.WidgetPaintable
IsGValue (Maybe WidgetPaintable) Source # | Convert `WidgetPaintable` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gtk.Objects.WidgetPaintable Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe WidgetPaintable -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe WidgetPaintable) Source #
type ParentTypes WidgetPaintable Source # |
Instance details Defined in GI.Gtk.Objects.WidgetPaintable type ParentTypes WidgetPaintable = '[Object, Paintable]

class (GObject o, IsDescendantOf WidgetPaintable o) => IsWidgetPaintable o Source #

Type class for types which can be safely cast to `WidgetPaintable`, for instance with `toWidgetPaintable`.

#### Instances

Instances details

(GObject o, IsDescendantOf WidgetPaintable o) => IsWidgetPaintable o Source # |
Instance details Defined in GI.Gtk.Objects.WidgetPaintable

toWidgetPaintable :: (MonadIO m, IsWidgetPaintable o) => o -> m WidgetPaintable Source #

Cast to `WidgetPaintable`, 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

Expand

#### Methods

bindProperty, bindPropertyFull, computeConcreteSize, forceFloating, freezeNotify, getv, invalidateContents, invalidateSize, isFloating, notify, notifyByPspec, ref, refSink, runDispose, snapshot, stealData, stealQdata, thawNotify, unref, watchClosure.

#### Getters

getCurrentImage, getData, getFlags, getIntrinsicAspectRatio, getIntrinsicHeight, getIntrinsicWidth, getProperty, getQdata, getWidget.

#### Setters

setData, setDataFull, setProperty, setWidget.

## getWidget

widgetPaintableGetWidget Source #

Arguments

:: (HasCallStack, MonadIO m, IsWidgetPaintable a) |
=> a | `self`: a `GtkWidgetPaintable`
-> m (Maybe Widget) | Returns: the observed widget.

Returns the widget that is observed or `Nothing` if none.

## new

widgetPaintableNew Source #

Arguments

:: (HasCallStack, MonadIO m, IsWidget a) |
=> Maybe a | `widget`: a `GtkWidget`
-> m WidgetPaintable | Returns: a new `GtkWidgetPaintable`

Creates a new widget paintable observing the given widget.

## setWidget

widgetPaintableSetWidget Source #

Arguments

:: (HasCallStack, MonadIO m, IsWidgetPaintable a, IsWidget b) |
=> a | `self`: a `GtkWidgetPaintable`
-> Maybe b | `widget`: the widget to observe
-> m () |

Sets the widget that should be observed.

# Properties

## widget

The observed widget or `Nothing` if none.

clearWidgetPaintableWidget :: (MonadIO m, IsWidgetPaintable o) => o -> m () Source #

Set the value of the “`widget`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #widget

constructWidgetPaintableWidget :: (IsWidgetPaintable o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o) Source #

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

getWidgetPaintableWidget :: (MonadIO m, IsWidgetPaintable o) => o -> m (Maybe Widget) Source #

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

    get widgetPaintable #widget

setWidgetPaintableWidget :: (MonadIO m, IsWidgetPaintable o, IsWidget a) => o -> a -> m () Source #

Set the value of the “`widget`” property. When overloading is enabled, this is equivalent to

    set widgetPaintable [ #widget := value ]