|
| SelectionModel (SelectionModel&& src) noexcept |
|
SelectionModel& | operator= (SelectionModel&& src) noexcept |
|
| ~SelectionModel () noexcept override |
|
GtkSelectionModel* | gobj () |
| Provides access to the underlying C GObject. More...
|
|
const GtkSelectionModel* | gobj () const |
| Provides access to the underlying C GObject. More...
|
|
bool | is_slected (guint position) const |
| Checks if the given item is selected. More...
|
|
bool | select_item (guint position, bool exclusive) |
| Requests to select an item in the model. More...
|
|
bool | unselect_item (guint position) |
| Requests to unselect an item in the model. More...
|
|
bool | select_range (guint position, guint n_items, bool exclusive) |
| Requests to select a range of items in the model. More...
|
|
bool | unselect_range (guint position, guint n_items) |
| Requests to unselect a range of items in the model. More...
|
|
bool | select_all () |
| Requests to select all items in the model. More...
|
|
bool | unselect_all () |
| Requests to unselect all items in the model. More...
|
|
void | query_range (guint position, guint& start_range, guint& n_items, bool& selected) const |
| This function allows to query the selection status of multiple elements at once. More...
|
|
Glib::SignalProxy< void(guint, guint)> | signal_selection_changed () |
|
| 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 |
|
| 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 |
|
| 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 |
|
An extension of the list model interface that handles selections.
Gtk::SelectionModel is an interface that extends the Gio::ListModel interface by adding support for selections. This support is then used by widgets using list models to add the ability to select and unselect various items.
GTK provides default implementations of the common selection modes such as Gtk::SingleSelection, so you will only need to implement this interface if you want detailed control about how selections should be handled.
A Gtk::SelectionModel supports a single boolean per row indicating if a row is selected or not. This can be queried via is_selected(). When the selected state of one or more rows changes, the model will emit signal_selection_changed() by calling the selection_changed() method. The positions given in that signal may have their selection state changed, though that is not a requirement. If new items added to the model via Gio::ListModel::signal_items_changed() are selected or not is up to the implementation.
Additionally, the interface can expose functionality to select and unselect items. If these functions are implemented, GTK's list widgets will allow users to select and unselect items. However, Gtk::SelectionModels are free to only implement them partially or not at all. In that case the widgets will not support the unimplemented operations.
When selecting or unselecting is supported by a model, the return values of the selection functions do NOT indicate if selection or unselection happened. They are only meant to indicate complete failure, like when this mode of selecting is not supported by the model. Selections may happen asynchronously, so the only reliable way to find out when an item was selected is to listen to the signals that indicate selection.
- See also
- Gio::ListModel, Gtk::SingleSelection
- Since gtkmm 3.96:
void Gtk::SelectionModel::query_range |
( |
guint |
position, |
|
|
guint & |
start_range, |
|
|
guint & |
n_items, |
|
|
bool & |
selected |
|
) |
| const |
This function allows to query the selection status of multiple elements at once.
It is passed a position and returns a range of elements of uniform selection status.
If position is greater than the number of items in model, n_items is set to 0. Otherwise the returned range is guaranteed to include the passed-in position, so n_items will be >= 1.
Positions directly adjacent to the returned range may have the same selection status as the returned range.
This is an optimization function to make iterating over a model faster when few items are selected. However, it is valid behavior for implementations to use a naive implementation that only ever returns a single element.
- Parameters
-
position | The position inside the range. |
start_range | Returns the position of the first element of the range. |
n_items | Returns the size of the range. |
selected | Returns whether items in range are selected. |