CellRenderer

open class CellRenderer(pointer: <Error class: unknown class><<Error class: unknown class>>)

An object for rendering a single cell

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

The primary use of a GtkCellRenderer is for drawing a certain graphical elements on a cairo_t. 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 gtk_cell_renderer_get_preferred_size(). Finally, the cell is rendered in the correct location using gtk_cell_renderer_snapshot().

There are a number of rules that must be followed when writing a new GtkCellRenderer. 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 GtkCellRenderer 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 GtkCellRendererToggle, which toggles when it gets activated by a mouse click, or it can be “editable” like GtkCellRendererText, which allows the user to edit the text using a widget implementing the GtkCellEditable interface, e.g. GtkEntry. To make a cell renderer activatable or editable, you have to implement the GtkCellRendererClass.activate or GtkCellRendererClass.start_editing virtual functions, respectively.

Many properties of GtkCellRenderer 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.

Skipped during bindings generation

  • parameter xalign: xalign: Out parameter is not supported

  • parameter width: width: Out parameter is not supported

  • parameter xpad: xpad: Out parameter is not supported

  • parameter minimum_size: minimum_size: Out parameter is not supported

  • parameter minimum_height: minimum_height: Out parameter is not supported

  • parameter minimum_size: minimum_size: Out parameter is not supported

  • parameter minimum_width: minimum_width: Out parameter is not supported

  • parameter snapshot: Snapshot

  • method cell-background: Property has no getter nor setter

  • method cell-background-rgba: Property has no getter nor setter

  • method cell-background-set: Property has no getter nor setter

  • method editing: Property has no getter nor setter

  • method height: Property has no getter nor setter

  • method mode: Property has no getter nor setter

  • method width: Property has no getter nor setter

  • method xalign: Property has no getter nor setter

  • method xpad: Property has no getter nor setter

  • method yalign: Property has no getter nor setter

  • method ypad: Property has no getter nor setter

Inheritors

Constructors

Link copied to clipboard
constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val gtkCellRendererPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open var sensitive: Boolean
Link copied to clipboard
open var visible: Boolean

Functions

Link copied to clipboard
open fun activate(event: <Error class: unknown class>, widget: Widget, path: String, backgroundArea: <Error class: unknown class>, cellArea: <Error class: unknown class>, flags: CellRendererState): Boolean

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

Link copied to clipboard
fun connectEditingCanceled(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

This signal gets emitted when the user cancels the process of editing a cell. For example, an editable cell renderer could be written to cancel editing when the user presses Escape.

Link copied to clipboard
fun connectEditingStarted(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (editable: CellEditable, path: String) -> Unit): <Error class: unknown class>

This signal gets emitted when a cell starts to be edited. The intended use of this signal is to do special setup on @editable, e.g. adding a GtkEntryCompletion or setting up additional columns in a GtkComboBox.

Link copied to clipboard
open fun getAlignedArea(widget: Widget, flags: CellRendererState, cellArea: <Error class: unknown class>, alignedArea: <Error class: unknown class>)

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

Link copied to clipboard

Checks whether the given GtkCellRenderer is expanded.

Link copied to clipboard

Checks whether the given GtkCellRenderer is an expander.

Link copied to clipboard
open fun getPreferredSize(widget: Widget, minimumSize: Requisition?, naturalSize: Requisition?)

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

Link copied to clipboard

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

Link copied to clipboard
open fun getSensitive(): Boolean

Returns the cell renderer’s sensitivity.

Link copied to clipboard
open fun getState(widget: Widget? = null, cellState: CellRendererState): StateFlags

Translates the cell renderer state to GtkStateFlags, based on the cell renderer and widget sensitivity, and the given GtkCellRendererState.

Link copied to clipboard
open fun getVisible(): Boolean

Returns the cell renderer’s visibility.

Link copied to clipboard

Checks whether the cell renderer can do something when activated.

Link copied to clipboard
open fun setAlignment(xalign: Float, yalign: Float)

Sets the renderer’s alignment within its available space.

Link copied to clipboard
open fun setFixedSize(width: Int, height: Int)

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

Link copied to clipboard
open fun setIsExpanded(isExpanded: Boolean)

Sets whether the given GtkCellRenderer is expanded.

Link copied to clipboard
open fun setIsExpander(isExpander: Boolean)

Sets whether the given GtkCellRenderer is an expander.

Link copied to clipboard
open fun setPadding(xpad: Int, ypad: Int)

Sets the renderer’s padding.

Link copied to clipboard
open fun setSensitive(sensitive: Boolean)

Sets the cell renderer’s sensitivity.

Link copied to clipboard
open fun setVisible(visible: Boolean)

Sets the cell renderer’s visibility.

Link copied to clipboard
open fun startEditing(event: <Error class: unknown class>? = null, widget: Widget, path: String, backgroundArea: <Error class: unknown class>, cellArea: <Error class: unknown class>, flags: CellRendererState): CellEditable?

Starts editing the contents of this @cell, through a new GtkCellEditable widget created by the GtkCellRendererClass.start_editing virtual function.

Link copied to clipboard
open fun stopEditing(canceled: Boolean)

Informs the cell renderer that the editing is stopped. If @canceled is true, the cell renderer will emit the GtkCellRenderer::editing-canceled signal.