:right-sidebar: True CellView =================================================================== .. currentmodule:: gi.repository.Gtk .. deprecated:: 4.10 List views use widgets to display their contents. You can use :obj:`~gi.repository.Gtk.Box` instead .. class:: CellView(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.Widget`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gtk.Accessible`, :class:`~gi.repository.Gtk.Buildable`, :class:`~gi.repository.Gtk.CellLayout`, :class:`~gi.repository.Gtk.ConstraintTarget`, :class:`~gi.repository.Gtk.Orientable` 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. Constructors ------------ .. rst-class:: interim-class .. class:: CellView :no-index: .. classmethod:: new() -> ~gi.repository.Gtk.Widget Creates a new ``GtkCellView`` widget. .. deprecated:: 4.10 Please do not use it in newly written code .. classmethod:: new_with_context(area: ~gi.repository.Gtk.CellArea, context: ~gi.repository.Gtk.CellAreaContext) -> ~gi.repository.Gtk.Widget 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. .. deprecated:: 4.10 Please do not use it in newly written code :param area: the ``GtkCellArea`` to layout cells :param context: the ``GtkCellAreaContext`` in which to calculate cell geometry .. classmethod:: new_with_markup(markup: str) -> ~gi.repository.Gtk.Widget 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 `_. .. deprecated:: 4.10 Please do not use it in newly written code :param markup: the text to display in the cell view .. classmethod:: new_with_text(text: str) -> ~gi.repository.Gtk.Widget Creates a new ``GtkCellView`` widget, adds a ``GtkCellRendererText`` to it, and makes it show ``text``. .. deprecated:: 4.10 Please do not use it in newly written code :param text: the text to display in the cell view .. classmethod:: new_with_texture(texture: ~gi.repository.Gdk.Texture) -> ~gi.repository.Gtk.Widget Creates a new ``GtkCellView`` widget, adds a ``GtkCellRendererPixbuf`` to it, and makes it show ``texture``. .. deprecated:: 4.10 Please do not use it in newly written code :param texture: the image to display in the cell view Methods ------- .. rst-class:: interim-class .. class:: CellView :no-index: .. method:: get_displayed_row() -> ~gi.repository.Gtk.TreePath | None Returns a ``GtkTreePath`` referring to the currently displayed row. If no row is currently displayed, :const:`None` is returned. .. deprecated:: 4.10 Please do not use it in newly written code .. method:: get_draw_sensitive() -> bool Gets whether ``cell_view`` is configured to draw all of its cells in a sensitive state. .. deprecated:: 4.10 Please do not use it in newly written code .. method:: get_fit_model() -> bool Gets whether ``cell_view`` is configured to request space to fit the entire ``GtkTreeModel``. .. deprecated:: 4.10 Please do not use it in newly written code .. method:: get_model() -> ~gi.repository.Gtk.TreeModel | None Returns the model for ``cell_view``. If no model is used :const:`None` is returned. .. deprecated:: 4.10 Please do not use it in newly written code .. method:: set_displayed_row(path: ~gi.repository.Gtk.TreePath | None = None) -> None 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. .. deprecated:: 4.10 Please do not use it in newly written code :param path: a ``GtkTreePath`` or :const:`None` to unset. .. method:: set_draw_sensitive(draw_sensitive: bool) -> None 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. .. deprecated:: 4.10 Please do not use it in newly written code :param draw_sensitive: whether to draw all cells in a sensitive state. .. method:: set_fit_model(fit_model: bool) -> None 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. .. deprecated:: 4.10 Please do not use it in newly written code :param fit_model: whether ``cell_view`` should request space for the whole model. .. method:: set_model(model: ~gi.repository.Gtk.TreeModel | None = None) -> None 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 :const:`None`, then it will unset the old model. .. deprecated:: 4.10 Please do not use it in newly written code :param model: a ``GtkTreeModel`` Properties ---------- .. rst-class:: interim-class .. class:: CellView :no-index: .. attribute:: props.cell_area :type: ~gi.repository.Gtk.CellArea The ``GtkCellArea`` rendering cells If no area is specified when creating the cell view with :func:`~gi.repository.Gtk.CellView.new_with_context` a horizontally oriented ``GtkCellArea``Box will be used. since 3.0 .. attribute:: props.cell_area_context :type: ~gi.repository.Gtk.CellAreaContext The ``GtkCellAreaContext`` used to compute the geometry of the cell view. A group of cell views can be assigned the same context in order to ensure the sizes and cell alignments match across all the views with the same context. ``GtkComboBox`` menus uses this to assign the same context to all cell views in the menu items for a single menu (each submenu creates its own context since the size of each submenu does not depend on parent or sibling menus). since 3.0 .. attribute:: props.draw_sensitive :type: bool Whether all cells should be draw as sensitive for this view regardless of the actual cell properties (used to make menus with submenus appear sensitive when the items in submenus might be insensitive). since 3.0 .. attribute:: props.fit_model :type: bool Whether the view should request enough space to always fit the size of every row in the model (used by the combo box to ensure the combo box size doesn't change when different items are selected). since 3.0 .. attribute:: props.model :type: ~gi.repository.Gtk.TreeModel The model for cell view since 2.10