gi-gdk-3.0.28: Gdk bindings

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

GI.Gdk.Objects.DrawingContext

Contents

- Exported types
- Methods
  - getCairoContext
  - getClip
  - getWindow
  - isValid
- Properties
  - clip
  - window

Description

`DrawingContext` is an object that represents the current drawing state of a `Window`.

It's possible to use a `DrawingContext` to draw on a `Window` via rendering API like Cairo or OpenGL.

A `DrawingContext` can only be created by calling `windowBeginDrawFrame` and will be valid until a call to `windowEndDrawFrame`.

`DrawingContext` is available since GDK 3.22

Synopsis

- newtype DrawingContext = DrawingContext (ManagedPtr DrawingContext)
- class (GObject o, IsDescendantOf DrawingContext o) => IsDrawingContext o
- toDrawingContext :: (MonadIO m, IsDrawingContext o) => o -> m DrawingContext
- drawingContextGetCairoContext :: (HasCallStack, MonadIO m, IsDrawingContext a) => a -> m Context
- drawingContextGetClip :: (HasCallStack, MonadIO m, IsDrawingContext a) => a -> m (Maybe Region)
- drawingContextGetWindow :: (HasCallStack, MonadIO m, IsDrawingContext a) => a -> m Window
- drawingContextIsValid :: (HasCallStack, MonadIO m, IsDrawingContext a) => a -> m Bool
- constructDrawingContextClip :: (IsDrawingContext o, MonadIO m) => Region -> m (GValueConstruct o)
- getDrawingContextClip :: (MonadIO m, IsDrawingContext o) => o -> m (Maybe Region)
- constructDrawingContextWindow :: (IsDrawingContext o, MonadIO m, IsWindow a) => a -> m (GValueConstruct o)
- getDrawingContextWindow :: (MonadIO m, IsDrawingContext o) => o -> m Window

# Exported types

newtype DrawingContext Source #

Memory-managed wrapper type.

Constructors

DrawingContext (ManagedPtr DrawingContext) |

#### Instances

Instances details

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

class (GObject o, IsDescendantOf DrawingContext o) => IsDrawingContext o Source #

Type class for types which can be safely cast to `DrawingContext`, for instance with `toDrawingContext`.

#### Instances

Instances details

(GObject o, IsDescendantOf DrawingContext o) => IsDrawingContext o Source # |
Instance details Defined in GI.Gdk.Objects.DrawingContext

toDrawingContext :: (MonadIO m, IsDrawingContext o) => o -> m DrawingContext Source #

Cast to `DrawingContext`, 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, forceFloating, freezeNotify, getv, isFloating, isValid, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.

#### Getters

getCairoContext, getClip, getData, getProperty, getQdata, getWindow.

#### Setters

setData, setDataFull, setProperty.

## getCairoContext

drawingContextGetCairoContext Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrawingContext a) |
=> a |
-> m Context | Returns: a Cairo context to be used to draw the contents of the `Window`. The context is owned by the `DrawingContext` and should not be destroyed

Retrieves a Cairo context to be used to draw on the `Window` that created the `DrawingContext`.

The returned context is guaranteed to be valid as long as the `DrawingContext` is valid, that is between a call to `windowBeginDrawFrame` and `windowEndDrawFrame`.

Since: 3.22

## getClip

drawingContextGetClip Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrawingContext a) |
=> a | `context`: a `DrawingContext`
-> m (Maybe Region) | Returns: a Cairo region

Retrieves a copy of the clip region used when creating the `context`.

Since: 3.22

## getWindow

drawingContextGetWindow Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrawingContext a) |
=> a | `context`: a `DrawingContext`
-> m Window | Returns: a `Window`

Retrieves the window that created the drawing `context`.

Since: 3.22

## isValid

drawingContextIsValid Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrawingContext a) |
=> a | `context`: a `DrawingContext`
-> m Bool | Returns: `True` if the context is valid

Checks whether the given `DrawingContext` is valid.

Since: 3.22

# Properties

## clip

The clip region applied to the drawing context.

Since: 3.22

constructDrawingContextClip :: (IsDrawingContext o, MonadIO m) => Region -> m (GValueConstruct o) Source #

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

getDrawingContextClip :: (MonadIO m, IsDrawingContext o) => o -> m (Maybe Region) Source #

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

    get drawingContext #clip

## window

The `Window` that created the drawing context.

Since: 3.22

constructDrawingContextWindow :: (IsDrawingContext o, MonadIO m, IsWindow a) => a -> m (GValueConstruct o) Source #

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

getDrawingContextWindow :: (MonadIO m, IsDrawingContext o) => o -> m Window Source #

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

    get drawingContext #window