GridViewRef

public struct GridViewRef : GridViewProtocol, GWeakCapturing

GtkGridView presents a large dynamic grid of items.

GtkGridView uses its factory to generate one child widget for each visible item and shows them in a grid. The orientation of the grid view determines if the grid reflows vertically or horizontally.

GtkGridView allows the user to select items according to the selection characteristics of the model. For models that allow multiple selected items, it is possible to turn on rubberband selection, using [propertyGtk.GridView:enable-rubberband].

To learn more about the list widget framework, see the overview.

CSS nodes

gridview
├── child[.activatable]

├── child[.activatable]


╰── [rubberband]

GtkGridView uses a single CSS node with name gridview. Each child uses a single CSS node with name child. If the [propertyGtk.ListItem:activatable] property is set, the corresponding row will have the .activatable style class. For rubberband selection, a subnode with name rubberband is used.

Accessibility

GtkGridView uses the GTK_ACCESSIBLE_ROLE_GRID role, and the items use the GTK_ACCESSIBLE_ROLE_GRID_CELL role.

The GridViewRef type acts as a lightweight Swift reference to an underlying GtkGridView instance. It exposes methods that can operate on this data type through GridViewProtocol conformance. Use GridViewRef only as an unowned reference to an existing GtkGridView instance.

  • ptr
    Untyped pointer to the underlying `GtkGridView` instance.
    

    For type-safe access, use the generated, typed pointer grid_view_ptr property instead.

    Declaration

    Swift

    public let ptr: UnsafeMutableRawPointer!

GridView Class

  • Designated initialiser from the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafeMutablePointer<GtkGridView>)
  • Designated initialiser from a constant pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafePointer<GtkGridView>)
  • Conditional initialiser from an optional pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafeMutablePointer<GtkGridView>?)
  • Conditional initialiser from an optional, non-mutable pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafePointer<GtkGridView>?)
  • 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 GridViewProtocol

    Declaration

    Swift

    @inlinable
    init<T>(_ other: T) where T : GridViewProtocol
  • This factory is syntactic sugar for setting weak pointers wrapped in GWeak<T>

    Declaration

    Swift

    @inlinable
    static func unowned<T>(_ other: T) -> GridViewRef where T : GridViewProtocol
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to GridViewProtocol.

    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 GridViewProtocol.

    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 GridViewProtocol.

    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 GridViewProtocol.

    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 GridViewProtocol.

    Declaration

    Swift

    @inlinable
    init(opaquePointer: OpaquePointer)
  • Creates a new `GtkGridView` that uses the given `factory` for
    

    mapping items to widgets.

    The function takes ownership of the arguments, so you can write code like

    grid_view = gtk_grid_view_new (create_model (),
      gtk_builder_list_item_factory_new_from_resource ("/resource.ui"));
    

    Declaration

    Swift

    @inlinable
    init<ListItemFactoryT, SelectionModelT>(model: SelectionModelT?, factory: ListItemFactoryT?) where ListItemFactoryT : ListItemFactoryProtocol, SelectionModelT : SelectionModelProtocol