Class: Gtk::ListBox
- Inherits:
-
Object
- Object
- Gtk::ListBox
- Defined in:
- (unknown)
Instance Method Summary collapse
-
#activate_on_single_click ⇒ TrueClass
Returns whether rows activate on single clicks.
- #activate_on_single_click=(activate_on_single_click) ⇒ TrueClass
-
#activate_on_single_click? ⇒ TrueClass
Activate-on-single-click.
-
#adjustment ⇒ Gtk::Adjustment
Gets the adjustment (if any) that the widget uses to for vertical scrolling.
-
#adjustment=(adjustment) ⇒ nil
Sets the adjustment (if any) that the widget uses to for vertical scrolling.
-
#bind_model(model, create_widget_func, user_data, user_data_free_func) ⇒ nil
Binds model to box.
-
#drag_highlight_row(row) ⇒ nil
This is a helper function for implementing DnD onto a Gtk::ListBox.
-
#drag_unhighlight_row ⇒ nil
If a row has previously been highlighted via gtk_list_box_drag_highlight_row() it will have the highlight removed.
-
#get_row_at_index(index_) ⇒ Gtk::ListBoxRow
Gets the n-th child in the list (not counting headers).
-
#get_row_at_y(y) ⇒ Gtk::ListBoxRow
Gets the row at the y position.
-
#insert(child, position) ⇒ nil
Insert the child into the box at position.
-
#invalidate_filter ⇒ nil
Update the filtering for all rows.
-
#invalidate_headers ⇒ nil
Update the separators for all rows.
-
#invalidate_sort ⇒ nil
Update the sorting for all rows.
-
#new ⇒ Gtk::Widget
Creates a new Gtk::ListBox container.
-
#placeholder=(placeholder) ⇒ nil
Sets the placeholder widget that is shown in the list when it doesn’t display any visible children.
-
#prepend(child) ⇒ nil
Prepend a widget to the list.
-
#select_all ⇒ nil
Select all children of box, if the selection mode allows it.
-
#select_row(row) ⇒ nil
Make row the currently selected row.
-
#selected_foreach(func, data) ⇒ nil
Calls a function for each selected child.
-
#selected_row ⇒ Gtk::ListBoxRow
Gets the selected row.
-
#selected_rows ⇒ GLib::List
Creates a list of all selected children.
-
#selection_mode ⇒ Gtk::SelectionMode
Selection-mode.
- #selection_mode=(selection_mode) ⇒ Gtk::SelectionMode
-
#set_filter_func(filter_func, user_data, destroy) ⇒ nil
By setting a filter function on the box one can decide dynamically which of the rows to show.
-
#set_header_func(update_header, user_data, destroy) ⇒ nil
By setting a header function on the box one can dynamically add headers in front of rows, depending on the contents of the row and its position in the list.
-
#set_sort_func(sort_func, user_data, destroy) ⇒ nil
By setting a sort function on the box one can dynamically reorder the rows of the list, based on the contents of the rows.
-
#unselect_all ⇒ nil
Unselect all children of box, if the selection mode allows it.
-
#unselect_row(row) ⇒ nil
Unselects a single row of box, if the selection mode allows it.
Instance Method Details
#activate_on_single_click ⇒ TrueClass
Returns whether rows activate on single clicks.
#activate_on_single_click=(activate_on_single_click) ⇒ TrueClass
#activate_on_single_click? ⇒ TrueClass
Returns activate-on-single-click.
#adjustment ⇒ Gtk::Adjustment
Gets the adjustment (if any) that the widget uses to for vertical scrolling.
#adjustment=(adjustment) ⇒ nil
Sets the adjustment (if any) that the widget uses to for vertical scrolling. For instance, this is used to get the page size for PageUp/Down key handling.
In the normal case when the box is packed inside a Gtk::ScrolledWindow the adjustment from that will be picked up automatically, so there is no need to manually do that.
#bind_model(model, create_widget_func, user_data, user_data_free_func) ⇒ nil
Binds model to box.
If box was already bound to a model, that previous binding is destroyed.
The contents of box are cleared and then filled with widgets that represent items from model. box is updated whenever model changes. If model is nil, box is left empty.
It is undefined to add or remove widgets directly (for example, with gtk_list_box_insert() or gtk_container_add()) while box is bound to a model.
Note that using a model is incompatible with the filtering and sorting functionality in GtkListBox. When using a model, filtering and sorting should be implemented by the model.
#drag_highlight_row(row) ⇒ nil
This is a helper function for implementing DnD onto a Gtk::ListBox. The passed in row will be highlighted via gtk_drag_highlight(), and any previously highlighted row will be unhighlighted.
The row will also be unhighlighted when the widget gets a drag leave event.
#drag_unhighlight_row ⇒ nil
If a row has previously been highlighted via gtk_list_box_drag_highlight_row() it will have the highlight removed.
#get_row_at_index(index_) ⇒ Gtk::ListBoxRow
Gets the n-th child in the list (not counting headers). If _index is negative or larger than the number of items in the list, nil is returned.
#get_row_at_y(y) ⇒ Gtk::ListBoxRow
Gets the row at the y position.
#insert(child, position) ⇒ nil
Insert the child into the box at position. If a sort function is set, the widget will actually be inserted at the calculated position and this function has the same effect of gtk_container_add().
If position is -1, or larger than the total number of items in the box, then the child will be appended to the end.
#invalidate_filter ⇒ nil
Update the filtering for all rows. Call this when result of the filter function on the box is changed due to an external factor. For instance, this would be used if the filter function just looked for a specific search string and the entry with the search string has changed.
#invalidate_headers ⇒ nil
Update the separators for all rows. Call this when result of the header function on the box is changed due to an external factor.
#invalidate_sort ⇒ nil
Update the sorting for all rows. Call this when result of the sort function on the box is changed due to an external factor.
#new ⇒ Gtk::Widget
Creates a new Gtk::ListBox container.
#placeholder=(placeholder) ⇒ nil
Sets the placeholder widget that is shown in the list when it doesn’t display any visible children.
#prepend(child) ⇒ nil
Prepend a widget to the list. If a sort function is set, the widget will actually be inserted at the calculated position and this function has the same effect of gtk_container_add().
#select_all ⇒ nil
Select all children of box, if the selection mode allows it.
#select_row(row) ⇒ nil
Make row the currently selected row.
#selected_foreach(func, data) ⇒ nil
Calls a function for each selected child.
Note that the selection cannot be modified from within this function.
#selected_row ⇒ Gtk::ListBoxRow
Gets the selected row.
Note that the box may allow multiple selection, in which case you should use gtk_list_box_selected_foreach() to find all selected rows.
#selected_rows ⇒ GLib::List
Creates a list of all selected children.
#selection_mode ⇒ Gtk::SelectionMode
Returns selection-mode.
#selection_mode=(selection_mode) ⇒ Gtk::SelectionMode
#set_filter_func(filter_func, user_data, destroy) ⇒ nil
By setting a filter function on the box one can decide dynamically which of the rows to show. For instance, to implement a search function on a list that filters the original list to only show the matching rows.
The filter_func will be called for each row after the call, and it will continue to be called each time a row changes (via gtk_list_box_row_changed()) or when gtk_list_box_invalidate_filter() is called.
Note that using a filter function is incompatible with using a model (see gtk_list_box_bind_model()).
#set_header_func(update_header, user_data, destroy) ⇒ nil
By setting a header function on the box one can dynamically add headers in front of rows, depending on the contents of the row and its position in the list. For instance, one could use it to add headers in front of the first item of a new kind, in a list sorted by the kind.
The update_header can look at the current header widget using gtk_list_box_row_get_header() and either update the state of the widget as needed, or set a new one using gtk_list_box_row_set_header(). If no header is needed, set the header to nil.
Note that you may get many calls update_header to this for a particular row when e.g. changing things that don’t affect the header. In this case it is important for performance to not blindly replace an existing header with an identical one.
The update_header function will be called for each row after the call, and it will continue to be called each time a row changes (via gtk_list_box_row_changed()) and when the row before changes (either by gtk_list_box_row_changed() on the previous row, or when the previous row becomes a different row). It is also called for all rows when gtk_list_box_invalidate_headers() is called.
#set_sort_func(sort_func, user_data, destroy) ⇒ nil
By setting a sort function on the box one can dynamically reorder the rows of the list, based on the contents of the rows.
The sort_func will be called for each row after the call, and will continue to be called each time a row changes (via gtk_list_box_row_changed()) and when gtk_list_box_invalidate_sort() is called.
Note that using a sort function is incompatible with using a model (see gtk_list_box_bind_model()).
#unselect_all ⇒ nil
Unselect all children of box, if the selection mode allows it.
#unselect_row(row) ⇒ nil
Unselects a single row of box, if the selection mode allows it.