|
| ListModel (ListModel && src) noexcept |
|
ListModel & | operator= (ListModel && src) noexcept |
|
| ~ListModel () noexcept override |
|
GListModel * | gobj () |
| Provides access to the underlying C GObject. More...
|
|
const GListModel * | gobj () const |
| Provides access to the underlying C GObject. More...
|
|
GType | get_item_type () const |
| Gets the type of the items in list. More...
|
|
guint | get_n_items () const |
| Gets the number of items in list. More...
|
|
Glib::RefPtr< Glib::ObjectBase > | get_object (guint position) |
| Get the item at position. More...
|
|
Glib::RefPtr< const Glib::ObjectBase > | get_object (guint position) const |
| Get the item at position. More...
|
|
Glib::SignalProxy< void, guint, guint, guint > | signal_items_changed () |
|
virtual GType | get_item_type_vfunc () |
|
virtual guint | get_n_items_vfunc () |
|
virtual gpointer | get_item_vfunc (guint position) |
|
| Interface () |
| A Default constructor. More...
|
|
| Interface (Interface && src) noexcept |
|
Interface & | operator= (Interface && src) noexcept |
|
| Interface (const Glib::Interface_Class & interface_class) |
| Called by constructors of derived classes. More...
|
|
| Interface (GObject * castitem) |
| Called by constructors of derived classes. More...
|
|
| ~Interface () noexcept override |
|
| Interface (const Interface &)=delete |
|
Interface & | operator= (const Interface &)=delete |
|
GObject * | gobj () |
|
const GObject * | gobj () const |
|
| ObjectBase (const ObjectBase &)=delete |
|
ObjectBase & | operator= (const ObjectBase &)=delete |
|
void | set_property_value (const Glib::ustring & property_name, const Glib::ValueBase & value) |
| You probably want to use a specific property_*() accessor method instead. More...
|
|
void | get_property_value (const Glib::ustring & property_name, Glib::ValueBase & value) const |
| You probably want to use a specific property_*() accessor method instead. More...
|
|
template<class PropertyType > |
void | set_property (const Glib::ustring & property_name, const PropertyType & value) |
| You probably want to use a specific property_*() accessor method instead. More...
|
|
template<class PropertyType > |
void | get_property (const Glib::ustring & property_name, PropertyType & value) const |
| You probably want to use a specific property_*() accessor method instead. More...
|
|
void | connect_property_changed (const Glib::ustring & property_name, const sigc::slot< void > & slot) |
| You can use the signal_changed() signal of the property proxy instead. More...
|
|
void | connect_property_changed (const Glib::ustring & property_name, sigc::slot< void > && slot) |
| You can use the signal_changed() signal of the property proxy instead. More...
|
|
sigc::connection | connect_property_changed_with_return (const Glib::ustring & property_name, const sigc::slot< void > & slot) |
| You can use the signal_changed() signal of the property proxy instead. More...
|
|
sigc::connection | connect_property_changed_with_return (const Glib::ustring & property_name, sigc::slot< void > && slot) |
| You can use the signal_changed() signal of the property proxy instead. More...
|
|
void | freeze_notify () |
| Increases the freeze count on object. More...
|
|
void | thaw_notify () |
| Reverts the effect of a previous call to freeze_notify(). More...
|
|
virtual void | reference () const |
| Increment the reference count for this object. More...
|
|
virtual void | unreference () const |
| Decrement the reference count for this object. More...
|
|
GObject * | gobj () |
| Provides access to the underlying C GObject. More...
|
|
const GObject * | gobj () const |
| Provides access to the underlying C GObject. More...
|
|
GObject * | gobj_copy () const |
| Give a ref-ed copy to someone. Use for direct struct access. More...
|
|
A dynamic list of objects.
A ListModel represents a mutable list of Glib::Objects. Its main intention is as a model for various widgets in user interfaces, such as list views, but it can also be used as a convenient method of returning lists of data, with support for updates.
Each object in the list may also report changes in itself via some mechanism (normally the Glib::PropertyProxy<>::signal_changed() signal of one or more of the object's properties). Taken together with the signal_items_changed() signal, this provides for a list that can change its membership, and in which the members can change their individual properties.
A good example would be the list of visible wireless network access points, where each access point can report dynamic properties such as signal strength.
It is important to note that the ListModel itself does not report changes to the individual items. It only reports changes to the list membership. If you want to observe changes to the objects themselves then you need to connect signals to the objects that you are interested in.
All items in a ListModel are of (or derived from) the same type. get_item_type() returns that type. The type may be an interface, in which case all objects in the list must implement it.
The semantics are close to that of an array: get_n_items() returns the number of items in the list and get_object() returns an item at a (0-based) position. In order to allow implementations to calculate the list length lazily, you can also iterate over items: starting from 0, repeatedly call get_object() until it returns nullptr.
This interface is intended only to be used from a single thread. The thread in which it is appropriate to use it depends on the particular implementation, but typically it will be from the thread that owns the thread-default main context in effect at the time that the model was created.
- Since glibmm 2.50:
void Gio::ListModel::items_changed |
( |
guint |
position, |
|
|
guint |
removed, |
|
|
guint |
added |
|
) |
| |
|
protected |
Emits the ListModel::signal_items_changed() signal on list.
This function should only be called by classes implementing ListModel. It has to be called after the internal representation of list has been updated, because handlers connected to this signal might query the new state of the list.
Implementations must only make changes to the model (as visible to its consumer) in places that will not cause problems for that consumer. For models that are driven directly by a write API (such as ListStore), changes can be reported in response to uses of that API. For models that represent remote data, changes should only be made from a fresh mainloop dispatch. It is particularly not permitted to make changes in response to a call to the ListModel consumer API.
Stated another way: in general, it is assumed that code making a series of accesses to the model via the API, without returning to the mainloop, and without calling other code, will continue to view the same contents of the model.
- Since glibmm 2.50:
- Parameters
-
position | The position at which list changed. |
removed | The number of items removed. |
added | The number of items added. |