Gtk.CellView

g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.CellLayout Gtk.CellLayout GObject.GInterface->Gtk.CellLayout Gtk.Orientable Gtk.Orientable GObject.GInterface->Gtk.Orientable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Buildable->Gtk.Widget Gtk.CellView Gtk.CellView Gtk.CellLayout->Gtk.CellView Gtk.Orientable->Gtk.CellView Gtk.Widget->Gtk.CellView

Subclasses:None

Properties

Inherited:Gtk.Widget (39), Gtk.Orientable (1)
Name Type Flags Short Description
background str w Background color as a string
background-gdk Gdk.Color d/r/w Background color as a Gdk.Color deprecated
background-rgba Gdk.RGBA r/w Background color as a Gdk.RGBA
background-set bool r/w Whether this tag affects the background color
cell-area Gtk.CellArea r/w/co The Gtk.CellArea used to layout cells
cell-area-context Gtk.CellAreaContext r/w/co The Gtk.CellAreaContext used to compute the geometry of the cell view
draw-sensitive bool r/w/en Whether to force cells to be drawn in a sensitive state
fit-model bool r/w/en Whether to request enough space for every row in the model
model Gtk.TreeModel r/w The model for cell view

Style Properties

Inherited:Gtk.Widget (17)

Fields

Inherited:Gtk.Widget (69), GObject.Object (1)
Name Type Access Description
parent_instance Gtk.Widget r  

Class Details

class Gtk.CellView(**kwargs)
Bases:Gtk.Widget, Gtk.CellLayout, Gtk.Orientable
Abstract:No
Structure:Gtk.CellViewClass

A Gtk.CellView displays a single row of a Gtk.TreeModel using a Gtk.CellArea and Gtk.CellAreaContext. A Gtk.CellAreaContext can be provided to the Gtk.CellView 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 eachother (like the aligned cells in the menus of Gtk.ComboBox).

Gtk.CellView is Gtk.Orientable in order to decide in which orientation the underlying Gtk.CellAreaContext should be allocated. Taking the Gtk.ComboBox 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

Gtk.CellView has a single CSS node with name cellview.

classmethod new()[source]
Returns:A newly created Gtk.CellView widget.
Return type:Gtk.Widget

Creates a new Gtk.CellView widget.

New in version 2.6.

classmethod new_with_context(area, context)[source]
Parameters:
Returns:

A newly created Gtk.CellView widget.

Return type:

Gtk.Widget

Creates a new Gtk.CellView widget with a specific Gtk.CellArea to layout cells and a specific Gtk.CellAreaContext.

Specifying the same context for a handfull of cells lets the underlying area synchronize the geometry for those cells, in this way alignments with cellviews for other rows are possible.

New in version 2.6.

classmethod new_with_markup(markup)[source]
Parameters:markup (str) – the text to display in the cell view
Returns:A newly created Gtk.CellView widget.
Return type:Gtk.Widget

Creates a new Gtk.CellView widget, adds a Gtk.CellRendererText to it, and makes it show markup. The text can be marked up with the Pango text markup language.

New in version 2.6.

classmethod new_with_pixbuf(pixbuf)[source]
Parameters:pixbuf (GdkPixbuf.Pixbuf) – the image to display in the cell view
Returns:A newly created Gtk.CellView widget.
Return type:Gtk.Widget

Creates a new Gtk.CellView widget, adds a Gtk.CellRendererPixbuf to it, and makes it show pixbuf.

New in version 2.6.

classmethod new_with_text(text)[source]
Parameters:text (str) – the text to display in the cell view
Returns:A newly created Gtk.CellView widget.
Return type:Gtk.Widget

Creates a new Gtk.CellView widget, adds a Gtk.CellRendererText to it, and makes it show text.

New in version 2.6.

get_displayed_row()[source]
Returns:the currently displayed row or None
Return type:Gtk.TreePath or None

Returns a Gtk.TreePath referring to the currently displayed row. If no row is currently displayed, None is returned.

New in version 2.6.

get_draw_sensitive()[source]
Returns:whether self draws all of its cells in a sensitive state
Return type:bool

Gets whether self is configured to draw all of its cells in a sensitive state.

New in version 3.0.

get_fit_model()[source]
Returns:whether self requests space to fit the entire Gtk.TreeModel.
Return type:bool

Gets whether self is configured to request space to fit the entire Gtk.TreeModel.

