1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
5 Widget for packing a list of selectable items.
7 <!-- ##### SECTION Long_Description ##### -->
9 The #GtkList widget is a container whose children are displayed
10 vertically in order, and can be selected.
12 The list has many selection modes, which are programmer selective and
13 depend on how many elements are able to be selected at the same time.
16 GtkList has been deprecated since GTK+ 2.0 and should not be used
17 in newly written code. Use #GtkTreeView instead.
20 <!-- ##### SECTION See_Also ##### -->
24 <term>#GtkContainer</term>
25 <listitem><para>For functions that apply to every #GtkContainer
26 (like #GtkList).</para></listitem>
29 <term>#GtkListitem</term>
30 <listitem><para>Children of a #GtkList widget must be of this
31 type.</para></listitem>
36 <!-- ##### STRUCT GtkList ##### -->
42 <!-- ##### FUNCTION gtk_list_new ##### -->
44 Creates a new #GtkList.
47 @Returns: the newly-created #GtkList
50 <!-- ##### FUNCTION gtk_list_insert_items ##### -->
52 Inserts @items into the @list at the position @position. The #GList items
53 must not be freed after.
56 @list: the list widget.
58 @position: the position to insert @items, starting at 0.
61 <!-- ##### FUNCTION gtk_list_append_items ##### -->
63 Adds @items to the end of the @list.
66 @list: the list widget.
70 <!-- ##### FUNCTION gtk_list_prepend_items ##### -->
72 Inserts @items at the beginning of the @list.
75 @list: the list widget.
79 <!-- ##### FUNCTION gtk_list_remove_items ##### -->
81 Removes the @items from the @list.
84 @list: the list widget.
85 @items: the items to remove.
88 <!-- ##### FUNCTION gtk_list_remove_items_no_unref ##### -->
90 Removes the @items from the @list, without unreferencing them. It
91 may be useful if you want to move the items from one list to another.
94 @list: the list widget.
98 <!-- ##### FUNCTION gtk_list_clear_items ##### -->
100 Removes the items between index @start (included) and @end (excluded)
101 from the @list. If @end is negative, or greater than the number of
102 children of @list, it's assumed to be exactly the number of
103 elements. If @start is greater than or equal to @end, nothing is
107 @list: the list widget.
108 @start: the index of the first item to remove.
109 @end: the index of the lest item to remove plus one.
112 <!-- ##### FUNCTION gtk_list_select_item ##### -->
114 Selects the child number @item of the @list. Nothing happens if @item
115 is out of bounds. The signal GtkList::select-child will be emitted.
118 @list: the list widget.
119 @item: the index of the child to select.
122 <!-- ##### FUNCTION gtk_list_unselect_item ##### -->
124 Unselects the child number @item of the @list. Nothing happens if
125 @item is out of bounds. The signal GtkList::unselect-child will be
129 @list: the list widget.
130 @item: the index of the child to unselect.
133 <!-- ##### FUNCTION gtk_list_select_child ##### -->
135 Selects the given @child. The signal GtkList::select-child will be
139 @list: the list widget
140 @child: the child to select.
143 <!-- ##### FUNCTION gtk_list_unselect_child ##### -->
145 Unselects the given @child. The signal GtkList::unselect-child will be
149 @list: the list widget.
150 @child: the child to unselect.
153 <!-- ##### FUNCTION gtk_list_child_position ##### -->
155 Searches the children of @list for the index of @child.
158 @list: the list widget.
159 @child: the child to look for.
160 @Returns: the index of the child, -1 if not found.
163 <!-- ##### FUNCTION gtk_list_set_selection_mode ##### -->
165 Set the list selection mode. The selection mode can be any value in
169 <term>#GTK_SELECTION_SINGLE</term>
171 Zero or one element may be selected.
176 <term>#GTK_SELECTION_BROWSE</term>
178 Exactly one element is always selected (this can be false after you have
179 changed the selection mode).
184 <term>#GTK_SELECTION_MULTIPLE</term>
186 Any number of elements may be selected. Clicks toggle the state of an
192 <term>#GTK_SELECTION_EXTENDED</term>
194 Any number of elements may be selected. Click-drag selects a range of
195 elements; the Ctrl key may be used to enlarge the selection, and
196 Shift key to select between the focus and the child pointed to.
202 @list: the list widget.
203 @mode: the new selection mode.
206 <!-- ##### FUNCTION gtk_list_extend_selection ##### -->
208 Extends the selection by moving the anchor according to @scroll_type. Only
209 in #GTK_SELECTION_EXTENDED.
212 @list: the list widget.
213 @scroll_type: the direction and length.
214 @position: the position if @scroll_type is #GTK_SCROLL_JUMP.
215 @auto_start_selection: if %TRUE, gtk_list_start_selection() is automatically
216 carried out before extending the selection.
219 <!-- ##### FUNCTION gtk_list_start_selection ##### -->
221 Starts a selection (or part of selection) at the focused child. Only in
222 #GTK_SELECTION_EXTENDED mode.
225 @list: the list widget.
228 <!-- ##### FUNCTION gtk_list_end_selection ##### -->
230 Ends the selection. Used with gtk_list_extend_selection() and
231 gtk_list_start_selection(). Only in #GTK_SELECTION_EXTENDED mode.
234 @list: the list widget.
237 <!-- ##### FUNCTION gtk_list_select_all ##### -->
239 Selects all children of @list. A signal will be emitted for each
240 newly selected child.
243 @list: the list widget.
246 <!-- ##### FUNCTION gtk_list_unselect_all ##### -->
248 Unselects all children of @list. A signal will be emitted for each
249 newly unselected child.
252 @list: the list widget.
255 <!-- ##### FUNCTION gtk_list_scroll_horizontal ##### -->
257 Scrolls @list horizontaly. This supposes that the list is packed into a
258 scrolled window or something similar, and adjustments are well
259 set. Step and page increment are those from the horizontal adjustment
260 of @list. Backward means to the left, and forward to the
261 right. Out of bounds values are truncated.
262 @scroll_type may be any valid #GtkScrollType. If @scroll_type is
263 #GTK_SCROLL_NONE, nothing is done. If it's #GTK_SCROLL_JUMP, the list
264 scrolls to the ratio @position: 0 is full left, 1 is full right.
267 @list: the list widget.
268 @scroll_type: the scrolling type.
269 @position: the position if @scroll_type is #GTK_SCROLL_JUMP
272 <!-- ##### FUNCTION gtk_list_scroll_vertical ##### -->
274 Scrolls @list vertically. This supposes that the list is packed into a
275 scrolled window or something similar, and adjustments are well
276 set. Step and page increment are those from the vertical adjustment
277 of @list. Backward means up, and forward down. Out of bounds values are
279 @scroll_type may be any valid #GtkScrollType. If @scroll_type is
280 #GTK_SCROLL_NONE, nothing is done. If it's #GTK_SCROLL_JUMP, the list
281 scrolls to the ratio @position: 0 is top, 1 is bottom.
284 @list: the list widget.
285 @scroll_type: the scrolling type.
286 @position: the position if @scroll_type is #GTK_SCROLL_JUMP
289 <!-- ##### FUNCTION gtk_list_toggle_add_mode ##### -->
291 Toggles between adding to the selection and beginning a new selection. Only
292 in #GTK_SELECTION_EXTENDED. Useful with gtk_list_extend_selection().
295 @list: the list widget.
298 <!-- ##### FUNCTION gtk_list_toggle_focus_row ##### -->
300 Toggles the focus row. If the focus row is selected, it's
301 unselected. If the focus row is unselected, it's selected. If the
302 selection mode of @list is #GTK_SELECTION_BROWSE, this has no effect,
303 as the selection is always at the focus row.
306 @list: the list widget.
309 <!-- ##### FUNCTION gtk_list_toggle_row ##### -->
311 Toggles the child @item of list. If the selection mode of @list is
312 #GTK_SELECTION_BROWSE, the item is selected, and the others are
316 @list: the list widget.
317 @item: the child to toggle.
320 <!-- ##### FUNCTION gtk_list_undo_selection ##### -->
322 Restores the selection in the last state, only if selection mode is
323 #GTK_SELECTION_EXTENDED. If this function is called twice, the selection is
324 cleared. This function sometimes gives stranges "last states".
327 @list: the list widget.
330 <!-- ##### FUNCTION gtk_list_end_drag_selection ##### -->
332 Stops the drag selection mode and ungrabs the pointer. This has no
333 effect if a drag selection is not active.
336 @list: the list widget.
339 <!-- ##### SIGNAL GtkList::select-child ##### -->
341 The child @widget has just been selected.
344 @list: the object which received the signal.
345 @widget: the newly selected child.
347 <!-- ##### SIGNAL GtkList::selection-changed ##### -->
349 The selection of the widget has just changed.
352 @list: the object which received the signal.
354 <!-- ##### SIGNAL GtkList::unselect-child ##### -->
356 The child @widget has just been unselected.
359 @list: the object which received the signal.
360 @widget: the newly unselected child.
362 <!-- ##### ARG GtkList:selection-mode ##### -->