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 <!-- ##### SECTION See_Also ##### -->
20 <term>#GtkContainer</term>
21 <listitem><para>For functions that apply to every #GtkContainer
22 (like #GtkList).</para></listitem>
25 <term>#GtkListitem</term>
26 <listitem><para>Children of a #GtkList widget must be of this
27 type.</para></listitem>
32 <!-- ##### STRUCT GtkList ##### -->
38 <!-- ##### FUNCTION gtk_list_new ##### -->
40 Creates a new #GtkList.
43 @Returns: the newly-created #GtkList
46 <!-- ##### FUNCTION gtk_list_insert_items ##### -->
48 Inserts @items into the @list at the position @position. The #GList items
49 must not be freed after.
52 @list: the list widget.
54 @position: the position to insert @items, starting at 0.
57 <!-- ##### FUNCTION gtk_list_append_items ##### -->
59 Adds @items to the end of the @list.
62 @list: the list widget.
66 <!-- ##### FUNCTION gtk_list_prepend_items ##### -->
68 Inserts @items at the beginning of the @list.
71 @list: the list widget.
75 <!-- ##### FUNCTION gtk_list_remove_items ##### -->
77 Removes the @items from the @list.
80 @list: the list widget.
81 @items: the items to remove.
84 <!-- ##### FUNCTION gtk_list_remove_items_no_unref ##### -->
86 Removes the @items from the @list, without unreferencing them. It
87 may be useful if you want to move the items from one list to another.
90 @list: the list widget.
94 <!-- ##### FUNCTION gtk_list_clear_items ##### -->
96 Removes the items between index @start (included) and @end (excluded)
97 from the @list. If @end is negative, or greater than the number of
98 children of @list, it's assumed to be exactly the number of
99 elements. If @start is greater than or equal to @end, nothing is
103 @list: the list widget.
104 @start: the index of the first item to remove.
105 @end: the index of the lest item to remove plus one.
108 <!-- ##### FUNCTION gtk_list_select_item ##### -->
110 Selects the child number @item of the @list. Nothing happens if @item
111 is out of bounds. The signal GtkList::select-child will be emitted.
114 @list: the list widget.
115 @item: the index of the child to select.
118 <!-- ##### FUNCTION gtk_list_unselect_item ##### -->
120 Unselects the child number @item of the @list. Nothing happens if
121 @item is out of bounds. The signal GtkList::unselect-child will be
125 @list: the list widget.
126 @item: the index of the child to unselect.
129 <!-- ##### FUNCTION gtk_list_select_child ##### -->
131 Selects the given @child. The signal GtkList::select-child will be
135 @list: the list widget
136 @child: the child to select.
139 <!-- ##### FUNCTION gtk_list_unselect_child ##### -->
141 Unselects the given @child. The signal GtkList::unselect-child will be
145 @list: the list widget.
146 @child: the child to unselect.
149 <!-- ##### FUNCTION gtk_list_child_position ##### -->
151 Searches the children of @list for the index of @child.
154 @list: the list widget.
155 @child: the child to look for.
156 @Returns: the index of the child, -1 if not found.
159 <!-- ##### FUNCTION gtk_list_set_selection_mode ##### -->
161 Set the list selection mode. The selection mode can be any value in
165 <term>#GTK_SELECTION_SINGLE</term>
167 Zero or one element may be selected.
172 <term>#GTK_SELECTION_BROWSE</term>
174 Exactly one element is always selected (this can be false after you have
175 changed the selection mode).
180 <term>#GTK_SELECTION_MULTIPLE</term>
182 Any number of elements may be selected. Clicks toggle the state of an
188 <term>#GTK_SELECTION_EXTENDED</term>
190 Any number of elements may be selected. Click-drag selects a range of
191 elements; the Ctrl key may be used to enlarge the selection, and
192 Shift key to select between the focus and the child pointed to.
198 @list: the list widget.
199 @mode: the new selection mode.
202 <!-- ##### FUNCTION gtk_list_extend_selection ##### -->
204 Extends the selection by moving the anchor according to @scroll_type. Only
205 in #GTK_SELECTION_EXTENDED.
208 @list: the list widget.
209 @scroll_type: the direction and length.
210 @position: the position if @scroll_type is #GTK_SCROLL_JUMP.
211 @auto_start_selection: if %TRUE, gtk_list_start_selection() is automatically
212 carried out before extending the selection.
215 <!-- ##### FUNCTION gtk_list_start_selection ##### -->
217 Starts a selection (or part of selection) at the focused child. Only in
218 #GTK_SELECTION_EXTENDED mode.
221 @list: the list widget.
224 <!-- ##### FUNCTION gtk_list_end_selection ##### -->
226 Ends the selection. Used with gtk_list_extend_selection() and
227 gtk_list_start_selection(). Only in #GTK_SELECTION_EXTENDED mode.
230 @list: the list widget.
233 <!-- ##### FUNCTION gtk_list_select_all ##### -->
235 Selects all children of @list. A signal will be emitted for each
236 newly selected child.
239 @list: the list widget.
242 <!-- ##### FUNCTION gtk_list_unselect_all ##### -->
244 Unselects all children of @list. A signal will be emitted for each
245 newly unselected child.
248 @list: the list widget.
251 <!-- ##### FUNCTION gtk_list_scroll_horizontal ##### -->
253 Scrolls @list horizontaly. This supposes that the list is packed into a
254 scrolled window or something similar, and adjustments are well
255 set. Step and page increment are those from the horizontal adjustment
256 of @list. Backward means to the left, and forward to the
257 right. Out of bounds values are truncated.
258 @scroll_type may be any valid #GtkScrollType. If @scroll_type is
259 #GTK_SCROLL_NONE, nothing is done. If it's #GTK_SCROLL_JUMP, the list
260 scrolls to the ratio @position: 0 is full left, 1 is full right.
263 @list: the list widget.
264 @scroll_type: the scrolling type.
265 @position: the position if @scroll_type is #GTK_SCROLL_JUMP
268 <!-- ##### FUNCTION gtk_list_scroll_vertical ##### -->
270 Scrolls @list vertically. This supposes that the list is packed into a
271 scrolled window or something similar, and adjustments are well
272 set. Step and page increment are those from the vertical adjustment
273 of @list. Backward means up, and forward down. Out of bounds values are
275 @scroll_type may be any valid #GtkScrollType. If @scroll_type is
276 #GTK_SCROLL_NONE, nothing is done. If it's #GTK_SCROLL_JUMP, the list
277 scrolls to the ratio @position: 0 is top, 1 is bottom.
280 @list: the list widget.
281 @scroll_type: the scrolling type.
282 @position: the position if @scroll_type is #GTK_SCROLL_JUMP
285 <!-- ##### FUNCTION gtk_list_toggle_add_mode ##### -->
287 Toggles between adding to the selection and beginning a new selection. Only
288 in #GTK_SELECTION_EXTENDED. Useful with gtk_list_extend_selection().
291 @list: the list widget.
294 <!-- ##### FUNCTION gtk_list_toggle_focus_row ##### -->
296 Toggles the focus row. If the focus row is selected, it's
297 unselected. If the focus row is unselected, it's selected. If the
298 selection mode of @list is #GTK_SELECTION_BROWSE, this has no effect,
299 as the selection is always at the focus row.
302 @list: the list widget.
305 <!-- ##### FUNCTION gtk_list_toggle_row ##### -->
307 Toggles the child @item of list. If the selection mode of @list is
308 #GTK_SELECTION_BROWSE, the item is selected, and the others are
312 @list: the list widget.
313 @item: the child to toggle.
316 <!-- ##### FUNCTION gtk_list_undo_selection ##### -->
318 Restores the selection in the last state, only if selection mode is
319 #GTK_SELECTION_EXTENDED. If this function is called twice, the selection is
320 cleared. This function sometimes gives stranges "last states".
323 @list: the list widget.
326 <!-- ##### FUNCTION gtk_list_end_drag_selection ##### -->
328 Stops the drag selection mode and ungrabs the pointer. This has no
329 effect if a drag selection is not active.
332 @list: the list widget.
335 <!-- ##### SIGNAL GtkList::select-child ##### -->
337 The child @widget has just been selected.
340 @list: the object which received the signal.
341 @widget: the newly selected child.
343 <!-- ##### SIGNAL GtkList::selection-changed ##### -->
345 The selection of the widget has just changed.
348 @list: the object which received the signal.
350 <!-- ##### SIGNAL GtkList::unselect-child ##### -->
352 The child @widget has just been unselected.
355 @list: the object which received the signal.
356 @widget: the newly unselected child.
358 <!-- ##### ARG GtkList:selection-mode ##### -->