New in version 3.0.

get_model()[source]
Returns:a Gtk.TreeModel used or None
Return type:Gtk.TreeModel or None

Returns the model for self. If no model is used None is returned.

New in version 2.16.

get_size_of_row(path)[source]
Parameters:path (Gtk.TreePath) – a Gtk.TreePath
Returns:True
requisition:return location for the size
Return type:(bool, requisition: Gtk.Requisition)

Sets requisition to the size needed by self to display the model row pointed to by path.

New in version 2.6.

Deprecated since version 3.0: Combo box formerly used this to calculate the sizes for cellviews, now you can achieve this by either using the Gtk.CellView :fit-model property or by setting the currently displayed row of the Gtk.CellView and using Gtk.Widget.get_preferred_size().

set_background_color(color)[source]
Parameters:color (Gdk.Color) – the new background color

Sets the background color of view.

New in version 2.6.

Deprecated since version 3.4: Use Gtk.CellView.set_background_rgba() instead.

set_background_rgba(rgba)[source]
Parameters:rgba (Gdk.RGBA) – the new background color

Sets the background color of self.

New in version 3.0.

set_displayed_row(path)[source]
Parameters:path (Gtk.TreePath or None) – a Gtk.TreePath or None to unset.

Sets the row of the model that is currently displayed by the Gtk.CellView. 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 Gtk.CellView becomes temporarily empty.

New in version 2.6.

set_draw_sensitive(draw_sensitive)[source]
Parameters:draw_sensitive (bool) – whether to draw all cells in a sensitive state.

Sets whether self should draw all of its cells in a sensitive state, this is used by Gtk.ComboBox menus to ensure that rows with insensitive cells that contain children appear sensitive in the parent menu item.

New in version 3.0.

set_fit_model(fit_model)[source]
Parameters:fit_model (bool) – whether self should request space for the whole model.

Sets whether self should request space to fit the entire Gtk.TreeModel.

This is used by Gtk.ComboBox to ensure that the cell view displayed on the combo box’s button always gets enough space and does not resize when selection changes.

New in version 3.0.

set_model(model)[source]
Parameters:model (Gtk.TreeModel or None) – a Gtk.TreeModel

Sets the model for self. If self already has a model set, it will remove it before setting the new model. If model is None, then it will unset the old model.

New in version 2.6.

Property Details

Gtk.CellView.props.background
Name:background
Type:str
Default Value:None
Flags:WRITABLE

Background color as a string

Gtk.CellView.props.background_gdk
Name:background-gdk
Type:Gdk.Color
Default Value:None
Flags:DEPRECATED, READABLE, WRITABLE

The background color as a Gdk.Color

Deprecated since version 3.4: Use Gtk.CellView :background-rgba instead.

Gtk.CellView.props.background_rgba
Name:background-rgba
Type:Gdk.RGBA
Default Value:None
Flags:READABLE, WRITABLE

The background color as a Gdk.RGBA

New in version 3.0.

Gtk.CellView.props.background_set
Name:background-set
Type:bool
Default Value:False
Flags:READABLE, WRITABLE

Whether this tag affects the background color

Gtk.CellView.props.cell_area
Name:cell-area
Type:Gtk.CellArea
Default Value:None
Flags:READABLE, WRITABLE, CONSTRUCT_ONLY

The Gtk.CellArea rendering cells

If no area is specified when creating the cell view with Gtk.CellView.new_with_context() a horizontally oriented Gtk.CellAreaBox will be used.

since 3.0

Gtk.CellView.props.cell_area_context
Name:cell-area-context
Type:Gtk.CellAreaContext
Default Value:None
Flags:READABLE, WRITABLE, CONSTRUCT_ONLY

The Gtk.CellAreaContext 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.

Gtk.ComboBox 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

Gtk.CellView.props.draw_sensitive
Name:draw-sensitive
Type:bool
Default Value:False
Flags:READABLE, WRITABLE, EXPLICIT_NOTIFY

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

Gtk.CellView.props.fit_model
Name:fit-model
Type:bool
Default Value:False
Flags:READABLE, WRITABLE, EXPLICIT_NOTIFY

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 doesnt change when different items are selected).

since 3.0

Gtk.CellView.props.model
Name:model
Type:Gtk.TreeModel
Default Value:None
Flags:READABLE, WRITABLE

The model for cell view

since 2.10