Trait gtk4::prelude::CellAreaContextExt
source · pub trait CellAreaContextExt: 'static {
Show 18 methods
// Required methods
fn allocate(&self, width: i32, height: i32);
fn allocation(&self) -> (i32, i32);
fn area(&self) -> CellArea;
fn preferred_height(&self) -> (i32, i32);
fn preferred_height_for_width(&self, width: i32) -> (i32, i32);
fn preferred_width(&self) -> (i32, i32);
fn preferred_width_for_height(&self, height: i32) -> (i32, i32);
fn push_preferred_height(&self, minimum_height: i32, natural_height: i32);
fn push_preferred_width(&self, minimum_width: i32, natural_width: i32);
fn reset(&self);
fn minimum_height(&self) -> i32;
fn minimum_width(&self) -> i32;
fn natural_height(&self) -> i32;
fn natural_width(&self) -> i32;
fn connect_minimum_height_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_minimum_width_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_natural_height_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_natural_width_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
}
Expand description
Required Methods§
sourcefn allocate(&self, width: i32, height: i32)
fn allocate(&self, width: i32, height: i32)
Allocates a width and/or a height for all rows which are to be rendered with @self.
Usually allocation is performed only horizontally or sometimes
vertically since a group of rows are usually rendered side by
side vertically or horizontally and share either the same width
or the same height. Sometimes they are allocated in both horizontal
and vertical orientations producing a homogeneous effect of the
rows. This is generally the case for TreeView
when
GtkTreeView:fixed-height-mode
is enabled.
width
the allocated width for all TreeModel
rows rendered
with @self, or -1
height
the allocated height for all TreeModel
rows rendered
with @self, or -1
sourcefn allocation(&self) -> (i32, i32)
fn allocation(&self) -> (i32, i32)
Fetches the current allocation size for @self.
If the context was not allocated in width or height, or if the context was recently reset with gtk_cell_area_context_reset(), the returned value will be -1.
Returns
width
location to store the allocated width
height
location to store the allocated height
sourcefn area(&self) -> CellArea
fn area(&self) -> CellArea
Fetches the CellArea
this @self was created by.
This is generally unneeded by layouting widgets; however, it is important for the context implementation itself to fetch information about the area it is being used for.
For instance at GtkCellAreaContextClass.allocate()
time
it’s important to know details about any cell spacing
that the CellArea
is configured with in order to
compute a proper allocation.
Returns
the CellArea
this context was created by.
sourcefn preferred_height(&self) -> (i32, i32)
fn preferred_height(&self) -> (i32, i32)
Gets the accumulative preferred height for all rows which have been requested with this context.
After gtk_cell_area_context_reset() is called and/or before ever
requesting the size of a CellArea
, the returned values are 0.
Returns
minimum_height
location to store the minimum height
natural_height
location to store the natural height
sourcefn preferred_height_for_width(&self, width: i32) -> (i32, i32)
fn preferred_height_for_width(&self, width: i32) -> (i32, i32)
Gets the accumulative preferred height for @width for all rows which have been requested for the same said @width with this context.
After gtk_cell_area_context_reset() is called and/or before ever
requesting the size of a CellArea
, the returned values are -1.
width
a proposed width for allocation
Returns
minimum_height
location to store the minimum height
natural_height
location to store the natural height
sourcefn preferred_width(&self) -> (i32, i32)
fn preferred_width(&self) -> (i32, i32)
Gets the accumulative preferred width for all rows which have been requested with this context.
After gtk_cell_area_context_reset() is called and/or before ever
requesting the size of a CellArea
, the returned values are 0.
Returns
minimum_width
location to store the minimum width
natural_width
location to store the natural width
sourcefn preferred_width_for_height(&self, height: i32) -> (i32, i32)
fn preferred_width_for_height(&self, height: i32) -> (i32, i32)
Gets the accumulative preferred width for @height for all rows which have been requested for the same said @height with this context.
After gtk_cell_area_context_reset() is called and/or before ever
requesting the size of a CellArea
, the returned values are -1.
height
a proposed height for allocation
Returns
minimum_width
location to store the minimum width
natural_width
location to store the natural width
sourcefn push_preferred_height(&self, minimum_height: i32, natural_height: i32)
fn push_preferred_height(&self, minimum_height: i32, natural_height: i32)
Causes the minimum and/or natural height to grow if the new proposed sizes exceed the current minimum and natural height.
This is used by CellAreaContext
implementations during
the request process over a series of TreeModel
rows to
progressively push the requested height over a series of
gtk_cell_area_get_preferred_height() requests.
minimum_height
the proposed new minimum height for @self
natural_height
the proposed new natural height for @self
sourcefn push_preferred_width(&self, minimum_width: i32, natural_width: i32)
fn push_preferred_width(&self, minimum_width: i32, natural_width: i32)
Causes the minimum and/or natural width to grow if the new proposed sizes exceed the current minimum and natural width.
This is used by CellAreaContext
implementations during
the request process over a series of TreeModel
rows to
progressively push the requested width over a series of
gtk_cell_area_get_preferred_width() requests.
minimum_width
the proposed new minimum width for @self
natural_width
the proposed new natural width for @self
sourcefn reset(&self)
fn reset(&self)
Resets any previously cached request and allocation data.
When underlying TreeModel
data changes its
important to reset the context if the content
size is allowed to shrink. If the content size
is only allowed to grow (this is usually an option
for views rendering large data stores as a measure
of optimization), then only the row that changed
or was inserted needs to be (re)requested with
gtk_cell_area_get_preferred_width().
When the new overall size of the context requires that the allocated size changes (or whenever this allocation changes at all), the variable row sizes need to be re-requested for every row.
For instance, if the rows are displayed all with the same width from top to bottom then a change in the allocated width necessitates a recalculation of all the displayed row heights using gtk_cell_area_get_preferred_height_for_width().