gtkmm: Gtk::CellArea Class Reference

An abstract base class for laying out CellRenderers. More...

#include <gtkmm/cellarea.h>

Inheritance diagram for Gtk::CellArea:

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 Glib::Object
typedef void(*)(gpointer data DestroyNotify)
 
- Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify func_destroy_notify
 
- Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify func_destroy_notify
 
- Public Types inherited from Gtk::CellLayout
typedef sigc::slot< void(const TreeModel::const_iterator&)> SlotCellData
 

Public Member Functions

 CellArea (CellArea&& src) noexcept
 
CellAreaoperator= (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, const Glib::RefPtr< const Gdk::Event >& gdk_event, const Gdk::Rectangle& cell_area, GtkCellRendererState flags)
 Delegates event handling to a Gtk::CellArea. More...

 
void snapshot (const Glib::RefPtr< CellAreaContext >& context, Widget& widget, const Glib::RefPtr< Gtk::Snapshot >& snapshot, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, CellRendererState flags, bool paint_focus)
 Snapshots area’s cells according to area’s layout onto 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...

 
CellRendererget_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 CellRendererget_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< CellAreaContextcreate_context () const
 Creates a Gtk::CellAreaContext to be used with area for all purposes. More...

 
Glib::RefPtr< CellAreaContextcopy_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...

 
CellRendererget_focus_cell ()
 Retrieves the currently focused cell for area. More...

 
const CellRendererget_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...

 
CellRendererget_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 CellRendererget_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...

 
CellRendererget_edited_cell ()
 Gets the Gtk::CellRenderer in area that is currently being edited. More...

 
const CellRendererget_edited_cell () const
 Gets the Gtk::CellRenderer in area that is currently being edited. More...

 
CellEditableget_edit_widget ()
 Gets the Gtk::CellEditable widget currently used to edit the currently edited cell. More...

 
const CellEditableget_edit_widget () const
 Gets the Gtk::CellEditable widget currently used to edit the currently edited cell. More...

 
bool activate_cell (Widget& widget, CellRenderer& renderer, const Glib::RefPtr< const Gdk::Event >& 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 Glib::Object
 Object (const Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&src) noexcept
 
Objectoperator= (Object &&src) noexcept
 
void * get_data (const QueryQuark &key)
 
void set_data (const Quark &key, void *data)
 
void set_data (const Quark &key, void *data, DestroyNotify notify)
 
void remove_data (const QueryQuark &quark)
 
void * steal_data (const QueryQuark &quark)
 
Glib::RefPtr< Glib::Objectwrap (GObject *object, bool take_copy=false)
 
- Public Member Functions inherited from Glib::ObjectBase
 ObjectBase (const ObjectBase &)=delete
 
ObjectBaseoperator= (const ObjectBase &)=delete
 
void set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
 
void get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
 
void set_property (const Glib::ustring &property_name, const PropertyType &value)
 
void get_property (const Glib::ustring &property_name, PropertyType &value) const
 
PropertyType get_property (const Glib::ustring &property_name) const
 
sigc::connection connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot)
 
sigc::connection connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot)
 
void freeze_notify ()
 
void thaw_notify ()
 
virtual void reference () const
 
virtual void unreference () const
 
GObject * gobj ()
 
const GObject * gobj () const
 
GObject * gobj_copy () const
 
- Public Member Functions inherited from sigc::trackable
 trackable () noexcept
 
 trackable (const trackable &src) noexcept
 
 trackable (trackable &&src) noexcept
 
 ~trackable ()
 
void add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
 
void notify_callbacks ()
 
trackableoperator= (const trackable &src)
 
trackableoperator= (trackable &&src) noexcept
 
void remove_destroy_notify_callback (notifiable *data) const
 
- Public Member Functions inherited from Gtk::Buildable
 Buildable (Buildable&& src) noexcept
 
