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 |
The Canvas
structure contains
private data and should only be accessed using the provided
API.
Since: 1.10
Synopsis
- newtype Canvas = Canvas (ManagedPtr Canvas)
- class (GObject o, IsDescendantOf Canvas o) => IsCanvas o
- toCanvas :: (MonadIO m, IsCanvas o) => o -> m Canvas
- canvasGetScaleFactor :: (HasCallStack, MonadIO m, IsCanvas a) => a -> m Int32
- canvasNew :: (HasCallStack, MonadIO m) => m Content
- canvasSetScaleFactor :: (HasCallStack, MonadIO m, IsCanvas a) => a -> Int32 -> m ()
- canvasSetSize :: (HasCallStack, MonadIO m, IsCanvas a) => a -> Int32 -> Int32 -> m Bool
- constructCanvasHeight :: (IsCanvas o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getCanvasHeight :: (MonadIO m, IsCanvas o) => o -> m Int32
- setCanvasHeight :: (MonadIO m, IsCanvas o) => o -> Int32 -> m ()
- constructCanvasScaleFactor :: (IsCanvas o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getCanvasScaleFactor :: (MonadIO m, IsCanvas o) => o -> m Int32
- setCanvasScaleFactor :: (MonadIO m, IsCanvas o) => o -> Int32 -> m ()
- getCanvasScaleFactorSet :: (MonadIO m, IsCanvas o) => o -> m Bool
- constructCanvasWidth :: (IsCanvas o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getCanvasWidth :: (MonadIO m, IsCanvas o) => o -> m Int32
- setCanvasWidth :: (MonadIO m, IsCanvas o) => o -> Int32 -> m ()
- type CanvasDrawCallback = Context -> Int32 -> Int32 -> IO Bool
- afterCanvasDraw :: (IsCanvas a, MonadIO m) => a -> ((?self :: a) => CanvasDrawCallback) -> m SignalHandlerId
- onCanvasDraw :: (IsCanvas a, MonadIO m) => a -> ((?self :: a) => CanvasDrawCallback) -> m SignalHandlerId
Exported types
Memory-managed wrapper type.
Instances
Eq Canvas Source # | |
GObject Canvas Source # | |
Defined in GI.Clutter.Objects.Canvas | |
ManagedPtrNewtype Canvas Source # | |
Defined in GI.Clutter.Objects.Canvas toManagedPtr :: Canvas -> ManagedPtr Canvas | |
TypedObject Canvas Source # | |
Defined in GI.Clutter.Objects.Canvas | |
HasParentTypes Canvas Source # | |
Defined in GI.Clutter.Objects.Canvas | |
IsGValue (Maybe Canvas) Source # | Convert |
Defined in GI.Clutter.Objects.Canvas gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Canvas -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Canvas) | |
type ParentTypes Canvas Source # | |
Defined in GI.Clutter.Objects.Canvas |
class (GObject o, IsDescendantOf Canvas o) => IsCanvas o Source #
Instances
(GObject o, IsDescendantOf Canvas o) => IsCanvas o Source # | |
Defined in GI.Clutter.Objects.Canvas |
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, invalidate, isFloating, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getData, getPreferredSize, getProperty, getQdata, getScaleFactor.
Setters
getScaleFactor
:: (HasCallStack, MonadIO m, IsCanvas a) | |
=> a |
|
-> m Int32 | Returns: the scaling factor, or -1 if the |
Retrieves the scaling factor of canvas
, as set using
canvasSetScaleFactor
.
Since: 1.18
new
:: (HasCallStack, MonadIO m) | |
=> m Content | Returns: The newly allocated instance of
|
Creates a new instance of Canvas
.
You should call canvasSetSize
to set the size of the canvas.
You should call contentInvalidate
every time you wish to
draw the contents of the canvas.
Since: 1.10
setScaleFactor
:: (HasCallStack, MonadIO m, IsCanvas a) | |
=> a |
|
-> Int32 |
|
-> m () |
Sets the scaling factor for the Cairo surface used by canvas
.
This function should rarely be used.
The default scaling factor of a Canvas
content uses the
Settings:windowScalingFactor property, which is set by
the windowing system. By using this function it is possible to
override that setting.
Changing the scale factor will invalidate the canvas
.
Since: 1.18
setSize
:: (HasCallStack, MonadIO m, IsCanvas a) | |
=> a |
|
-> Int32 |
|
-> Int32 |
|
-> m Bool | Returns: this function returns |
Sets the size of the canvas
, and invalidates the content.
This function will cause the canvas
to be invalidated only
if the size of the canvas surface has changed.
If you want to invalidate the contents of the canvas
when setting
the size, you can use the return value of the function to conditionally
call contentInvalidate
:
if (!clutter_canvas_set_size (canvas, width, height)) clutter_content_invalidate (CLUTTER_CONTENT (canvas));
Since: 1.10
Properties
height
The height of the canvas.
Since: 1.10
constructCanvasHeight :: (IsCanvas o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “height
” property. This is rarely needed directly, but it is used by new
.
getCanvasHeight :: (MonadIO m, IsCanvas o) => o -> m Int32 Source #
Get the value of the “height
” property.
When overloading is enabled, this is equivalent to
get
canvas #height
setCanvasHeight :: (MonadIO m, IsCanvas o) => o -> Int32 -> m () Source #
Set the value of the “height
” property.
When overloading is enabled, this is equivalent to
set
canvas [ #height:=
value ]
scaleFactor
The scaling factor to be applied to the Cairo surface used for drawing.
If Canvas:scaleFactor is set to a negative value, the value of the Settings:windowScalingFactor property is used instead.
Use Canvas:scaleFactorSet to check if the scale factor is set.
Since: 1.18
constructCanvasScaleFactor :: (IsCanvas o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “scale-factor
” property. This is rarely needed directly, but it is used by new
.
getCanvasScaleFactor :: (MonadIO m, IsCanvas o) => o -> m Int32 Source #
Get the value of the “scale-factor
” property.
When overloading is enabled, this is equivalent to
get
canvas #scaleFactor
setCanvasScaleFactor :: (MonadIO m, IsCanvas o) => o -> Int32 -> m () Source #
Set the value of the “scale-factor
” property.
When overloading is enabled, this is equivalent to
set
canvas [ #scaleFactor:=
value ]
scaleFactorSet
Whether the Canvas:scaleFactor property is set.
If the Canvas:scaleFactorSet property is False
then Canvas
will use the Settings:windowScalingFactor
property.
Since: 1.18
getCanvasScaleFactorSet :: (MonadIO m, IsCanvas o) => o -> m Bool Source #
Get the value of the “scale-factor-set
” property.
When overloading is enabled, this is equivalent to
get
canvas #scaleFactorSet
width
The width of the canvas.
Since: 1.10
constructCanvasWidth :: (IsCanvas o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “width
” property. This is rarely needed directly, but it is used by new
.
getCanvasWidth :: (MonadIO m, IsCanvas o) => o -> m Int32 Source #
Get the value of the “width
” property.
When overloading is enabled, this is equivalent to
get
canvas #width
setCanvasWidth :: (MonadIO m, IsCanvas o) => o -> Int32 -> m () Source #
Set the value of the “width
” property.
When overloading is enabled, this is equivalent to
set
canvas [ #width:=
value ]
Signals
draw
type CanvasDrawCallback Source #
= Context |
|
-> Int32 |
|
-> Int32 |
|
-> IO Bool | Returns: |
The Canvas::draw signal is emitted each time a canvas is invalidated.
It is safe to connect multiple handlers to this signal: each
handler invocation will be automatically protected by cairo_save()
and cairo_restore()
pairs.
Since: 1.10
afterCanvasDraw :: (IsCanvas a, MonadIO m) => a -> ((?self :: a) => CanvasDrawCallback) -> m SignalHandlerId Source #
Connect a signal handler for the draw signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
canvas #draw callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onCanvasDraw :: (IsCanvas a, MonadIO m) => a -> ((?self :: a) => CanvasDrawCallback) -> m SignalHandlerId Source #
Connect a signal handler for the draw signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
canvas #draw callback