Class: Gtk::ListStore
- Inherits:
-
Object
- Object
- Gtk::ListStore
- Defined in:
- lib/gtk3/list-store.rb
Instance Method Summary collapse
-
#append ⇒ nil
Appends a new row to list_store.
-
#append_raw ⇒ nil
Appends a new row to list_store.
-
#clear ⇒ nil
Removes all rows from the list store.
-
#initialize(*columns) ⇒ Gtk::ListStore
constructor
Creates a new
GtkListStore. -
#initialize_raw ⇒ Gtk::ListStore
Creates a new
GtkListStore. -
#insert(index, values = nil) ⇒ nil
Creates a new row at position.
-
#insert_after(index) ⇒ nil
Inserts a new row after sibling.
-
#insert_after_raw ⇒ nil
Inserts a new row after sibling.
-
#insert_before(index) ⇒ nil
Inserts a new row before sibling.
-
#insert_before_raw ⇒ nil
Inserts a new row before sibling.
-
#insert_raw ⇒ nil
Creates a new row at position.
-
#insert_with_values(iter, position, array) ⇒ nil
Creates a new row at position.
-
#insert_with_valuesv(iter, position, columns, values, n_values) ⇒ nil
A variant of gtk_list_store_insert_with_values() which takes the columns and values as two arrays, instead of varargs.
-
#iter_is_valid(iter) ⇒ Boolean
Checks if the given iter is a valid iter for this
GtkListStore. -
#move_after(iter, position) ⇒ nil
Moves iter in store to the position after position.
-
#move_before(iter, position) ⇒ nil
Moves iter in store to the position before position.
-
#prepend ⇒ nil
Prepends a new row to list_store.
-
#prepend_raw ⇒ nil
Prepends a new row to list_store.
-
#remove(iter) ⇒ Boolean
Removes the given row from the list store.
-
#reorder(new_order) ⇒ nil
Reorders store to follow the order indicated by new_order.
-
#set(iter, array) ⇒ nil
Sets the value of one or more cells in the row referenced by iter.
-
#set_column_types(*types) ⇒ nil
Sets the types of the columns of a list store.
-
#set_column_types_raw ⇒ nil
Sets the types of the columns of a list store.
-
#set_valist(iter, var_args) ⇒ nil
See gtk_list_store_set(); this version takes a va_list for use by language bindings.
-
#set_value(iter, column, value) ⇒ nil
Sets the data in the cell specified by iter and column.
-
#set_valuesv(iter, columns, values, n_values) ⇒ nil
A variant of gtk_list_store_set_valist() which takes the columns and values as two arrays, instead of varargs.
-
#swap(a, b) ⇒ nil
Swaps a and b in store.
Constructor Details
#initialize(*columns) ⇒ Gtk::ListStore
Creates a new GtkListStore.
This function is meant to be used by language bindings.
20 21 22 23 24 25 |
# File 'lib/gtk3/list-store.rb', line 20 def initialize(*columns) if columns.empty? raise ArgumentError, "No column type is specified" end initialize_raw(columns) end |
Instance Method Details
#append ⇒ nil
Appends a new row to list_store. iter will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call gtk_list_store_set() or gtk_list_store_set_value().
28 29 30 31 32 |
# File 'lib/gtk3/list-store.rb', line 28 def append iter = append_raw setup_iter(iter) iter end |
#append_raw ⇒ nil
Appends a new row to list_store. iter will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call gtk_list_store_set() or gtk_list_store_set_value().
|
|
# File 'lib/gtk3/list-store.rb', line 27
|
#clear ⇒ nil
Removes all rows from the list store.
#initialize_raw ⇒ Gtk::ListStore
Creates a new GtkListStore.
This function is meant to be used by language bindings.
|
|
# File 'lib/gtk3/list-store.rb', line 19
|
#insert(index, values = nil) ⇒ nil
Creates a new row at position. iter will be changed to point to this new row. If position is -1 or is larger than the number of rows on the list, then the new row will be appended to the list. The row will be empty after this function is called. To fill in values, you need to call gtk_list_store_set() or gtk_list_store_set_value().
42 43 44 45 46 47 |
# File 'lib/gtk3/list-store.rb', line 42 def insert(index, values=nil) iter = insert_raw(index) setup_iter(iter) set_values(iter, values) if values iter end |
#insert_after(index) ⇒ nil
Inserts a new row after sibling. If sibling is nil, then the row will be prepended to the beginning of the list. iter will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call gtk_list_store_set() or gtk_list_store_set_value().
57 58 59 60 61 |
# File 'lib/gtk3/list-store.rb', line 57 def insert_after(index) iter = insert_after_raw(index) setup_iter(iter) iter end |
#insert_after_raw ⇒ nil
Inserts a new row after sibling. If sibling is nil, then the row will be prepended to the beginning of the list. iter will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call gtk_list_store_set() or gtk_list_store_set_value().
|
|
# File 'lib/gtk3/list-store.rb', line 56
|
#insert_before(index) ⇒ nil
Inserts a new row before sibling. If sibling is nil, then the row will be appended to the end of the list. iter will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call gtk_list_store_set() or gtk_list_store_set_value().
50 51 52 53 54 |
# File 'lib/gtk3/list-store.rb', line 50 def insert_before(index) iter = insert_before_raw(index) setup_iter(iter) iter end |
#insert_before_raw ⇒ nil
Inserts a new row before sibling. If sibling is nil, then the row will be appended to the end of the list. iter will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call gtk_list_store_set() or gtk_list_store_set_value().
|
|
# File 'lib/gtk3/list-store.rb', line 49
|
#insert_raw ⇒ nil
Creates a new row at position. iter will be changed to point to this new row. If position is -1 or is larger than the number of rows on the list, then the new row will be appended to the list. The row will be empty after this function is called. To fill in values, you need to call gtk_list_store_set() or gtk_list_store_set_value().
|
|
# File 'lib/gtk3/list-store.rb', line 41
|
#insert_with_values(iter, position, array) ⇒ nil
Creates a new row at position. iter will be changed to point to this new row. If position is -1, or larger than the number of rows in the list, then the new row will be appended to the list. The row will be filled with the values given to this function.
Calling
gtk_list_store_insert_with_values (list_store, iter, position...)
has the same effect as calling:
static void
insert_value (GtkListStore *list_store,
GtkTreeIter *iter,
int position)
{
gtk_list_store_insert (list_store, iter, position);
gtk_list_store_set (list_store,
iter
// ...
);
}
with the difference that the former will only emit GtkTreeModel::row-inserted
once, while the latter will emit GtkTreeModel::row-inserted,
GtkTreeModel::row-changed and, if the list store is sorted,
GtkTreeModel::rows-reordered for every inserted value.
Since emitting the GtkTreeModel::rows-reordered signal repeatedly can
affect the performance of the program, gtk_list_store_insert_with_values()
should generally be preferred when inserting rows in a sorted list store.
#insert_with_valuesv(iter, position, columns, values, n_values) ⇒ nil
A variant of gtk_list_store_insert_with_values() which takes the columns and values as two arrays, instead of varargs.
This function is mainly intended for language-bindings.
#iter_is_valid(iter) ⇒ Boolean
Checks if the given iter is a valid iter for this GtkListStore.
This function is slow. Only use it for debugging and/or testing purposes.
#move_after(iter, position) ⇒ nil
Moves iter in store to the position after position. Note that this function only works with unsorted stores. If position is nil, iter will be moved to the start of the list.
#move_before(iter, position) ⇒ nil
Moves iter in store to the position before position. Note that this function only works with unsorted stores. If position is nil, iter will be moved to the end of the list.
#prepend ⇒ nil
Prepends a new row to list_store. iter will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call gtk_list_store_set() or gtk_list_store_set_value().
35 36 37 38 39 |
# File 'lib/gtk3/list-store.rb', line 35 def prepend iter = prepend_raw setup_iter(iter) iter end |
#prepend_raw ⇒ nil
Prepends a new row to list_store. iter will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call gtk_list_store_set() or gtk_list_store_set_value().
|
|
# File 'lib/gtk3/list-store.rb', line 34
|
#remove(iter) ⇒ Boolean
Removes the given row from the list store. After being removed, iter is set to be the next valid row, or invalidated if it pointed to the last row in list_store.
#reorder(new_order) ⇒ nil
Reorders store to follow the order indicated by new_order. Note that this function only works with unsorted stores.
#set(iter, array) ⇒ nil
Sets the value of one or more cells in the row referenced by iter.
The variable argument list should contain integer column numbers,
each column number followed by the value to be set.
The list is terminated by a -1. For example, to set column 0 with type
%G_TYPE_STRING to “Foo”, you would write gtk_list_store_set (store, iter, 0, "Foo", -1).
The value will be referenced by the store if it is a %G_TYPE_OBJECT, and it will be copied if it is a %G_TYPE_STRING or %G_TYPE_BOXED.
#set_column_types(*types) ⇒ nil
Sets the types of the columns of a list store.
This function is meant primarily for objects that inherit
from GtkListStore, and should only be used when constructing
a new instance.
This function cannot be called after a row has been added, or
a method on the GtkTreeModel interface is called.
64 65 66 67 68 69 |
# File 'lib/gtk3/list-store.rb', line 64 def set_column_types(*types) if types.size == 1 and types[0].is_a?(Array) types = types[0] end set_column_types_raw(types) end |
#set_column_types_raw ⇒ nil
Sets the types of the columns of a list store.
This function is meant primarily for objects that inherit
from GtkListStore, and should only be used when constructing
a new instance.
This function cannot be called after a row has been added, or
a method on the GtkTreeModel interface is called.
|
|
# File 'lib/gtk3/list-store.rb', line 63
|
#set_valist(iter, var_args) ⇒ nil
See gtk_list_store_set(); this version takes a va_list for use by language bindings.
#set_value(iter, column, value) ⇒ nil
Sets the data in the cell specified by iter and column. The type of value must be convertible to the type of the column.
#set_valuesv(iter, columns, values, n_values) ⇒ nil
A variant of gtk_list_store_set_valist() which takes the columns and values as two arrays, instead of varargs. This function is mainly intended for language-bindings and in case the number of columns to change is not known until run-time.
#swap(a, b) ⇒ nil
Swaps a and b in store. Note that this function only works with unsorted stores.