gtkmm: Gtk::TreeListModel Class Reference
A list model that can create child models on demand. More...
#include <gtkmm/treelistmodel.h>
Public Types | |
using | SlotCreateModel = sigc::slot< Glib::RefPtr< Gio::ListModel >(const Glib::RefPtr< Glib::ObjectBase >&)> |
For instance: Glib::RefPtr<Gio::ListModel> create_func(const Glib::RefPtr<Glib::ObjectBase>& item);. 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 Member Functions | |
TreeListModel (TreeListModel&& src) noexcept | |
TreeListModel& | operator= (TreeListModel&& src) noexcept |
~TreeListModel () noexcept override | |
GtkTreeListModel* | gobj () |
Provides access to the underlying C GObject. More... | |
const GtkTreeListModel* | gobj () const |
Provides access to the underlying C GObject. More... | |
GtkTreeListModel* | gobj_copy () |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More... | |
Glib::RefPtr< Gio::ListModel > | get_model () |
Gets the root model that self was created with. More... | |
Glib::RefPtr< const Gio::ListModel > | get_model () const |
Gets the root model that self was created with. More... | |
bool | get_passthrough () const |
If this function returns false , the ListModel functions for self return custom Gtk::TreeListRow objects. More... | |
void | set_autoexpand (bool autoexpand=true) |
If set to true , the model will recursively expand all rows that get added to the model. More... | |
bool | get_autoexpand () const |
Gets whether the model is set to automatically expand new rows that get added. More... | |
Glib::RefPtr< TreeListRow > | get_child_row (guint position) |
Gets the row item corresponding to the child at index position for self's root model. More... | |
Glib::RefPtr< const TreeListRow > | get_child_row (guint position) const |
Gets the row item corresponding to the child at index position for self's root model. More... | |
Glib::RefPtr< TreeListRow > | get_row (guint position) |
Gets the row object for the given row. More... | |
Glib::RefPtr< const TreeListRow > | get_row (guint position) const |
Gets the row object for the given row. More... | |
Glib::PropertyProxy< bool > | property_autoexpand () |
If all rows should be expanded by default. More... | |
Glib::PropertyProxy_ReadOnly< bool > | property_autoexpand () const |
If all rows should be expanded by default. More... | |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::ListModel > > | property_model () const |
The root model displayed. More... | |
Glib::PropertyProxy_ReadOnly< bool > | property_passthrough () const |
If false , the ListModel functions for this object return custom Gtk::TreeListRow objects. More... | |
Public Member Functions inherited from Glib::Object | |
Object (const Object &)=delete | |
Object & | operator= (const Object &)=delete |
Object (Object &&src) noexcept | |
Object & | operator= (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::Object > | wrap (GObject *object, bool take_copy=false) |
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 |
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 () |
trackable & | operator= (const trackable &src) |
trackable & | operator= (trackable &&src) noexcept |
void | remove_destroy_notify_callback (notifiable *data) const |
Public Member Functions inherited from Gio::ListModel | |
ListModel (ListModel &&src) noexcept | |
ListModel & | operator= (ListModel &&src) noexcept |
~ListModel () noexcept override | |
GListModel * | gobj () |
const GListModel * | gobj () const |
GType | get_item_type () const |
guint | get_n_items () const |
Glib::RefPtr< Glib::ObjectBase > | get_object (guint position) |
Glib::RefPtr< const Glib::ObjectBase > | get_object (guint position) const |
Glib::SignalProxy< void(guint, guint, guint)> | signal_items_changed () |
Glib::RefPtr< Gio::ListModel > | wrap (GListModel *object, bool take_copy=false) |
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 |
Static Public Member Functions | |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. More... | |
static Glib::RefPtr< TreeListModel > | create (const Glib::RefPtr< Gio::ListModel >& root, const SlotCreateModel& slot_create, bool passthrough=false, bool autoexpand=false) |
Creates a new empty Gtk::TreeListModel displaying root with all rows collapsed. More... | |
Static Public Member Functions inherited from Gio::ListModel | |
static void | add_interface (GType gtype_implementer) |
static GType | get_type () |
Protected Member Functions | |
TreeListModel (const Glib::RefPtr< Gio::ListModel >& root, const SlotCreateModel& slot_create, bool passthrough=false, bool autoexpand=false) | |
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 | |
ObjectBase & | operator= (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 Gio::ListModel | |
ListModel () | |
void | items_changed (guint position, guint removed, guint added) |
virtual GType | get_item_type_vfunc () |
virtual guint | get_n_items_vfunc () |
virtual gpointer | get_item_vfunc (guint position) |
Related Functions | |
(Note that these are not member functions.) | |
Glib::RefPtr< Gtk::TreeListModel > | wrap (GtkTreeListModel* object, bool take_copy=false) |
A Glib::wrap() method for this object. More... | |
Detailed Description
A list model that can create child models on demand.
Gtk::TreeListModel is a Gio::ListModel implementation that can expand rows by creating new child list models on demand.
- See also
- Gio::ListModel
Member Typedef Documentation
using Gtk::TreeListModel::SlotCreateModel = sigc::slot<Glib::RefPtr<Gio::ListModel>(const Glib::RefPtr<Glib::ObjectBase>&)> |
For instance: Glib::RefPtr<Gio::ListModel> create_func(const Glib::RefPtr<Glib::ObjectBase>& item);.
Prototype of the function called to create new child models when Gtk::TreeListRow::set_expanded() is called.
This function can return nullptr
to indicate that item is guaranteed to be a leaf node and will never have children. If it does not have children but may get children later, it should return an empty model that is filled once children arrive.
- Parameters
-
item The item that is being expanded.
- Returns
- The model tracking the children of item or
nullptr
if item can never have children.
Constructor & Destructor Documentation
|
noexcept |
|
overridenoexcept |
|
protected |
Member Function Documentation
|
static |
Creates a new empty Gtk::TreeListModel displaying root with all rows collapsed.
- Parameters
-
root The Gio::ListModel to use as root. slot_create Slot to call to create the Gio::ListModel for the children of an item. passthrough true
to pass through items from the models.autoexpand true
to set the autoexpand property and expand the root model.
bool Gtk::TreeListModel::get_autoexpand | ( | ) | const |
Gets whether the model is set to automatically expand new rows that get added.
This can be either rows added by changes to the underlying models or via Gtk::TreeListRow::set_expanded().
- Returns
true
if the model is set to autoexpand.
Glib::RefPtr<TreeListRow> Gtk::TreeListModel::get_child_row | ( | guint | position | ) |
Gets the row item corresponding to the child at index position for self's root model.
If position is greater than the number of children in the root model, nullptr
is returned.
Do not confuse this function with get_row().
- Parameters
-
position Position of the child to get.
- Returns
- The child in position.
Glib::RefPtr<const TreeListRow> Gtk::TreeListModel::get_child_row | ( | guint | position | ) | const |
Gets the row item corresponding to the child at index position for self's root model.
If position is greater than the number of children in the root model, nullptr
is returned.
Do not confuse this function with get_row().
- Parameters
-
position Position of the child to get.
- Returns
- The child in position.
Glib::RefPtr<Gio::ListModel> Gtk::TreeListModel::get_model | ( | ) |
Gets the root model that self was created with.
- Returns
- The root model.
Glib::RefPtr<const Gio::ListModel> Gtk::TreeListModel::get_model | ( | ) | const |
Gets the root model that self was created with.
- Returns
- The root model.
bool Gtk::TreeListModel::get_passthrough | ( | ) | const |
If this function returns false
, the ListModel functions for self return custom Gtk::TreeListRow objects.
You need to call Gtk::TreeListRow::get_item() on these objects to get the original item.
If true
, the values of the child models are passed through in their original state. You then need to call get_row() to get the custom Gtk::TreeListRows.
- Returns
true
if the model is passing through original row items.
Glib::RefPtr<TreeListRow> Gtk::TreeListModel::get_row | ( | guint | position | ) |
Gets the row object for the given row.
If position is greater than the number of items in self, nullptr
is returned.
The row object can be used to expand and collapse rows as well as to inspect its position in the tree. See its documentation for details.
This row object is persistent and will refer to the current item as long as the row is present in self, independent of other rows being added or removed.
If self is set to not be passthrough, this function is equivalent to calling Glib::list_model_get_item().
Do not confuse this function with get_child_row().
- Parameters
-
position The position of the row to fetch.
- Returns
- The row item.
Glib::RefPtr<const TreeListRow> Gtk::TreeListModel::get_row | ( | guint | position | ) | const |
Gets the row object for the given row.
If position is greater than the number of items in self, nullptr
is returned.
The row object can be used to expand and collapse rows as well as to inspect its position in the tree. See its documentation for details.
This row object is persistent and will refer to the current item as long as the row is present in self, independent of other rows being added or removed.
If self is set to not be passthrough, this function is equivalent to calling Glib::list_model_get_item().
Do not confuse this function with get_child_row().
- Parameters
-
position The position of the row to fetch.
- Returns
- The row item.
|
static |
Get the GType for this class, for use with the underlying GObject type system.
|
inline |
Provides access to the underlying C GObject.
|
inline |
Provides access to the underlying C GObject.
GtkTreeListModel* Gtk::TreeListModel::gobj_copy | ( | ) |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
|
noexcept |
Glib::PropertyProxy< bool > Gtk::TreeListModel::property_autoexpand | ( | ) |
If all rows should be expanded by default.
Default value: false
- 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< bool > Gtk::TreeListModel::property_autoexpand | ( | ) | const |
If all rows should be expanded by default.
Default value: false
- 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< Glib::RefPtr<Gio::ListModel> > Gtk::TreeListModel::property_model | ( | ) | const |
The root model displayed.
- 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< bool > Gtk::TreeListModel::property_passthrough | ( | ) | const |
If false
, the ListModel functions for this object return custom Gtk::TreeListRow objects.
If true
, the values of the child models are pass through unmodified.
Default value: false
- 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::TreeListModel::set_autoexpand | ( | bool | autoexpand = true | ) |
If set to true
, the model will recursively expand all rows that get added to the model.
This can be either rows added by changes to the underlying models or via Gtk::TreeListRow::set_expanded().
- Parameters
-
autoexpand true
to make the model autoexpand its rows.
Friends And Related Function Documentation
|
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.