gi-gdk4-4.0.10: Gdk 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.Gdk.Objects.DrawContext

Contents

- Exported types
- Methods
  - beginFrame
  - endFrame
  - getDisplay
  - getFrameRegion
  - getSurface
  - isInFrame
- Properties
  - display
  - surface

Description

Base class for objects implementing different rendering methods.

`GdkDrawContext` is the base object used by contexts implementing different rendering methods, such as `CairoContext` or `GLContext`. It provides shared functionality between those contexts.

You will always interact with one of those subclasses.

A `GdkDrawContext` is always associated with a single toplevel surface.

Synopsis

- newtype DrawContext = DrawContext (ManagedPtr DrawContext)
- class (GObject o, IsDescendantOf DrawContext o) => IsDrawContext o
- toDrawContext :: (MonadIO m, IsDrawContext o) => o -> m DrawContext
- drawContextBeginFrame :: (HasCallStack, MonadIO m, IsDrawContext a) => a -> Region -> m ()
- drawContextEndFrame :: (HasCallStack, MonadIO m, IsDrawContext a) => a -> m ()
- drawContextGetDisplay :: (HasCallStack, MonadIO m, IsDrawContext a) => a -> m (Maybe Display)
- drawContextGetFrameRegion :: (HasCallStack, MonadIO m, IsDrawContext a) => a -> m (Maybe Region)
- drawContextGetSurface :: (HasCallStack, MonadIO m, IsDrawContext a) => a -> m (Maybe Surface)
- drawContextIsInFrame :: (HasCallStack, MonadIO m, IsDrawContext a) => a -> m Bool
- constructDrawContextDisplay :: (IsDrawContext o, MonadIO m, IsDisplay a) => a -> m (GValueConstruct o)
- getDrawContextDisplay :: (MonadIO m, IsDrawContext o) => o -> m (Maybe Display)
- constructDrawContextSurface :: (IsDrawContext o, MonadIO m, IsSurface a) => a -> m (GValueConstruct o)
- getDrawContextSurface :: (MonadIO m, IsDrawContext o) => o -> m (Maybe Surface)

# Exported types

newtype DrawContext Source #

Memory-managed wrapper type.

Constructors

DrawContext (ManagedPtr DrawContext) |

#### Instances

Instances details

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

class (GObject o, IsDescendantOf DrawContext o) => IsDrawContext o Source #

Type class for types which can be safely cast to `DrawContext`, for instance with `toDrawContext`.

#### Instances

Instances details

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

toDrawContext :: (MonadIO m, IsDrawContext o) => o -> m DrawContext Source #

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

beginFrame, bindProperty, bindPropertyFull, endFrame, forceFloating, freezeNotify, getv, isFloating, isInFrame, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.

#### Getters

getData, getDisplay, getFrameRegion, getProperty, getQdata, getSurface.

#### Setters

setData, setDataFull, setProperty.

## beginFrame

drawContextBeginFrame Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrawContext a) |
=> a | `context`: the `GdkDrawContext` used to draw the frame. The context must have a surface.
-> Region | `region`: minimum region that should be drawn
-> m () |

Deprecated: (Since version 4.16)Drawing directly to the surface is no longer recommended.Use `GskRenderNode` and `GskRenderer`.

Indicates that you are beginning the process of redrawing `region` on the `context`'s surface.

Calling this function begins a drawing operation using `context` on the surface that `context` was created from. The actual requirements and guarantees for the drawing operation vary for different implementations of drawing, so a `CairoContext` and a `GLContext` need to be treated differently.

A call to this function is a requirement for drawing and must be followed by a call to `drawContextEndFrame`, which will complete the drawing operation and ensure the contents become visible on screen.

Note that the `region` passed to this function is the minimum region that needs to be drawn and depending on implementation, windowing system and hardware in use, it might be necessary to draw a larger region. Drawing implementation must use `drawContextGetFrameRegion` to query the region that must be drawn.

When using GTK, the widget system automatically places calls to `drawContextBeginFrame` and `drawContextEndFrame` via the use of GskRenderers, so application code does not need to call these functions explicitly.

## endFrame

drawContextEndFrame Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrawContext a) |
=> a | `context`: a `GdkDrawContext`
-> m () |

Deprecated: (Since version 4.16)Drawing directly to the surface is no longer recommended.Use `GskRenderNode` and `GskRenderer`.

Ends a drawing operation started with `drawContextBeginFrame`.

This makes the drawing available on screen. See `drawContextBeginFrame` for more details about drawing.

When using a `GLContext`, this function may call `glFlush()` implicitly before returning; it is not recommended to call `glFlush()` explicitly before calling this function.

## getDisplay

drawContextGetDisplay Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrawContext a) |
=> a | `context`: a `GdkDrawContext`
-> m (Maybe Display) | Returns: the `GdkDisplay`

Retrieves the `GdkDisplay` the `context` is created for

## getFrameRegion

drawContextGetFrameRegion Source #

Arguments

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

Deprecated: (Since version 4.16)Drawing directly to the surface is no longer recommended.Use `GskRenderNode` and `GskRenderer`.

Retrieves the region that is currently being repainted.

After a call to `drawContextBeginFrame` this function will return a union of the region passed to that function and the area of the surface that the `context` determined needs to be repainted.

If `context` is not in between calls to `drawContextBeginFrame` and `drawContextEndFrame`, `Nothing` will be returned.

## getSurface

drawContextGetSurface Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrawContext a) |
=> a | `context`: a `GdkDrawContext`
-> m (Maybe Surface) | Returns: a `GdkSurface`

Retrieves the surface that `context` is bound to.

## isInFrame

drawContextIsInFrame Source #

Arguments

:: (HasCallStack, MonadIO m, IsDrawContext a) |
=> a | `context`: a `GdkDrawContext`
-> m Bool | Returns: `True` if the context is between `drawContextBeginFrame` and `drawContextEndFrame` calls.

Deprecated: (Since version 4.16)Drawing directly to the surface is no longer recommended.Use `GskRenderNode` and `GskRenderer`.

Returns `True` if `context` is in the process of drawing to its surface.

This is the case between calls to `drawContextBeginFrame` and `drawContextEndFrame`. In this situation, drawing commands may be effecting the contents of the `context`'s surface.

# Properties

## display

The `GdkDisplay` used to create the `GdkDrawContext`.

constructDrawContextDisplay :: (IsDrawContext o, MonadIO m, IsDisplay a) => a -> m (GValueConstruct o) Source #

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

getDrawContextDisplay :: (MonadIO m, IsDrawContext o) => o -> m (Maybe Display) Source #

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

    get drawContext #display

## surface

The `GdkSurface` the context is bound to.

constructDrawContextSurface :: (IsDrawContext o, MonadIO m, IsSurface a) => a -> m (GValueConstruct o) Source #

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

getDrawContextSurface :: (MonadIO m, IsDrawContext o) => o -> m (Maybe Surface) Source #

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

    get drawContext #surface