Buildableoperator= (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...

 
Glib::ustring get_buildable_id () const
 Gets the ID of the buildable object. More...

 
- Public Member Functions inherited from Glib::Interface
 Interface ()
 
 Interface (Interface &&src) noexcept
 
Interfaceoperator= (Interface &&src) noexcept
 
 Interface (const Glib::Interface_Class &interface_class)
 
 Interface (GObject *castitem)
 
 ~Interface () noexcept override
 
 Interface (const Interface &)=delete
 
Interfaceoperator= (const Interface &)=delete
 
GObject * gobj ()
 
const GObject * gobj () const
 
- Public Member Functions inherited from Gtk::CellLayout
 CellLayout (CellLayout&& src) noexcept
 
CellLayoutoperator= (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 ()
 Returns the cell renderers which have been added to cell_layout. More...

 
std::vector< const CellRenderer* > get_cells () const
 Returns the cell renderers which have been added to cell_layout. More...

 
CellRendererget_first_cell ()
 Gets the CellRenderer for the first column if any has been added, or nullptr otherwise. More...

 
const CellRendererget_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< CellAreaget_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 CellAreaget_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 void snapshot_vfunc (const Glib::RefPtr< CellAreaContext >& context, Widget& widget, const Glib::RefPtr< Gtk::Snapshot >&snapshot, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, CellRendererState flags, bool paint_focus)
 
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...

 
virtual void on_apply_attributes (const Glib::RefPtr< TreeModel >& tree_model, const TreeModel::iterator& iter, bool is_expander, bool is_expanded)
 This is a default handler for the signal signal_apply_attributes(). More...

 
- Protected Member Functions inherited from Glib::Object
 Object ()
 
 Object (const Glib::ConstructParams &construct_params)
 
 Object (GObject *castitem)
 
 ~Object () noexcept override
 
- Protected Member Functions inherited from Glib::ObjectBase
 ObjectBase ()
 
 ObjectBase (const char *custom_type_name)
 
 ObjectBase (const std::type_info &custom_type_info)
 
 ObjectBase (ObjectBase &&src) noexcept
 
ObjectBaseoperator= (ObjectBase &&src) noexcept
 
virtual ~ObjectBase () noexcept=0
 
void initialize (GObject *castitem)
 
void initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)
 
- 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::CellAreawrap (GtkCellArea* object, bool take_copy=false)
 A Glib::wrap() method for this object. More...

 

Detailed Description

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.

Requesting area sizes

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.

Cell Properties

The CellArea introduces cell properties for CellRenderers. 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().

Since gtkmm 3.0:

Member Typedef Documentation

typedef sigc::slot<bool(CellRenderer*)> Gtk::CellArea::SlotForeach

For instance, bool on_foreach(Gtk::CellRenderer* renderer);.

Parameters
rendererthe cell renderer to operate on
Returns
true to stop iterating over cells.
Since gtkmm 3.4:
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);.

Parameters
rendererthe cell renderer to operate on
cell_areathe area allocated to the renderer inside the rectangle provided to foreach().
background_areaThe background area for the renderer inside the background area provided to foreach().
Returns
true to stop iterating over cells.
Since gtkmm 3.4:

Constructor & Destructor Documentation

Gtk::CellArea::CellArea ( CellArea&&  src)
noexcept
Gtk::CellArea::~CellArea ( )
overridenoexcept
Gtk::CellArea::CellArea ( )
protected

Member Function Documentation

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.

Parameters
contextThe Gtk::CellAreaContext in context with the current row data.
widgetThe Gtk::Widget that area is rendering on.
cell_areaThe size and location of area relative to widget’s allocation.
flagsThe Gtk::CellRendererState flags for area for this row of data.
edit_onlyIf true then only cell renderers that are Gtk::CellRendererMode::EDITABLE will be activated.
Returns
Whether area was successfully activated.
bool Gtk::CellArea::activate_cell ( Widget widget,
CellRenderer renderer,
const Glib::RefPtr< const Gdk::Event >&  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.

Parameters
widgetThe Gtk::Widget that area is rendering onto.
rendererThe Gtk::CellRenderer in area to activate.
gdk_eventThe Gdk::Event for which cell activation should occur.
cell_areaThe Gdk::Rectangle in widget relative coordinates of renderer for the current row.
flagsThe Gtk::CellRendererState for renderer.
Returns
Whether cell activation was successful.
void Gtk::CellArea::add ( CellRenderer renderer)

Adds renderer to area with the default child cell properties.

Parameters
rendererThe 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.

Parameters
rendererThe Gtk::CellRenderer expected to have focus.
siblingThe 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.

Parameters
tree_modelThe Gtk::TreeModel to pull values from.
iterThe Gtk::TreeIter in tree_model to apply values for.
is_expanderWhether iter has children.
is_expandedWhether 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.

Parameters
rendererThe Gtk::CellRenderer to connect an attribute for.
attributeThe attribute name.
columnThe 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.

Parameters
rendererThe Gtk::CellRenderer to disconnect an attribute for.
attributeThe 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.

Parameters
rendererA Gtk::CellRenderer.
attributeAn attribute on the renderer.
Returns
The model column, or -1.
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.

Parameters
rendererA Gtk::CellRenderer inside area.
property_nameThe name of the property to get.
valueA 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.

Parameters
rendererA Gtk::CellRenderer inside area.
property_nameThe name of the cell property to set.
valueThe 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.

Parameters
contextThe Gtk::CellAreaContext to copy.
Returns
A newly created Gtk::CellAreaContext copy of context.
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).

