| 100 }; |
100 }; |
| 101 |
101 |
| 102 G_BEGIN_DECLS |
102 G_BEGIN_DECLS |
| 103 |
103 |
| 104 /** |
104 /** |
| 105 * @return The GType for GntTree |
105 * Returns: The GType for GntTree |
| 106 */ |
106 */ |
| 107 GType gnt_tree_get_gtype(void); |
107 GType gnt_tree_get_gtype(void); |
| 108 |
108 |
| 109 /** |
109 /** |
| 110 * Create a tree with one column. |
110 * Create a tree with one column. |
| 111 * |
111 * |
| 112 * @return The newly created tree |
112 * Returns: The newly created tree |
| 113 * |
113 * |
| 114 * @see gnt_tree_new_with_columns |
114 * @see gnt_tree_new_with_columns |
| 115 */ |
115 */ |
| 116 GntWidget * gnt_tree_new(void); |
116 GntWidget * gnt_tree_new(void); |
| 117 |
117 |
| 118 /** |
118 /** |
| 119 * Create a tree with a specified number of columns. |
119 * Create a tree with a specified number of columns. |
| 120 * |
120 * |
| 121 * @param columns Number of columns |
121 * @columns: Number of columns |
| 122 * |
122 * |
| 123 * @return The newly created tree |
123 * Returns: The newly created tree |
| 124 * |
124 * |
| 125 * @see gnt_tree_new |
125 * @see gnt_tree_new |
| 126 */ |
126 */ |
| 127 GntWidget * gnt_tree_new_with_columns(int columns); |
127 GntWidget * gnt_tree_new_with_columns(int columns); |
| 128 |
128 |
| 129 /** |
129 /** |
| 130 * The number of rows the tree should display at a time. |
130 * The number of rows the tree should display at a time. |
| 131 * |
131 * |
| 132 * @param tree The tree |
132 * @tree: The tree |
| 133 * @param rows The number of rows |
133 * @rows: The number of rows |
| 134 */ |
134 */ |
| 135 void gnt_tree_set_visible_rows(GntTree *tree, int rows); |
135 void gnt_tree_set_visible_rows(GntTree *tree, int rows); |
| 136 |
136 |
| 137 /** |
137 /** |
| 138 * Get the number visible rows. |
138 * Get the number visible rows. |
| 139 * |
139 * |
| 140 * @param tree The tree |
140 * @tree: The tree |
| 141 * |
141 * |
| 142 * @return The number of visible rows |
142 * Returns: The number of visible rows |
| 143 */ |
143 */ |
| 144 int gnt_tree_get_visible_rows(GntTree *tree); |
144 int gnt_tree_get_visible_rows(GntTree *tree); |
| 145 |
145 |
| 146 /** |
146 /** |
| 147 * Scroll the contents of the tree. |
147 * Scroll the contents of the tree. |
| 148 * |
148 * |
| 149 * @param tree The tree |
149 * @tree: The tree |
| 150 * @param count If positive, the tree will be scrolled down by count rows, |
150 * @count: If positive, the tree will be scrolled down by count rows, |
| 151 * otherwise, it will be scrolled up by count rows. |
151 * otherwise, it will be scrolled up by count rows. |
| 152 */ |
152 */ |
| 153 void gnt_tree_scroll(GntTree *tree, int count); |
153 void gnt_tree_scroll(GntTree *tree, int count); |
| 154 |
154 |
| 155 /** |
155 /** |
| 156 * Insert a row in the tree. |
156 * Insert a row in the tree. |
| 157 * |
157 * |
| 158 * @param tree The tree |
158 * @tree: The tree |
| 159 * @param key The key for the row |
159 * @key: The key for the row |
| 160 * @param row The row to insert |
160 * @row: The row to insert |
| 161 * @param parent The key for the parent row |
161 * @parent: The key for the parent row |
| 162 * @param bigbro The key for the row to insert the new row after. |
162 * @bigbro: The key for the row to insert the new row after. |
| 163 * |
163 * |
| 164 * @return The inserted row |
164 * Returns: The inserted row |
| 165 * |
165 * |
| 166 * @see gnt_tree_create_row |
166 * @see gnt_tree_create_row |
| 167 * @see gnt_tree_add_row_last |
167 * @see gnt_tree_add_row_last |
| 168 * @see gnt_tree_add_choice |
168 * @see gnt_tree_add_choice |
| 169 */ |
169 */ |
| 170 GntTreeRow * gnt_tree_add_row_after(GntTree *tree, void *key, GntTreeRow *row, void *parent, void *bigbro); |
170 GntTreeRow * gnt_tree_add_row_after(GntTree *tree, void *key, GntTreeRow *row, void *parent, void *bigbro); |
| 171 |
171 |
| 172 /** |
172 /** |
| 173 * Insert a row at the end of the tree. |
173 * Insert a row at the end of the tree. |
| 174 * |
174 * |
| 175 * @param tree The tree |
175 * @tree: The tree |
| 176 * @param key The key for the row |
176 * @key: The key for the row |
| 177 * @param row The row to insert |
177 * @row: The row to insert |
| 178 * @param parent The key for the parent row |
178 * @parent: The key for the parent row |
| 179 * |
179 * |
| 180 * @return The inserted row |
180 * Returns: The inserted row |
| 181 * |
181 * |
| 182 * @see gnt_tree_create_row |
182 * @see gnt_tree_create_row |
| 183 * @see gnt_tree_add_row_after |
183 * @see gnt_tree_add_row_after |
| 184 * @see gnt_tree_add_choice |
184 * @see gnt_tree_add_choice |
| 185 */ |
185 */ |
| 186 GntTreeRow * gnt_tree_add_row_last(GntTree *tree, void *key, GntTreeRow *row, void *parent); |
186 GntTreeRow * gnt_tree_add_row_last(GntTree *tree, void *key, GntTreeRow *row, void *parent); |
| 187 |
187 |
| 188 /** |
188 /** |
| 189 * Get the key for the selected row. |
189 * Get the key for the selected row. |
| 190 * |
190 * |
| 191 * @param tree The tree |
191 * @tree: The tree |
| 192 * |
192 * |
| 193 * @return The key for the selected row |
193 * Returns: The key for the selected row |
| 194 */ |
194 */ |
| 195 gpointer gnt_tree_get_selection_data(GntTree *tree); |
195 gpointer gnt_tree_get_selection_data(GntTree *tree); |
| 196 |
196 |
| 197 /** |
197 /** |
| 198 * Get the text displayed for the selected row. |
198 * Get the text displayed for the selected row. |
| 199 * |
199 * |
| 200 * @param tree The tree |
200 * @tree: The tree |
| 201 * |
201 * |
| 202 * @return The text, which needs to be freed by the caller |
202 * Returns: The text, which needs to be freed by the caller |
| 203 * @see gnt_tree_get_row_text_list |
203 * @see gnt_tree_get_row_text_list |
| 204 * @see gnt_tree_get_selection_text_list |
204 * @see gnt_tree_get_selection_text_list |
| 205 */ |
205 */ |
| 206 char * gnt_tree_get_selection_text(GntTree *tree); |
206 char * gnt_tree_get_selection_text(GntTree *tree); |
| 207 |
207 |
| 208 /** |
208 /** |
| 209 * Get a list of text for a row. |
209 * Get a list of text for a row. |
| 210 * |
210 * |
| 211 * @param tree The tree |
211 * @tree: The tree |
| 212 * @param key A key corresponding to the row in question. If key |
212 * @key: A key corresponding to the row in question. If key |
| 213 * is @c NULL, the text list for the selected row will |
213 * is @c NULL, the text list for the selected row will |
| 214 * be returned. |
214 * be returned. |
| 215 * |
215 * |
| 216 * @return A list of texts of a row. The list and its data should be |
216 * Returns: A list of texts of a row. The list and its data should be |
| 217 * freed by the caller. The caller should make sure that if |
217 * freed by the caller. The caller should make sure that if |
| 218 * any column of the tree contains binary data, it's not freed. |
218 * any column of the tree contains binary data, it's not freed. |
| 219 * @see gnt_tree_get_selection_text_list |
219 * @see gnt_tree_get_selection_text_list |
| 220 * @see gnt_tree_get_selection_text |
220 * @see gnt_tree_get_selection_text |
| 221 */ |
221 */ |
| 222 GList * gnt_tree_get_row_text_list(GntTree *tree, gpointer key); |
222 GList * gnt_tree_get_row_text_list(GntTree *tree, gpointer key); |
| 223 |
223 |
| 224 /** |
224 /** |
| 225 * Get the key of a row. |
225 * Get the key of a row. |
| 226 * |
226 * |
| 227 * @param tree The tree |
227 * @tree: The tree |
| 228 * @param row The GntTreeRow object |
228 * @row: The GntTreeRow object |
| 229 * |
229 * |
| 230 * @return The key of the row. |
230 * Returns: The key of the row. |
| 231 * @since 2.8.0 (gnt), 2.7.2 (pidgin) |
231 * @since 2.8.0 (gnt), 2.7.2 (pidgin) |
| 232 */ |
232 */ |
| 233 gpointer gnt_tree_row_get_key(GntTree *tree, GntTreeRow *row); |
233 gpointer gnt_tree_row_get_key(GntTree *tree, GntTreeRow *row); |
| 234 |
234 |
| 235 /** |
235 /** |
| 236 * Get the next row. |
236 * Get the next row. |
| 237 * |
237 * |
| 238 * @param tree The tree |
238 * @tree: The tree |
| 239 * @param row The GntTreeRow object |
239 * @row: The GntTreeRow object |
| 240 * |
240 * |
| 241 * @return The next row. |
241 * Returns: The next row. |
| 242 * @since 2.8.0 (gnt), 2.7.2 (pidgin) |
242 * @since 2.8.0 (gnt), 2.7.2 (pidgin) |
| 243 */ |
243 */ |
| 244 GntTreeRow * gnt_tree_row_get_next(GntTree *tree, GntTreeRow *row); |
244 GntTreeRow * gnt_tree_row_get_next(GntTree *tree, GntTreeRow *row); |
| 245 |
245 |
| 246 /** |
246 /** |
| 247 * Get the previous row. |
247 * Get the previous row. |
| 248 * |
248 * |
| 249 * @param tree The tree |
249 * @tree: The tree |
| 250 * @param row The GntTreeRow object |
250 * @row: The GntTreeRow object |
| 251 * |
251 * |
| 252 * @return The previous row. |
252 * Returns: The previous row. |
| 253 * @since 2.8.0 (gnt), 2.7.2 (pidgin) |
253 * @since 2.8.0 (gnt), 2.7.2 (pidgin) |
| 254 */ |
254 */ |
| 255 GntTreeRow * gnt_tree_row_get_prev(GntTree *tree, GntTreeRow *row); |
255 GntTreeRow * gnt_tree_row_get_prev(GntTree *tree, GntTreeRow *row); |
| 256 |
256 |
| 257 /** |
257 /** |
| 258 * Get the child row. |
258 * Get the child row. |
| 259 * |
259 * |
| 260 * @param tree The tree |
260 * @tree: The tree |
| 261 * @param row The GntTreeRow object |
261 * @row: The GntTreeRow object |
| 262 * |
262 * |
| 263 * @return The child row. |
263 * Returns: The child row. |
| 264 * @since 2.8.0 (gnt), 2.7.2 (pidgin) |
264 * @since 2.8.0 (gnt), 2.7.2 (pidgin) |
| 265 */ |
265 */ |
| 266 GntTreeRow * gnt_tree_row_get_child(GntTree *tree, GntTreeRow *row); |
266 GntTreeRow * gnt_tree_row_get_child(GntTree *tree, GntTreeRow *row); |
| 267 |
267 |
| 268 /** |
268 /** |
| 269 * Get the parent row. |
269 * Get the parent row. |
| 270 * |
270 * |
| 271 * @param tree The tree |
271 * @tree: The tree |
| 272 * @param row The GntTreeRow object |
272 * @row: The GntTreeRow object |
| 273 * |
273 * |
| 274 * @return The parent row. |
274 * Returns: The parent row. |
| 275 * @since 2.8.0 (gnt), 2.7.2 (pidgin) |
275 * @since 2.8.0 (gnt), 2.7.2 (pidgin) |
| 276 */ |
276 */ |
| 277 GntTreeRow * gnt_tree_row_get_parent(GntTree *tree, GntTreeRow *row); |
277 GntTreeRow * gnt_tree_row_get_parent(GntTree *tree, GntTreeRow *row); |
| 278 |
278 |
| 279 /** |
279 /** |
| 280 * Get a list of text of the current row. |
280 * Get a list of text of the current row. |
| 281 * |
281 * |
| 282 * @param tree The tree |
282 * @tree: The tree |
| 283 * |
283 * |
| 284 * @return A list of texts of the currently selected row. The list |
284 * Returns: A list of texts of the currently selected row. The list |
| 285 * and its data should be freed by the caller. The caller |
285 * and its data should be freed by the caller. The caller |
| 286 * should make sure that if any column of the tree contains |
286 * should make sure that if any column of the tree contains |
| 287 * binary data, it's not freed. |
287 * binary data, it's not freed. |
| 288 * @see gnt_tree_get_row_text_list |
288 * @see gnt_tree_get_row_text_list |
| 289 * @see gnt_tree_get_selection_text |
289 * @see gnt_tree_get_selection_text |
| 291 GList * gnt_tree_get_selection_text_list(GntTree *tree); |
291 GList * gnt_tree_get_selection_text_list(GntTree *tree); |
| 292 |
292 |
| 293 /** |
293 /** |
| 294 * Returns the list of rows in the tree. |
294 * Returns the list of rows in the tree. |
| 295 * |
295 * |
| 296 * @param tree The tree |
296 * @tree: The tree |
| 297 * |
297 * |
| 298 * @return The list of the rows. The list should not be modified by the caller. |
298 * Returns: The list of the rows. The list should not be modified by the caller. |
| 299 */ |
299 */ |
| 300 GList *gnt_tree_get_rows(GntTree *tree); |
300 GList *gnt_tree_get_rows(GntTree *tree); |
| 301 |
301 |
| 302 /** |
302 /** |
| 303 * Remove a row from the tree. |
303 * Remove a row from the tree. |
| 304 * |
304 * |
| 305 * @param tree The tree |
305 * @tree: The tree |
| 306 * @param key The key for the row to remove |
306 * @key: The key for the row to remove |
| 307 */ |
307 */ |
| 308 void gnt_tree_remove(GntTree *tree, gpointer key); |
308 void gnt_tree_remove(GntTree *tree, gpointer key); |
| 309 |
309 |
| 310 /** |
310 /** |
| 311 * Remove all the item from the tree. |
311 * Remove all the item from the tree. |
| 312 * |
312 * |
| 313 * @param tree The tree |
313 * @tree: The tree |
| 314 */ |
314 */ |
| 315 void gnt_tree_remove_all(GntTree *tree); |
315 void gnt_tree_remove_all(GntTree *tree); |
| 316 |
316 |
| 317 /** |
317 /** |
| 318 * Get the visible line number of the selected row. |
318 * Get the visible line number of the selected row. |
| 319 * |
319 * |
| 320 * @param tree The tree |
320 * @tree: The tree |
| 321 * |
321 * |
| 322 * @return The line number of the currently selected row |
322 * Returns: The line number of the currently selected row |
| 323 */ |
323 */ |
| 324 int gnt_tree_get_selection_visible_line(GntTree *tree); |
324 int gnt_tree_get_selection_visible_line(GntTree *tree); |
| 325 |
325 |
| 326 /** |
326 /** |
| 327 * Change the text of a column in a row. |
327 * Change the text of a column in a row. |
| 328 * |
328 * |
| 329 * @param tree The tree |
329 * @tree: The tree |
| 330 * @param key The key for the row |
330 * @key: The key for the row |
| 331 * @param colno The index of the column |
331 * @colno: The index of the column |
| 332 * @param text The new text |
332 * @text: The new text |
| 333 */ |
333 */ |
| 334 void gnt_tree_change_text(GntTree *tree, gpointer key, int colno, const char *text); |
334 void gnt_tree_change_text(GntTree *tree, gpointer key, int colno, const char *text); |
| 335 |
335 |
| 336 /** |
336 /** |
| 337 * Add a checkable item in the tree. |
337 * Add a checkable item in the tree. |
| 338 * |
338 * |
| 339 * @param tree The tree |
339 * @tree: The tree |
| 340 * @param key The key for the row |
340 * @key: The key for the row |
| 341 * @param row The row to add |
341 * @row: The row to add |
| 342 * @param parent The parent of the row, or @c NULL |
342 * @parent: The parent of the row, or @c NULL |
| 343 * @param bigbro The row to insert after, or @c NULL |
343 * @bigbro: The row to insert after, or @c NULL |
| 344 * |
344 * |
| 345 * @return The row inserted. |
345 * Returns: The row inserted. |
| 346 * |
346 * |
| 347 * @see gnt_tree_create_row |
347 * @see gnt_tree_create_row |
| 348 * @see gnt_tree_create_row_from_list |
348 * @see gnt_tree_create_row_from_list |
| 349 * @see gnt_tree_add_row_last |
349 * @see gnt_tree_add_row_last |
| 350 * @see gnt_tree_add_row_after |
350 * @see gnt_tree_add_row_after |
| 352 GntTreeRow * gnt_tree_add_choice(GntTree *tree, void *key, GntTreeRow *row, void *parent, void *bigbro); |
352 GntTreeRow * gnt_tree_add_choice(GntTree *tree, void *key, GntTreeRow *row, void *parent, void *bigbro); |
| 353 |
353 |
| 354 /** |
354 /** |
| 355 * Set whether a checkable item is checked or not. |
355 * Set whether a checkable item is checked or not. |
| 356 * |
356 * |
| 357 * @param tree The tree |
357 * @tree: The tree |
| 358 * @param key The key for the row |
358 * @key: The key for the row |
| 359 * @param set @c TRUE if the item should be checked, @c FALSE if not |
359 * @set: @c TRUE if the item should be checked, @c FALSE if not |
| 360 */ |
360 */ |
| 361 void gnt_tree_set_choice(GntTree *tree, void *key, gboolean set); |
361 void gnt_tree_set_choice(GntTree *tree, void *key, gboolean set); |
| 362 |
362 |
| 363 /** |
363 /** |
| 364 * Return whether a row is selected or not, where the row is a checkable item. |
364 * Return whether a row is selected or not, where the row is a checkable item. |
| 365 * |
365 * |
| 366 * @param tree The tree |
366 * @tree: The tree |
| 367 * @param key The key for the row |
367 * @key: The key for the row |
| 368 * |
368 * |
| 369 * @return @c TRUE if the row is checked, @c FALSE otherwise. |
369 * Returns: @c TRUE if the row is checked, @c FALSE otherwise. |
| 370 */ |
370 */ |
| 371 gboolean gnt_tree_get_choice(GntTree *tree, void *key); |
371 gboolean gnt_tree_get_choice(GntTree *tree, void *key); |
| 372 |
372 |
| 373 /** |
373 /** |
| 374 * Set flags for the text in a row in the tree. |
374 * Set flags for the text in a row in the tree. |
| 375 * |
375 * |
| 376 * @param tree The tree |
376 * @tree: The tree |
| 377 * @param key The key for the row |
377 * @key: The key for the row |
| 378 * @param flags The flags to set |
378 * @flags: The flags to set |
| 379 */ |
379 */ |
| 380 void gnt_tree_set_row_flags(GntTree *tree, void *key, GntTextFormatFlags flags); |
380 void gnt_tree_set_row_flags(GntTree *tree, void *key, GntTextFormatFlags flags); |
| 381 |
381 |
| 382 /** |
382 /** |
| 383 * Set color for the text in a row in the tree. |
383 * Set color for the text in a row in the tree. |
| 384 * |
384 * |
| 385 * @param tree The tree |
385 * @tree: The tree |
| 386 * @param key The key for the row |
386 * @key: The key for the row |
| 387 * @param color The color |
387 * @color: The color |
| 388 * @since 2.4.0 |
388 * @since 2.4.0 |
| 389 */ |
389 */ |
| 390 void gnt_tree_set_row_color(GntTree *tree, void *key, int color); |
390 void gnt_tree_set_row_color(GntTree *tree, void *key, int color); |
| 391 |
391 |
| 392 /** |
392 /** |
| 393 * Select a row. |
393 * Select a row. |
| 394 * |
394 * |
| 395 * @param tree The tree |
395 * @tree: The tree |
| 396 * @param key The key of the row to select |
396 * @key: The key of the row to select |
| 397 */ |
397 */ |
| 398 void gnt_tree_set_selected(GntTree *tree , void *key); |
398 void gnt_tree_set_selected(GntTree *tree , void *key); |
| 399 |
399 |
| 400 /** |
400 /** |
| 401 * Create a row to insert in the tree. |
401 * Create a row to insert in the tree. |
| 402 * |
402 * |
| 403 * @param tree The tree |
403 * @tree: The tree |
| 404 * @param ... A string for each column in the tree |
404 * @...: A string for each column in the tree |
| 405 * |
405 * |
| 406 * @return The row |
406 * Returns: The row |
| 407 * |
407 * |
| 408 * @see gnt_tree_create_row_from_list |
408 * @see gnt_tree_create_row_from_list |
| 409 * @see gnt_tree_add_row_after |
409 * @see gnt_tree_add_row_after |
| 410 * @see gnt_tree_add_row_last |
410 * @see gnt_tree_add_row_last |
| 411 * @see gnt_tree_add_choice |
411 * @see gnt_tree_add_choice |
| 454 void gnt_tree_set_column_title(GntTree *tree, int index, const char *title); |
454 void gnt_tree_set_column_title(GntTree *tree, int index, const char *title); |
| 455 |
455 |
| 456 /** |
456 /** |
| 457 * Set the titles of the columns |
457 * Set the titles of the columns |
| 458 * |
458 * |
| 459 * @param tree The tree |
459 * @tree: The tree |
| 460 * @param ... One title for each column in the tree |
460 * @...: One title for each column in the tree |
| 461 * |
461 * |
| 462 * @see gnt_tree_set_column_title |
462 * @see gnt_tree_set_column_title |
| 463 * @see gnt_tree_set_show_title |
463 * @see gnt_tree_set_show_title |
| 464 */ |
464 */ |
| 465 void gnt_tree_set_column_titles(GntTree *tree, ...); |
465 void gnt_tree_set_column_titles(GntTree *tree, ...); |
| 466 |
466 |
| 467 /** |
467 /** |
| 468 * Set whether to display the title of the columns. |
468 * Set whether to display the title of the columns. |
| 469 * |
469 * |
| 470 * @param tree The tree |
470 * @tree: The tree |
| 471 * @param set If @c TRUE, the column titles are displayed |
471 * @set: If @c TRUE, the column titles are displayed |
| 472 * |
472 * |
| 473 * @see gnt_tree_set_column_title |
473 * @see gnt_tree_set_column_title |
| 474 * @see gnt_tree_set_column_titles |
474 * @see gnt_tree_set_column_titles |
| 475 */ |
475 */ |
| 476 void gnt_tree_set_show_title(GntTree *tree, gboolean set); |
476 void gnt_tree_set_show_title(GntTree *tree, gboolean set); |
| 477 |
477 |
| 478 /** |
478 /** |
| 479 * Set the compare function for sorting the data. |
479 * Set the compare function for sorting the data. |
| 480 * |
480 * |
| 481 * @param tree The tree |
481 * @tree: The tree |
| 482 * @param func The comparison function, which is used to compare |
482 * @func: The comparison function, which is used to compare |
| 483 * the keys |
483 * the keys |
| 484 * |
484 * |
| 485 * @see gnt_tree_sort_row |
485 * @see gnt_tree_sort_row |
| 486 */ |
486 */ |
| 487 void gnt_tree_set_compare_func(GntTree *tree, GCompareFunc func); |
487 void gnt_tree_set_compare_func(GntTree *tree, GCompareFunc func); |
| 488 |
488 |
| 489 /** |
489 /** |
| 490 * Set whether a row, which has child rows, should be expanded. |
490 * Set whether a row, which has child rows, should be expanded. |
| 491 * |
491 * |
| 492 * @param tree The tree |
492 * @tree: The tree |
| 493 * @param key The key of the row |
493 * @key: The key of the row |
| 494 * @param expanded Whether to expand the child rows |
494 * @expanded: Whether to expand the child rows |
| 495 */ |
495 */ |
| 496 void gnt_tree_set_expanded(GntTree *tree, void *key, gboolean expanded); |
496 void gnt_tree_set_expanded(GntTree *tree, void *key, gboolean expanded); |
| 497 |
497 |
| 498 /** |
498 /** |
| 499 * Set whether to show column separators. |
499 * Set whether to show column separators. |
| 500 * |
500 * |
| 501 * @param tree The tree |
501 * @tree: The tree |
| 502 * @param set If @c TRUE, the column separators are displayed |
502 * @set: If @c TRUE, the column separators are displayed |
| 503 */ |
503 */ |
| 504 void gnt_tree_set_show_separator(GntTree *tree, gboolean set); |
504 void gnt_tree_set_show_separator(GntTree *tree, gboolean set); |
| 505 |
505 |
| 506 /** |
506 /** |
| 507 * Sort a row in the tree. |
507 * Sort a row in the tree. |
| 508 * |
508 * |
| 509 * @param tree The tree |
509 * @tree: The tree |
| 510 * @param row The row to sort |
510 * @row: The row to sort |
| 511 * |
511 * |
| 512 * @see gnt_tree_set_compare_func |
512 * @see gnt_tree_set_compare_func |
| 513 */ |
513 */ |
| 514 void gnt_tree_sort_row(GntTree *tree, void *row); |
514 void gnt_tree_sort_row(GntTree *tree, void *row); |
| 515 |
515 |
| 516 /** |
516 /** |
| 517 * Automatically adjust the width of the columns in the tree. |
517 * Automatically adjust the width of the columns in the tree. |
| 518 * |
518 * |
| 519 * @param tree The tree |
519 * @tree: The tree |
| 520 */ |
520 */ |
| 521 void gnt_tree_adjust_columns(GntTree *tree); |
521 void gnt_tree_adjust_columns(GntTree *tree); |
| 522 |
522 |
| 523 /** |
523 /** |
| 524 * Set the hash functions to use to hash, compare and free the keys. |
524 * Set the hash functions to use to hash, compare and free the keys. |
| 525 * |
525 * |
| 526 * @param tree The tree |
526 * @tree: The tree |
| 527 * @param hash The hashing function |
527 * @hash: The hashing function |
| 528 * @param eq The function to compare keys |
528 * @eq: The function to compare keys |
| 529 * @param kd The function to use to free the keys when a row is removed |
529 * @kd: The function to use to free the keys when a row is removed |
| 530 * from the tree |
530 * from the tree |
| 531 */ |
531 */ |
| 532 void gnt_tree_set_hash_fns(GntTree *tree, gpointer hash, gpointer eq, gpointer kd); |
532 void gnt_tree_set_hash_fns(GntTree *tree, gpointer hash, gpointer eq, gpointer kd); |
| 533 |
533 |
| 534 /** |
534 /** |
| 535 * Set whether a column is visible or not. |
535 * Set whether a column is visible or not. |
| 536 * This can be useful when, for example, we want to store some data |
536 * This can be useful when, for example, we want to store some data |
| 537 * which we don't want/need to display. |
537 * which we don't want/need to display. |
| 538 * |
538 * |
| 539 * @param tree The tree |
539 * @tree: The tree |
| 540 * @param col The index of the column |
540 * @col: The index of the column |
| 541 * @param vis If @c FALSE, the column will not be displayed |
541 * @vis: If @c FALSE, the column will not be displayed |
| 542 */ |
542 */ |
| 543 void gnt_tree_set_column_visible(GntTree *tree, int col, gboolean vis); |
543 void gnt_tree_set_column_visible(GntTree *tree, int col, gboolean vis); |
| 544 |
544 |
| 545 /** |
545 /** |
| 546 * Set whether a column can be resized to keep the same ratio when the |
546 * Set whether a column can be resized to keep the same ratio when the |
| 547 * tree is resized. |
547 * tree is resized. |
| 548 * |
548 * |
| 549 * @param tree The tree |
549 * @tree: The tree |
| 550 * @param col The index of the column |
550 * @col: The index of the column |
| 551 * @param res If @c FALSE, the column will not be resized when the |
551 * @res: If @c FALSE, the column will not be resized when the |
| 552 * tree is resized |
552 * tree is resized |
| 553 * |
553 * |
| 554 * @see gnt_tree_set_col_width |
554 * @see gnt_tree_set_col_width |
| 555 * @see gnt_tree_set_column_width_ratio |
555 * @see gnt_tree_set_column_width_ratio |
| 556 * |
556 * |
| 560 |
560 |
| 561 /** |
561 /** |
| 562 * Set whether data in a column should be considered as binary data, and |
562 * Set whether data in a column should be considered as binary data, and |
| 563 * not as strings. A column containing binary data will be display empty text. |
563 * not as strings. A column containing binary data will be display empty text. |
| 564 * |
564 * |
| 565 * @param tree The tree |
565 * @tree: The tree |
| 566 * @param col The index of the column |
566 * @col: The index of the column |
| 567 * @param bin @c TRUE if the data for the column is binary |
567 * @bin: @c TRUE if the data for the column is binary |
| 568 */ |
568 */ |
| 569 void gnt_tree_set_column_is_binary(GntTree *tree, int col, gboolean bin); |
569 void gnt_tree_set_column_is_binary(GntTree *tree, int col, gboolean bin); |
| 570 |
570 |
| 571 /** |
571 /** |
| 572 * Set whether text in a column should be right-aligned. |
572 * Set whether text in a column should be right-aligned. |
| 573 * |
573 * |
| 574 * @param tree The tree |
574 * @tree: The tree |
| 575 * @param col The index of the column |
575 * @col: The index of the column |
| 576 * @param right @c TRUE if the text in the column should be right aligned |
576 * @right: @c TRUE if the text in the column should be right aligned |
| 577 * |
577 * |
| 578 * @since 2.0.0 (gnt), 2.1.0 (pidgin) |
578 * @since 2.0.0 (gnt), 2.1.0 (pidgin) |
| 579 */ |
579 */ |
| 580 void gnt_tree_set_column_is_right_aligned(GntTree *tree, int col, gboolean right); |
580 void gnt_tree_set_column_is_right_aligned(GntTree *tree, int col, gboolean right); |
| 581 |
581 |
| 582 /** |
582 /** |
| 583 * Set column widths to use when calculating column widths after a tree |
583 * Set column widths to use when calculating column widths after a tree |
| 584 * is resized. |
584 * is resized. |
| 585 * |
585 * |
| 586 * @param tree The tree |
586 * @tree: The tree |
| 587 * @param cols Array of widths. The width must have the same number |
587 * @cols: Array of widths. The width must have the same number |
| 588 * of entries as the number of columns in the tree, or |
588 * of entries as the number of columns in the tree, or |
| 589 * end with a negative value for a column-width. |
589 * end with a negative value for a column-width. |
| 590 * |
590 * |
| 591 * @see gnt_tree_set_col_width |
591 * @see gnt_tree_set_col_width |
| 592 * @see gnt_tree_set_column_resizable |
592 * @see gnt_tree_set_column_resizable |
| 596 void gnt_tree_set_column_width_ratio(GntTree *tree, int cols[]); |
596 void gnt_tree_set_column_width_ratio(GntTree *tree, int cols[]); |
| 597 |
597 |
| 598 /** |
598 /** |
| 599 * Set the column to use for typeahead searching. |
599 * Set the column to use for typeahead searching. |
| 600 * |
600 * |
| 601 * @param tree The tree |
601 * @tree: The tree |
| 602 * @param col The index of the column |
602 * @col: The index of the column |
| 603 * |
603 * |
| 604 * @since 2.0.0 (gnt), 2.1.0 (pidgin) |
604 * @since 2.0.0 (gnt), 2.1.0 (pidgin) |
| 605 */ |
605 */ |
| 606 void gnt_tree_set_search_column(GntTree *tree, int col); |
606 void gnt_tree_set_search_column(GntTree *tree, int col); |
| 607 |
607 |
| 608 /** |
608 /** |
| 609 * Check whether the user is currently in the middle of a search. |
609 * Check whether the user is currently in the middle of a search. |
| 610 * |
610 * |
| 611 * @param tree The tree |
611 * @tree: The tree |
| 612 * @return @c TRUE if the user is searching, @c FALSE otherwise. |
612 * Returns: @c TRUE if the user is searching, @c FALSE otherwise. |
| 613 * |
613 * |
| 614 * @since 2.0.0 (gnt), 2.1.0 (pidgin) |
614 * @since 2.0.0 (gnt), 2.1.0 (pidgin) |
| 615 */ |
615 */ |
| 616 gboolean gnt_tree_is_searching(GntTree *tree); |
616 gboolean gnt_tree_is_searching(GntTree *tree); |
| 617 |
617 |
| 618 /** |
618 /** |
| 619 * Set a custom search function. |
619 * Set a custom search function. |
| 620 * |
620 * |
| 621 * @param tree The tree |
621 * @tree: The tree |
| 622 * @param func The custom search function. The search function is |
622 * @func: The custom search function. The search function is |
| 623 * sent the tree itself, the key of a row, the search |
623 * sent the tree itself, the key of a row, the search |
| 624 * string and the content of row in the search column. |
624 * string and the content of row in the search column. |
| 625 * If the function returns @c TRUE, the row is dislayed, |
625 * If the function returns @c TRUE, the row is dislayed, |
| 626 * otherwise it's not. |
626 * otherwise it's not. |
| 627 * |
627 * |