gtk.string_list

Module for StringList class

Types 3

gtk.string_list.StringList is a list model that wraps an array of strings.

The objects in the model are of type gtk.string_object.StringObject and have a "string" property that can be used inside expressions.

gtk.string_list.StringList is well-suited for any place where you would typically use a char*[], but need a list model.

GtkStringList as GtkBuildable

The gtk.string_list.StringList implementation of the gtk.buildable.Buildable interface supports adding items directly using the <items> element and specifying <item> elements for each item. Each <item> element supports the regular translation attributes “translatable”, “context” and “comments”.

Here is a UI definition fragment specifying a gtk.string_list.StringList

<object class="GtkStringList">
  <items>
    <item translatable="yes">Factory</item>
    <item translatable="yes">Home</item>
    <item translatable="yes">Subway</item>
  </items>
</object>

Methods
GType _gType() @property
StringList self()Returns `this`, for use in `with` statements.
StringListGidBuilder builder()Get builder for [gtk.string_list.StringList] Returns: New builder object
gobject.types.GType itemType() @propertyGet `itemType` property. Returns: The type of items. See [gio.list_model.ListModel.getItemType].
uint nItems() @propertyGet `nItems` property. Returns: The number of items. See [gio.list_model.ListModel.getNItems].
void append(string string_)Appends string to self.
string getString(uint position)Gets the string that is at position in self.
void remove(uint position)Removes the string at position from self.
void splice(uint position, uint nRemovals, string[] additions = null)Changes self by removing n_removals strings and adding additions to it.
void take(string string_)Adds string to self at the end, and takes ownership of it.
Constructors
this(void * ptr, Flag!"Take" take)
this(string[] strings = null)Creates a new [gtk.string_list.StringList] with the given strings.

Fluent builder for gtk.string_list.StringList

Methods
StringList build()Create object from builder. Returns: New object