Returns
A newly created Gtk::CellAreaContext which can be used with area.
int Gtk::CellArea::event ( const Glib::RefPtr< CellAreaContext >&  context,
Widget widget,
const Glib::RefPtr< const Gdk::Event >&  gdk_event,
const Gdk::Rectangle cell_area,
GtkCellRendererState  flags 
)

Delegates event handling to a Gtk::CellArea.

Parameters
contextThe Gtk::CellAreaContext for this row of data.
widgetThe Gtk::Widget that area is rendering to.
gdk_eventThe Gdk::Event to handle.
cell_areaThe widget relative coordinates for area.
flagsThe Gtk::CellRendererState for area in this row.
Returns
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.

Parameters
directionThe Gtk::DirectionType.
Returns
true if focus remains inside area as a result of this call.
void Gtk::CellArea::foreach ( const SlotForeach slot)

Calls the slot for every CellRenderer in the CellArea.

Parameters
slotThe slot to call for every CellRenderer.
Since gtkmm 3.4:
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.

Parameters
contextThe CellAreaContext for this row of data.
widgetThe widget that the CellArea is rendering to.
cell_areaThe widget-relative coordinates and size for the CellArea.
background_areaThe widget-relative coordinates of the background area.
slotThe slot to call for every CellRenderer.
Since gtkmm 3.4:
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.

Parameters
contextThe Gtk::CellAreaContext used to hold sizes for area.
widgetThe Gtk::Widget that area is rendering on.
rendererThe Gtk::CellRenderer to get the allocation for.
cell_areaThe whole allocated area for area in widget for this row.
allocationWhere 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.

Parameters
contextThe Gtk::CellAreaContext used to hold sizes for area.
widgetThe Gtk::Widget that area is rendering on.
cell_areaThe whole allocated area for area in widget for this row.
xThe x position.
yThe y position.
alloc_areaWhere to store the inner allocated area of the returned cell renderer, or nullptr.
Returns
The Gtk::CellRenderer at x and y.
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.

Parameters
contextThe Gtk::CellAreaContext used to hold sizes for area.
widgetThe Gtk::Widget that area is rendering on.
cell_areaThe whole allocated area for area in widget for this row.
xThe x position.
yThe y position.
alloc_areaWhere to store the inner allocated area of the returned cell renderer, or nullptr.
Returns
The Gtk::CellRenderer at x and y.
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.

Returns
The current Gtk::TreePath string for the current attributes applied to area. This string belongs to the area and should not be freed.
CellEditable* Gtk::CellArea::get_edit_widget ( )

Gets the Gtk::CellEditable widget currently used to edit the currently edited cell.

Returns
The currently active Gtk::CellEditable widget.
const CellEditable* Gtk::CellArea::get_edit_widget ( ) const

Gets the Gtk::CellEditable widget currently used to edit the currently edited cell.

Returns
The currently active Gtk::CellEditable widget.
CellRenderer* Gtk::CellArea::get_edited_cell ( )

Gets the Gtk::CellRenderer in area that is currently being edited.

Returns
The currently edited Gtk::CellRenderer.
const CellRenderer* Gtk::CellArea::get_edited_cell ( ) const

Gets the Gtk::CellRenderer in area that is currently being edited.

Returns
The currently edited Gtk::CellRenderer.
CellRenderer* Gtk::CellArea::get_focus_cell ( )

Retrieves the currently focused cell for area.

Returns
The currently focused cell in area.
const CellRenderer* Gtk::CellArea::get_focus_cell ( ) const

Retrieves the currently focused cell for area.

Returns
The currently focused cell in 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.

