gtkmm 3.24.7
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions | List of all members
Gtk::CellArea Class Reference

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

#include <gtkmm/cellarea.h>

Inheritance diagram for Gtk::CellArea:
Inheritance graph
[legend]

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
 
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, 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...
 
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, 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
 
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...
 
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
 
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 ()
 Return value: a list of cell renderers. More...
 
std::vector< const CellRenderer * > get_cells () const
 Return value: a list of cell renderers. 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 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::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 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().

Since gtkmm 3.0:

Member Typedef Documentation

◆ SlotForeach

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:

◆ SlotForeachAlloc

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

◆ CellArea() [1/2]

Gtk::CellArea::CellArea ( CellArea &&  src)
noexcept

◆ ~CellArea()

Gtk::CellArea::~CellArea ( )
overridenoexcept

◆ CellArea() [2/2]

Gtk::CellArea::CellArea ( )
protected

Member Function Documentation

◆ activate()

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.

Since gtkmm 3.0:
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::CELL_RENDERER_MODE_EDITABLE will be activated.
Returns
Whether area was successfully activated.

◆ activate_cell()

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.

Since gtkmm 3.0:
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.

◆ add()

void Gtk::CellArea::add ( CellRenderer renderer)

Adds renderer to area with the default child cell properties.

Since gtkmm 3.0:
Parameters
rendererThe Gtk::CellRenderer to add to area.

◆ add_focus_sibling()

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.

Since gtkmm 3.0:
Parameters
rendererThe Gtk::CellRenderer expected to have focus.
siblingThe Gtk::CellRenderer to add to renderer’s focus area.

◆ apply_attributes()

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.

Since gtkmm 3.0:
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.

◆ attribute_connect()

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.

Since gtkmm 3.0:
Parameters
rendererThe Gtk::CellRenderer to connect an attribute for.
attributeThe attribute name.
columnThe Gtk::TreeModel column to fetch attribute values from.

◆ attribute_disconnect()

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.

Since gtkmm 3.0:
Parameters
rendererThe Gtk::CellRenderer to disconnect an attribute for.
attributeThe attribute name.

◆ attribute_get_column()

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.

Since gtkmm 3.14:
Parameters
rendererA Gtk::CellRenderer.
attributeAn attribute on the renderer.
Returns
The model column, or -1.

◆ cell_get_property()

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.

Since gtkmm 3.0:
Parameters
rendererA Gtk::CellRenderer inside area.
property_nameThe name of the property to get.
valueA location to return the value.

◆ cell_set_property()

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.

Since gtkmm 3.0:
Parameters
rendererA Gtk::CellRenderer inside area.
property_nameThe name of the cell property to set.
valueThe value to set the cell property to.

◆ copy_context()

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.

Since gtkmm 3.0:
Parameters
contextThe Gtk::CellAreaContext to copy.
Returns
A newly created Gtk::CellAreaContext copy of context.

◆ create_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).

Since gtkmm 3.0:
Returns
A newly created Gtk::CellAreaContext which can be used with area.

◆ event()

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.

Since gtkmm 3.0:
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.

◆ focus()

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.

Since gtkmm 3.0:
Parameters
directionThe Gtk::DirectionType.
Returns
true if focus remains inside area as a result of this call.

◆ foreach() [1/2]

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:

◆ foreach() [2/2]

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:

◆ get_cell_allocation()

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.

Since gtkmm 3.0:
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.

◆ get_cell_at_position() [1/2]

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.

Since gtkmm 3.0:
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.

◆ get_cell_at_position() [2/2]

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.

Since gtkmm 3.0:
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.

◆ get_current_path_string()

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.

Since gtkmm 3.0:
Returns
The current Gtk::TreePath string for the current attributes applied to area. This string belongs to the area and should not be freed.

◆ get_edit_widget() [1/2]

CellEditable * Gtk::CellArea::get_edit_widget ( )

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

Since gtkmm 3.0:
Returns
The currently active Gtk::CellEditable widget.

◆ get_edit_widget() [2/2]

const CellEditable * Gtk::CellArea::get_edit_widget ( ) const

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

Since gtkmm 3.0:
Returns
The currently active Gtk::CellEditable widget.

◆ get_edited_cell() [1/2]

CellRenderer * Gtk::CellArea::get_edited_cell ( )

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

Since gtkmm 3.0:
Returns
The currently edited Gtk::CellRenderer.

◆ get_edited_cell() [2/2]

const CellRenderer * Gtk::CellArea::get_edited_cell ( ) const

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

Since gtkmm 3.0:
Returns
The currently edited Gtk::CellRenderer.

◆ get_focus_cell() [1/2]

CellRenderer * Gtk::CellArea::get_focus_cell ( )

Retrieves the currently focused cell for area.

Since gtkmm 3.0:
Returns
The currently focused cell in area.

◆ get_focus_cell() [2/2]

const CellRenderer * Gtk::CellArea::get_focus_cell ( ) const

Retrieves the currently focused cell for area.

Since gtkmm 3.0:
Returns
The currently focused cell in area.

◆ get_focus_from_sibling() [1/2]

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.

Since gtkmm 3.0:
Parameters
rendererThe Gtk::CellRenderer.
Returns
The Gtk::CellRenderer for which renderer is a sibling, or nullptr.

◆ get_focus_from_sibling() [2/2]

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.

Since gtkmm 3.0:
Parameters
rendererThe Gtk::CellRenderer.
Returns
The Gtk::CellRenderer for which renderer is a sibling, or nullptr.

◆ get_focus_siblings() [1/2]

