:right-sidebar: True CellAreaContext =================================================================== .. currentmodule:: gi.repository.Gtk .. deprecated:: 4.10 This object will be removed in GTK 5 .. class:: CellAreaContext(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` Stores geometrical information for a series of rows in a GtkCellArea The ``GtkCellAreaContext`` object is created by a given ``GtkCellArea`` implementation via its ``GtkCellAreaClass.create_context()`` virtual method and is used to store cell sizes and alignments for a series of ``GtkTreeModel`` rows that are requested and rendered in the same context. ``GtkCellLayout`` 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 ``GtkTreeModel`` row also be used for the same row when calling other ``GtkCellArea`` APIs such as gtk_cell_area_render() and :func:`~gi.repository.Gtk.CellArea.event`. Methods ------- .. rst-class:: interim-class .. class:: CellAreaContext :no-index: .. method:: allocate(width: int, height: int) -> None 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 ``GtkTreeView`` when ``GtkTreeView:fixed-height-mode`` is enabled. .. deprecated:: 4.10 This object will be removed in GTK 5 :param width: the allocated width for all ``GtkTreeModel`` rows rendered with ``context``, or -1 :param height: the allocated height for all ``GtkTreeModel`` rows rendered with ``context``, or -1 .. method:: get_allocation() -> tuple[int, int] 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 :func:`~gi.repository.Gtk.CellAreaContext.reset`, the returned value will be -1. .. deprecated:: 4.10 This object will be removed in GTK 5 .. method:: get_area() -> ~gi.repository.Gtk.CellArea Fetches the ``GtkCellArea`` 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 ``GtkCellAreaContextClass.allocate()`` time it’s important to know details about any cell spacing that the ``GtkCellArea`` is configured with in order to compute a proper allocation. .. deprecated:: 4.10 This object will be removed in GTK 5 .. method:: get_preferred_height() -> tuple[int, int] Gets the accumulative preferred height for all rows which have been requested with this context. After :func:`~gi.repository.Gtk.CellAreaContext.reset` is called and/or before ever requesting the size of a ``GtkCellArea``, the returned values are 0. .. deprecated:: 4.10 This object will be removed in GTK 5 .. method:: get_preferred_height_for_width(width: int) -> tuple[int, int] Gets the accumulative preferred height for ``width`` for all rows which have been requested for the same said ``width`` with this context. After :func:`~gi.repository.Gtk.CellAreaContext.reset` is called and/or before ever requesting the size of a ``GtkCellArea``, the returned values are -1. .. deprecated:: 4.10 This object will be removed in GTK 5 :param width: a proposed width for allocation .. method:: get_preferred_width() -> tuple[int, int] Gets the accumulative preferred width for all rows which have been requested with this context. After :func:`~gi.repository.Gtk.CellAreaContext.reset` is called and/or before ever requesting the size of a ``GtkCellArea``, the returned values are 0. .. deprecated:: 4.10 This object will be removed in GTK 5 .. method:: get_preferred_width_for_height(height: int) -> tuple[int, int] Gets the accumulative preferred width for ``height`` for all rows which have been requested for the same said ``height`` with this context. After :func:`~gi.repository.Gtk.CellAreaContext.reset` is called and/or before ever requesting the size of a ``GtkCellArea``, the returned values are -1. .. deprecated:: 4.10 This object will be removed in GTK 5 :param height: a proposed height for allocation .. method:: push_preferred_height(minimum_height: int, natural_height: int) -> None 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 ``GtkCellAreaContext`` implementations during the request process over a series of ``GtkTreeModel`` rows to progressively push the requested height over a series of :func:`~gi.repository.Gtk.CellArea.get_preferred_height` requests. .. deprecated:: 4.10 This object will be removed in GTK 5 :param minimum_height: the proposed new minimum height for ``context`` :param natural_height: the proposed new natural height for ``context`` .. method:: push_preferred_width(minimum_width: int, natural_width: int) -> None 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 ``GtkCellAreaContext`` implementations during the request process over a series of ``GtkTreeModel`` rows to progressively push the requested width over a series of :func:`~gi.repository.Gtk.CellArea.get_preferred_width` requests. .. deprecated:: 4.10 This object will be removed in GTK 5 :param minimum_width: the proposed new minimum width for ``context`` :param natural_width: the proposed new natural width for ``context`` .. method:: reset() -> None Resets any previously cached request and allocation data. When underlying ``GtkTreeModel`` 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 :func:`~gi.repository.Gtk.CellArea.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 :func:`~gi.repository.Gtk.CellArea.get_preferred_height_for_width`. .. deprecated:: 4.10 This object will be removed in GTK 5 Properties ---------- .. rst-class:: interim-class .. class:: CellAreaContext :no-index: .. attribute:: props.area :type: ~gi.repository.Gtk.CellArea The ``GtkCellArea`` this context was created by .. deprecated:: 4.10 This object will be removed in GTK 5 .. attribute:: props.minimum_height :type: int The minimum height for the ``GtkCellArea`` in this context for all ``GtkTreeModel`` rows that this context was requested for using :func:`~gi.repository.Gtk.CellArea.get_preferred_height`. .. deprecated:: 4.10 This object will be removed in GTK 5 .. attribute:: props.minimum_width :type: int The minimum width for the ``GtkCellArea`` in this context for all ``GtkTreeModel`` rows that this context was requested for using :func:`~gi.repository.Gtk.CellArea.get_preferred_width`. .. deprecated:: 4.10 This object will be removed in GTK 5 .. attribute:: props.natural_height :type: int The natural height for the ``GtkCellArea`` in this context for all ``GtkTreeModel`` rows that this context was requested for using :func:`~gi.repository.Gtk.CellArea.get_preferred_height`. .. deprecated:: 4.10 This object will be removed in GTK 5 .. attribute:: props.natural_width :type: int The natural width for the ``GtkCellArea`` in this context for all ``GtkTreeModel`` rows that this context was requested for using :func:`~gi.repository.Gtk.CellArea.get_preferred_width`. .. deprecated:: 4.10 This object will be removed in GTK 5 Virtual Methods --------------- .. rst-class:: interim-class .. class:: CellAreaContext :no-index: .. method:: do_allocate(width: int, height: int) -> None 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 ``GtkTreeView`` when ``GtkTreeView:fixed-height-mode`` is enabled. .. deprecated:: 4.10 This object will be removed in GTK 5 :param width: the allocated width for all ``GtkTreeModel`` rows rendered with ``context``, or -1 :param height: the allocated height for all ``GtkTreeModel`` rows rendered with ``context``, or -1 .. method:: do_get_preferred_height_for_width(width: int) -> tuple[int, int] Gets the accumulative preferred height for ``width`` for all rows which have been requested for the same said ``width`` with this context. After :func:`~gi.repository.Gtk.CellAreaContext.reset` is called and/or before ever requesting the size of a ``GtkCellArea``, the returned values are -1. .. deprecated:: 4.10 This object will be removed in GTK 5 :param width: a proposed width for allocation .. method:: do_get_preferred_width_for_height(height: int) -> tuple[int, int] Gets the accumulative preferred width for ``height`` for all rows which have been requested for the same said ``height`` with this context. After :func:`~gi.repository.Gtk.CellAreaContext.reset` is called and/or before ever requesting the size of a ``GtkCellArea``, the returned values are -1. .. deprecated:: 4.10 This object will be removed in GTK 5 :param height: a proposed height for allocation .. method:: do_reset() -> None Resets any previously cached request and allocation data. When underlying ``GtkTreeModel`` 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 :func:`~gi.repository.Gtk.CellArea.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 :func:`~gi.repository.Gtk.CellArea.get_preferred_height_for_width`. .. deprecated:: 4.10 This object will be removed in GTK 5 Fields ------ .. rst-class:: interim-class .. class:: CellAreaContext :no-index: .. attribute:: parent_instance