Parameters
rendererThe Gtk::CellRenderer.
Returns
The Gtk::CellRenderer for which renderer is a sibling, or 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.

Parameters
rendererThe Gtk::CellRenderer.
Returns
The Gtk::CellRenderer for which renderer is a sibling, or nullptr.
std::vector<CellRenderer*> Gtk::CellArea::get_focus_siblings ( CellRenderer renderer)

Gets the focus sibling cell renderers for renderer.

Parameters
rendererThe Gtk::CellRenderer expected to have focus.
Returns
A List of Gtk::CellRenderers. The returned list is internal and should not be freed.
std::vector<const CellRenderer*> Gtk::CellArea::get_focus_siblings ( const CellRenderer renderer) const

Gets the focus sibling cell renderers for renderer.

Parameters
rendererThe Gtk::CellRenderer expected to have focus.
Returns
A List of Gtk::CellRenderers. The returned list is internal and should not be freed.
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.

Parameters
contextThe Gtk::CellAreaContext to perform this request with.
widgetThe Gtk::Widget where area will be rendering.
minimum_heightLocation to store the minimum height, or nullptr.
natural_heightLocation 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().

Parameters
contextThe Gtk::CellAreaContext which has already been requested for widths.
widgetThe Gtk::Widget where area will be rendering.
widthThe width for which to check the height of this area.
minimum_heightLocation to store the minimum height, or nullptr.
natural_heightLocation to store the natural height, or nullptr.
virtual void Gtk::CellArea::get_preferred_height_for_width_vfunc ( const Glib::RefPtr< CellAreaContext >&  context,
Widget widget,
int  width,
int &  minimum_height,
int &  natural_height 
)
protectedvirtual
virtual void Gtk::CellArea::get_preferred_height_vfunc ( const Glib::RefPtr< CellAreaContext >&  context,
Widget widget,
int &  minimum_height,
int &  natural_height 
)
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.

Parameters
contextThe Gtk::CellAreaContext to perform this request with.
widgetThe Gtk::Widget where area will be rendering.
minimum_widthLocation to store the minimum width, or nullptr.
natural_widthLocation 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().

Parameters
contextThe Gtk::CellAreaContext which has already been requested for widths.
widgetThe Gtk::Widget where area will be rendering.
heightThe height for which to check the width of this area.
minimum_widthLocation to store the minimum width, or nullptr.
natural_widthLocation to store the natural width, or nullptr.
virtual void Gtk::CellArea::get_preferred_width_for_height_vfunc ( const Glib::RefPtr< CellAreaContext >&  context,
Widget widget,
int  height,
int &  minimum_width,
int &  natural_width 
)
protectedvirtual
virtual void Gtk::CellArea::get_preferred_width_vfunc ( const Glib::RefPtr< CellAreaContext >&  context,
Widget widget,
int &  minimum_width,
int &  natural_width 
)
protectedvirtual
SizeRequestMode Gtk::CellArea::get_request_mode ( ) const

Gets whether the area prefers a height-for-width layout or a width-for-height layout.

Returns
The Gtk::SizeRequestMode preferred by area.
virtual SizeRequestMode Gtk::CellArea::get_request_mode_vfunc ( ) const
protectedvirtual
static GType Gtk::CellArea::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

GtkCellArea* Gtk::CellArea::gobj ( )
inline

Provides access to the underlying C GObject.

const GtkCellArea* Gtk::CellArea::gobj ( ) const
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.

Parameters
rendererThe Gtk::CellRenderer to check.
Returns
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().

Parameters
widgetThe Gtk::Widget that area is rendering onto.
cell_areaThe widget relative coordinates where one of area’s cells is to be placed.
inner_areaThe 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.

Returns
Whether area can do anything when activated.
bool Gtk::CellArea::is_focus_sibling ( CellRenderer renderer,
CellRenderer sibling 
)

Returns whether sibling is one of renderer’s focus siblings (see add_focus_sibling()).

Parameters
rendererThe Gtk::CellRenderer expected to have focus.
siblingThe Gtk::CellRenderer to check against renderer’s sibling list.
Returns
true if sibling is a focus sibling of renderer.
virtual void Gtk::CellArea::on_apply_attributes ( const Glib::RefPtr< TreeModel >&  tree_model,
const TreeModel::iterator iter,
bool  is_expander,
bool  is_expanded 
)
protectedvirtual

