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.

  • ptr

    Untyped pointer to the underlying GtkCellAreaContext instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • cell_area_context_ptr Default implementation

    Typed 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)

CellAreaContext Class

  • 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 transformation

    transform_to

    ValueTransformer to use for backwards transformation

    Return 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:value:) Extension method

    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

CellAreaContext Class: CellAreaContextProtocol extension (methods and fields)

  • allocate(width:height:) Extension method

    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 when GtkTreeView:fixed-height-mode is enabled.

    Declaration

    Swift

    @inlinable
    func allocate(width: Int, height: Int)
  • getAllocation(width:height:) Extension method

    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 method

    Fetches the GtkCellArea this context 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 the GtkCellArea is configured with in order to compute a proper allocation.

    Declaration

    Swift

    @inlinable
    func getArea() -> CellAreaRef!
  • 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 a GtkCellArea, the returned values are 0.

    Declaration

    Swift

    @inlinable
    func getPreferredHeight(minimumHeight: UnsafeMutablePointer<gint>! = nil, naturalHeight: UnsafeMutablePointer<gint>! = nil)
  • Gets the accumulative preferred height for width for all rows which have been requested for the same said width with this context.

    After gtk_cell_area_context_reset() is called and/or before ever requesting the size of a GtkCellArea, the returned values are -1.

    Declaration

    Swift

    @inlinable
    func getPreferredHeightFor(width: Int, minimumHeight: UnsafeMutablePointer<gint>! = nil, naturalHeight: UnsafeMutablePointer<gint>! = nil)
  • 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 a GtkCellArea, the returned values are 0.

    Declaration

    Swift

    @inlinable
    func getPreferredWidth(minimumWidth: UnsafeMutablePointer<gint>! = nil, naturalWidth: UnsafeMutablePointer<gint>! = nil)
  • Gets the accumulative preferred width for height for all rows which have been requested for the same said height with this context.

    After gtk_cell_area_context_reset() is called and/or before ever requesting the size of a GtkCellArea, the returned values are -1.

    Declaration

    Swift

    @inlinable
    func getPreferredWidthFor(height: Int, minimumWidth: UnsafeMutablePointer<gint>! = nil, naturalWidth: UnsafeMutablePointer<gint>! = nil)
  • 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 of GtkTreeModel rows to progressively push the requested height over a series of gtk_cell_area_get_preferred_height() requests.

    Declaration

    Swift

    @inlinable
    func pushPreferredHeight(minimumHeight: Int, naturalHeight: Int)
  • 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 of GtkTreeModel rows to progressively push the requested width over a series of gtk_cell_area_get_preferred_width() requests.

    Declaration

    Swift

    @inlinable
    func pushPreferredWidth(minimumWidth: Int, naturalWidth: Int)
  • reset() Extension method

    Resets 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 with gtk_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 method

    The GtkCellArea this context was created by

    Declaration

    Swift

    @inlinable
    var area: CellAreaRef! { get }