gtkmm 3.22.1

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

An interface for packing cells. More...

`#include <gtkmm/celllayout.h>`

Inheritance diagram for Gtk::CellLayout:
[legend]

## Public Types
typedef sigc::slot< void, const TreeModel::const_iterator& > | SlotCellData
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify

## Public Member Functions
| CellLayout (CellLayout&& src) noexcept
CellLayout& | operator= (CellLayout&& src) noexcept
| ~CellLayout () noexcept override
GtkCellLayout* | gobj ()
| Provides access to the underlying C GObject. More...
const GtkCellLayout* | gobj () const
| Provides access to the underlying C GObject. More...
template<class ColumnType >
void | pack_start (const TreeModelColumn< ColumnType >& model_column, bool expand=true)
void | pack_start (CellRenderer& cell, bool expand=true)
| Packs the cell into the beginning of cell_layout. More...
void | pack_end (CellRenderer& cell, bool expand=true)
| Adds the cell to the end of cell_layout. More...
std::vector< CellRenderer* > | get_cells ()
| Return value: a list of cell renderers. More...
std::vector< const CellRenderer* > | get_cells () const
| Return value: a list of cell renderers. More...
CellRenderer* | get_first_cell ()
| Gets the CellRenderer for the first column if any has been added, or nullptr otherwise. More...
const CellRenderer* | get_first_cell () const
| Gets the CellRenderer for the first column if any has been added, or nullptr otherwise. More...
void | clear ()
| Unsets all the mappings on all renderers on cell_layout and removes all renderers from cell_layout. More...
void | add_attribute (CellRenderer& cell, const Glib::ustring& attribute, int column)
| Adds an attribute mapping to the list in cell_layout. More...
void | add_attribute (const Glib::PropertyProxy_Base& property, const TreeModelColumnBase& column)
void | add_attribute (CellRenderer& cell, const Glib::ustring& attribute, const TreeModelColumnBase& column)
void | set_cell_data_func (CellRenderer& cell, const SlotCellData& slot)
void | clear_attributes (CellRenderer& cell)
| Clears all existing attributes previously set with set_attributes(). More...
void | reorder (CellRenderer& cell, int position)
| Re-inserts cell at position. More...
Glib::RefPtr< CellArea > | get_area ()
| Returns the underlying Gtk::CellArea which might be cell_layout if called on a Gtk::CellArea or might be `nullptr` if no Gtk::CellArea is used by cell_layout. More...
Glib::RefPtr< const CellArea > | get_area () const
| Returns the underlying Gtk::CellArea which might be cell_layout if called on a Gtk::CellArea or might be `nullptr` if no Gtk::CellArea is used by cell_layout. More...
template<class T_ModelColumnType >
void | pack_start (const TreeModelColumn< T_ModelColumnType >& column, bool expand)
Public Member Functions inherited from Glib::Interface
| Interface ()
| Interface (Interface &&src) noexcept
Interface & | operator= (Interface &&src) noexcept
| Interface (const Glib::Interface_Class &interface_class)
| Interface (GObject *castitem)
| ~Interface () noexcept override
| Interface (const Interface &)=delete
Interface & | operator= (const Interface &)=delete
GObject * | gobj ()
const GObject * | gobj () const
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (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
void | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void > &slot)
void | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void > &&slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, const sigc::slot< void > &slot)
sigc::connection | connect_property_changed_with_return (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)
| ~trackable ()
void | add_destroy_notify_callback (void *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src)
void | remove_destroy_notify_callback (void *data) const

## Static Public Member Functions
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
| 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)
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
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)

## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gtk::CellLayout > | wrap (GtkCellLayout* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Detailed Description

An interface for packing cells.

CellLayout is an interface to be implemented by all objects which want to provide a TreeView::Column-like API for packing cells, setting attributes and data funcs.

## Member Typedef Documentation

## ◆ SlotCellData