This is a default handler for the signal signal_apply_attributes().

CellArea& Gtk::CellArea::operator= ( CellArea&&  src)
noexcept
Glib::PropertyProxy_ReadOnly< CellEditable* > Gtk::CellArea::property_edit_widget ( ) const
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().

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< CellRenderer* > Gtk::CellArea::property_edited_cell ( ) const
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().

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy< CellRenderer* > Gtk::CellArea::property_focus_cell ( )
protected

The cell in the area that currently has focus.

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< CellRenderer* > Gtk::CellArea::property_focus_cell ( ) const
protected

The cell in the area that currently has focus.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
void Gtk::CellArea::remove ( CellRenderer renderer)

Removes renderer from area.

Parameters
rendererThe 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()).

Parameters
rendererThe Gtk::CellRenderer expected to have focus.
siblingThe Gtk::CellRenderer to remove from renderer’s focus area.
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.

Parameters
rendererThe Gtk::CellRenderer to request size for.
orientationThe Gtk::Orientation in which to request size.
widgetThe Gtk::Widget that area is rendering onto.
for_sizeThe allocation contextual size to request for, or -1 if the base request for the orientation is to be returned.
minimum_sizeLocation to store the minimum size, or nullptr.
natural_sizeLocation 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().

Parameters
rendererThe Gtk::CellRenderer to give focus to.
Glib::SignalProxy<void(CellRenderer*, CellEditable*, const Gdk::Rectangle&, const Glib::ustring&)> Gtk::CellArea::signal_add_editable ( )
protected
Slot Prototype:
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.

Parameters
rendererThe Gtk::CellRenderer that started the edited.
editableThe Gtk::CellEditable widget to add.
cell_areaThe Gtk::Widget relative Gdk::Rectangle coordinates where editable should be added.
pathThe Gtk::TreePath string this edit was initiated for.
Glib::SignalProxy<void(const Glib::RefPtr<TreeModel>&, const TreeModel::iterator&, bool, bool)> Gtk::CellArea::signal_apply_attributes ( )
protected
Slot Prototype:
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

Parameters
tree_modelThe Gtk::TreeModel to apply the attributes from.
iterThe Gtk::TreeIter indicating which row to apply the attributes of.
is_expanderWhether the view shows children for this row.
is_expandedWhether the view is currently showing the children of this row.
Glib::SignalProxy<void(CellRenderer*, const Glib::ustring&)> Gtk::CellArea::signal_focus_changed ( )
protected
Slot Prototype:
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.

Parameters
rendererThe Gtk::CellRenderer that has focus.
pathThe current Gtk::TreePath string set for area.
Glib::SignalProxy<void(CellRenderer*, CellEditable*)> Gtk::CellArea::signal_remove_editable ( )
protected
Slot Prototype:
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.

Parameters
rendererThe Gtk::CellRenderer that finished editeding.
editableThe Gtk::CellEditable widget to remove.
void Gtk::CellArea::snapshot ( const Glib::RefPtr< CellAreaContext >&  context,
Widget widget,
const Glib::RefPtr< Gtk::Snapshot >&  snapshot,
const Gdk::Rectangle background_area,
const Gdk::Rectangle cell_area,
CellRendererState  flags,
bool  paint_focus 
)

Snapshots area’s cells according to area’s layout onto at the given coordinates.

Parameters
contextThe Gtk::CellAreaContext for this row of data.
widgetThe Gtk::Widget that area is rendering to.
snapshotThe Gtk::Snapshot to draw to.
background_areaThe widget relative coordinates for area’s background.
cell_areaThe widget relative coordinates for area.
flagsThe Gtk::CellRendererState for area in this row.
paint_focusWhether area should paint focus on focused cells for focused rows or not.
virtual void Gtk::CellArea::snapshot_vfunc ( const Glib::RefPtr< CellAreaContext >&  context,
Widget widget,
const Glib::RefPtr< Gtk::Snapshot >&  snapshot,
const Gdk::Rectangle background_area,
const Gdk::Rectangle cell_area,
CellRendererState  flags,
bool  paint_focus 
)
protectedvirtual
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().

Parameters
canceledWhether editing was canceled.

Friends And Related Function Documentation

Glib::RefPtr< Gtk::CellArea > wrap ( GtkCellArea *  object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.