类
GtkStringList
描述 [src]
final class Gtk.StringList : GObject.Object
implements Gio.ListModel, Gtk.Buildable {
/* No available fields */
}
GtkStringList 是一个包装字符串数组的列表模型。
模型中的对象是 GtkStringObject 类型,并具有可以在表达式中使用的“string”属性。
GtkStringList 非常适合任何通常会使用 char*[] 但需要列表模型的地方。
GtkStringList 作为 GtkBuildable
GtkStringList GtkBuildable 接口的实现支持直接使用 <items> 元素添加项目,并为每个项目指定 <item> 元素。每个 <item> 元素都支持常规翻译属性“translatable”、“context”和“comments”。
这是一个指定 GtkStringList 的 UI 定义片段
<object class="GtkStringList">
<items>
<item translatable="yes">Factory</item>
<item translatable="yes">Home</item>
<item translatable="yes">Subway</item>
</items>
</object>
实例方法
从 GListModel (5) 继承的方法
g_list_model_get_item
获取 position 上的项目。
g_list_model_get_item_type
获取 list 中项的类型。
g_list_model_get_n_items
获取 list 中项的数量。
g_list_model_get_object
获取 position 上的项目。
g_list_model_items_changed
发出对 list 上的 GListModel::items-changed 信号。
从 GtkBuildable 继承的方法 (1)
信号
从 GObject 继承的信号 (1)
GObject::notify
只要对象的一个属性通过 g_object_set_property()、g_object_set() 等设置其值,notify 信号就会在该对象上发出。
从 GListModel 继承的信号 (1)
GListModel::items-changed
每当向 list 中添加了元件或从 list 中移除了元件时就会发出此信号。在 position 处,removed 元件被移除了,added 元件在其位置处添加了。