typedef sigc::slot<void, const TreeModel::const_iterator&> Gtk::CellLayout::SlotCellData

## Constructor & Destructor Documentation

## ◆ CellLayout() [1/2]

Gtk::CellLayout::CellLayout | ( |  | ) |
| protected

You should derive from this class to use it.

## ◆ CellLayout() [2/2]

Gtk::CellLayout::CellLayout | ( | CellLayout&& | src | ) |
| noexcept

## ◆ ~CellLayout()

Gtk::CellLayout::~CellLayout | ( |  | ) |
| override noexcept

## Member Function Documentation

## ◆ add_attribute() [1/3]

void Gtk::CellLayout::add_attribute | ( | CellRenderer& | cell,
|  | const Glib::ustring & | attribute,
|  | int | column
| ) |  |

Adds an attribute mapping to the list in cell_layout.

The column is the column of the model to get a value from, and the attribute is the parameter on cell to be set from the value. So for example if column 2 of the model contains strings, you could have the “text” attribute of a Gtk::CellRendererText get its values from column 2.

Since gtkmm 2.4:

Parameters

  cell | A Gtk::CellRenderer.
  attribute | An attribute on the renderer.
  column | The column position on the model to get the attribute from.

## ◆ add_attribute() [2/3]

void Gtk::CellLayout::add_attribute | ( | const Glib::PropertyProxy_Base & | property,
|  | const TreeModelColumnBase& | column
| ) |  |

## ◆ add_attribute() [3/3]

void Gtk::CellLayout::add_attribute | ( | CellRenderer& | cell,
|  | const Glib::ustring & | attribute,
|  | const TreeModelColumnBase& | column
| ) |  |

## ◆ add_attribute_vfunc()

virtual void Gtk::CellLayout::add_attribute_vfunc | ( | CellRenderer* | cell,
|  | const Glib::ustring & | attribute,
|  | int | column
| ) |  |
| protected virtual

## ◆ add_interface()

static void Gtk::CellLayout::add_interface | ( | GType | gtype_implementer | ) |
| static

## ◆ clear()

void Gtk::CellLayout::clear | ( |  | ) |

Unsets all the mappings on all renderers on cell_layout and removes all renderers from cell_layout.

Since gtkmm 2.4:

## ◆ clear_attributes()

void Gtk::CellLayout::clear_attributes | ( | CellRenderer& | cell | ) |

Clears all existing attributes previously set with set_attributes().

Since gtkmm 2.4:

Parameters

  cell | A Gtk::CellRenderer to clear the attribute mapping on.

## ◆ clear_attributes_vfunc()

virtual void Gtk::CellLayout::clear_attributes_vfunc | ( | CellRenderer* | cell | ) |
| protected virtual

## ◆ clear_vfunc()

virtual void Gtk::CellLayout::clear_vfunc | ( |  | ) |
| protected virtual

## ◆ get_area() [1/2]

Glib::RefPtr<CellArea> Gtk::CellLayout::get_area | ( |  | ) |

Returns the underlying Gtk::CellArea which might be cell_layout if called on a Gtk::CellArea or might be `nullptr` if no Gtk::CellArea is used by cell_layout.

Since gtkmm 3.0:

Returns
  The cell area used by cell_layout, or `nullptr` in case no cell area is used.

## ◆ get_area() [2/2]

Glib::RefPtr<const CellArea> Gtk::CellLayout::get_area | ( |  | ) | const

Returns the underlying Gtk::CellArea which might be cell_layout if called on a Gtk::CellArea or might be `nullptr` if no Gtk::CellArea is used by cell_layout.

Since gtkmm 3.0:

Returns
  The cell area used by cell_layout, or `nullptr` in case no cell area is used.

## ◆ get_cells() [1/2]

std::vector<CellRenderer*> Gtk::CellLayout::get_cells | ( |  | ) |

Return value: a list of cell renderers.

Since gtkmm 2.12:

Returns
  A list of cell renderers.

## ◆ get_cells() [2/2]

