gi-gtk-3.0.17: Gtk bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Objects.CellRenderer

Contents

Description

The CellRenderer is a base class of a set of objects used for rendering a cell to a Context. These objects are used primarily by the TreeView widget, though they aren’t tied to them in any specific way. It is worth noting that CellRenderer is not a Widget and cannot be treated as such.

The primary use of a CellRenderer is for drawing a certain graphical elements on a Context. Typically, one cell renderer is used to draw many cells on the screen. To this extent, it isn’t expected that a CellRenderer keep any permanent state around. Instead, any state is set just prior to use using GObjects property system. Then, the cell is measured using cellRendererGetSize. Finally, the cell is rendered in the correct location using cellRendererRender.

There are a number of rules that must be followed when writing a new CellRenderer. First and foremost, it’s important that a certain set of properties will always yield a cell renderer of the same size, barring a Style change. The CellRenderer also has a number of generic properties that are expected to be honored by all children.

Beyond merely rendering a cell, cell renderers can optionally provide active user interface elements. A cell renderer can be “activatable” like CellRendererToggle, which toggles when it gets activated by a mouse click, or it can be “editable” like CellRendererText, which allows the user to edit the text using a Entry. To make a cell renderer activatable or editable, you have to implement the CellRendererClass.activate or CellRendererClass.start_editing virtual functions, respectively.

Many properties of CellRenderer and its subclasses have a corresponding “set” property, e.g. “cell-background-set” corresponds to “cell-background”. These “set” properties reflect whether a property has been set or not. You should not set them independently.

Synopsis

Exported types

Methods

activate

cellRendererActivate Source #

Arguments

:: (HasCallStack, MonadIO m, IsCellRenderer a, IsWidget b) 
=> a

cell: a CellRenderer

-> Event

event: a Event

-> b

widget: widget that received the event

-> Text

path: widget-dependent string representation of the event location; e.g. for TreeView, a string representation of TreePath

-> Rectangle

backgroundArea: background area as passed to cellRendererRender

-> Rectangle

cellArea: cell area as passed to cellRendererRender

-> [CellRendererState]

flags: render flags

-> m Bool

Returns: True if the event was consumed/handled

Passes an activate event to the cell renderer for possible processing. Some cell renderers may use events; for example, CellRendererToggle toggles when it gets a mouse click.

getAlignedArea

cellRendererGetAlignedArea Source #

Arguments

:: (HasCallStack, MonadIO m, IsCellRenderer a, IsWidget b) 
=> a

cell: a CellRenderer instance

-> b

widget: the Widget this cell will be rendering to

-> [CellRendererState]

flags: render flags

-> Rectangle

cellArea: cell area which would be passed to cellRendererRender

-> m Rectangle 

Gets the aligned area used by cell inside cellArea. Used for finding the appropriate edit and focus rectangle.

Since: 3.0

getAlignment

cellRendererGetAlignment Source #

Arguments

:: (HasCallStack, MonadIO m, IsCellRenderer a) 
=> a

cell: A CellRenderer

-> m (Float, Float) 

Fills in xalign and yalign with the appropriate values of cell.

Since: 2.18

getFixedSize

cellRendererGetFixedSize Source #

Arguments

:: (HasCallStack, MonadIO m, IsCellRenderer a) 
=> a

cell: A CellRenderer

-> m (Int32, Int32) 

Fills in width and height with the appropriate size of cell.

getPadding

cellRendererGetPadding Source #

Arguments

:: (HasCallStack, MonadIO m, IsCellRenderer a) 
=> a

cell: A CellRenderer

-> m (Int32, Int32) 

Fills in xpad and ypad with the appropriate values of cell.

Since: 2.18

getPreferredHeight

cellRendererGetPreferredHeight Source #

Arguments

:: (HasCallStack, MonadIO m, IsCellRenderer a, IsWidget b) 
=> a

cell: a CellRenderer instance

-> b

widget: the Widget this cell will be rendering to

-> m (Int32, Int32) 

Retreives a renderer’s natural size when rendered to widget.

Since: 3.0

getPreferredHeightForWidth

cellRendererGetPreferredHeightForWidth Source #