std::vector< CellRenderer * > Gtk::CellArea::get_focus_siblings ( CellRenderer renderer)

Gets the focus sibling cell renderers for renderer.

Since gtkmm 3.0:
Parameters
rendererThe Gtk::CellRenderer expected to have focus.
Returns
A List of Gtk::CellRenderers. The returned list is internal and should not be freed.

◆ get_focus_siblings() [2/2]

std::vector< const CellRenderer * > Gtk::CellArea::get_focus_siblings ( const CellRenderer renderer) const

Gets the focus sibling cell renderers for renderer.

Since gtkmm 3.0:
Parameters
rendererThe Gtk::CellRenderer expected to have focus.
Returns
A List of Gtk::CellRenderers. The returned list is internal and should not be freed.

◆ get_preferred_height()

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.

Since gtkmm 3.0:
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.

◆ get_preferred_height_for_width()

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

Since gtkmm 3.0:
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.

◆ get_preferred_height_for_width_vfunc()

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

◆ get_preferred_height_vfunc()

virtual void Gtk::CellArea::get_preferred_height_vfunc ( const Glib::RefPtr< CellAreaContext > &  context,
Widget widget,
int &  minimum_height,
int &  natural_height 
)
protectedvirtual

◆ get_preferred_width()

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.

Since gtkmm 3.0:
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.

◆ get_preferred_width_for_height()

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

Since gtkmm 3.0:
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.

◆ get_preferred_width_for_height_vfunc()

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

◆ get_preferred_width_vfunc()

virtual void Gtk::CellArea::get_preferred_width_vfunc ( const Glib::RefPtr< CellAreaContext > &  context,
Widget widget,
int &  minimum_width,
int &  natural_width 
)
protectedvirtual

◆ get_request_mode()

SizeRequestMode Gtk::CellArea::get_request_mode ( ) const

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

Since gtkmm 3.0:
Returns
The Gtk::SizeRequestMode preferred by area.

◆ get_request_mode_vfunc()

virtual SizeRequestMode Gtk::CellArea::get_request_mode_vfunc ( ) const
protectedvirtual

◆ get_type()

static GType Gtk::CellArea::get_type ( )
static

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

◆ gobj() [1/2]

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

Provides access to the underlying C GObject.

◆ gobj() [2/2]

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

Provides access to the underlying C GObject.

◆ gobj_copy()

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.

◆ has_renderer()

bool Gtk::CellArea::has_renderer ( CellRenderer renderer)

Checks if area contains renderer.

Since gtkmm 3.0:
Parameters
rendererThe Gtk::CellRenderer to check.
Returns
true if renderer is in the area.

◆ inner_cell_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().

Since gtkmm 3.0:
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.

◆ is_activatable()

bool Gtk::CellArea::is_activatable ( ) const

Returns whether the area can do anything when activated, after applying new attributes to area.

Since gtkmm 3.0:
Returns
Whether area can do anything when activated.

◆ is_focus_sibling()

bool Gtk::CellArea::is_focus_sibling ( CellRenderer renderer,
CellRenderer sibling 
)

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

Since gtkmm 3.0:
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.

◆ operator=()

CellArea & Gtk::CellArea::operator= ( CellArea &&  src)
noexcept

◆ property_edit_widget()

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

Since gtkmm 3.0:
Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_edited_cell()

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

Since gtkmm 3.0:
Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_focus_cell() [1/2]

Glib::PropertyProxy< CellRenderer * > Gtk::CellArea::property_focus_cell ( )
protected

The cell in the area that currently has focus.

Since gtkmm 3.0:
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.

◆ property_focus_cell() [2/2]

Glib::PropertyProxy_ReadOnly< CellRenderer * > Gtk::CellArea::property_focus_cell ( ) const
protected

The cell in the area that currently has focus.

Since gtkmm 3.0:
Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ remove()

void Gtk::CellArea::remove ( CellRenderer renderer)

Removes renderer from area.

Since gtkmm 3.0:
Parameters
rendererThe Gtk::CellRenderer to remove from area.

◆ remove_focus_sibling()

void Gtk::CellArea::remove_focus_sibling ( CellRenderer renderer,
CellRenderer sibling 
)

Removes sibling from renderer’s focus sibling list (see add_focus_sibling()).

Since gtkmm 3.0:
Parameters
rendererThe Gtk::CellRenderer expected to have focus.
siblingThe Gtk::CellRenderer to remove from renderer’s focus area.

◆ render()

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.

Since gtkmm 3.0:
Parameters
contextThe Gtk::CellAreaContext for this row of data.
widgetThe Gtk::Widget that area is rendering to.
crThe #cairo_t to render with.
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.

◆ request_renderer()

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.

Since gtkmm 3.0:
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.

◆ set_focus_cell()

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

Since gtkmm 3.0:
Parameters
rendererThe Gtk::CellRenderer to give focus to.

◆ signal_add_editable()

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.

Since gtkmm 3.0:
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.

◆ signal_apply_attributes()

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

Since gtkmm 3.0:
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.

◆ signal_focus_changed()

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.

Since gtkmm 3.0:
Parameters
rendererThe Gtk::CellRenderer that has focus.
pathThe current Gtk::TreePath string set for area.

◆ signal_remove_editable()

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.

Since gtkmm 3.0:
Parameters
rendererThe Gtk::CellRenderer that finished editeding.
editableThe Gtk::CellEditable widget to remove.

◆ stop_editing()

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

Since gtkmm 3.0:
Parameters
canceledWhether editing was canceled.

Friends And Related Function Documentation

◆ wrap()

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.