1 | /* GTK - The GIMP Toolkit |
2 | * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball, Josh MacDonald |
3 | * Copyright (C) 1997-1998 Jay Painter <[email protected]><[email protected]> |
4 | * |
5 | * This library is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU Lesser General Public |
7 | * License as published by the Free Software Foundation; either |
8 | * version 2 of the License, or (at your option) any later version. |
9 | * |
10 | * This library is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | * Lesser General Public License for more details. |
14 | * |
15 | * You should have received a copy of the GNU Lesser General Public |
16 | * License along with this library; if not, write to the |
17 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | * Boston, MA 02111-1307, USA. |
19 | */ |
20 | |
21 | /* |
22 | * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS |
23 | * file for a list of people on the GTK+ Team. See the ChangeLog |
24 | * files for a list of changes. These files are distributed with |
25 | * GTK+ at ftp://ftp.gtk.org/pub/gtk/. |
26 | */ |
27 | |
28 | #if !defined (GTK_DISABLE_DEPRECATED) || defined (__GTK_CLIST_C__) || defined (__GTK_CTREE_C__) |
29 | |
30 | #ifndef __GTK_CLIST_H__ |
31 | #define __GTK_CLIST_H__ |
32 | |
33 | |
34 | #include <gtk/gtksignal.h> |
35 | #include <gtk/gtkalignment.h> |
36 | #include <gtk/gtklabel.h> |
37 | #include <gtk/gtkbutton.h> |
38 | #include <gtk/gtkhscrollbar.h> |
39 | #include <gtk/gtkvscrollbar.h> |
40 | |
41 | |
42 | G_BEGIN_DECLS |
43 | |
44 | |
45 | /* clist flags */ |
46 | enum { |
47 | GTK_CLIST_IN_DRAG = 1 << 0, |
48 | GTK_CLIST_ROW_HEIGHT_SET = 1 << 1, |
49 | GTK_CLIST_SHOW_TITLES = 1 << 2, |
50 | /* Unused */ |
51 | GTK_CLIST_ADD_MODE = 1 << 4, |
52 | GTK_CLIST_AUTO_SORT = 1 << 5, |
53 | GTK_CLIST_AUTO_RESIZE_BLOCKED = 1 << 6, |
54 | GTK_CLIST_REORDERABLE = 1 << 7, |
55 | GTK_CLIST_USE_DRAG_ICONS = 1 << 8, |
56 | GTK_CLIST_DRAW_DRAG_LINE = 1 << 9, |
57 | GTK_CLIST_DRAW_DRAG_RECT = 1 << 10 |
58 | }; |
59 | |
60 | /* cell types */ |
61 | typedef enum |
62 | { |
63 | GTK_CELL_EMPTY, |
64 | GTK_CELL_TEXT, |
65 | GTK_CELL_PIXMAP, |
66 | GTK_CELL_PIXTEXT, |
67 | GTK_CELL_WIDGET |
68 | } GtkCellType; |
69 | |
70 | typedef enum |
71 | { |
72 | GTK_CLIST_DRAG_NONE, |
73 | GTK_CLIST_DRAG_BEFORE, |
74 | GTK_CLIST_DRAG_INTO, |
75 | GTK_CLIST_DRAG_AFTER |
76 | } GtkCListDragPos; |
77 | |
78 | typedef enum |
79 | { |
80 | GTK_BUTTON_IGNORED = 0, |
81 | GTK_BUTTON_SELECTS = 1 << 0, |
82 | GTK_BUTTON_DRAGS = 1 << 1, |
83 | GTK_BUTTON_EXPANDS = 1 << 2 |
84 | } GtkButtonAction; |
85 | |
86 | #define GTK_TYPE_CLIST (gtk_clist_get_type ()) |
87 | #define GTK_CLIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CLIST, GtkCList)) |
88 | #define GTK_CLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CLIST, GtkCListClass)) |
89 | #define GTK_IS_CLIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CLIST)) |
90 | #define GTK_IS_CLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CLIST)) |
91 | #define GTK_CLIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CLIST, GtkCListClass)) |
92 | |
93 | |
94 | #define GTK_CLIST_FLAGS(clist) (GTK_CLIST (clist)->flags) |
95 | #define GTK_CLIST_SET_FLAG(clist,flag) (GTK_CLIST_FLAGS (clist) |= (GTK_ ## flag)) |
96 | #define GTK_CLIST_UNSET_FLAG(clist,flag) (GTK_CLIST_FLAGS (clist) &= ~(GTK_ ## flag)) |
97 | |
98 | #define GTK_CLIST_IN_DRAG(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_IN_DRAG) |
99 | #define GTK_CLIST_ROW_HEIGHT_SET(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_ROW_HEIGHT_SET) |
100 | #define GTK_CLIST_SHOW_TITLES(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_SHOW_TITLES) |
101 | #define GTK_CLIST_ADD_MODE(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_ADD_MODE) |
102 | #define GTK_CLIST_AUTO_SORT(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_AUTO_SORT) |
103 | #define GTK_CLIST_AUTO_RESIZE_BLOCKED(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_AUTO_RESIZE_BLOCKED) |
104 | #define GTK_CLIST_REORDERABLE(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_REORDERABLE) |
105 | #define GTK_CLIST_USE_DRAG_ICONS(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_USE_DRAG_ICONS) |
106 | #define GTK_CLIST_DRAW_DRAG_LINE(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_DRAW_DRAG_LINE) |
107 | #define GTK_CLIST_DRAW_DRAG_RECT(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_DRAW_DRAG_RECT) |
108 | |
109 | #define GTK_CLIST_ROW(_glist_) ((GtkCListRow *)((_glist_)->data)) |
110 | |
111 | /* pointer casting for cells */ |
112 | #define GTK_CELL_TEXT(cell) (((GtkCellText *) &(cell))) |
113 | #define GTK_CELL_PIXMAP(cell) (((GtkCellPixmap *) &(cell))) |
114 | #define GTK_CELL_PIXTEXT(cell) (((GtkCellPixText *) &(cell))) |
115 | #define GTK_CELL_WIDGET(cell) (((GtkCellWidget *) &(cell))) |
116 | |
117 | typedef struct _GtkCList GtkCList; |
118 | typedef struct _GtkCListClass GtkCListClass; |
119 | typedef struct _GtkCListColumn GtkCListColumn; |
120 | typedef struct _GtkCListRow GtkCListRow; |
121 | |
122 | typedef struct _GtkCell GtkCell; |
123 | typedef struct _GtkCellText GtkCellText; |
124 | typedef struct _GtkCellPixmap GtkCellPixmap; |
125 | typedef struct _GtkCellPixText GtkCellPixText; |
126 | typedef struct _GtkCellWidget GtkCellWidget; |
127 | |
128 | typedef gint (*GtkCListCompareFunc) (GtkCList *clist, |
129 | gconstpointer ptr1, |
130 | gconstpointer ptr2); |
131 | |
132 | typedef struct _GtkCListCellInfo GtkCListCellInfo; |
133 | typedef struct _GtkCListDestInfo GtkCListDestInfo; |
134 | |
135 | struct _GtkCListCellInfo |
136 | { |
137 | gint row; |
138 | gint column; |
139 | }; |
140 | |
141 | struct _GtkCListDestInfo |
142 | { |
143 | GtkCListCellInfo cell; |
144 | GtkCListDragPos insert_pos; |
145 | }; |
146 | |
147 | struct _GtkCList |
148 | { |
149 | GtkContainer container; |
150 | |
151 | guint16 flags; |
152 | |
153 | gpointer reserved1; |
154 | gpointer reserved2; |
155 | |
156 | guint freeze_count; |
157 | |
158 | /* allocation rectangle after the container_border_width |
159 | * and the width of the shadow border */ |
160 | GdkRectangle internal_allocation; |
161 | |
162 | /* rows */ |
163 | gint rows; |
164 | gint row_height; |
165 | GList *row_list; |
166 | GList *row_list_end; |
167 | |
168 | /* columns */ |
169 | gint columns; |
170 | GdkRectangle column_title_area; |
171 | GdkWindow *title_window; |
172 | |
173 | /* dynamicly allocated array of column structures */ |
174 | GtkCListColumn *column; |
175 | |
176 | /* the scrolling window and its height and width to |
177 | * make things a little speedier */ |
178 | GdkWindow *clist_window; |
179 | gint clist_window_width; |
180 | gint clist_window_height; |
181 | |
182 | /* offsets for scrolling */ |
183 | gint hoffset; |
184 | gint voffset; |
185 | |
186 | /* border shadow style */ |
187 | GtkShadowType shadow_type; |
188 | |
189 | /* the list's selection mode (gtkenums.h) */ |
190 | GtkSelectionMode selection_mode; |
191 | |
192 | /* list of selected rows */ |
193 | GList *selection; |
194 | GList *selection_end; |
195 | |
196 | GList *undo_selection; |
197 | GList *undo_unselection; |
198 | gint undo_anchor; |
199 | |
200 | /* mouse buttons */ |
201 | guint8 button_actions[5]; |
202 | |
203 | guint8 drag_button; |
204 | |
205 | /* dnd */ |
206 | GtkCListCellInfo click_cell; |
207 | |
208 | /* scroll adjustments */ |
209 | GtkAdjustment *hadjustment; |
210 | GtkAdjustment *vadjustment; |
211 | |
212 | /* xor GC for the vertical drag line */ |
213 | GdkGC *xor_gc; |
214 | |
215 | /* gc for drawing unselected cells */ |
216 | GdkGC *fg_gc; |
217 | GdkGC *bg_gc; |
218 | |
219 | /* cursor used to indicate dragging */ |
220 | GdkCursor *cursor_drag; |
221 | |
222 | /* the current x-pixel location of the xor-drag line */ |
223 | gint x_drag; |
224 | |
225 | /* focus handling */ |
226 | gint focus_row; |
227 | |
228 | gint focus_header_column; |
229 | |
230 | /* dragging the selection */ |
231 | gint anchor; |
232 | GtkStateType anchor_state; |
233 | gint drag_pos; |
234 | gint htimer; |
235 | gint vtimer; |
236 | |
237 | GtkSortType sort_type; |
238 | GtkCListCompareFunc compare; |
239 | gint sort_column; |
240 | |
241 | gint drag_highlight_row; |
242 | GtkCListDragPos drag_highlight_pos; |
243 | }; |
244 | |
245 | struct _GtkCListClass |
246 | { |
247 | GtkContainerClass parent_class; |
248 | |
249 | void (*set_scroll_adjustments) (GtkCList *clist, |
250 | GtkAdjustment *hadjustment, |
251 | GtkAdjustment *vadjustment); |
252 | void (*refresh) (GtkCList *clist); |
253 | void (*select_row) (GtkCList *clist, |
254 | gint row, |
255 | gint column, |
256 | GdkEvent *event); |
257 | void (*unselect_row) (GtkCList *clist, |
258 | gint row, |
259 | gint column, |
260 | GdkEvent *event); |
261 | void (*row_move) (GtkCList *clist, |
262 | gint source_row, |
263 | gint dest_row); |
264 | void (*click_column) (GtkCList *clist, |
265 | gint column); |
266 | void (*resize_column) (GtkCList *clist, |
267 | gint column, |
268 | gint width); |
269 | void (*toggle_focus_row) (GtkCList *clist); |
270 | void (*select_all) (GtkCList *clist); |
271 | void (*unselect_all) (GtkCList *clist); |
272 | void (*undo_selection) (GtkCList *clist); |
273 | void (*start_selection) (GtkCList *clist); |
274 | void (*end_selection) (GtkCList *clist); |
275 | void (*extend_selection) (GtkCList *clist, |
276 | GtkScrollType scroll_type, |
277 | gfloat position, |
278 | gboolean auto_start_selection); |
279 | void (*scroll_horizontal) (GtkCList *clist, |
280 | GtkScrollType scroll_type, |
281 | gfloat position); |
282 | void (*scroll_vertical) (GtkCList *clist, |
283 | GtkScrollType scroll_type, |
284 | gfloat position); |
285 | void (*toggle_add_mode) (GtkCList *clist); |
286 | void (*abort_column_resize) (GtkCList *clist); |
287 | void (*resync_selection) (GtkCList *clist, |
288 | GdkEvent *event); |
289 | GList* (*selection_find) (GtkCList *clist, |
290 | gint row_number, |
291 | GList *row_list_element); |
292 | void (*draw_row) (GtkCList *clist, |
293 | GdkRectangle *area, |
294 | gint row, |
295 | GtkCListRow *clist_row); |
296 | void (*draw_drag_highlight) (GtkCList *clist, |
297 | GtkCListRow *target_row, |
298 | gint target_row_number, |
299 | GtkCListDragPos drag_pos); |
300 | void (*clear) (GtkCList *clist); |
301 | void (*fake_unselect_all) (GtkCList *clist, |
302 | gint row); |
303 | void (*sort_list) (GtkCList *clist); |
304 | gint (*insert_row) (GtkCList *clist, |
305 | gint row, |
306 | gchar *text[]); |
307 | void (*remove_row) (GtkCList *clist, |
308 | gint row); |
309 | void (*set_cell_contents) (GtkCList *clist, |
310 | GtkCListRow *clist_row, |
311 | gint column, |
312 | GtkCellType type, |
313 | const gchar *text, |
314 | guint8 spacing, |
315 | GdkPixmap *pixmap, |
316 | GdkBitmap *mask); |
317 | void (*cell_size_request) (GtkCList *clist, |
318 | GtkCListRow *clist_row, |
319 | gint column, |
320 | GtkRequisition *requisition); |
321 | |
322 | }; |
323 | |
324 | struct _GtkCListColumn |
325 | { |
326 | gchar *title; |
327 | GdkRectangle area; |
328 | |
329 | GtkWidget *button; |
330 | GdkWindow *window; |
331 | |
332 | gint width; |
333 | gint min_width; |
334 | gint max_width; |
335 | GtkJustification justification; |
336 | |
337 | guint visible : 1; |
338 | guint width_set : 1; |
339 | guint resizeable : 1; |
340 | guint auto_resize : 1; |
341 | guint button_passive : 1; |
342 | }; |
343 | |
344 | struct _GtkCListRow |
345 | { |
346 | GtkCell *cell; |
347 | GtkStateType state; |
348 | |
349 | GdkColor foreground; |
350 | GdkColor background; |
351 | |
352 | GtkStyle *style; |
353 | |
354 | gpointer data; |
355 | GDestroyNotify destroy; |
356 | |
357 | guint fg_set : 1; |
358 | guint bg_set : 1; |
359 | guint selectable : 1; |
360 | }; |
361 | |
362 | /* Cell Structures */ |
363 | struct _GtkCellText |
364 | { |
365 | GtkCellType type; |
366 | |
367 | gint16 vertical; |
368 | gint16 horizontal; |
369 | |
370 | GtkStyle *style; |
371 | |
372 | gchar *text; |
373 | }; |
374 | |
375 | struct _GtkCellPixmap |
376 | { |
377 | GtkCellType type; |
378 | |
379 | gint16 vertical; |
380 | gint16 horizontal; |
381 | |
382 | GtkStyle *style; |
383 | |
384 | GdkPixmap *pixmap; |
385 | GdkBitmap *mask; |
386 | }; |
387 | |
388 | struct _GtkCellPixText |
389 | { |
390 | GtkCellType type; |
391 | |
392 | gint16 vertical; |
393 | gint16 horizontal; |
394 | |
395 | GtkStyle *style; |
396 | |
397 | gchar *text; |
398 | guint8 spacing; |
399 | GdkPixmap *pixmap; |
400 | GdkBitmap *mask; |
401 | }; |
402 | |
403 | struct _GtkCellWidget |
404 | { |
405 | GtkCellType type; |
406 | |
407 | gint16 vertical; |
408 | gint16 horizontal; |
409 | |
410 | GtkStyle *style; |
411 | |
412 | GtkWidget *widget; |
413 | }; |
414 | |
415 | struct _GtkCell |
416 | { |
417 | GtkCellType type; |
418 | |
419 | gint16 vertical; |
420 | gint16 horizontal; |
421 | |
422 | GtkStyle *style; |
423 | |
424 | union { |
425 | gchar *text; |
426 | |
427 | struct { |
428 | GdkPixmap *pixmap; |
429 | GdkBitmap *mask; |
430 | } pm; |
431 | |
432 | struct { |
433 | gchar *text; |
434 | guint8 spacing; |
435 | GdkPixmap *pixmap; |
436 | GdkBitmap *mask; |
437 | } pt; |
438 | |
439 | GtkWidget *widget; |
440 | } u; |
441 | }; |
442 | |
443 | GType gtk_clist_get_type (void) G_GNUC_CONST; |
444 | |
445 | /* create a new GtkCList */ |
446 | GtkWidget* gtk_clist_new (gint columns); |
447 | GtkWidget* gtk_clist_new_with_titles (gint columns, |
448 | gchar *titles[]); |
449 | |
450 | /* set adjustments of clist */ |
451 | void gtk_clist_set_hadjustment (GtkCList *clist, |
452 | GtkAdjustment *adjustment); |
453 | void gtk_clist_set_vadjustment (GtkCList *clist, |
454 | GtkAdjustment *adjustment); |
455 | |
456 | /* get adjustments of clist */ |
457 | GtkAdjustment* gtk_clist_get_hadjustment (GtkCList *clist); |
458 | GtkAdjustment* gtk_clist_get_vadjustment (GtkCList *clist); |
459 | |
460 | /* set the border style of the clist */ |
461 | void gtk_clist_set_shadow_type (GtkCList *clist, |
462 | GtkShadowType type); |
463 | |
464 | /* set the clist's selection mode */ |
465 | void gtk_clist_set_selection_mode (GtkCList *clist, |
466 | GtkSelectionMode mode); |
467 | |
468 | /* enable clists reorder ability */ |
469 | void gtk_clist_set_reorderable (GtkCList *clist, |
470 | gboolean reorderable); |
471 | void gtk_clist_set_use_drag_icons (GtkCList *clist, |
472 | gboolean use_icons); |
473 | void gtk_clist_set_button_actions (GtkCList *clist, |
474 | guint button, |
475 | guint8 button_actions); |
476 | |
477 | /* freeze all visual updates of the list, and then thaw the list after |
478 | * you have made a number of changes and the updates wil occure in a |
479 | * more efficent mannor than if you made them on a unfrozen list |
480 | */ |
481 | void gtk_clist_freeze (GtkCList *clist); |
482 | void gtk_clist_thaw (GtkCList *clist); |
483 | |
484 | /* show and hide the column title buttons */ |
485 | void gtk_clist_column_titles_show (GtkCList *clist); |
486 | void gtk_clist_column_titles_hide (GtkCList *clist); |
487 | |
488 | /* set the column title to be a active title (responds to button presses, |
489 | * prelights, and grabs keyboard focus), or passive where it acts as just |
490 | * a title |
491 | */ |
492 | void gtk_clist_column_title_active (GtkCList *clist, |
493 | gint column); |
494 | void gtk_clist_column_title_passive (GtkCList *clist, |
495 | gint column); |
496 | void gtk_clist_column_titles_active (GtkCList *clist); |
497 | void gtk_clist_column_titles_passive (GtkCList *clist); |
498 | |
499 | /* set the title in the column title button */ |
500 | void gtk_clist_set_column_title (GtkCList *clist, |
501 | gint column, |
502 | const gchar *title); |
503 | |
504 | /* returns the title of column. Returns NULL if title is not set */ |
505 | gchar * gtk_clist_get_column_title (GtkCList *clist, |
506 | gint column); |
507 | |
508 | /* set a widget instead of a title for the column title button */ |
509 | void gtk_clist_set_column_widget (GtkCList *clist, |
510 | gint column, |
511 | GtkWidget *widget); |
512 | |
513 | /* returns the column widget */ |
514 | GtkWidget * gtk_clist_get_column_widget (GtkCList *clist, |
515 | gint column); |
516 | |
517 | /* set the justification on a column */ |
518 | void gtk_clist_set_column_justification (GtkCList *clist, |
519 | gint column, |
520 | GtkJustification justification); |
521 | |
522 | /* set visibility of a column */ |
523 | void gtk_clist_set_column_visibility (GtkCList *clist, |
524 | gint column, |
525 | gboolean visible); |
526 | |
527 | /* enable/disable column resize operations by mouse */ |
528 | void gtk_clist_set_column_resizeable (GtkCList *clist, |
529 | gint column, |
530 | gboolean resizeable); |
531 | |
532 | /* resize column automatically to its optimal width */ |
533 | void gtk_clist_set_column_auto_resize (GtkCList *clist, |
534 | gint column, |
535 | gboolean auto_resize); |
536 | |
537 | gint gtk_clist_columns_autosize (GtkCList *clist); |
538 | |
539 | /* return the optimal column width, i.e. maximum of all cell widths */ |
540 | gint gtk_clist_optimal_column_width (GtkCList *clist, |
541 | gint column); |
542 | |
543 | /* set the pixel width of a column; this is a necessary step in |
544 | * creating a CList because otherwise the column width is chozen from |
545 | * the width of the column title, which will never be right |
546 | */ |
547 | void gtk_clist_set_column_width (GtkCList *clist, |
548 | gint column, |
549 | gint width); |
550 | |
551 | /* set column minimum/maximum width. min/max_width < 0 => no restriction */ |
552 | void gtk_clist_set_column_min_width (GtkCList *clist, |
553 | gint column, |
554 | gint min_width); |
555 | void gtk_clist_set_column_max_width (GtkCList *clist, |
556 | gint column, |
557 | gint max_width); |
558 | |
559 | /* change the height of the rows, the default (height=0) is |
560 | * the hight of the current font. |
561 | */ |
562 | void gtk_clist_set_row_height (GtkCList *clist, |
563 | guint height); |
564 | |
565 | /* scroll the viewing area of the list to the given column and row; |
566 | * row_align and col_align are between 0-1 representing the location the |
567 | * row should appear on the screnn, 0.0 being top or left, 1.0 being |
568 | * bottom or right; if row or column is -1 then then there is no change |
569 | */ |
570 | void gtk_clist_moveto (GtkCList *clist, |
571 | gint row, |
572 | gint column, |
573 | gfloat row_align, |
574 | gfloat col_align); |
575 | |
576 | /* returns whether the row is visible */ |
577 | GtkVisibility gtk_clist_row_is_visible (GtkCList *clist, |
578 | gint row); |
579 | |
580 | /* returns the cell type */ |
581 | GtkCellType gtk_clist_get_cell_type (GtkCList *clist, |
582 | gint row, |
583 | gint column); |
584 | |
585 | /* sets a given cell's text, replacing its current contents */ |
586 | void gtk_clist_set_text (GtkCList *clist, |
587 | gint row, |
588 | gint column, |
589 | const gchar *text); |
590 | |
591 | /* for the "get" functions, any of the return pointer can be |
592 | * NULL if you are not interested |
593 | */ |
594 | gint gtk_clist_get_text (GtkCList *clist, |
595 | gint row, |
596 | gint column, |
597 | gchar **text); |
598 | |
599 | /* sets a given cell's pixmap, replacing its current contents */ |
600 | void gtk_clist_set_pixmap (GtkCList *clist, |
601 | gint row, |
602 | gint column, |
603 | GdkPixmap *pixmap, |
604 | GdkBitmap *mask); |
605 | |
606 | gint gtk_clist_get_pixmap (GtkCList *clist, |
607 | gint row, |
608 | gint column, |
609 | GdkPixmap **pixmap, |
610 | GdkBitmap **mask); |
611 | |
612 | /* sets a given cell's pixmap and text, replacing its current contents */ |
613 | void gtk_clist_set_pixtext (GtkCList *clist, |
614 | gint row, |
615 | gint column, |
616 | const gchar *text, |
617 | guint8 spacing, |
618 | GdkPixmap *pixmap, |
619 | GdkBitmap *mask); |
620 | |
621 | gint gtk_clist_get_pixtext (GtkCList *clist, |
622 | gint row, |
623 | gint column, |
624 | gchar **text, |
625 | guint8 *spacing, |
626 | GdkPixmap **pixmap, |
627 | GdkBitmap **mask); |
628 | |
629 | /* sets the foreground color of a row, the color must already |
630 | * be allocated |
631 | */ |
632 | void gtk_clist_set_foreground (GtkCList *clist, |
633 | gint row, |
634 | const GdkColor *color); |
635 | |
636 | /* sets the background color of a row, the color must already |
637 | * be allocated |
638 | */ |
639 | void gtk_clist_set_background (GtkCList *clist, |
640 | gint row, |
641 | const GdkColor *color); |
642 | |
643 | /* set / get cell styles */ |
644 | void gtk_clist_set_cell_style (GtkCList *clist, |
645 | gint row, |
646 | gint column, |
647 | GtkStyle *style); |
648 | |
649 | GtkStyle *gtk_clist_get_cell_style (GtkCList *clist, |
650 | gint row, |
651 | gint column); |
652 | |
653 | void gtk_clist_set_row_style (GtkCList *clist, |
654 | gint row, |
655 | GtkStyle *style); |
656 | |
657 | GtkStyle *gtk_clist_get_row_style (GtkCList *clist, |
658 | gint row); |
659 | |
660 | /* this sets a horizontal and vertical shift for drawing |
661 | * the contents of a cell; it can be positive or negitive; |
662 | * this is particulary useful for indenting items in a column |
663 | */ |
664 | void gtk_clist_set_shift (GtkCList *clist, |
665 | gint row, |
666 | gint column, |
667 | gint vertical, |
668 | gint horizontal); |
669 | |
670 | /* set/get selectable flag of a single row */ |
671 | void gtk_clist_set_selectable (GtkCList *clist, |
672 | gint row, |
673 | gboolean selectable); |
674 | gboolean gtk_clist_get_selectable (GtkCList *clist, |
675 | gint row); |
676 | |
677 | /* prepend/append returns the index of the row you just added, |
678 | * making it easier to append and modify a row |
679 | */ |
680 | gint gtk_clist_prepend (GtkCList *clist, |
681 | gchar *text[]); |
682 | gint gtk_clist_append (GtkCList *clist, |
683 | gchar *text[]); |
684 | |
685 | /* inserts a row at index row and returns the row where it was |
686 | * actually inserted (may be different from "row" in auto_sort mode) |
687 | */ |
688 | gint gtk_clist_insert (GtkCList *clist, |
689 | gint row, |
690 | gchar *text[]); |
691 | |
692 | /* removes row at index row */ |
693 | void gtk_clist_remove (GtkCList *clist, |
694 | gint row); |
695 | |
696 | /* sets a arbitrary data pointer for a given row */ |
697 | void gtk_clist_set_row_data (GtkCList *clist, |
698 | gint row, |
699 | gpointer data); |
700 | |
701 | /* sets a data pointer for a given row with destroy notification */ |
702 | void gtk_clist_set_row_data_full (GtkCList *clist, |
703 | gint row, |
704 | gpointer data, |
705 | GDestroyNotify destroy); |
706 | |
707 | /* returns the data set for a row */ |
708 | gpointer gtk_clist_get_row_data (GtkCList *clist, |
709 | gint row); |
710 | |
711 | /* givin a data pointer, find the first (and hopefully only!) |
712 | * row that points to that data, or -1 if none do |
713 | */ |
714 | gint gtk_clist_find_row_from_data (GtkCList *clist, |
715 | gpointer data); |
716 | |
717 | /* force selection of a row */ |
718 | void gtk_clist_select_row (GtkCList *clist, |
719 | gint row, |
720 | gint column); |
721 | |
722 | /* force unselection of a row */ |
723 | void gtk_clist_unselect_row (GtkCList *clist, |
724 | gint row, |
725 | gint column); |
726 | |
727 | /* undo the last select/unselect operation */ |
728 | void gtk_clist_undo_selection (GtkCList *clist); |
729 | |
730 | /* clear the entire list -- this is much faster than removing |
731 | * each item with gtk_clist_remove |
732 | */ |
733 | void gtk_clist_clear (GtkCList *clist); |
734 | |
735 | /* return the row column corresponding to the x and y coordinates, |
736 | * the returned values are only valid if the x and y coordinates |
737 | * are respectively to a window == clist->clist_window |
738 | */ |
739 | gint gtk_clist_get_selection_info (GtkCList *clist, |
740 | gint x, |
741 | gint y, |
742 | gint *row, |
743 | gint *column); |
744 | |
745 | /* in multiple or extended mode, select all rows */ |
746 | void gtk_clist_select_all (GtkCList *clist); |
747 | |
748 | /* in all modes except browse mode, deselect all rows */ |
749 | void gtk_clist_unselect_all (GtkCList *clist); |
750 | |
751 | /* swap the position of two rows */ |
752 | void gtk_clist_swap_rows (GtkCList *clist, |
753 | gint row1, |
754 | gint row2); |
755 | |
756 | /* move row from source_row position to dest_row position */ |
757 | void gtk_clist_row_move (GtkCList *clist, |
758 | gint source_row, |
759 | gint dest_row); |
760 | |
761 | /* sets a compare function different to the default */ |
762 | void gtk_clist_set_compare_func (GtkCList *clist, |
763 | GtkCListCompareFunc cmp_func); |
764 | |
765 | /* the column to sort by */ |
766 | void gtk_clist_set_sort_column (GtkCList *clist, |
767 | gint column); |
768 | |
769 | /* how to sort : ascending or descending */ |
770 | void gtk_clist_set_sort_type (GtkCList *clist, |
771 | GtkSortType sort_type); |
772 | |
773 | /* sort the list with the current compare function */ |
774 | void gtk_clist_sort (GtkCList *clist); |
775 | |
776 | /* Automatically sort upon insertion */ |
777 | void gtk_clist_set_auto_sort (GtkCList *clist, |
778 | gboolean auto_sort); |
779 | |
780 | /* Private function for clist, ctree */ |
781 | |
782 | PangoLayout *_gtk_clist_create_cell_layout (GtkCList *clist, |
783 | GtkCListRow *clist_row, |
784 | gint column); |
785 | |
786 | |
787 | G_END_DECLS |
788 | |
789 | |
790 | #endif /* __GTK_CLIST_H__ */ |
791 | |
792 | #endif /* GTK_DISABLE_DEPRECATED */ |
793 | |