CellAreaContextProtocol
public protocol CellAreaContextProtocol : ObjectProtocol
Stores geometrical information for a series of rows in a GtkCellArea
The GtkCellAreaContext
object is created by a given GtkCellArea
implementation via its GtkCellAreaClass.create_context()
virtual
method and is used to store cell sizes and alignments for a series of
GtkTreeModel
rows that are requested and rendered in the same context.
GtkCellLayout
widgets can create any number of contexts in which to
request and render groups of data rows. However, it’s important that the
same context which was used to request sizes for a given GtkTreeModel
row also be used for the same row when calling other GtkCellArea
APIs
such as gtk_cell_area_render()
and gtk_cell_area_event()
.
The CellAreaContextProtocol
protocol exposes the methods and properties of an underlying GtkCellAreaContext
instance.
The default implementation of these can be found in the protocol extension below.
For a concrete class that implements these methods and properties, see CellAreaContext
.
Alternatively, use CellAreaContextRef
as a lighweight, unowned
reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkCellAreaContext
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
cell_area_context_ptr
Default implementationTyped pointer to the underlying
GtkCellAreaContext
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkCellAreaContext
instance.Declaration
Swift
var cell_area_context_ptr: UnsafeMutablePointer<GtkCellAreaContext>! { get }
-
Required Initialiser for types conforming to
CellAreaContextProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:
Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
CellAreaContextPropertyName
source property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: CellAreaContextPropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocol
Parameters
source_property
the source property to bind
target
the target object to bind to
target_property
the target property to bind to
flags
the flags to pass to the
Binding
transform_from
ValueTransformer
to use for forward transformationtransform_to
ValueTransformer
to use for backwards transformationReturn Value
binding reference or
nil
in case of an error -
get(property:
Extension method) Get the value of a CellAreaContext property
Declaration
Swift
@inlinable func get(property: CellAreaContextPropertyName) -> GLibObject.Value
Parameters
property
the property to get the value for
Return Value
the value of the named property
-
set(property:
Extension methodvalue: ) Set the value of a CellAreaContext property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: CellAreaContextPropertyName, value v: GLibObject.Value)
Parameters
property
the property to get the value for
Return Value
the value of the named property
-
allocate(width:
Extension methodheight: ) Allocates a width and/or a height for all rows which are to be rendered with
context
.Usually allocation is performed only horizontally or sometimes vertically since a group of rows are usually rendered side by side vertically or horizontally and share either the same width or the same height. Sometimes they are allocated in both horizontal and vertical orientations producing a homogeneous effect of the rows. This is generally the case for
GtkTreeView
whenGtkTreeView:fixed-height-mode
is enabled.Declaration
Swift
@inlinable func allocate(width: Int, height: Int)
-
getAllocation(width:
Extension methodheight: ) Fetches the current allocation size for
context
.If the context was not allocated in width or height, or if the context was recently reset with
gtk_cell_area_context_reset()
, the returned value will be -1.Declaration
Swift
@inlinable func getAllocation(width: UnsafeMutablePointer<gint>! = nil, height: UnsafeMutablePointer<gint>! = nil)
-
getArea()
Extension methodFetches the
GtkCellArea
thiscontext
was created by.This is generally unneeded by layouting widgets; however, it is important for the context implementation itself to fetch information about the area it is being used for.
For instance at
GtkCellAreaContextClass.allocate()
time it’s important to know details about any cell spacing that theGtkCellArea
is configured with in order to compute a proper allocation.Declaration
Swift
@inlinable func getArea() -> CellAreaRef!
-
getPreferredHeight(minimumHeight:
Extension methodnaturalHeight: ) Gets the accumulative preferred height for all rows which have been requested with this context.
After
gtk_cell_area_context_reset()
is called and/or before ever requesting the size of aGtkCellArea
, the returned values are 0.Declaration
Swift
@inlinable func getPreferredHeight(minimumHeight: UnsafeMutablePointer<gint>! = nil, naturalHeight: UnsafeMutablePointer<gint>! = nil)
-
getPreferredHeightFor(width:
Extension methodminimumHeight: naturalHeight: ) Gets the accumulative preferred height for
width
for all rows which have been requested for the same saidwidth
with this context.After
gtk_cell_area_context_reset()
is called and/or before ever requesting the size of aGtkCellArea
, the returned values are -1.Declaration
Swift
@inlinable func getPreferredHeightFor(width: Int, minimumHeight: UnsafeMutablePointer<gint>! = nil, naturalHeight: UnsafeMutablePointer<gint>! = nil)
-
getPreferredWidth(minimumWidth:
Extension methodnaturalWidth: ) Gets the accumulative preferred width for all rows which have been requested with this context.
After
gtk_cell_area_context_reset()
is called and/or before ever requesting the size of aGtkCellArea
, the returned values are 0.Declaration
Swift
@inlinable func getPreferredWidth(minimumWidth: UnsafeMutablePointer<gint>! = nil, naturalWidth: UnsafeMutablePointer<gint>! = nil)
-
getPreferredWidthFor(height:
Extension methodminimumWidth: naturalWidth: ) Gets the accumulative preferred width for
height
for all rows which have been requested for the same saidheight
with this context.After
gtk_cell_area_context_reset()
is called and/or before ever requesting the size of aGtkCellArea
, the returned values are -1.Declaration
Swift
@inlinable func getPreferredWidthFor(height: Int, minimumWidth: UnsafeMutablePointer<gint>! = nil, naturalWidth: UnsafeMutablePointer<gint>! = nil)
-
pushPreferredHeight(minimumHeight:
Extension methodnaturalHeight: ) Causes the minimum and/or natural height to grow if the new proposed sizes exceed the current minimum and natural height.
This is used by
GtkCellAreaContext
implementations during the request process over a series ofGtkTreeModel
rows to progressively push the requested height over a series ofgtk_cell_area_get_preferred_height()
requests.Declaration
Swift
@inlinable func pushPreferredHeight(minimumHeight: Int, naturalHeight: Int)
-
pushPreferredWidth(minimumWidth:
Extension methodnaturalWidth: ) Causes the minimum and/or natural width to grow if the new proposed sizes exceed the current minimum and natural width.
This is used by
GtkCellAreaContext
implementations during the request process over a series ofGtkTreeModel
rows to progressively push the requested width over a series ofgtk_cell_area_get_preferred_width()
requests.Declaration
Swift
@inlinable func pushPreferredWidth(minimumWidth: Int, naturalWidth: Int)
-
reset()
Extension methodResets any previously cached request and allocation data.
When underlying
GtkTreeModel
data changes its important to reset the context if the content size is allowed to shrink. If the content size is only allowed to grow (this is usually an option for views rendering large data stores as a measure of optimization), then only the row that changed or was inserted needs to be (re)requested withgtk_cell_area_get_preferred_width()
.When the new overall size of the context requires that the allocated size changes (or whenever this allocation changes at all), the variable row sizes need to be re-requested for every row.
For instance, if the rows are displayed all with the same width from top to bottom then a change in the allocated width necessitates a recalculation of all the displayed row heights using
gtk_cell_area_get_preferred_height_for_width()
.Declaration
Swift
@inlinable func reset()
-
area
Extension methodThe
GtkCellArea
this context was created byDeclaration
Swift
@inlinable var area: CellAreaRef! { get }