gtkmm 3.24.7
|
An abstract base class for laying out CellRenderers. More...
#include <gtkmm/cellarea.h>
Public Types | |
typedef sigc::slot< bool, CellRenderer * > | SlotForeach |
For instance, bool on_foreach(Gtk::CellRenderer* renderer);. More... | |
typedef sigc::slot< bool, CellRenderer *, const Gdk::Rectangle &, const Gdk::Rectangle & > | SlotForeachAlloc |
For instance, bool on_foreach(Gtk::CellRenderer* renderer, const Gdk::Rectangle& cell_area, const Gdk::Rectangle& background_area);. More... | |
Public Types inherited from Gtk::CellLayout | |
typedef sigc::slot< void, const TreeModel::const_iterator & > | SlotCellData |
Public Member Functions | |
CellArea (CellArea && src) noexcept | |
CellArea & | operator= (CellArea && src) noexcept |
~CellArea () noexcept override | |
GtkCellArea * | gobj () |
Provides access to the underlying C GObject. More... | |
const GtkCellArea * | gobj () const |
Provides access to the underlying C GObject. More... | |
GtkCellArea * | gobj_copy () |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More... | |
void | add (CellRenderer & renderer) |
Adds renderer to area with the default child cell properties. More... | |
void | remove (CellRenderer & renderer) |
Removes renderer from area. More... | |
bool | has_renderer (CellRenderer & renderer) |
Checks if area contains renderer. More... | |
void | foreach (const SlotForeach & slot) |
Calls the slot for every CellRenderer in the CellArea. More... | |
void | foreach (const Glib::RefPtr< CellAreaContext > & context, Widget * widget, const Gdk::Rectangle & cell_area, const Gdk::Rectangle & background_area, const SlotForeachAlloc & slot) |
Calls the slot for every CellRenderer in the CellArea with the allocated rectangle inside the cell_area rectangle. More... | |
int | event (const Glib::RefPtr< CellAreaContext > & context, Widget & widget, GdkEvent * gdk_event, const Gdk::Rectangle & cell_area, GtkCellRendererState flags) |
Delegates event handling to a Gtk::CellArea. More... | |
void | render (const Glib::RefPtr< CellAreaContext > & context, Widget & widget, const ::Cairo::RefPtr< ::Cairo::Context > & cr, const Gdk::Rectangle & background_area, const Gdk::Rectangle & cell_area, CellRendererState flags, bool paint_focus) |
Renders area’s cells according to area’s layout onto widget at the given coordinates. More... | |
void | get_cell_allocation (const Glib::RefPtr< CellAreaContext > & context, Widget & widget, CellRenderer & renderer, const Gdk::Rectangle & cell_area, Gdk::Rectangle & allocation) |
Derives the allocation of renderer inside area if area were to be renderered in cell_area. More... | |
CellRenderer * | get_cell_at_position (const Glib::RefPtr< CellAreaContext > & context, Widget & widget, const Gdk::Rectangle & cell_area, int x, int y, Gdk::Rectangle & alloc_area) |
Gets the Gtk::CellRenderer at x and y coordinates inside area and optionally returns the full cell allocation for it inside cell_area. More... | |
const CellRenderer * | get_cell_at_position (const Glib::RefPtr< CellAreaContext > & context, Widget & widget, const Gdk::Rectangle & cell_area, int x, int y, Gdk::Rectangle & alloc_area) const |
Gets the Gtk::CellRenderer at x and y coordinates inside area and optionally returns the full cell allocation for it inside cell_area. More... | |
Glib::RefPtr< CellAreaContext > | create_context () const |
Creates a Gtk::CellAreaContext to be used with area for all purposes. More... | |
Glib::RefPtr< CellAreaContext > | copy_context (const Glib::RefPtr< const CellAreaContext > & context) |
This is sometimes needed for cases where rows need to share alignments in one orientation but may be separately grouped in the opposing orientation. More... | |
SizeRequestMode | get_request_mode () const |
Gets whether the area prefers a height-for-width layout or a width-for-height layout. More... | |
void | get_preferred_width (const Glib::RefPtr< CellAreaContext > & context, Widget & widget, int & minimum_width, int & natural_width) |
Retrieves a cell area’s initial minimum and natural width. More... | |
void | get_preferred_height_for_width (const Glib::RefPtr< CellAreaContext > & context, Widget & widget, int width, int & minimum_height, int & natural_height) |
Retrieves a cell area’s minimum and natural height if it would be given the specified width. More... | |
void | get_preferred_height (const Glib::RefPtr< CellAreaContext > & context, Widget & widget, int & minimum_height, int & natural_height) |
Retrieves a cell area’s initial minimum and natural height. More... | |
void | get_preferred_width_for_height (const Glib::RefPtr< CellAreaContext > & context, Widget & widget, int height, int & minimum_width, int & natural_width) |
Retrieves a cell area’s minimum and natural width if it would be given the specified height. More... | |
Glib::ustring | get_current_path_string () const |
Gets the current Gtk::TreePath string for the currently applied Gtk::TreeIter, this is implicitly updated when apply_attributes() is called and can be used to interact with renderers from Gtk::CellArea subclasses. More... | |
void | apply_attributes (const Glib::RefPtr< TreeModel > & tree_model, const TreeModel::iterator & iter, bool is_expander, bool is_expanded) |
Applies any connected attributes to the renderers in area by pulling the values from tree_model. More... | |
void | attribute_connect (CellRenderer & renderer, const Glib::ustring & attribute, int column) |
Connects an attribute to apply values from column for the Gtk::TreeModel in use. More... | |
void | attribute_disconnect (CellRenderer & renderer, const Glib::ustring & attribute) |
Disconnects attribute for the renderer in area so that attribute will no longer be updated with values from the model. More... | |
int | attribute_get_column (CellRenderer & renderer, const Glib::ustring & attribute) const |
Returns the model column that an attribute has been mapped to, or -1 if the attribute is not mapped. More... | |
void | cell_set_property (CellRenderer & renderer, const Glib::ustring & property_name, const Glib::ValueBase & value) |
Sets a cell property for renderer in area. More... | |
void | cell_get_property (CellRenderer & renderer, const Glib::ustring & property_name, Glib::ValueBase & value) |
Gets the value of a cell property for renderer in area. More... | |
bool | is_activatable () const |
Returns whether the area can do anything when activated, after applying new attributes to area. More... | |
bool | activate (const Glib::RefPtr< CellAreaContext > & context, Widget & widget, const Gdk::Rectangle & cell_area, CellRendererState flags, bool edit_only) |
Activates area, usually by activating the currently focused cell, however some subclasses which embed widgets in the area can also activate a widget if it currently has the focus. More... | |
bool | focus (DirectionType direction) |
This should be called by the area’s owning layout widget when focus is to be passed to area, or moved within area for a given direction and row data. More... | |
void | set_focus_cell (CellRenderer & renderer) |
Explicitly sets the currently focused cell to renderer. More... | |
CellRenderer * | get_focus_cell () |
Retrieves the currently focused cell for area. More... | |
const CellRenderer * | get_focus_cell () const |
Retrieves the currently focused cell for area. More... | |
void | add_focus_sibling (CellRenderer & renderer, CellRenderer & sibling) |
Adds sibling to renderer’s focusable area, focus will be drawn around renderer and all of its siblings if renderer can focus for a given row. More... | |
void | remove_focus_sibling (CellRenderer & renderer, CellRenderer & sibling) |
Removes sibling from renderer’s focus sibling list (see add_focus_sibling()). More... | |
bool | is_focus_sibling (CellRenderer & renderer, CellRenderer & sibling) |
Returns whether sibling is one of renderer’s focus siblings (see add_focus_sibling()). More... | |
std::vector< CellRenderer * > | get_focus_siblings (CellRenderer & renderer) |
Gets the focus sibling cell renderers for renderer. More... | |
std::vector< const CellRenderer * > | get_focus_siblings (const CellRenderer & renderer) const |
Gets the focus sibling cell renderers for renderer. More... | |
CellRenderer * | get_focus_from_sibling (CellRenderer & renderer) |
Gets the Gtk::CellRenderer which is expected to be focusable for which renderer is, or may be a sibling. More... | |
const CellRenderer * | get_focus_from_sibling (CellRenderer & renderer) const |
Gets the Gtk::CellRenderer which is expected to be focusable for which renderer is, or may be a sibling. More... | |
CellRenderer * | get_edited_cell () |
Gets the Gtk::CellRenderer in area that is currently being edited. More... | |
const CellRenderer * | get_edited_cell () const |
Gets the Gtk::CellRenderer in area that is currently being edited. More... | |
CellEditable * | get_edit_widget () |
Gets the Gtk::CellEditable widget currently used to edit the currently edited cell. More... | |
const CellEditable * | get_edit_widget () const |
Gets the Gtk::CellEditable widget currently used to edit the currently edited cell. More... | |
bool | activate_cell (Widget & widget, CellRenderer & renderer, GdkEvent * gdk_event, const Gdk::Rectangle & cell_area, CellRendererState flags) |
This is used by Gtk::CellArea subclasses when handling events to activate cells, the base Gtk::CellArea class activates cells for keyboard events for free in its own GtkCellArea->activate() implementation. More... | |
void | stop_editing (bool canceled) |
Explicitly stops the editing of the currently edited cell. More... | |
void | inner_cell_area (Widget & widget, const Gdk::Rectangle & cell_area, Gdk::Rectangle & inner_area) |
This is a convenience function for Gtk::CellArea implementations to get the inner area where a given Gtk::CellRenderer will be rendered. More... | |
void | request_renderer (CellRenderer & renderer, Orientation orientation, Widget & widget, int for_size, int & minimum_size, int & natural_size) |
This is a convenience function for Gtk::CellArea implementations to request size for cell renderers. More... | |
Public Member Functions inherited from Gtk::Buildable | |
Buildable (Buildable && src) noexcept | |
Buildable & | operator= (Buildable && src) noexcept |
~Buildable () noexcept override | |
GtkBuildable * | gobj () |
Provides access to the underlying C GObject. More... | |
const GtkBuildable * | gobj () const |
Provides access to the underlying C GObject. More... | |
void | set_name (const Glib::ustring & name) |
Sets the name of the buildable object. More... | |
Glib::ustring | get_name () const |
Gets the name of the buildable object. More... | |
Public Member Functions inherited from Gtk::CellLayout | |
CellLayout (CellLayout && src) noexcept | |
CellLayout & | operator= (CellLayout && src) noexcept |
~CellLayout () noexcept override | |
GtkCellLayout * | gobj () |
Provides access to the underlying C GObject. More... | |
const GtkCellLayout * | gobj () const |
Provides access to the underlying C GObject. More... | |
template<class ColumnType > | |
void | pack_start (const TreeModelColumn< ColumnType > & model_column, bool expand=true) |
void | pack_start (CellRenderer & cell, bool expand=true) |
Packs the cell into the beginning of cell_layout. More... | |
void | pack_end (CellRenderer & cell, bool expand=true) |
Adds the cell to the end of cell_layout. More... | |
std::vector< CellRenderer * > | get_cells () |
Return value: a list of cell renderers. More... | |
std::vector< const CellRenderer * > | get_cells () const |
Return value: a list of cell renderers. More... | |
CellRenderer * | get_first_cell () |
Gets the CellRenderer for the first column if any has been added, or nullptr otherwise. More... | |
const CellRenderer * | get_first_cell () const |
Gets the CellRenderer for the first column if any has been added, or nullptr otherwise. More... | |
void | clear () |
Unsets all the mappings on all renderers on cell_layout and removes all renderers from cell_layout. More... | |
void | add_attribute (CellRenderer & cell, const Glib::ustring & attribute, int column) |
Adds an attribute mapping to the list in cell_layout. More... | |
void | add_attribute (const Glib::PropertyProxy_Base & property, const TreeModelColumnBase & column) |
void | add_attribute (CellRenderer & cell, const Glib::ustring & attribute, const TreeModelColumnBase & column) |
void | set_cell_data_func (CellRenderer & cell, const SlotCellData & slot) |
void | clear_attributes (CellRenderer & cell) |
Clears all existing attributes previously set with set_attributes(). More... | |
void | reorder (CellRenderer & cell, int position) |
Re-inserts cell at position. More... | |
Glib::RefPtr< CellArea > | get_area () |
Returns the underlying Gtk::CellArea which might be cell_layout if called on a Gtk::CellArea or might be nullptr if no Gtk::CellArea is used by cell_layout. More... | |
Glib::RefPtr< const CellArea > | get_area () const |
Returns the underlying Gtk::CellArea which might be cell_layout if called on a Gtk::CellArea or might be nullptr if no Gtk::CellArea is used by cell_layout. More... | |
template<class T_ModelColumnType > | |
void | pack_start (const TreeModelColumn< T_ModelColumnType > & column, bool expand) |
Static Public Member Functions | |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. More... | |
Static Public Member Functions inherited from Gtk::Buildable | |
static void | add_interface (GType gtype_implementer) |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. More... | |
Static Public Member Functions inherited from Gtk::CellLayout | |
static void | add_interface (GType gtype_implementer) |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. More... | |
Protected Member Functions | |
CellArea () | |
Glib::SignalProxy< void, const Glib::RefPtr< TreeModel > &, const TreeModel::iterator &, bool, bool > | signal_apply_attributes () |
Glib::SignalProxy< void, CellRenderer *, CellEditable *, const Gdk::Rectangle &, const Glib::ustring & > | signal_add_editable () |
Glib::SignalProxy< void, CellRenderer *, CellEditable * > | signal_remove_editable () |
Glib::SignalProxy< void, CellRenderer *, const Glib::ustring & > | signal_focus_changed () |
virtual SizeRequestMode | get_request_mode_vfunc () const |
virtual void | get_preferred_width_vfunc (const Glib::RefPtr< CellAreaContext > & context, Widget & widget, int & minimum_width, int & natural_width) |
virtual void | get_preferred_height_for_width_vfunc (const Glib::RefPtr< CellAreaContext > & context, Widget & widget, int width, int & minimum_height, int & natural_height) |
virtual void | get_preferred_height_vfunc (const Glib::RefPtr< CellAreaContext > & context, Widget & widget, int & minimum_height, int & natural_height) |
virtual void | get_preferred_width_for_height_vfunc (const Glib::RefPtr< CellAreaContext > & context, Widget & widget, int height, int & minimum_width, int & natural_width) |
Glib::PropertyProxy< CellRenderer * > | property_focus_cell () |
The cell in the area that currently has focus. More... | |
Glib::PropertyProxy_ReadOnly< CellRenderer * > | property_focus_cell () const |
The cell in the area that currently has focus. More... | |
Glib::PropertyProxy_ReadOnly< CellRenderer * > | property_edited_cell () const |
The cell in the area that is currently edited. More... | |
Glib::PropertyProxy_ReadOnly< CellEditable * > | property_edit_widget () const |
The widget currently editing the edited cell. More... | |
Protected Member Functions inherited from Gtk::Buildable | |
Buildable () | |
You should derive from this class to use it. More... | |
Protected Member Functions inherited from Gtk::CellLayout | |
CellLayout () | |
You should derive from this class to use it. More... | |
virtual void | pack_start_vfunc (CellRenderer * cell, bool expand) |
virtual void | pack_end_vfunc (CellRenderer * cell, bool expand) |
virtual void | clear_vfunc () |
virtual void | add_attribute_vfunc (CellRenderer * cell, const Glib::ustring & attribute, int column) |
virtual void | clear_attributes_vfunc (CellRenderer * cell) |
virtual void | reorder_vfunc (CellRenderer * cell, int position) |
Related Functions | |
(Note that these are not member functions.) | |
Glib::RefPtr< Gtk::CellArea > | wrap (GtkCellArea * object, bool take_copy=false) |
A Glib::wrap() method for this object. More... | |
Related Functions inherited from Gtk::Buildable | |
Glib::RefPtr< Gtk::Buildable > | wrap (GtkBuildable * object, bool take_copy=false) |
A Glib::wrap() method for this object. More... | |
Related Functions inherited from Gtk::CellLayout | |
Glib::RefPtr< Gtk::CellLayout > | wrap (GtkCellLayout * object, bool take_copy=false) |
A Glib::wrap() method for this object. More... | |
An abstract base class for laying out CellRenderers.
This is an abstract base class for CellLayout widgets (also referred to as "layouting widgets") to interface with an arbitrary number of CellRenderers and interact with the user for a given TreeModel row.
The cell area handles events, focus navigation, drawing and size requests and allocations for a given row of data.
Usually users dont have to interact with the CellArea directly unless they are implementing a cell layouting widget themselves.
As outlined in Gtk::Widget's geometry management description, GTK+ uses a height-for-width geometry management system to compute the sizes of widgets and user interfaces. CellArea uses the same semantics to calculate the size of an area for an arbitrary number of TreeModel rows.
When requesting the size of a cell area one needs to calculate the size for a handful of rows, and this will be done differently by different layouting widgets. For instance a TreeViewColumn always lines up the areas from top to bottom while an IconView, on the other hand, might enforce that all areas received the same width and wrap the areas around, requesting height for more cell areas when allocated less width.
It's also important for areas to maintain some cell alignments with areas rendered for adjacent rows (cells can appear "columnized" inside an area even when the size of cells are different in each row). For this reason the CellArea uses a CellAreaContext object to store the alignments and sizes along the way (as well as the overall largest minimum and natural size for all the rows which have been calculated with the said context).
The CellAreaContext is an opaque object specific to the CellArea which created it (see CellArea::create_context()). The owning cell-layouting widget can create as many contexts as it wishes to calculate sizes of rows which should receive the same size in at least one orientation (horizontally or vertically). However, it's important that the same CellAreaContext which was used to request the sizes for a given TreeModel row be used when rendering or processing events for that row.
The CellArea introduces cell properties for CellRenderers in very much the same way that Gtk::Container introduces child properties for Widgets. This provides some general interfaces for defining the relationship cell areas have with their cells. For instance in a CellAreaBox a cell might "expand" and receive extra space when the area is allocated more than its full natural request, or a cell might be configured to "align" with adjacent rows which were requested and rendered with the same CellAreaContext.
To set the value of a cell property, use cell_set_property(). To obtain the value of a cell property, use cell_get_property().
typedef sigc::slot<bool, CellRenderer*> Gtk::CellArea::SlotForeach |
For instance, bool on_foreach(Gtk::CellRenderer* renderer);.
renderer | the cell renderer to operate on |
typedef sigc::slot<bool, CellRenderer*, const Gdk::Rectangle&, const Gdk::Rectangle&> Gtk::CellArea::SlotForeachAlloc |
For instance, bool on_foreach(Gtk::CellRenderer* renderer, const Gdk::Rectangle& cell_area, const Gdk::Rectangle& background_area);.
renderer | the cell renderer to operate on |
cell_area | the area allocated to the renderer inside the rectangle provided to foreach(). |
background_area | The background area for the renderer inside the background area provided to foreach(). |
|
noexcept |
|
overridenoexcept |
|
protected |
bool Gtk::CellArea::activate | ( | const Glib::RefPtr< CellAreaContext > & | context, |
Widget & | widget, | ||
const Gdk::Rectangle & | cell_area, | ||
CellRendererState | flags, | ||
bool | edit_only | ||
) |
Activates area, usually by activating the currently focused cell, however some subclasses which embed widgets in the area can also activate a widget if it currently has the focus.
context | The Gtk::CellAreaContext in context with the current row data. |
widget | The Gtk::Widget that area is rendering on. |
cell_area | The size and location of area relative to widget’s allocation. |
flags | The Gtk::CellRendererState flags for area for this row of data. |
edit_only | If true then only cell renderers that are Gtk::CELL_RENDERER_MODE_EDITABLE will be activated. |
bool Gtk::CellArea::activate_cell | ( | Widget & | widget, |
CellRenderer & | renderer, | ||
GdkEvent * | gdk_event, | ||
const Gdk::Rectangle & | cell_area, | ||
CellRendererState | flags | ||
) |
This is used by Gtk::CellArea subclasses when handling events to activate cells, the base Gtk::CellArea class activates cells for keyboard events for free in its own GtkCellArea->activate() implementation.
widget | The Gtk::Widget that area is rendering onto. |
renderer | The Gtk::CellRenderer in area to activate. |
gdk_event | The Gdk::Event for which cell activation should occur. |
cell_area | The Gdk::Rectangle in widget relative coordinates of renderer for the current row. |
flags | The Gtk::CellRendererState for renderer. |
void Gtk::CellArea::add | ( | CellRenderer & | renderer | ) |
Adds renderer to area with the default child cell properties.
renderer | The Gtk::CellRenderer to add to area. |
void Gtk::CellArea::add_focus_sibling | ( | CellRenderer & | renderer, |
CellRenderer & | sibling | ||
) |
Adds sibling to renderer’s focusable area, focus will be drawn around renderer and all of its siblings if renderer can focus for a given row.
Events handled by focus siblings can also activate the given focusable renderer.
renderer | The Gtk::CellRenderer expected to have focus. |
sibling | The Gtk::CellRenderer to add to renderer’s focus area. |
void Gtk::CellArea::apply_attributes | ( | const Glib::RefPtr< TreeModel > & | tree_model, |
const TreeModel::iterator & | iter, | ||
bool | is_expander, | ||
bool | is_expanded | ||
) |
Applies any connected attributes to the renderers in area by pulling the values from tree_model.
tree_model | The Gtk::TreeModel to pull values from. |
iter | The Gtk::TreeIter in tree_model to apply values for. |
is_expander | Whether iter has children. |
is_expanded | Whether iter is expanded in the view and children are visible. |
void Gtk::CellArea::attribute_connect | ( | CellRenderer & | renderer, |
const Glib::ustring & | attribute, | ||
int | column | ||
) |
Connects an attribute to apply values from column for the Gtk::TreeModel in use.
renderer | The Gtk::CellRenderer to connect an attribute for. |
attribute | The attribute name. |
column | The Gtk::TreeModel column to fetch attribute values from. |
void Gtk::CellArea::attribute_disconnect | ( | CellRenderer & | renderer, |
const Glib::ustring & | attribute | ||
) |
Disconnects attribute for the renderer in area so that attribute will no longer be updated with values from the model.
renderer | The Gtk::CellRenderer to disconnect an attribute for. |
attribute | The attribute name. |
int Gtk::CellArea::attribute_get_column | ( | CellRenderer & | renderer, |
const Glib::ustring & | attribute | ||
) | const |
Returns the model column that an attribute has been mapped to, or -1 if the attribute is not mapped.
renderer | A Gtk::CellRenderer. |
attribute | An attribute on the renderer. |
void Gtk::CellArea::cell_get_property | ( | CellRenderer & | renderer, |
const Glib::ustring & | property_name, | ||
Glib::ValueBase & | value | ||
) |
Gets the value of a cell property for renderer in area.
renderer | A Gtk::CellRenderer inside area. |
property_name | The name of the property to get. |
value | A location to return the value. |
void Gtk::CellArea::cell_set_property | ( | CellRenderer & | renderer, |
const Glib::ustring & | property_name, | ||
const Glib::ValueBase & | value | ||
) |
Sets a cell property for renderer in area.
renderer | A Gtk::CellRenderer inside area. |
property_name | The name of the cell property to set. |
value | The value to set the cell property to. |
Glib::RefPtr< CellAreaContext > Gtk::CellArea::copy_context | ( | const Glib::RefPtr< const CellAreaContext > & | context | ) |
This is sometimes needed for cases where rows need to share alignments in one orientation but may be separately grouped in the opposing orientation.
For instance, Gtk::IconView creates all icons (rows) to have the same width and the cells theirin to have the same horizontal alignments. However each row of icons may have a separate collective height. Gtk::IconView uses this to request the heights of each row based on a context which was already used to request all the row widths that are to be displayed.
context | The Gtk::CellAreaContext to copy. |
Glib::RefPtr< CellAreaContext > Gtk::CellArea::create_context | ( | ) | const |
Creates a Gtk::CellAreaContext to be used with area for all purposes.
Gtk::CellAreaContext stores geometry information for rows for which it was operated on, it is important to use the same context for the same row of data at all times (i.e. one should render and handle events with the same Gtk::CellAreaContext which was used to request the size of those rows of data).
int Gtk::CellArea::event | ( | const Glib::RefPtr< CellAreaContext > & | context, |
Widget & | widget, | ||
GdkEvent * | gdk_event, | ||
const Gdk::Rectangle & | cell_area, | ||
GtkCellRendererState | flags | ||
) |
Delegates event handling to a Gtk::CellArea.
context | The Gtk::CellAreaContext for this row of data. |
widget | The Gtk::Widget that area is rendering to. |
gdk_event | The Gdk::Event to handle. |
cell_area | The widget relative coordinates for area. |
flags | The Gtk::CellRendererState for area in this row. |
true
if the event was handled by area. bool Gtk::CellArea::focus | ( | DirectionType | direction | ) |
This should be called by the area’s owning layout widget when focus is to be passed to area, or moved within area for a given direction and row data.
Implementing Gtk::CellArea classes should implement this method to receive and navigate focus in its own way particular to how it lays out cells.
direction | The Gtk::DirectionType. |
true
if focus remains inside area as a result of this call. void Gtk::CellArea::foreach | ( | const Glib::RefPtr< CellAreaContext > & | context, |
Widget * | widget, | ||
const Gdk::Rectangle & | cell_area, | ||
const Gdk::Rectangle & | background_area, | ||
const SlotForeachAlloc & | slot | ||
) |
Calls the slot for every CellRenderer in the CellArea with the allocated rectangle inside the cell_area rectangle.
context | The CellAreaContext for this row of data. |
widget | The widget that the CellArea is rendering to. |
cell_area | The widget-relative coordinates and size for the CellArea. |
background_area | The widget-relative coordinates of the background area. |
slot | The slot to call for every CellRenderer. |
void Gtk::CellArea::foreach | ( | const SlotForeach & | slot | ) |
Calls the slot for every CellRenderer in the CellArea.
slot | The slot to call for every CellRenderer. |
void Gtk::CellArea::get_cell_allocation | ( | const Glib::RefPtr< CellAreaContext > & | context, |
Widget & | widget, | ||
CellRenderer & | renderer, | ||
const Gdk::Rectangle & | cell_area, | ||
Gdk::Rectangle & | allocation | ||
) |
Derives the allocation of renderer inside area if area were to be renderered in cell_area.
context | The Gtk::CellAreaContext used to hold sizes for area. |
widget | The Gtk::Widget that area is rendering on. |
renderer | The Gtk::CellRenderer to get the allocation for. |
cell_area | The whole allocated area for area in widget for this row. |
allocation | Where to store the allocation for renderer. |
CellRenderer * Gtk::CellArea::get_cell_at_position | ( | const Glib::RefPtr< CellAreaContext > & | context, |
Widget & | widget, | ||
const Gdk::Rectangle & | cell_area, | ||
int | x, | ||
int | y, | ||
Gdk::Rectangle & | alloc_area | ||
) |
Gets the Gtk::CellRenderer at x and y coordinates inside area and optionally returns the full cell allocation for it inside cell_area.
context | The Gtk::CellAreaContext used to hold sizes for area. |
widget | The Gtk::Widget that area is rendering on. |
cell_area | The whole allocated area for area in widget for this row. |
x | The x position. |
y | The y position. |
alloc_area | Where to store the inner allocated area of the returned cell renderer, or nullptr . |
const CellRenderer * Gtk::CellArea::get_cell_at_position | ( | const Glib::RefPtr< CellAreaContext > & | context, |
Widget & | widget, | ||
const Gdk::Rectangle & | cell_area, | ||
int | x, | ||
int | y, | ||
Gdk::Rectangle & | alloc_area | ||
) | const |
Gets the Gtk::CellRenderer at x and y coordinates inside area and optionally returns the full cell allocation for it inside cell_area.
context | The Gtk::CellAreaContext used to hold sizes for area. |
widget | The Gtk::Widget that area is rendering on. |
cell_area | The whole allocated area for area in widget for this row. |
x | The x position. |
y | The y position. |
alloc_area | Where to store the inner allocated area of the returned cell renderer, or nullptr . |
Glib::ustring Gtk::CellArea::get_current_path_string | ( | ) | const |
Gets the current Gtk::TreePath string for the currently applied Gtk::TreeIter, this is implicitly updated when apply_attributes() is called and can be used to interact with renderers from Gtk::CellArea subclasses.
CellEditable * Gtk::CellArea::get_edit_widget | ( | ) |
Gets the Gtk::CellEditable widget currently used to edit the currently edited cell.
const CellEditable * Gtk::CellArea::get_edit_widget | ( | ) | const |
Gets the Gtk::CellEditable widget currently used to edit the currently edited cell.
CellRenderer * Gtk::CellArea::get_edited_cell | ( | ) |
Gets the Gtk::CellRenderer in area that is currently being edited.
const CellRenderer * Gtk::CellArea::get_edited_cell | ( | ) | const |
Gets the Gtk::CellRenderer in area that is currently being edited.
CellRenderer * Gtk::CellArea::get_focus_cell | ( | ) |
Retrieves the currently focused cell for area.
const CellRenderer * Gtk::CellArea::get_focus_cell | ( | ) | const |
Retrieves the currently focused cell for area.
CellRenderer * Gtk::CellArea::get_focus_from_sibling | ( | CellRenderer & | renderer | ) |
Gets the Gtk::CellRenderer which is expected to be focusable for which renderer is, or may be a sibling.
This is handy for Gtk::CellArea subclasses when handling events, after determining the renderer at the event location it can then chose to activate the focus cell for which the event cell may have been a sibling.
renderer | The Gtk::CellRenderer. |
nullptr
. const CellRenderer * Gtk::CellArea::get_focus_from_sibling | ( | CellRenderer & | renderer | ) | const |
Gets the Gtk::CellRenderer which is expected to be focusable for which renderer is, or may be a sibling.
This is handy for Gtk::CellArea subclasses when handling events, after determining the renderer at the event location it can then chose to activate the focus cell for which the event cell may have been a sibling.
renderer | The Gtk::CellRenderer. |
nullptr
. std::vector< CellRenderer * > Gtk::CellArea::get_focus_siblings | ( | CellRenderer & | renderer | ) |
Gets the focus sibling cell renderers for renderer.
renderer | The Gtk::CellRenderer expected to have focus. |
std::vector< const CellRenderer * > Gtk::CellArea::get_focus_siblings | ( | const CellRenderer & | renderer | ) | const |
Gets the focus sibling cell renderers for renderer.
renderer | The Gtk::CellRenderer expected to have focus. |
void Gtk::CellArea::get_preferred_height | ( | const Glib::RefPtr< CellAreaContext > & | context, |
Widget & | widget, | ||
int & | minimum_height, | ||
int & | natural_height | ||
) |
Retrieves a cell area’s initial minimum and natural height.
area will store some geometrical information in context along the way; when requesting sizes over an arbitrary number of rows, it’s not important to check the minimum_height and natural_height of this call but rather to consult Gtk::CellAreaContext::get_preferred_height() after a series of requests.
context | The Gtk::CellAreaContext to perform this request with. |
widget | The Gtk::Widget where area will be rendering. |
minimum_height | Location to store the minimum height, or nullptr . |
natural_height | Location to store the natural height, or nullptr . |
void Gtk::CellArea::get_preferred_height_for_width | ( | const Glib::RefPtr< CellAreaContext > & | context, |
Widget & | widget, | ||
int | width, | ||
int & | minimum_height, | ||
int & | natural_height | ||
) |
Retrieves a cell area’s minimum and natural height if it would be given the specified width.
area stores some geometrical information in context along the way while calling get_preferred_width(). It’s important to perform a series of get_preferred_width() requests with context first and then call get_preferred_height_for_width() on each cell area individually to get the height for width of each fully requested row.
If at some point, the width of a single row changes, it should be requested with get_preferred_width() again and then the full width of the requested rows checked again with Gtk::CellAreaContext::get_preferred_width().
context | The Gtk::CellAreaContext which has already been requested for widths. |
widget | The Gtk::Widget where area will be rendering. |
width | The width for which to check the height of this area. |
minimum_height | Location to store the minimum height, or nullptr . |
natural_height | Location to store the natural height, or nullptr . |
|
protectedvirtual |
|
protectedvirtual |
void Gtk::CellArea::get_preferred_width | ( | const Glib::RefPtr< CellAreaContext > & | context, |
Widget & | widget, | ||
int & | minimum_width, | ||
int & | natural_width | ||
) |
Retrieves a cell area’s initial minimum and natural width.
area will store some geometrical information in context along the way; when requesting sizes over an arbitrary number of rows, it’s not important to check the minimum_width and natural_width of this call but rather to consult Gtk::CellAreaContext::get_preferred_width() after a series of requests.
context | The Gtk::CellAreaContext to perform this request with. |
widget | The Gtk::Widget where area will be rendering. |
minimum_width | Location to store the minimum width, or nullptr . |
natural_width | Location to store the natural width, or nullptr . |
void Gtk::CellArea::get_preferred_width_for_height | ( | const Glib::RefPtr< CellAreaContext > & | context, |
Widget & | widget, | ||
int | height, | ||
int & | minimum_width, | ||
int & | natural_width | ||
) |
Retrieves a cell area’s minimum and natural width if it would be given the specified height.
area stores some geometrical information in context along the way while calling get_preferred_height(). It’s important to perform a series of get_preferred_height() requests with context first and then call get_preferred_width_for_height() on each cell area individually to get the height for width of each fully requested row.
If at some point, the height of a single row changes, it should be requested with get_preferred_height() again and then the full height of the requested rows checked again with Gtk::CellAreaContext::get_preferred_height().
context | The Gtk::CellAreaContext which has already been requested for widths. |
widget | The Gtk::Widget where area will be rendering. |
height | The height for which to check the width of this area. |
minimum_width | Location to store the minimum width, or nullptr . |
natural_width | Location to store the natural width, or nullptr . |
|
protectedvirtual |
|
protectedvirtual |
SizeRequestMode Gtk::CellArea::get_request_mode | ( | ) | const |
Gets whether the area prefers a height-for-width layout or a width-for-height layout.
|
protectedvirtual |
|
static |
Get the GType for this class, for use with the underlying GObject type system.
|
inline |
Provides access to the underlying C GObject.
|
inline |
Provides access to the underlying C GObject.
GtkCellArea * Gtk::CellArea::gobj_copy | ( | ) |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
bool Gtk::CellArea::has_renderer | ( | CellRenderer & | renderer | ) |
Checks if area contains renderer.
renderer | The Gtk::CellRenderer to check. |
true
if renderer is in the area. void Gtk::CellArea::inner_cell_area | ( | Widget & | widget, |
const Gdk::Rectangle & | cell_area, | ||
Gdk::Rectangle & | inner_area | ||
) |
This is a convenience function for Gtk::CellArea implementations to get the inner area where a given Gtk::CellRenderer will be rendered.
It removes any padding previously added by request_renderer().
widget | The Gtk::Widget that area is rendering onto. |
cell_area | The widget relative coordinates where one of area’s cells is to be placed. |
inner_area | The return location for the inner cell area. |
bool Gtk::CellArea::is_activatable | ( | ) | const |
Returns whether the area can do anything when activated, after applying new attributes to area.
bool Gtk::CellArea::is_focus_sibling | ( | CellRenderer & | renderer, |
CellRenderer & | sibling | ||
) |
Returns whether sibling is one of renderer’s focus siblings (see add_focus_sibling()).
renderer | The Gtk::CellRenderer expected to have focus. |
sibling | The Gtk::CellRenderer to check against renderer’s sibling list. |
true
if sibling is a focus sibling of renderer.
|
protected |
The widget currently editing the edited cell.
This property is read-only and only changes as a result of a call Gtk::CellArea::activate_cell().
|
protected |
The cell in the area that is currently edited.
This property is read-only and only changes as a result of a call Gtk::CellArea::activate_cell().
|
protected |
The cell in the area that currently has focus.
|
protected |
The cell in the area that currently has focus.
void Gtk::CellArea::remove | ( | CellRenderer & | renderer | ) |
Removes renderer from area.
renderer | The Gtk::CellRenderer to remove from area. |
void Gtk::CellArea::remove_focus_sibling | ( | CellRenderer & | renderer, |
CellRenderer & | sibling | ||
) |
Removes sibling from renderer’s focus sibling list (see add_focus_sibling()).
renderer | The Gtk::CellRenderer expected to have focus. |
sibling | The Gtk::CellRenderer to remove from renderer’s focus area. |
void Gtk::CellArea::render | ( | const Glib::RefPtr< CellAreaContext > & | context, |
Widget & | widget, | ||
const ::Cairo::RefPtr< ::Cairo::Context > & | cr, | ||
const Gdk::Rectangle & | background_area, | ||
const Gdk::Rectangle & | cell_area, | ||
CellRendererState | flags, | ||
bool | paint_focus | ||
) |
Renders area’s cells according to area’s layout onto widget at the given coordinates.
context | The Gtk::CellAreaContext for this row of data. |
widget | The Gtk::Widget that area is rendering to. |
cr | The #cairo_t to render with. |
background_area | The widget relative coordinates for area’s background. |
cell_area | The widget relative coordinates for area. |
flags | The Gtk::CellRendererState for area in this row. |
paint_focus | Whether area should paint focus on focused cells for focused rows or not. |
void Gtk::CellArea::request_renderer | ( | CellRenderer & | renderer, |
Orientation | orientation, | ||
Widget & | widget, | ||
int | for_size, | ||
int & | minimum_size, | ||
int & | natural_size | ||
) |
This is a convenience function for Gtk::CellArea implementations to request size for cell renderers.
It’s important to use this function to request size and then use inner_cell_area() at render and event time since this function will add padding around the cell for focus painting.
renderer | The Gtk::CellRenderer to request size for. |
orientation | The Gtk::Orientation in which to request size. |
widget | The Gtk::Widget that area is rendering onto. |
for_size | The allocation contextual size to request for, or -1 if the base request for the orientation is to be returned. |
minimum_size | Location to store the minimum size, or nullptr . |
natural_size | Location to store the natural size, or nullptr . |
void Gtk::CellArea::set_focus_cell | ( | CellRenderer & | renderer | ) |
Explicitly sets the currently focused cell to renderer.
This is generally called by implementations of Gtk::CellAreaClass.focus() or Gtk::CellAreaClass.event(), however it can also be used to implement functions such as Gtk::TreeView::set_cursor_on_cell().
renderer | The Gtk::CellRenderer to give focus to. |
|
protected |
void on_my_add_editable(CellRenderer* renderer, CellEditable* editable, const Gdk::Rectangle& cell_area, const Glib::ustring& path)
Flags: Run First
Indicates that editing has started on renderer and that editable should be added to the owning cell-layouting widget at cell_area.
renderer | The Gtk::CellRenderer that started the edited. |
editable | The Gtk::CellEditable widget to add. |
cell_area | The Gtk::Widget relative Gdk::Rectangle coordinates where editable should be added. |
path | The Gtk::TreePath string this edit was initiated for. |
|
protected |
void on_my_apply_attributes(const Glib::RefPtr<TreeModel>& tree_model, const TreeModel::iterator& iter, bool is_expander, bool is_expanded)
Flags: Run First
This signal is emitted whenever applying attributes to area from tree_model
tree_model | The Gtk::TreeModel to apply the attributes from. |
iter | The Gtk::TreeIter indicating which row to apply the attributes of. |
is_expander | Whether the view shows children for this row. |
is_expanded | Whether the view is currently showing the children of this row. |
|
protected |
void on_my_focus_changed(CellRenderer* renderer, const Glib::ustring& path)
Flags: Run First
Indicates that focus changed on this area. This signal is emitted either as a result of focus handling or event handling.
It's possible that the signal is emitted even if the currently focused renderer did not change, this is because focus may change to the same renderer in the same cell area for a different row of data.
renderer | The Gtk::CellRenderer that has focus. |
path | The current Gtk::TreePath string set for area. |
|
protected |
void on_my_remove_editable(CellRenderer* renderer, CellEditable* editable)
Flags: Run First
Indicates that editing finished on renderer and that editable should be removed from the owning cell-layouting widget.
renderer | The Gtk::CellRenderer that finished editeding. |
editable | The Gtk::CellEditable widget to remove. |
void Gtk::CellArea::stop_editing | ( | bool | canceled | ) |
Explicitly stops the editing of the currently edited cell.
If canceled is true
, the currently edited cell renderer will emit the signal_editing_canceled() signal, otherwise the the signal_editing_done() signal will be emitted on the current edit widget.
See get_edited_cell() and get_edit_widget().
canceled | Whether editing was canceled. |
|
related |
A Glib::wrap() method for this object.
object | The C instance. |
take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref. |