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 _getGType() static nothrow
GType _gType() @property nothrow
StringList self() nothrowReturns `this`, for use in `with` statements.
StringListGidBuilder builder() static nothrowGet builder for [gtk.string_list.StringList] Returns: New builder object
gobject.types.GType itemType() @property nothrowGet `itemType` property. Returns: The type of items. See [gio.list_model.ListModel.getItemType].
uint nItems() @property nothrowGet `nItems` property. Returns: The number of items. See [gio.list_model.ListModel.getNItems].
void append(string string_) nothrowAppends string to self.
string getString(uint position) nothrowGets the string that is at position in self.
void remove(uint position) nothrowRemoves the string at position from self.
void splice(uint position, uint nRemovals, string[] additions = null) nothrowChanges self by removing n_removals strings and adding additions to it.
void take(string string_) nothrowAdds 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() nothrowCreate object from builder. Returns: New object