std::vector<const CellRenderer*> Gtk::CellLayout::get_cells | ( |  | ) | const

Return value: a list of cell renderers.

Since gtkmm 2.12:

Returns
  A list of cell renderers.

## ◆ get_first_cell() [1/2]

CellRenderer* Gtk::CellLayout::get_first_cell | ( |  | ) |

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

You should dynamic_cast<> to the expected derived CellRenderer type.

## ◆ get_first_cell() [2/2]

const CellRenderer* Gtk::CellLayout::get_first_cell | ( |  | ) | const

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

You should dynamic_cast<> to the expected derived CellRenderer type.

## ◆ get_type()

static GType Gtk::CellLayout::get_type | ( |  | ) |
| static

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

## ◆ gobj() [1/2]

GtkCellLayout* Gtk::CellLayout::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GtkCellLayout* Gtk::CellLayout::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ operator=()

CellLayout& Gtk::CellLayout::operator= | ( | CellLayout&& | src | ) |
| noexcept

## ◆ pack_end()

void Gtk::CellLayout::pack_end | ( | CellRenderer& | cell,
|  | bool | expand = `true`
| ) |  |

Adds the cell to the end of cell_layout.

If expand is `false`, then the cell is allocated no more space than it needs. Any unused space is divided evenly between cells for which expand is `true`.

Note that reusing the same cell renderer is not supported.

Since gtkmm 2.4:

Parameters

  cell | A Gtk::CellRenderer.
  expand | `true` if cell is to be given extra space allocated to cell_layout.

## ◆ pack_end_vfunc()

virtual void Gtk::CellLayout::pack_end_vfunc | ( | CellRenderer* | cell,
|  | bool | expand
| ) |  |
| protected virtual

## ◆ pack_start() [1/3]

template <class ColumnType >

void Gtk::CellLayout::pack_start | ( | const TreeModelColumn< ColumnType >& | model_column,
|  | bool | expand = `true`
| ) |  |
| inline

## ◆ pack_start() [2/3]

void Gtk::CellLayout::pack_start | ( | CellRenderer& | cell,
|  | bool | expand = `true`
| ) |  |

Packs the cell into the beginning of cell_layout.

If expand is `false`, then the cell is allocated no more space than it needs. Any unused space is divided evenly between cells for which expand is `true`.

Note that reusing the same cell renderer is not supported.

Since gtkmm 2.4:

Parameters

  cell | A Gtk::CellRenderer.
  expand | `true` if cell is to be given extra space allocated to cell_layout.

## ◆ pack_start() [3/3]

template <class T_ModelColumnType >

void Gtk::CellLayout::pack_start | ( | const TreeModelColumn< T_ModelColumnType >& | column,
|  | bool | expand
| ) |  |

## ◆ pack_start_vfunc()

virtual void Gtk::CellLayout::pack_start_vfunc | ( | CellRenderer* | cell,
|  | bool | expand
| ) |  |
| protected virtual

## ◆ reorder()

void Gtk::CellLayout::reorder | ( | CellRenderer& | cell,
|  | int | position
| ) |  |

Re-inserts cell at position.

Note that cell has already to be packed into cell_layout for this to function properly.

Since gtkmm 2.4:

Parameters

  cell | A Gtk::CellRenderer to reorder.
  position | New position to insert cell at.

## ◆ reorder_vfunc()

virtual void Gtk::CellLayout::reorder_vfunc | ( | CellRenderer* | cell,
|  | int | position
| ) |  |
| protected virtual

## ◆ set_cell_data_func()

void Gtk::CellLayout::set_cell_data_func | ( | CellRenderer& | cell,
|  | const SlotCellData& | slot
| ) |  |

## Friends And Related Function Documentation

## ◆ wrap()

Glib::RefPtr< Gtk::CellLayout > wrap | ( | GtkCellLayout * | object,
|  | bool | take_copy = `false`
| ) |  |
| related

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

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.