source: appstream-generator/build/girepo/gio/ListModelIF.d @ 4841

Last change on this file since 4841 was 4841, checked in by Juanma, 2 years ago

Initial release

File size: 6.8 KB
Line 
1/*
2 * Licensed under the GNU Lesser General Public License Version 3
3 *
4 * This library is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the license, or
7 * (at your option) any later version.
8 *
9 * This software is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18// generated automatically - do not change
19
20
21module gio.ListModelIF;
22
23private import gi.gio;
24public  import gi.giotypes;
25private import gobject.ObjectG;
26private import gobject.Signals;
27private import std.algorithm;
28
29
30/**
31 * #GListModel is an interface that represents a mutable list of
32 * #GObjects. Its main intention is as a model for various widgets in
33 * user interfaces, such as list views, but it can also be used as a
34 * convenient method of returning lists of data, with support for
35 * updates.
36 *
37 * Each object in the list may also report changes in itself via some
38 * mechanism (normally the #GObject::notify signal).  Taken together
39 * with the #GListModel::items-changed signal, this provides for a list
40 * that can change its membership, and in which the members can change
41 * their individual properties.
42 *
43 * A good example would be the list of visible wireless network access
44 * points, where each access point can report dynamic properties such as
45 * signal strength.
46 *
47 * It is important to note that the #GListModel itself does not report
48 * changes to the individual items.  It only reports changes to the list
49 * membership.  If you want to observe changes to the objects themselves
50 * then you need to connect signals to the objects that you are
51 * interested in.
52 *
53 * All items in a #GListModel are of (or derived from) the same type.
54 * g_list_model_get_item_type() returns that type.  The type may be an
55 * interface, in which case all objects in the list must implement it.
56 *
57 * The semantics are close to that of an array:
58 * g_list_model_get_length() returns the number of items in the list and
59 * g_list_model_get_item() returns an item at a (0-based) position. In
60 * order to allow implementations to calculate the list length lazily,
61 * you can also iterate over items: starting from 0, repeatedly call
62 * g_list_model_get_item() until it returns %NULL.
63 *
64 * An implementation may create objects lazily, but must take care to
65 * return the same object for a given position until all references to
66 * it are gone.
67 *
68 * On the other side, a consumer is expected only to hold references on
69 * objects that are currently "user visible", in order to faciliate the
70 * maximum level of laziness in the implementation of the list and to
71 * reduce the required number of signal connections at a given time.
72 *
73 * This interface is intended only to be used from a single thread.  The
74 * thread in which it is appropriate to use it depends on the particular
75 * implementation, but typically it will be from the thread that owns
76 * the [thread-default main context][g-main-context-push-thread-default]
77 * in effect at the time that the model was created.
78 */
79public interface ListModelIF{
80        /** Get the main Gtk struct */
81        public GListModel* getListModelStruct();
82
83        /** the main Gtk struct as a void* */
84        protected void* getStruct();
85
86
87        /**
88         * Get the item at @position. If @position is greater than the number of
89         * items in @list, %NULL is returned.
90         *
91         * %NULL is never returned for an index that is smaller than the length
92         * of the list.  See g_list_model_get_n_items().
93         *
94         * Params:
95         *     position = the position of the item to fetch
96         *
97         * Returns: the item at @position.
98         *
99         * Since: 2.44
100         */
101        public ObjectG getItem(uint position);
102
103        /**
104         * Gets the type of the items in @list. All items returned from
105         * g_list_model_get_type() are of that type or a subtype, or are an
106         * implementation of that interface.
107         *
108         * The item type of a #GListModel can not change during the life of the
109         * model.
110         *
111         * Returns: the #GType of the items contained in @list.
112         *
113         * Since: 2.44
114         */
115        public GType getItemType();
116
117        /**
118         * Gets the number of items in @list.
119         *
120         * Depending on the model implementation, calling this function may be
121         * less efficient than iterating the list with increasing values for
122         * @position until g_list_model_get_item() returns %NULL.
123         *
124         * Returns: the number of items in @list.
125         *
126         * Since: 2.44
127         */
128        public uint getNItems();
129
130        /**
131         * Get the item at @position. If @position is greater than the number of
132         * items in @list, %NULL is returned.
133         *
134         * %NULL is never returned for an index that is smaller than the length
135         * of the list.  See g_list_model_get_n_items().
136         *
137         * Params:
138         *     position = the position of the item to fetch
139         *
140         * Returns: the object at @position.
141         *
142         * Since: 2.44
143         */
144        public ObjectG getObject(uint position);
145
146        /**
147         * Emits the #GListModel::items-changed signal on @list.
148         *
149         * This function should only be called by classes implementing
150         * #GListModel. It has to be called after the internal representation
151         * of @list has been updated, because handlers connected to this signal
152         * might query the new state of the list.
153         *
154         * Implementations must only make changes to the model (as visible to
155         * its consumer) in places that will not cause problems for that
156         * consumer.  For models that are driven directly by a write API (such
157         * as #GListStore), changes can be reported in response to uses of that
158         * API.  For models that represent remote data, changes should only be
159         * made from a fresh mainloop dispatch.  It is particularly not
160         * permitted to make changes in response to a call to the #GListModel
161         * consumer API.
162         *
163         * Stated another way: in general, it is assumed that code making a
164         * series of accesses to the model via the API, without returning to the
165         * mainloop, and without calling other code, will continue to view the
166         * same contents of the model.
167         *
168         * Params:
169         *     position = the position at which @list changed
170         *     removed = the number of items removed
171         *     added = the number of items added
172         *
173         * Since: 2.44
174         */
175        public void itemsChanged(uint position, uint removed, uint added);
176
177        /**
178         * This signal is emitted whenever items were added or removed to
179         * @list. At @position, @removed items were removed and @added items
180         * were added in their place.
181         *
182         * Params:
183         *     position = the position at which @list changed
184         *     removed = the number of items removed
185         *     added = the number of items added
186         *
187         * Since: 2.44
188         */
189        gulong addOnItemsChanged(void delegate(uint, uint, uint, ListModelIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
190}
Note: See TracBrowser for help on using the repository browser.