Class CellView

All Implemented Interfaces:
PointerInterface

public class CellView extends Widget
A widget displaying a single row of a GtkTreeModel

A `GtkCellView` displays a single row of a `GtkTreeModel` using a `GtkCellArea`
and `GtkCellAreaContext`. A `GtkCellAreaContext` can be provided to the
`GtkCellView` at construction time in order to keep the cellview in context
of a group of cell views, this ensures that the renderers displayed will
be properly aligned with each other (like the aligned cells in the menus
of `GtkComboBox`).

`GtkCellView` is `GtkOrientable` in order to decide in which orientation
the underlying `GtkCellAreaContext` should be allocated. Taking the `GtkComboBox`
menu as an example, cellviews should be oriented horizontally if the menus are
listed top-to-bottom and thus all share the same width but may have separate
individual heights (left-to-right menus should be allocated vertically since
they all share the same height but may have variable widths).

# CSS nodes

GtkCellView has a single CSS node with name cellview.

https://docs.gtk.org/gtk4/class.CellView.html

  • Constructor Details

    • CellView

      public CellView(PointerContainer pointer)
    • CellView

      public CellView()
      Creates a new `GtkCellView` widget.
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • newWithContextCellView

      public static CellView newWithContextCellView(@Nonnull CellArea area, @Nonnull CellAreaContext context)
      Creates a new `GtkCellView` widget with a specific `GtkCellArea`
      to layout cells and a specific `GtkCellAreaContext`.

      Specifying the same context for a handful of cells lets
      the underlying area synchronize the geometry for those cells,
      in this way alignments with cellviews for other rows are
      possible.
      Parameters:
      area - the `GtkCellArea` to layout cells
      context - the `GtkCellAreaContext` in which to calculate cell geometry
      Returns:
      A newly created `GtkCellView` widget.
    • newWithMarkupCellView

      public static CellView newWithMarkupCellView(@Nonnull Str markup)
      Creates a new `GtkCellView` widget, adds a `GtkCellRendererText`
      to it, and makes it show @markup. The text can be marked up with
      the [Pango text markup language](https://docs.gtk.org/Pango/pango_markup.html).
      Parameters:
      markup - the text to display in the cell view
      Returns:
      A newly created `GtkCellView` widget.
    • newWithMarkupCellView

      public static CellView newWithMarkupCellView(String markup)
      Creates a new `GtkCellView` widget, adds a `GtkCellRendererText`
      to it, and makes it show @markup. The text can be marked up with
      the [Pango text markup language](https://docs.gtk.org/Pango/pango_markup.html).
      Parameters:
      markup - the text to display in the cell view
      Returns:
      A newly created `GtkCellView` widget.
    • newWithTextCellView

      public static CellView newWithTextCellView(@Nonnull Str text)
      Creates a new `GtkCellView` widget, adds a `GtkCellRendererText`
      to it, and makes it show @text.
      Parameters:
      text - the text to display in the cell view
      Returns:
      A newly created `GtkCellView` widget.
    • newWithTextCellView

      public static CellView newWithTextCellView(String text)
      Creates a new `GtkCellView` widget, adds a `GtkCellRendererText`
      to it, and makes it show @text.
      Parameters:
      text - the text to display in the cell view
      Returns:
      A newly created `GtkCellView` widget.
    • newWithTextureCellView

      public static CellView newWithTextureCellView(@Nonnull Texture texture)
      Creates a new `GtkCellView` widget, adds a `GtkCellRendererPixbuf`
      to it, and makes it show @texture.
      Parameters:
      texture - the image to display in the cell view
      Returns:
      A newly created `GtkCellView` widget.
    • getDisplayedRow

      public TreePath getDisplayedRow()
      Returns a `GtkTreePath` referring to the currently
      displayed row. If no row is currently displayed,
      %NULL is returned.
      Returns:
      the currently displayed row
    • getDrawSensitive

      public boolean getDrawSensitive()
      Gets whether @cell_view is configured to draw all of its
      cells in a sensitive state.
      Returns:
      whether @cell_view draws all of its cells in a sensitive state
    • getFitModel

      public boolean getFitModel()
      Gets whether @cell_view is configured to request space
      to fit the entire `GtkTreeModel`.
      Returns:
      whether @cell_view requests space to fit the entire `GtkTreeModel`.
    • getModel

      public TreeModel getModel()
      Returns the model for @cell_view. If no model is used %NULL is
      returned.
      Returns:
      a `GtkTreeModel` used
    • setDisplayedRow

      public void setDisplayedRow(@Nullable TreePath path)
      Sets the row of the model that is currently displayed
      by the `GtkCellView`. If the path is unset, then the
      contents of the cellview “stick” at their last value;
      this is not normally a desired result, but may be
      a needed intermediate state if say, the model for
      the `GtkCellView` becomes temporarily empty.
      Parameters:
      path - a `GtkTreePath` or %NULL to unset.
    • setDrawSensitive

      public void setDrawSensitive(boolean draw_sensitive)
      Sets whether @cell_view should draw all of its
      cells in a sensitive state, this is used by `GtkComboBox` menus
      to ensure that rows with insensitive cells that contain
      children appear sensitive in the parent menu item.
      Parameters:
      draw_sensitive - whether to draw all cells in a sensitive state.
    • setFitModel

      public void setFitModel(boolean fit_model)
      Sets whether @cell_view should request space to fit the entire `GtkTreeModel`.

      This is used by `GtkComboBox` to ensure that the cell view displayed on
      the combo box’s button always gets enough space and does not resize
      when selection changes.
      Parameters:
      fit_model - whether @cell_view should request space for the whole model.
    • setModel

      public void setModel(@Nullable TreeModel model)
      Sets the model for @cell_view. If @cell_view already has a model
      set, it will remove it before setting the new model. If @model is
      %NULL, then it will unset the old model.
      Parameters:
      model - a `GtkTreeModel`
    • asAccessible

      public Accessible asAccessible()
      Implements interface Accessible. Call this to get access to interface functions.
      Overrides:
      asAccessible in class Widget
      Returns:
      Accessible
    • asBuildable

      public Buildable asBuildable()
      Implements interface Buildable. Call this to get access to interface functions.
      Overrides:
      asBuildable in class Widget
      Returns:
      Buildable
    • asCellLayout

      public CellLayout asCellLayout()
      Implements interface CellLayout. Call this to get access to interface functions.
      Returns:
      CellLayout
    • asConstraintTarget

      public ConstraintTarget asConstraintTarget()
      Implements interface ConstraintTarget. Call this to get access to interface functions.
      Overrides:
      asConstraintTarget in class Widget
      Returns:
      ConstraintTarget
    • asOrientable

      public Orientable asOrientable()
      Implements interface Orientable. Call this to get access to interface functions.
      Returns:
      Orientable
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()