Class: Gtk::StringList
- Inherits:
-
Object
- Object
- Gtk::StringList
- Defined in:
- (unknown)
Instance Method Summary collapse
-
#append(string) ⇒ nil
Appends string to self.
-
#get_string(position) ⇒ String
Gets the string that is at position in self.
-
#initialize(strings) ⇒ Gtk::StringList
constructor
Creates a new
GtkStringListwith the given strings. -
#item_type ⇒ GLib::Type
The type of items.
-
#item_type=(item_type) ⇒ GLib::Type
The type of items.
-
#n_items ⇒ Integer
The number of items.
-
#n_items=(n_items) ⇒ Integer
The number of items.
-
#remove(position) ⇒ nil
Removes the string at position from self.
-
#splice(position, n_removals, additions) ⇒ nil
Changes self by removing n_removals strings and adding additions to it.
-
#strings=(strings) ⇒ Gtk::
Strings.
-
#take(string) ⇒ nil
Adds string to self at the end, and takes ownership of it.
Constructor Details
#initialize(strings) ⇒ Gtk::StringList
Creates a new GtkStringList with the given strings.
Instance Method Details
#append(string) ⇒ nil
Appends string to self.
The string will be copied. See [methodGtk.StringList.take] for a way to avoid that.
#get_string(position) ⇒ String
Gets the string that is at position in self.
If self does not contain position items, nil is returned.
This function returns the const char *. To get the object wrapping it, use g_list_model_get_item().
#item_type ⇒ GLib::Type
The type of items. See [methodGio.ListModel.get_item_type].
#item_type=(item_type) ⇒ GLib::Type
The type of items. See [methodGio.ListModel.get_item_type].
#n_items ⇒ Integer
The number of items. See [methodGio.ListModel.get_n_items].
#n_items=(n_items) ⇒ Integer
The number of items. See [methodGio.ListModel.get_n_items].
#remove(position) ⇒ nil
Removes the string at position from self.
position must be smaller than the current length of the list.
#splice(position, n_removals, additions) ⇒ nil
Changes self by removing n_removals strings and adding additions to it.
This function is more efficient than [methodGtk.StringList.append] and [methodGtk.StringList.remove], because it only emits the ::items-changed signal once for the change.
This function copies the strings in additions.
The parameters position and n_removals must be correct (ie: position + n_removals must be less than or equal to the length of the list at the time this function is called).
#strings=(strings) ⇒ Gtk::
Returns strings.
#take(string) ⇒ nil
Adds string to self at the end, and takes ownership of it.
This variant of [methodGtk.StringList.append] is convenient for formatting strings:
gtk_string_list_take (self, g_strdup_print ("%d dollars", lots));