| Top |
CtkCellAreaContextCtkCellAreaContext — Stores geometrical information for a series of rows in a CtkCellArea |
| CtkCellArea * | area | Read / Write / Construct Only |
| int | minimum-height | Read |
| int | minimum-width | Read |
| int | natural-height | Read |
| int | natural-width | Read |
The CtkCellAreaContext object is created by a given CtkCellArea
implementation via its CtkCellAreaClass.create_context() virtual
method and is used to store cell sizes and alignments for a series of
CtkTreeModel rows that are requested and rendered in the same context.
CtkCellLayout 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 CtkTreeModel
row also be used for the same row when calling other CtkCellArea APIs
such as ctk_cell_area_render() and ctk_cell_area_event().
CtkCellArea *
ctk_cell_area_context_get_area (CtkCellAreaContext *context);
Fetches the CtkCellArea this context
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 CtkCellAreaContextClass.allocate() time
it’s important to know details about any cell spacing
that the CtkCellArea is configured with in order to
compute a proper allocation.
Since: 3.0
void ctk_cell_area_context_allocate (CtkCellAreaContext *context,gint width,gint height);
Allocates a width and/or a height for all rows which are to be
rendered with context
.
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 CtkTreeView when “fixed-height-mode” is enabled.
Since 3.0
context |
||
width |
the allocated width for all CtkTreeModel rows rendered
with |
|
height |
the allocated height for all CtkTreeModel rows rendered
with |
void
ctk_cell_area_context_reset (CtkCellAreaContext *context);
Resets any previously cached request and allocation data.
When underlying CtkTreeModel 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
ctk_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
ctk_cell_area_get_preferred_height_for_width().
Since 3.0
void ctk_cell_area_context_get_preferred_width (CtkCellAreaContext *context,gint *minimum_width,gint *natural_width);
Gets the accumulative preferred width for all rows which have been requested with this context.
After ctk_cell_area_context_reset() is called and/or before ever
requesting the size of a CtkCellArea, the returned values are 0.
context |
||
minimum_width |
location to store the minimum width,
or |
[out][allow-none] |
natural_width |
location to store the natural width,
or |
[out][allow-none] |
Since: 3.0
void ctk_cell_area_context_get_preferred_height (CtkCellAreaContext *context,gint *minimum_height,gint *natural_height);
Gets the accumulative preferred height for all rows which have been requested with this context.
After ctk_cell_area_context_reset() is called and/or before ever
requesting the size of a CtkCellArea, the returned values are 0.
context |
||
minimum_height |
location to store the minimum height,
or |
[out][allow-none] |
natural_height |
location to store the natural height,
or |
[out][allow-none] |
Since: 3.0
void ctk_cell_area_context_get_preferred_height_for_width (CtkCellAreaContext *context,gint width,gint *minimum_height,gint *natural_height);
Gets the accumulative preferred height for width
for all rows
which have been requested for the same said width
with this context.
After ctk_cell_area_context_reset() is called and/or before ever
requesting the size of a CtkCellArea, the returned values are -1.
context |
||
width |
a proposed width for allocation |
|
minimum_height |
location to store the minimum height,
or |
[out][allow-none] |
natural_height |
location to store the natural height,
or |
[out][allow-none] |
Since: 3.0
void ctk_cell_area_context_get_preferred_width_for_height (CtkCellAreaContext *context,gint height,gint *minimum_width,gint *natural_width);
Gets the accumulative preferred width for height
for all rows which
have been requested for the same said height
with this context.
After ctk_cell_area_context_reset() is called and/or before ever
requesting the size of a CtkCellArea, the returned values are -1.
context |
||
height |
a proposed height for allocation |
|
minimum_width |
location to store the minimum width,
or |
[out][allow-none] |
natural_width |
location to store the natural width,
or |
[out][allow-none] |
Since: 3.0
void ctk_cell_area_context_get_allocation (CtkCellAreaContext *context,gint *width,gint *height);
Fetches the current allocation size for context
.
If the context was not allocated in width or height, or if the
context was recently reset with ctk_cell_area_context_reset(),
the returned value will be -1.
context |
||
width |
location to store the allocated width, or |
[out][allow-none] |
height |
location to store the allocated height, or |
[out][allow-none] |
Since: 3.0
void ctk_cell_area_context_push_preferred_width (CtkCellAreaContext *context,gint minimum_width,gint natural_width);
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 CtkCellAreaContext implementations during
the request process over a series of CtkTreeModel rows to
progressively push the requested width over a series of
ctk_cell_area_get_preferred_width() requests.
context |
||
minimum_width |
the proposed new minimum width for |
|
natural_width |
the proposed new natural width for |
Since: 3.0
void ctk_cell_area_context_push_preferred_height (CtkCellAreaContext *context,gint minimum_height,gint natural_height);
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 CtkCellAreaContext implementations during
the request process over a series of CtkTreeModel rows to
progressively push the requested height over a series of
ctk_cell_area_get_preferred_height() requests.
context |
||
minimum_height |
the proposed new minimum height for |
|
natural_height |
the proposed new natural height for |
Since: 3.0
struct CtkCellAreaContextClass {
void (* allocate) (CtkCellAreaContext *context,
gint width,
gint height);
void (* reset) (CtkCellAreaContext *context);
void (* get_preferred_height_for_width) (CtkCellAreaContext *context,
gint width,
gint *minimum_height,
gint *natural_height);
void (* get_preferred_width_for_height) (CtkCellAreaContext *context,
gint height,
gint *minimum_width,
gint *natural_width);
};
This tells the context that an allocation width or height
(or both) have been decided for a group of rows. The context should
store any allocations for internally aligned cells at this point so
that they dont need to be recalculated at |
||
Clear any previously stored information about requested and allocated sizes for the context. |
||
Returns the aligned height for the given width that context must store while collecting sizes for it’s rows. |
||
Returns the aligned width for the given height that context must store while collecting sizes for it’s rows. |
“area” property“area” CtkCellArea *
The CtkCellArea this context was created by
Owner: CtkCellAreaContext
Flags: Read / Write / Construct Only
Since: 3.0
“minimum-height” property “minimum-height” int
The minimum height for the CtkCellArea in this context
for all CtkTreeModel rows that this context was requested
for using ctk_cell_area_get_preferred_height().
Owner: CtkCellAreaContext
Flags: Read
Allowed values: >= -1
Default value: -1
Since: 3.0
“minimum-width” property “minimum-width” int
The minimum width for the CtkCellArea in this context
for all CtkTreeModel rows that this context was requested
for using ctk_cell_area_get_preferred_width().
Owner: CtkCellAreaContext
Flags: Read
Allowed values: >= -1
Default value: -1
Since: 3.0
“natural-height” property “natural-height” int
The natural height for the CtkCellArea in this context
for all CtkTreeModel rows that this context was requested
for using ctk_cell_area_get_preferred_height().
Owner: CtkCellAreaContext
Flags: Read
Allowed values: >= -1
Default value: -1
Since: 3.0
“natural-width” property “natural-width” int
The natural width for the CtkCellArea in this context
for all CtkTreeModel rows that this context was requested
for using ctk_cell_area_get_preferred_width().
Owner: CtkCellAreaContext
Flags: Read
Allowed values: >= -1
Default value: -1
Since: 3.0