CellRendererRef
public struct CellRendererRef : CellRendererProtocol, GWeakCapturing
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 GObject
s 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 GtkCellRenderer
Toggle,
which toggles when it gets activated by a mouse click, or it can be
“editable” like GtkCellRenderer
Text, 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 GtkCellRenderer
Class.activate or
GtkCellRenderer
Class.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.
The CellRendererRef
type acts as a lightweight Swift reference to an underlying GtkCellRenderer
instance.
It exposes methods that can operate on this data type through CellRendererProtocol
conformance.
Use CellRendererRef
only as an unowned
reference to an existing GtkCellRenderer
instance.
-
Untyped pointer to the underlying `GtkCellRenderer` instance.
For type-safe access, use the generated, typed pointer
cell_renderer_ptr
property instead.Declaration
Swift
public let ptr: UnsafeMutableRawPointer!
-
Designated initialiser from the underlying
C
data typeDeclaration
Swift
@inlinable init(_ p: UnsafeMutablePointer<GtkCellRenderer>)
-
Designated initialiser from a constant pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init(_ p: UnsafePointer<GtkCellRenderer>)
-
Conditional initialiser from an optional pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init!(_ maybePointer: UnsafeMutablePointer<GtkCellRenderer>?)
-
Conditional initialiser from an optional, non-mutable pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init!(_ maybePointer: UnsafePointer<GtkCellRenderer>?)
-
Conditional initialiser from an optional
gpointer
Declaration
Swift
@inlinable init!(gpointer g: gpointer?)
-
Conditional initialiser from an optional, non-mutable
gconstpointer
Declaration
Swift
@inlinable init!(gconstpointer g: gconstpointer?)
-
Reference intialiser for a related type that implements
CellRendererProtocol
Declaration
Swift
@inlinable init<T>(_ other: T) where T : CellRendererProtocol
-
This factory is syntactic sugar for setting weak pointers wrapped in
GWeak<T>
Declaration
Swift
@inlinable static func unowned<T>(_ other: T) -> CellRendererRef where T : CellRendererProtocol
-
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
CellRendererProtocol
.Declaration
Swift
@inlinable init<T>(cPointer: UnsafeMutablePointer<T>)
-
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
CellRendererProtocol
.Declaration
Swift
@inlinable init<T>(constPointer: UnsafePointer<T>)
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
CellRendererProtocol
.Declaration
Swift
@inlinable init(mutating raw: UnsafeRawPointer)
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
CellRendererProtocol
.Declaration
Swift
@inlinable init(raw: UnsafeMutableRawPointer)
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
CellRendererProtocol
.Declaration
Swift
@inlinable init(opaquePointer: OpaquePointer)