Arguments

:: (HasCallStack, MonadIO m, IsCellRenderer a, IsWidget b) 
=> a

cell: a CellRenderer instance

-> b

widget: the Widget this cell will be rendering to

-> Int32

width: the size which is available for allocation

-> m (Int32, Int32) 

Retreives a cell renderers’s minimum and natural height if it were rendered to widget with the specified width.

Since: 3.0

getPreferredSize

cellRendererGetPreferredSize Source #

Arguments

:: (HasCallStack, MonadIO m, IsCellRenderer a, IsWidget b) 
=> a

cell: a CellRenderer instance

-> b

widget: the Widget this cell will be rendering to

-> m (Requisition, Requisition) 

Retrieves the minimum and natural size of a cell taking into account the widget’s preference for height-for-width management.

Since: 3.0

getPreferredWidth

cellRendererGetPreferredWidth Source #

Arguments

:: (HasCallStack, MonadIO m, IsCellRenderer a, IsWidget b) 
=> a

cell: a CellRenderer instance

-> b

widget: the Widget this cell will be rendering to

-> m (Int32, Int32) 

Retreives a renderer’s natural size when rendered to widget.

Since: 3.0

getPreferredWidthForHeight

cellRendererGetPreferredWidthForHeight Source #

Arguments

:: (HasCallStack, MonadIO m, IsCellRenderer a, IsWidget b) 
=> a

cell: a CellRenderer instance

-> b

widget: the Widget this cell will be rendering to

-> Int32

height: the size which is available for allocation

-> m (Int32, Int32) 

Retreives a cell renderers’s minimum and natural width if it were rendered to widget with the specified height.

Since: 3.0

getRequestMode

cellRendererGetRequestMode Source #

Arguments

:: (HasCallStack, MonadIO m, IsCellRenderer a) 
=> a

cell: a CellRenderer instance

-> m SizeRequestMode

Returns: The SizeRequestMode preferred by this renderer.

Gets whether the cell renderer prefers a height-for-width layout or a width-for-height layout.

Since: 3.0

getSensitive

cellRendererGetSensitive Source #

Arguments

:: (HasCallStack, MonadIO m, IsCellRenderer a) 
=> a

cell: A CellRenderer

-> m Bool

Returns: True if the cell renderer is sensitive

Returns the cell renderer’s sensitivity.

Since: 2.18

getSize

cellRendererGetSize Source #

Arguments

:: (HasCallStack, MonadIO m, IsCellRenderer a, IsWidget b) 
=> a

cell: a CellRenderer

-> b

widget: the widget the renderer is rendering to

-> Maybe Rectangle

cellArea: The area a cell will be allocated, or Nothing

-> m (Int32, Int32, Int32, Int32) 

Deprecated: (Since version 3.0)Use cellRendererGetPreferredSize instead.

Obtains the width and height needed to render the cell. Used by view widgets to determine the appropriate size for the cell_area passed to cellRendererRender. If cellArea is not Nothing, fills in the x and y offsets (if set) of the cell relative to this location.

Please note that the values set in width and height, as well as those in xOffset and yOffset are inclusive of the xpad and ypad properties.

getState

cellRendererGetState Source #

Arguments

:: (HasCallStack, MonadIO m, IsCellRenderer a, IsWidget b) 
=> a

cell: a CellRenderer, or Nothing

-> Maybe b

widget: a Widget, or Nothing

-> [CellRendererState]

cellState: cell renderer state

-> m [StateFlags]

Returns: the widget state flags applying to cell

Translates the cell renderer state to StateFlags, based on the cell renderer and widget sensitivity, and the given CellRendererState.

Since: 3.0

getVisible

cellRendererGetVisible Source #

Arguments

:: (HasCallStack, MonadIO m, IsCellRenderer a) 
=> a

cell: A CellRenderer

-> m Bool

Returns: True if the cell renderer is visible

Returns the cell renderer’s visibility.

Since: 2.18

isActivatable

cellRendererIsActivatable Source #

Arguments

:: (HasCallStack, MonadIO m, IsCellRenderer a) 
=> a

cell: A CellRenderer

