Gtk.CellView
Gtk.CellView — A widget displaying a single row of a Gtk.TreeModel
Object Hierarchy:
GObject
╰── GInitiallyUnowned
╰── Gtk.Widget
╰── Gtk.CellView
Functions:
- new
() -> Gtk.Widget
- new_with_context
(area:Gtk.CellArea, context:Gtk.CellAreaContext) -> Gtk.Widget
- new_with_text
(text:str) -> Gtk.Widget
- new_with_markup
(markup:str) -> Gtk.Widget
- new_with_pixbuf
(pixbuf:GdkPixbuf.Pixbuf) -> Gtk.Widget
- set_model
(self, model:Gtk.TreeModel=None)
- get_model
(self) -> Gtk.TreeModel
- set_displayed_row
(self, path:Gtk.TreePath=None)
- get_displayed_row
(self) -> Gtk.TreePath
- get_size_of_row
(self, path:Gtk.TreePath) -> bool, requisition:Gtk.Requisition
- set_background_color
(self, color:Gdk.Color)
- set_background_rgba
(self, rgba:Gdk.RGBA)
- set_draw_sensitive
(self, draw_sensitive:bool)
- get_draw_sensitive
(self) -> bool
- set_fit_model
(self, fit_model:bool)
- get_fit_model
(self) -> bool
Description:
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).
Function Details:
new()
new () -> Gtk.Widget
Creates a new Gtk.CellView
widget.
Returns: A newly created
Gtk.CellView
widget.Since: 2.6
new_with_context()
new_with_context (area:Gtk.CellArea, context:Gtk.CellAreaContext) -> Gtk.Widget
Creates a new Gtk.CellView
widget with a specific Gtk.CellAreato
layout cells and a specific Gtk.CellAreaContext
.
Specifying the same context for a handfull of cells letsthe underlying area synchronize the geometry for those cells,in this way alignments with cellviews for other rows arepossible.
Returns: A newly created
Gtk.CellView
widget.Since: 2.6
new_with_text()
new_with_text (text:str) -> Gtk.Widget
Creates a new Gtk.CellView
widget, adds a Gtk.CellRendererText
to it, and makes it show text
.
Returns: A newly created
Gtk.CellView
widget.Since: 2.6
new_with_markup()
new_with_markup (markup:str) -> Gtk.Widget
Creates a new Gtk.CellView
widget, adds a Gtk.CellRendererText
to it, and makes it show markup
. The text can bemarked up with the Pango text markup language.
Returns: A newly created
Gtk.CellView
widget.Since: 2.6
new_with_pixbuf()
new_with_pixbuf (pixbuf:GdkPixbuf.Pixbuf) -> Gtk.Widget
Creates a new Gtk.CellView
widget, adds a Gtk.CellRendererPixbufto
it, and makes it show pixbuf
.
Returns: A newly created
Gtk.CellView
widget.Since: 2.6
set_model()
set_model (self, model:Gtk.TreeModel=None)
Sets the model for cell_view
. If cell_view
already has a modelset, it will remove it before setting the new model. If model
isNone
, then it will unset the old model.
- Since: 2.6
get_model()
get_model (self) -> Gtk.TreeModel
Returns the model for cell_view
. If no model is used None
isreturned.
Returns: a
Gtk.TreeModel
used orNone
.Since: 2.16
set_displayed_row()
set_displayed_row (self, path:Gtk.TreePath=None)
Sets the row of the model that is currently displayedby the Gtk.CellView
. If the path is unset, then thecontents of the cellview “stick” at their last value;this is not normally a desired result, but may bea needed intermediate state if say, the model forthe Gtk.CellView
becomes temporarily empty.
- Since: 2.6
get_displayed_row()
get_displayed_row (self) -> Gtk.TreePath
Returns a Gtk.TreePath
referring to the currently displayed row. If no row is currently displayed, None
is returned.
Returns: the currently displayed row or
None
Since: 2.6
get_size_of_row()
get_size_of_row (self, path:Gtk.TreePath) -> bool, requisition:Gtk.Requisition
Gtk.CellView:get_size_of_row
has been deprecated since version 3.0 and should not be used in newly-written code.
Combo box formerly used this to calculate thesizes for cellviews, now you can achieve this by either usingthe “fit-model” property or by setting the currentlydisplayed row of the Gtk.CellView
and using `Gtk.Widget:get_preferred_size
().
Sets
requisitionto the size needed by
cell_viewto display the model row pointed to by
path`.
Returns:
True
Since: 2.6
set_background_color()
set_background_color (self, color:Gdk.Color)
Gtk.CellView:set_background_color
has been deprecated since version 3.4 and should not be used in newly-written code.
Use Gtk.CellView:set_background_rgba()
instead.
Sets the background color of view
.
- Since: 2.6
set_background_rgba()
set_background_rgba (self, rgba:Gdk.RGBA)
Sets the background color of cell_view
.
- Since: 3.0
set_draw_sensitive()
set_draw_sensitive (self, draw_sensitive:bool)
Sets whether cell_view
should draw all of itscells in a sensitive state, this is used by Gtk.ComboBox
menusto ensure that rows with insensitive cells that containchildren appear sensitive in the parent menu item.
- Since: 3.0
get_draw_sensitive()
get_draw_sensitive (self) -> bool
Gets whether cell_view
is configured to draw all of itscells in a sensitive state.
Returns: whether
cell_view
draws all of itscells in a sensitive stateSince: 3.0
set_fit_model()
set_fit_model (self, fit_model:bool)
Sets whether cell_view
should request space to fit the entire Gtk.TreeModel
.
This is used by Gtk.ComboBox
to ensure that the cell view displayed onthe combo box’s button always gets enough space and does not resizewhen selection changes.
- Since: 3.0
get_fit_model()
get_fit_model (self) -> bool
Gets whether cell_view
is configured to request spaceto fit the entire Gtk.TreeModel
.
Returns: whether
cell_view
requests space to fitthe entireGtk.TreeModel
.Since: 3.0