Gtk.CellAreaContext
Gtk.CellAreaContext — Stores geometrical information for a series of rows in a Gtk.CellArea
Object Hierarchy:
GObject
╰── Gtk.CellAreaContext
Functions:
- get_area
(self) -> Gtk.CellArea
- allocate
(self, width:int, height:int)
- reset
(self)
- get_preferred_width
(self) -> minimum_width:int, natural_width:int
- get_preferred_height
(self) -> minimum_height:int, natural_height:int
- get_preferred_height_for_width
(self, width:int) -> minimum_height:int, natural_height:int
- get_preferred_width_for_height
(self, height:int) -> minimum_width:int, natural_width:int
- get_allocation
(self) -> width:int, height:int
- push_preferred_width
(self, minimum_width:int, natural_width:int)
- push_preferred_height
(self, minimum_height:int, natural_height:int)
Description:
The Gtk.CellAreaContext
object is created by a given GtkCellArea implementation via its Gtk.CellAreaClass.create_context()
virtual method and is used to store cell sizes and alignments for a series of Gtk.TreeModel rows that are requested and rendered in the same context.
Gtk.CellLayout widgets can create any number of contexts in which to request and render groups of data rows. However, it’s important that the same context which was used to request sizes for a given Gtk.TreeModel row also be used for the same row when calling other Gtk.CellArea APIs such as Gtk.CellArea::render()
and Gtk.CellArea::event()
.
Function Details:
get_area()
get_area (self) -> Gtk.CellArea
Fetches the Gtk.CellArea
this context
was created by.
This is generally unneeded by layouting widgets; however,it is important for the context implementation itself tofetch information about the area it is being used for.
For instance at `Gtk.CellArea
ContextClass.allocate()timeit’s important to know details about any cell spacingthat the
Gtk.CellArea` is configured with in order tocompute a proper allocation.
Returns: the
Gtk.CellArea
this context was created by.Since: 3.0
allocate()
allocate (self, width:int, height:int)
Allocates a width and/or a height for all rows which are to berendered with context
.
Usually allocation is performed only horizontally or sometimesvertically since a group of rows are usually rendered side byside vertically or horizontally and share either the same widthor the same height. Sometimes they are allocated in both horizontaland vertical orientations producing a homogeneous effect of therows. This is generally the case for Gtk.TreeView
when“fixed-height-mode” is enabled.
Since 3.0
reset()
reset (self)
Resets any previously cached request and allocationdata.
When underlying Gtk.TreeModel
data changes itsimportant to reset the context if the contentsize is allowed to shrink. If the content sizeis only allowed to grow (this is usually an optionfor views rendering large data stores as a measureof optimization), then only the row that changedor was inserted needs to be (re)requested withGtk.CellArea:get_preferred_width`()`.
When the new overall size of the context requiresthat the allocated size changes (or whenever thisallocation changes at all), the variable rowsizes need to be re-requested for every row.
For instance, if the rows are displayed all withthe same width from top to bottom then a changein the allocated width necessitates a recalculationof all the displayed row heights using
Gtk.CellArea:get_preferred_height_for_width()
.
Since 3.0
get_preferred_width()
get_preferred_width (self) -> minimum_width:int, natural_width:int
Gets the accumulative preferred width for all rows which have beenrequested with this context.
After Gtk.CellAreaContext:reset()
is called and/or before everrequesting the size of a Gtk.CellArea
, the returned values are 0.
- Since: 3.0
get_preferred_height()
get_preferred_height (self) -> minimum_height:int, natural_height:int
Gets the accumulative preferred height for all rows which have beenrequested with this context.
After Gtk.CellAreaContext:reset()
is called and/or before everrequesting the size of a Gtk.CellArea
, the returned values are 0.
- Since: 3.0
get_preferred_height_for_width()
get_preferred_height_for_width (self, width:int) -> minimum_height:int, natural_height:int
Gets the accumulative preferred height for width
for all rowswhich have been requested for the same said width
with this context.
After Gtk.CellAreaContext:reset()
is called and/or before everrequesting the size of a Gtk.CellArea
, the returned values are -1.
- Since: 3.0
get_preferred_width_for_height()
get_preferred_width_for_height (self, height:int) -> minimum_width:int, natural_width:int
Gets the accumulative preferred width for height
for all rows whichhave been requested for the same said height
with this context.
After Gtk.CellAreaContext:reset()
is called and/or before everrequesting the size of a Gtk.CellArea
, the returned values are -1.
- Since: 3.0
get_allocation()
get_allocation (self) -> width:int, height:int
Fetches the current allocation size for context
.
If the context was not allocated in width or height, or if thecontext was recently reset with Gtk.CellAreaContext:reset()
,the returned value will be -1.
- Since: 3.0
push_preferred_width()
push_preferred_width (self, minimum_width:int, natural_width:int)
Causes the minimum and/or natural width to grow if the newproposed sizes exceed the current minimum and natural width.
This is used by Gtk.CellAreaContext
implementations duringthe request process over a series of Gtk.TreeModel
rows toprogressively push the requested width over a series of`Gtk.CellArea:get_preferred_width
()` requests.
- Since: 3.0
push_preferred_height()
push_preferred_height (self, minimum_height:int, natural_height:int)
Causes the minimum and/or natural height to grow if the newproposed sizes exceed the current minimum and natural height.
This is used by Gtk.CellAreaContext
implementations duringthe request process over a series of Gtk.TreeModel
rows toprogressively push the requested height over a series of`Gtk.CellArea:get_preferred_height
()` requests.
- Since: 3.0