-> m Bool

Returns: True if the cell renderer can do anything when activated

Checks whether the cell renderer can do something when activated.

Since: 3.0

render

cellRendererRender Source #

Arguments

:: (HasCallStack, MonadIO m, IsCellRenderer a, IsWidget b) 
=> a

cell: a CellRenderer

-> Context

cr: a cairo context to draw to

-> b

widget: the widget owning window

-> Rectangle

backgroundArea: entire cell area (including tree expanders and maybe padding on the sides)

-> Rectangle

cellArea: area normally rendered by a cell renderer

-> [CellRendererState]

flags: flags that affect rendering

-> m () 

Invokes the virtual render function of the CellRenderer. The three passed-in rectangles are areas in cr. Most renderers will draw within cellArea; the xalign, yalign, xpad, and ypad fields of the CellRenderer should be honored with respect to cellArea. backgroundArea includes the blank space around the cell, and also the area containing the tree expander; so the backgroundArea rectangles for all cells tile to cover the entire window.

setAlignment

cellRendererSetAlignment Source #

Arguments

:: (HasCallStack, MonadIO m, IsCellRenderer a) 
=> a

cell: A CellRenderer

-> Float

xalign: the x alignment of the cell renderer

-> Float

yalign: the y alignment of the cell renderer

-> m () 

Sets the renderer’s alignment within its available space.

Since: 2.18

setFixedSize

cellRendererSetFixedSize Source #

Arguments

:: (HasCallStack, MonadIO m, IsCellRenderer a) 
=> a

cell: A CellRenderer

-> Int32

width: the width of the cell renderer, or -1

-> Int32

height: the height of the cell renderer, or -1

-> m () 

Sets the renderer size to be explicit, independent of the properties set.

setPadding

cellRendererSetPadding Source #

Arguments

:: (HasCallStack, MonadIO m, IsCellRenderer a) 
=> a

cell: A CellRenderer

-> Int32

xpad: the x padding of the cell renderer

-> Int32

ypad: the y padding of the cell renderer

-> m () 

Sets the renderer’s padding.

Since: 2.18

setSensitive

cellRendererSetSensitive Source #

Arguments

:: (HasCallStack, MonadIO m, IsCellRenderer a) 
=> a

cell: A CellRenderer

-> Bool

sensitive: the sensitivity of the cell

-> m () 

Sets the cell renderer’s sensitivity.

Since: 2.18

setVisible

cellRendererSetVisible Source #

Arguments

:: (HasCallStack, MonadIO m, IsCellRenderer a) 
=> a

cell: A CellRenderer

-> Bool

visible: the visibility of the cell

-> m () 

Sets the cell renderer’s visibility.

Since: 2.18

startEditing

cellRendererStartEditing Source #

Arguments

:: (HasCallStack, MonadIO m, IsCellRenderer a, IsWidget b) 
=> a

cell: a CellRenderer

-> Maybe Event

event: a Event

-> b

widget: widget that received the event

-> Text

path: widget-dependent string representation of the event location; e.g. for TreeView, a string representation of TreePath

-> Rectangle

backgroundArea: background area as passed to cellRendererRender

-> Rectangle

cellArea: cell area as passed to cellRendererRender

-> [CellRendererState]

flags: render flags

-> m (Maybe CellEditable)

Returns: A new CellEditable, or Nothing

Passes an activate event to the cell renderer for possible processing.

stopEditing

cellRendererStopEditing Source #

Arguments

:: (HasCallStack, MonadIO m, IsCellRenderer a) 
=> a

cell: A CellRenderer

-> Bool

canceled: True if the editing has been canceled

-> m () 

Informs the cell renderer that the editing is stopped. If canceled is True, the cell renderer will emit the CellRenderer::editing-canceled signal.

This function should be called by cell renderer implementations in response to the CellEditable::editing-done signal of CellEditable.

Since: 2.6

Properties

cellBackground

cellBackgroundGdk

cellBackgroundRgba

cellBackgroundSet

editing

height

isExpanded

isExpander

mode

sensitive

visible

width

xalign

xpad

yalign

ypad

Signals

editingCanceled

editingStarted