1 | /* GTK - The GIMP Toolkit |
---|
2 | * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball, Josh MacDonald |
---|
3 | * Copyright (C) 1997-1998 Jay Painter <jpaint@serv.net><jpaint@gimp.org> |
---|
4 | * |
---|
5 | * This library is free software; you can redistribute it and/or |
---|
6 | * modify it under the terms of the GNU Library 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 | * Library General Public License for more details. |
---|
14 | * |
---|
15 | * You should have received a copy of the GNU Library 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-1999. 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 | #ifndef __GTK_CLIST_H__ |
---|
29 | #define __GTK_CLIST_H__ |
---|
30 | |
---|
31 | #include <gdk/gdk.h> |
---|
32 | #include <gtk/gtksignal.h> |
---|
33 | #include <gtk/gtkalignment.h> |
---|
34 | #include <gtk/gtklabel.h> |
---|
35 | #include <gtk/gtkbutton.h> |
---|
36 | #include <gtk/gtkhscrollbar.h> |
---|
37 | #include <gtk/gtkvscrollbar.h> |
---|
38 | #include <gtk/gtkenums.h> |
---|
39 | |
---|
40 | #ifdef __cplusplus |
---|
41 | extern "C" { |
---|
42 | #endif /* __cplusplus */ |
---|
43 | |
---|
44 | /* clist flags */ |
---|
45 | enum { |
---|
46 | GTK_CLIST_IN_DRAG = 1 << 0, |
---|
47 | GTK_CLIST_ROW_HEIGHT_SET = 1 << 1, |
---|
48 | GTK_CLIST_SHOW_TITLES = 1 << 2, |
---|
49 | GTK_CLIST_CHILD_HAS_FOCUS = 1 << 3, |
---|
50 | GTK_CLIST_ADD_MODE = 1 << 4, |
---|
51 | GTK_CLIST_AUTO_SORT = 1 << 5, |
---|
52 | GTK_CLIST_AUTO_RESIZE_BLOCKED = 1 << 6, |
---|
53 | GTK_CLIST_REORDERABLE = 1 << 7, |
---|
54 | GTK_CLIST_USE_DRAG_ICONS = 1 << 8, |
---|
55 | GTK_CLIST_DRAW_DRAG_LINE = 1 << 9, |
---|
56 | GTK_CLIST_DRAW_DRAG_RECT = 1 << 10 |
---|
57 | }; |
---|
58 | |
---|
59 | /* cell types */ |
---|
60 | typedef enum |
---|
61 | { |
---|
62 | GTK_CELL_EMPTY, |
---|
63 | GTK_CELL_TEXT, |
---|
64 | GTK_CELL_PIXMAP, |
---|
65 | GTK_CELL_PIXTEXT, |
---|
66 | GTK_CELL_WIDGET |
---|
67 | } GtkCellType; |
---|
68 | |
---|
69 | typedef enum |
---|
70 | { |
---|
71 | GTK_CLIST_DRAG_NONE, |
---|
72 | GTK_CLIST_DRAG_BEFORE, |
---|
73 | GTK_CLIST_DRAG_INTO, |
---|
74 | GTK_CLIST_DRAG_AFTER |
---|
75 | } GtkCListDragPos; |
---|
76 | |
---|
77 | typedef enum |
---|
78 | { |
---|
79 | GTK_BUTTON_IGNORED = 0, |
---|
80 | GTK_BUTTON_SELECTS = 1 << 0, |
---|
81 | GTK_BUTTON_DRAGS = 1 << 1, |
---|
82 | GTK_BUTTON_EXPANDS = 1 << 2 |
---|
83 | } GtkButtonAction; |
---|
84 | |
---|
85 | #define GTK_TYPE_CLIST (gtk_clist_get_type ()) |
---|
86 | #define GTK_CLIST(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_CLIST, GtkCList)) |
---|
87 | #define GTK_CLIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_CLIST, GtkCListClass)) |
---|
88 | #define GTK_IS_CLIST(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_CLIST)) |
---|
89 | #define GTK_IS_CLIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CLIST)) |
---|
90 | |
---|
91 | #define GTK_CLIST_FLAGS(clist) (GTK_CLIST (clist)->flags) |
---|
92 | #define GTK_CLIST_SET_FLAG(clist,flag) (GTK_CLIST_FLAGS (clist) |= (GTK_ ## flag)) |
---|
93 | #define GTK_CLIST_UNSET_FLAG(clist,flag) (GTK_CLIST_FLAGS (clist) &= ~(GTK_ ## flag)) |
---|
94 | |
---|
95 | #define GTK_CLIST_IN_DRAG(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_IN_DRAG) |
---|
96 | #define GTK_CLIST_ROW_HEIGHT_SET(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_ROW_HEIGHT_SET) |
---|
97 | #define GTK_CLIST_SHOW_TITLES(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_SHOW_TITLES) |
---|
98 | #define GTK_CLIST_CHILD_HAS_FOCUS(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_CHILD_HAS_FOCUS) |
---|
99 | #define GTK_CLIST_ADD_MODE(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_ADD_MODE) |
---|
100 | #define GTK_CLIST_AUTO_SORT(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_AUTO_SORT) |
---|
101 | #define GTK_CLIST_AUTO_RESIZE_BLOCKED(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_AUTO_RESIZE_BLOCKED) |
---|
102 | #define GTK_CLIST_REORDERABLE(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_REORDERABLE) |
---|
103 | #define GTK_CLIST_USE_DRAG_ICONS(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_USE_DRAG_ICONS) |
---|
104 | #define GTK_CLIST_DRAW_DRAG_LINE(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_DRAW_DRAG_LINE) |
---|
105 | #define GTK_CLIST_DRAW_DRAG_RECT(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_DRAW_DRAG_RECT) |
---|
106 | |
---|
107 | #define GTK_CLIST_ROW(_glist_) ((GtkCListRow *)((_glist_)->data)) |
---|
108 | |
---|
109 | /* pointer casting for cells */ |
---|
110 | #define GTK_CELL_TEXT(cell) (((GtkCellText *) &(cell))) |
---|
111 | #define GTK_CELL_PIXMAP(cell) (((GtkCellPixmap *) &(cell))) |
---|
112 | #define GTK_CELL_PIXTEXT(cell) (((GtkCellPixText *) &(cell))) |
---|
113 | #define GTK_CELL_WIDGET(cell) (((GtkCellWidget *) &(cell))) |
---|
114 | |
---|
115 | typedef struct _GtkCList GtkCList; |
---|
116 | typedef struct _GtkCListClass GtkCListClass; |
---|
117 | typedef struct _GtkCListColumn GtkCListColumn; |
---|
118 | typedef struct _GtkCListRow GtkCListRow; |
---|
119 | |
---|
120 | typedef struct _GtkCell GtkCell; |
---|
121 | typedef struct _GtkCellText GtkCellText; |
---|
122 | typedef struct _GtkCellPixmap GtkCellPixmap; |
---|
123 | typedef struct _GtkCellPixText GtkCellPixText; |
---|
124 | typedef struct _GtkCellWidget GtkCellWidget; |
---|
125 | |
---|
126 | typedef gint (*GtkCListCompareFunc) (GtkCList *clist, |
---|
127 | gconstpointer ptr1, |
---|
128 | gconstpointer ptr2); |
---|
129 | |
---|
130 | typedef struct _GtkCListCellInfo GtkCListCellInfo; |
---|
131 | typedef struct _GtkCListDestInfo GtkCListDestInfo; |
---|
132 | |
---|
133 | struct _GtkCListCellInfo |
---|
134 | { |
---|
135 | gint row; |
---|
136 | gint column; |
---|
137 | }; |
---|
138 | |
---|
139 | struct _GtkCListDestInfo |
---|
140 | { |
---|
141 | GtkCListCellInfo cell; |
---|
142 | GtkCListDragPos insert_pos; |
---|
143 | }; |
---|
144 | |
---|
145 | struct _GtkCList |
---|
146 | { |
---|
147 | GtkContainer container; |
---|
148 | |
---|
149 | guint16 flags; |
---|
150 | |
---|
151 | /* mem chunks */ |
---|
152 | GMemChunk *row_mem_chunk; |
---|
153 | GMemChunk *cell_mem_chunk; |
---|
154 | |
---|
155 | guint freeze_count; |
---|
156 | |
---|
157 | /* allocation rectangle after the conatiner_border_width |
---|
158 | * and the width of the shadow border */ |
---|
159 | GdkRectangle internal_allocation; |
---|
160 | |
---|
161 | /* rows */ |
---|
162 | gint rows; |
---|
163 | gint row_center_offset; |
---|
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 | /* dragging the selection */ |
---|
229 | gint anchor; |
---|
230 | GtkStateType anchor_state; |
---|
231 | gint drag_pos; |
---|
232 | gint htimer; |
---|
233 | gint vtimer; |
---|
234 | |
---|
235 | GtkSortType sort_type; |
---|
236 | GtkCListCompareFunc compare; |
---|
237 | gint sort_column; |
---|
238 | }; |
---|
239 | |
---|
240 | struct _GtkCListClass |
---|
241 | { |
---|
242 | GtkContainerClass parent_class; |
---|
243 | |
---|
244 | void (*set_scroll_adjustments) (GtkCList *clist, |
---|
245 | GtkAdjustment *hadjustment, |
---|
246 | GtkAdjustment *vadjustment); |
---|
247 | void (*refresh) (GtkCList *clist); |
---|
248 | void (*select_row) (GtkCList *clist, |
---|
249 | gint row, |
---|
250 | gint column, |
---|
251 | GdkEvent *event); |
---|
252 | void (*unselect_row) (GtkCList *clist, |
---|
253 | gint row, |
---|
254 | gint column, |
---|
255 | GdkEvent *event); |
---|
256 | void (*row_move) (GtkCList *clist, |
---|
257 | gint source_row, |
---|
258 | gint dest_row); |
---|
259 | void (*click_column) (GtkCList *clist, |
---|
260 | gint column); |
---|
261 | void (*resize_column) (GtkCList *clist, |
---|
262 | gint column, |
---|
263 | gint width); |
---|
264 | void (*toggle_focus_row) (GtkCList *clist); |
---|
265 | void (*select_all) (GtkCList *clist); |
---|
266 | void (*unselect_all) (GtkCList *clist); |
---|
267 | void (*undo_selection) (GtkCList *clist); |
---|
268 | void (*start_selection) (GtkCList *clist); |
---|
269 | void (*end_selection) (GtkCList *clist); |
---|
270 | void (*extend_selection) (GtkCList *clist, |
---|
271 | GtkScrollType scroll_type, |
---|
272 | gfloat position, |
---|
273 | gboolean auto_start_selection); |
---|
274 | void (*scroll_horizontal) (GtkCList *clist, |
---|
275 | GtkScrollType scroll_type, |
---|
276 | gfloat position); |
---|
277 | void (*scroll_vertical) (GtkCList *clist, |
---|
278 | GtkScrollType scroll_type, |
---|
279 | gfloat position); |
---|
280 | void (*toggle_add_mode) (GtkCList *clist); |
---|
281 | void (*abort_column_resize) (GtkCList *clist); |
---|
282 | void (*resync_selection) (GtkCList *clist, |
---|
283 | GdkEvent *event); |
---|
284 | GList* (*selection_find) (GtkCList *clist, |
---|
285 | gint row_number, |
---|
286 | GList *row_list_element); |
---|
287 | void (*draw_row) (GtkCList *clist, |
---|
288 | GdkRectangle *area, |
---|
289 | gint row, |
---|
290 | GtkCListRow *clist_row); |
---|
291 | void (*draw_drag_highlight) (GtkCList *clist, |
---|
292 | GtkCListRow *target_row, |
---|
293 | gint target_row_number, |
---|
294 | GtkCListDragPos drag_pos); |
---|
295 | void (*clear) (GtkCList *clist); |
---|
296 | void (*fake_unselect_all) (GtkCList *clist, |
---|
297 | gint row); |
---|
298 | void (*sort_list) (GtkCList *clist); |
---|
299 | gint (*insert_row) (GtkCList *clist, |
---|
300 | gint row, |
---|
301 | gchar *text[]); |
---|
302 | void (*remove_row) (GtkCList *clist, |
---|
303 | gint row); |
---|
304 | void (*set_cell_contents) (GtkCList *clist, |
---|
305 | GtkCListRow *clist_row, |
---|
306 | gint column, |
---|
307 | GtkCellType type, |
---|
308 | const gchar *text, |
---|
309 | guint8 spacing, |
---|
310 | GdkPixmap *pixmap, |
---|
311 | GdkBitmap *mask); |
---|
312 | void (*cell_size_request) (GtkCList *clist, |
---|
313 | GtkCListRow *clist_row, |
---|
314 | gint column, |
---|
315 | GtkRequisition *requisition); |
---|
316 | |
---|
317 | }; |
---|
318 | |
---|
319 | struct _GtkCListColumn |
---|
320 | { |
---|
321 | gchar *title; |
---|
322 | GdkRectangle area; |
---|
323 | |
---|
324 | GtkWidget *button; |
---|
325 | GdkWindow *window; |
---|
326 | |
---|
327 | gint width; |
---|
328 | gint min_width; |
---|
329 | gint max_width; |
---|
330 | GtkJustification justification; |
---|
331 | |
---|
332 | guint visible : 1; |
---|
333 | guint width_set : 1; |
---|
334 | guint resizeable : 1; |
---|
335 | guint auto_resize : 1; |
---|
336 | guint button_passive : 1; |
---|
337 | }; |
---|
338 | |
---|
339 | struct _GtkCListRow |
---|
340 | { |
---|
341 | GtkCell *cell; |
---|
342 | GtkStateType state; |
---|
343 | |
---|
344 | GdkColor foreground; |
---|
345 | GdkColor background; |
---|
346 | |
---|
347 | GtkStyle *style; |
---|
348 | |
---|
349 | gpointer data; |
---|
350 | GtkDestroyNotify destroy; |
---|
351 | |
---|
352 | guint fg_set : 1; |
---|
353 | guint bg_set : 1; |
---|
354 | guint selectable : 1; |
---|
355 | }; |
---|
356 | |
---|
357 | /* Cell Structures */ |
---|
358 | struct _GtkCellText |
---|
359 | { |
---|
360 | GtkCellType type; |
---|
361 | |
---|
362 | gint16 vertical; |
---|
363 | gint16 horizontal; |
---|
364 | |
---|
365 | GtkStyle *style; |
---|
366 | |
---|
367 | gchar *text; |
---|
368 | }; |
---|
369 | |
---|
370 | struct _GtkCellPixmap |
---|
371 | { |
---|
372 | GtkCellType type; |
---|
373 | |
---|
374 | gint16 vertical; |
---|
375 | gint16 horizontal; |
---|
376 | |
---|
377 | GtkStyle *style; |
---|
378 | |
---|
379 | GdkPixmap *pixmap; |
---|
380 | GdkBitmap *mask; |
---|
381 | }; |
---|
382 | |
---|
383 | struct _GtkCellPixText |
---|
384 | { |
---|
385 | GtkCellType type; |
---|
386 | |
---|
387 | gint16 vertical; |
---|
388 | gint16 horizontal; |
---|
389 | |
---|
390 | GtkStyle *style; |
---|
391 | |
---|
392 | gchar *text; |
---|
393 | guint8 spacing; |
---|
394 | GdkPixmap *pixmap; |
---|
395 | GdkBitmap *mask; |
---|
396 | }; |
---|
397 | |
---|
398 | struct _GtkCellWidget |
---|
399 | { |
---|
400 | GtkCellType type; |
---|
401 | |
---|
402 | gint16 vertical; |
---|
403 | gint16 horizontal; |
---|
404 | |
---|
405 | GtkStyle *style; |
---|
406 | |
---|
407 | GtkWidget *widget; |
---|
408 | }; |
---|
409 | |
---|
410 | struct _GtkCell |
---|
411 | { |
---|
412 | GtkCellType type; |
---|
413 | |
---|
414 | gint16 vertical; |
---|
415 | gint16 horizontal; |
---|
416 | |
---|
417 | GtkStyle *style; |
---|
418 | |
---|
419 | union { |
---|
420 | gchar *text; |
---|
421 | |
---|
422 | struct { |
---|
423 | GdkPixmap *pixmap; |
---|
424 | GdkBitmap *mask; |
---|
425 | } pm; |
---|
426 | |
---|
427 | struct { |
---|
428 | gchar *text; |
---|
429 | guint8 spacing; |
---|
430 | GdkPixmap *pixmap; |
---|
431 | GdkBitmap *mask; |
---|
432 | } pt; |
---|
433 | |
---|
434 | GtkWidget *widget; |
---|
435 | } u; |
---|
436 | }; |
---|
437 | |
---|
438 | GtkType gtk_clist_get_type (void); |
---|
439 | |
---|
440 | /* constructors useful for gtk-- wrappers */ |
---|
441 | void gtk_clist_construct (GtkCList *clist, |
---|
442 | gint columns, |
---|
443 | gchar *titles[]); |
---|
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 | 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 | 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 | GtkDestroyNotify 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 | |
---|
781 | #ifdef __cplusplus |
---|
782 | } |
---|
783 | #endif /* __cplusplus */ |
---|
784 | |
---|
785 | #endif /* __GTK_CLIST_H__ */ |
---|