2011-10-23 [colin] 3.7.10cvs46
[claws.git] / src / gtk / gtkcmclist.h
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 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 #ifndef __GTK_CMCLIST_H__
29 #define __GTK_CMCLIST_H__
30
31 #include <gdk/gdk.h>
32 #include <gtk/gtk.h>
33
34
35 G_BEGIN_DECLS
36
37
38 /* clist flags */
39 enum {
40   GTK_CMCLIST_IN_DRAG             = 1 <<  0,
41   GTK_CMCLIST_ROW_HEIGHT_SET      = 1 <<  1,
42   GTK_CMCLIST_SHOW_TITLES         = 1 <<  2,
43   /* Unused */
44   GTK_CMCLIST_ADD_MODE            = 1 <<  4,
45   GTK_CMCLIST_AUTO_SORT           = 1 <<  5,
46   GTK_CMCLIST_AUTO_RESIZE_BLOCKED = 1 <<  6,
47   GTK_CMCLIST_REORDERABLE         = 1 <<  7,
48   GTK_CMCLIST_USE_DRAG_ICONS      = 1 <<  8,
49   GTK_CMCLIST_DRAW_DRAG_LINE      = 1 <<  9,
50   GTK_CMCLIST_DRAW_DRAG_RECT      = 1 << 10
51 }; 
52
53 /* cell types */
54 typedef enum
55 {
56   GTK_CMCELL_EMPTY,
57   GTK_CMCELL_TEXT,
58   GTK_CMCELL_PIXBUF,
59   GTK_CMCELL_PIXTEXT,
60   GTK_CMCELL_WIDGET
61 } GtkCMCellType;
62
63 typedef enum
64 {
65   GTK_CMCLIST_DRAG_NONE,
66   GTK_CMCLIST_DRAG_BEFORE,
67   GTK_CMCLIST_DRAG_INTO,
68   GTK_CMCLIST_DRAG_AFTER
69 } GtkCMCListDragPos;
70
71 typedef enum
72 {
73   GTK_CMBUTTON_IGNORED = 0,
74   GTK_CMBUTTON_SELECTS = 1 << 0,
75   GTK_CMBUTTON_DRAGS   = 1 << 1,
76   GTK_CMBUTTON_EXPANDS = 1 << 2
77 } GtkCMButtonAction;
78
79 #define GTK_TYPE_CMCLIST            (gtk_cmclist_get_type ())
80 #define GTK_CMCLIST(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CMCLIST, GtkCMCList))
81 #define GTK_CMCLIST_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CMCLIST, GtkCMCListClass))
82 #define GTK_IS_CMCLIST(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CMCLIST))
83 #define GTK_IS_CMCLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CMCLIST))
84 #define GTK_CMCLIST_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CMCLIST, GtkCMCListClass))
85
86
87 #define GTK_CMCLIST_FLAGS(clist)             (GTK_CMCLIST (clist)->flags)
88 #define GTK_CMCLIST_SET_FLAG(clist,flag)     (GTK_CMCLIST_FLAGS (clist) |= (GTK_ ## flag))
89 #define GTK_CMCLIST_UNSET_FLAG(clist,flag)   (GTK_CMCLIST_FLAGS (clist) &= ~(GTK_ ## flag))
90
91 #define GTK_CMCLIST_IN_DRAG(clist)           (GTK_CMCLIST_FLAGS (clist) & GTK_CMCLIST_IN_DRAG)
92 #define GTK_CMCLIST_ROW_HEIGHT_SET(clist)    (GTK_CMCLIST_FLAGS (clist) & GTK_CMCLIST_ROW_HEIGHT_SET)
93 #define GTK_CMCLIST_SHOW_TITLES(clist)       (GTK_CMCLIST_FLAGS (clist) & GTK_CMCLIST_SHOW_TITLES)
94 #define GTK_CMCLIST_ADD_MODE(clist)          (GTK_CMCLIST_FLAGS (clist) & GTK_CMCLIST_ADD_MODE)
95 #define GTK_CMCLIST_AUTO_SORT(clist)         (GTK_CMCLIST_FLAGS (clist) & GTK_CMCLIST_AUTO_SORT)
96 #define GTK_CMCLIST_AUTO_RESIZE_BLOCKED(clist) (GTK_CMCLIST_FLAGS (clist) & GTK_CMCLIST_AUTO_RESIZE_BLOCKED)
97 #define GTK_CMCLIST_REORDERABLE(clist)       (GTK_CMCLIST_FLAGS (clist) & GTK_CMCLIST_REORDERABLE)
98 #define GTK_CMCLIST_USE_DRAG_ICONS(clist)    (GTK_CMCLIST_FLAGS (clist) & GTK_CMCLIST_USE_DRAG_ICONS)
99 #define GTK_CMCLIST_DRAW_DRAG_LINE(clist)    (GTK_CMCLIST_FLAGS (clist) & GTK_CMCLIST_DRAW_DRAG_LINE)
100 #define GTK_CMCLIST_DRAW_DRAG_RECT(clist)    (GTK_CMCLIST_FLAGS (clist) & GTK_CMCLIST_DRAW_DRAG_RECT)
101
102 #define GTK_CMCLIST_ROW(_glist_) ((GtkCMCListRow *)((_glist_)->data))
103
104 /* pointer casting for cells */
105 #define GTK_CMCELL_TEXT(cell)     (((GtkCMCellText *) &(cell)))
106 #define GTK_CMCELL_PIXBUF(cell)   (((GtkCMCellPixbuf *) &(cell)))
107 #define GTK_CMCELL_PIXTEXT(cell)  (((GtkCMCellPixText *) &(cell)))
108 #define GTK_CMCELL_WIDGET(cell)   (((GtkCMCellWidget *) &(cell)))
109
110 typedef struct _GtkCMCList GtkCMCList;
111 typedef struct _GtkCMCListClass GtkCMCListClass;
112 typedef struct _GtkCMCListColumn GtkCMCListColumn;
113 typedef struct _GtkCMCListRow GtkCMCListRow;
114
115 typedef struct _GtkCMCell GtkCMCell;
116 typedef struct _GtkCMCellText GtkCMCellText;
117 typedef struct _GtkCMCellPixbuf GtkCMCellPixbuf;
118 typedef struct _GtkCMCellPixText GtkCMCellPixText;
119 typedef struct _GtkCMCellWidget GtkCMCellWidget;
120
121 typedef gint (*GtkCMCListCompareFunc) (GtkCMCList     *clist,
122                                      gconstpointer ptr1,
123                                      gconstpointer ptr2);
124
125 typedef struct _GtkCMCListCellInfo GtkCMCListCellInfo;
126 typedef struct _GtkCMCListDestInfo GtkCMCListDestInfo;
127
128 struct _GtkCMCListCellInfo
129 {
130   gint row;
131   gint column;
132 };
133
134 struct _GtkCMCListDestInfo
135 {
136   GtkCMCListCellInfo cell;
137   GtkCMCListDragPos  insert_pos;
138 };
139
140 struct _GtkCMCList
141 {
142   GtkContainer container;
143   
144   guint16 flags;
145   
146 #if !GLIB_CHECK_VERSION(2,10,0)
147   GMemChunk *row_mem_chunk;
148   GMemChunk *cell_mem_chunk;
149 #else
150   gpointer reserved1;
151   gpointer reserved2;
152 #endif
153   guint freeze_count;
154   
155   /* allocation rectangle after the conatiner_border_width
156    * and the width of the shadow border */
157   GdkRectangle internal_allocation;
158   
159   /* rows */
160   gint rows;
161   gint row_height;
162   GList *row_list;
163   GList *row_list_end;
164   
165   /* columns */
166   gint columns;
167   GdkRectangle column_title_area;
168   GdkWindow *title_window;
169   
170   /* dynamicly allocated array of column structures */
171   GtkCMCListColumn *column;
172   
173   /* the scrolling window and its height and width to
174    * make things a little speedier */
175   GdkWindow *clist_window;
176   gint clist_window_width;
177   gint clist_window_height;
178   
179   /* offsets for scrolling */
180   gint hoffset;
181   gint voffset;
182   
183   /* border shadow style */
184   GtkShadowType shadow_type;
185   
186   /* the list's selection mode (gtkenums.h) */
187   GtkSelectionMode selection_mode;
188   
189   /* list of selected rows */
190   GList *selection;
191   GList *selection_end;
192   
193   GList *undo_selection;
194   GList *undo_unselection;
195   gint undo_anchor;
196   
197   /* mouse buttons */
198   guint8 button_actions[5];
199
200   guint8 drag_button;
201
202   /* dnd */
203   GtkCMCListCellInfo click_cell;
204
205   /* scroll adjustments */
206   GtkAdjustment *hadjustment;
207   GtkAdjustment *vadjustment;
208   
209   gint dash_mode;
210   
211   /* cursor used to indicate dragging */
212   GdkCursor *cursor_drag;
213   
214   /* the current x-pixel location of the xor-drag line */
215   gint x_drag;
216   
217   /* focus handling */
218   gint focus_row;
219
220   gint focus_header_column;
221   
222   /* dragging the selection */
223   gint anchor;
224   GtkStateType anchor_state;
225   gint drag_pos;
226   gint htimer;
227   gint vtimer;
228   
229   GtkSortType sort_type;
230   GtkCMCListCompareFunc compare;
231   gint sort_column;
232
233   gint drag_highlight_row;
234   GtkCMCListDragPos drag_highlight_pos;
235 };
236
237 struct _GtkCMCListClass
238 {
239   GtkContainerClass parent_class;
240   
241   void  (*set_scroll_adjustments) (GtkCMCList       *clist,
242                                    GtkAdjustment  *hadjustment,
243                                    GtkAdjustment  *vadjustment);
244   void   (*refresh)             (GtkCMCList       *clist);
245   void   (*select_row)          (GtkCMCList       *clist,
246                                  gint            row,
247                                  gint            column,
248                                  GdkEvent       *event);
249   void   (*unselect_row)        (GtkCMCList       *clist,
250                                  gint            row,
251                                  gint            column,
252                                  GdkEvent       *event);
253   void   (*row_move)            (GtkCMCList       *clist,
254                                  gint            source_row,
255                                  gint            dest_row);
256   void   (*click_column)        (GtkCMCList       *clist,
257                                  gint            column);
258   void   (*resize_column)       (GtkCMCList       *clist,
259                                  gint            column,
260                                  gint            width);
261   void   (*toggle_focus_row)    (GtkCMCList       *clist);
262   void   (*select_all)          (GtkCMCList       *clist);
263   void   (*unselect_all)        (GtkCMCList       *clist);
264   void   (*undo_selection)      (GtkCMCList       *clist);
265   void   (*start_selection)     (GtkCMCList       *clist);
266   void   (*end_selection)       (GtkCMCList       *clist);
267   void   (*extend_selection)    (GtkCMCList       *clist,
268                                  GtkScrollType   scroll_type,
269                                  gfloat          position,
270                                  gboolean        auto_start_selection);
271   void   (*scroll_horizontal)   (GtkCMCList       *clist,
272                                  GtkScrollType   scroll_type,
273                                  gfloat          position);
274   void   (*scroll_vertical)     (GtkCMCList       *clist,
275                                  GtkScrollType   scroll_type,
276                                  gfloat          position);
277   void   (*toggle_add_mode)     (GtkCMCList       *clist);
278   void   (*abort_column_resize) (GtkCMCList       *clist);
279   void   (*resync_selection)    (GtkCMCList       *clist,
280                                  GdkEvent       *event);
281   GList* (*selection_find)      (GtkCMCList       *clist,
282                                  gint            row_number,
283                                  GList          *row_list_element);
284   void   (*draw_row)            (GtkCMCList       *clist,
285                                  GdkRectangle   *area,
286                                  gint            row,
287                                  GtkCMCListRow    *clist_row);
288   void   (*clear)               (GtkCMCList       *clist);
289   void   (*fake_unselect_all)   (GtkCMCList       *clist,
290                                  gint            row);
291   void   (*sort_list)           (GtkCMCList       *clist);
292   gint   (*insert_row)          (GtkCMCList       *clist,
293                                  gint            row,
294                                  gchar          *text[]);
295   void   (*remove_row)          (GtkCMCList       *clist,
296                                  gint            row);
297   void   (*set_cell_contents)   (GtkCMCList       *clist,
298                                  GtkCMCListRow    *clist_row,
299                                  gint            column,
300                                  GtkCMCellType     type,
301                                  const gchar    *text,
302                                  guint8          spacing,
303                                  GdkPixbuf      *pixbuf);
304   void   (*cell_size_request)   (GtkCMCList       *clist,
305                                  GtkCMCListRow    *clist_row,
306                                  gint            column,
307                                  GtkRequisition *requisition);
308
309 };
310
311 struct _GtkCMCListColumn
312 {
313   gchar *title;
314   GdkRectangle area;
315   
316   GtkWidget *button;
317   GdkWindow *window;
318   
319   gint width;
320   gint min_width;
321   gint max_width;
322   GtkJustification justification;
323   
324   guint visible        : 1;  
325   guint width_set      : 1;
326   guint resizeable     : 1;
327   guint auto_resize    : 1;
328   guint button_passive : 1;
329 };
330
331 struct _GtkCMCListRow
332 {
333   GtkCMCell *cell;
334   GtkStateType state;
335   
336   GdkColor foreground;
337   GdkColor background;
338   
339   GtkStyle *style;
340
341   gpointer data;
342   GDestroyNotify destroy;
343   
344   guint fg_set     : 1;
345   guint bg_set     : 1;
346   guint selectable : 1;
347 };
348
349 /* Cell Structures */
350 struct _GtkCMCellText
351 {
352   GtkCMCellType type;
353   
354   gint16 vertical;
355   gint16 horizontal;
356   
357   GtkStyle *style;
358
359   gchar *text;
360 };
361
362 struct _GtkCMCellPixbuf
363 {
364   GtkCMCellType type;
365   
366   gint16 vertical;
367   gint16 horizontal;
368   
369   GtkStyle *style;
370
371   GdkPixbuf *pixbuf;
372 };
373
374 struct _GtkCMCellPixText
375 {
376   GtkCMCellType type;
377   
378   gint16 vertical;
379   gint16 horizontal;
380   
381   GtkStyle *style;
382
383   gchar *text;
384   guint8 spacing;
385   GdkPixbuf *pixbuf;
386 };
387
388 struct _GtkCMCellWidget
389 {
390   GtkCMCellType type;
391   
392   gint16 vertical;
393   gint16 horizontal;
394   
395   GtkStyle *style;
396
397   GtkWidget *widget;
398 };
399
400 struct _GtkCMCell
401 {
402   GtkCMCellType type;
403   
404   gint16 vertical;
405   gint16 horizontal;
406   
407   GtkStyle *style;
408
409   union {
410     gchar *text;
411     
412     struct {
413       GdkPixbuf *pixbuf;
414     } pm;
415     
416     struct {
417       gchar *text;
418       guint8 spacing;
419       GdkPixbuf *pixbuf;
420     } pt;
421     
422     GtkWidget *widget;
423   } u;
424 };
425
426 GType gtk_cmclist_get_type (void);
427
428 /* create a new GtkCMCList */
429 GtkWidget* gtk_cmclist_new             (gint   columns);
430 GtkWidget* gtk_cmclist_new_with_titles (gint   columns,
431                                       gchar *titles[]);
432
433 /* set adjustments of clist */
434 void gtk_cmclist_set_hadjustment (GtkCMCList      *clist,
435                                 GtkAdjustment *adjustment);
436 void gtk_cmclist_set_vadjustment (GtkCMCList      *clist,
437                                 GtkAdjustment *adjustment);
438
439 /* get adjustments of clist */
440 GtkAdjustment* gtk_cmclist_get_hadjustment (GtkCMCList *clist);
441 GtkAdjustment* gtk_cmclist_get_vadjustment (GtkCMCList *clist);
442
443 /* set the border style of the clist */
444 void gtk_cmclist_set_shadow_type (GtkCMCList      *clist,
445                                 GtkShadowType  type);
446
447 /* set the clist's selection mode */
448 void gtk_cmclist_set_selection_mode (GtkCMCList         *clist,
449                                    GtkSelectionMode  mode);
450
451 /* enable clists reorder ability */
452 void gtk_cmclist_set_reorderable (GtkCMCList *clist,
453                                 gboolean  reorderable);
454 void gtk_cmclist_set_use_drag_icons (GtkCMCList *clist,
455                                    gboolean  use_icons);
456 void gtk_cmclist_set_button_actions (GtkCMCList *clist,
457                                    guint     button,
458                                    guint8    button_actions);
459
460 /* freeze all visual updates of the list, and then thaw the list after
461  * you have made a number of changes and the updates wil occure in a
462  * more efficent mannor than if you made them on a unfrozen list
463  */
464 void gtk_cmclist_freeze (GtkCMCList *clist);
465 void gtk_cmclist_thaw   (GtkCMCList *clist);
466
467 /* show and hide the column title buttons */
468 void gtk_cmclist_column_titles_show (GtkCMCList *clist);
469 void gtk_cmclist_column_titles_hide (GtkCMCList *clist);
470
471 /* set the column title to be a active title (responds to button presses, 
472  * prelights, and grabs keyboard focus), or passive where it acts as just
473  * a title
474  */
475 void gtk_cmclist_column_title_active   (GtkCMCList *clist,
476                                       gint      column);
477 void gtk_cmclist_column_title_passive  (GtkCMCList *clist,
478                                       gint      column);
479 void gtk_cmclist_column_titles_active  (GtkCMCList *clist);
480 void gtk_cmclist_column_titles_passive (GtkCMCList *clist);
481
482 /* set the title in the column title button */
483 void gtk_cmclist_set_column_title (GtkCMCList    *clist,
484                                  gint         column,
485                                  const gchar *title);
486
487 /* returns the title of column. Returns NULL if title is not set */
488 gchar * gtk_cmclist_get_column_title (GtkCMCList *clist,
489                                     gint      column);
490
491 /* set a widget instead of a title for the column title button */
492 void gtk_cmclist_set_column_widget (GtkCMCList  *clist,
493                                   gint       column,
494                                   GtkWidget *widget);
495
496 /* returns the column widget */
497 GtkWidget * gtk_cmclist_get_column_widget (GtkCMCList *clist,
498                                          gint      column);
499
500 /* set the justification on a column */
501 void gtk_cmclist_set_column_justification (GtkCMCList         *clist,
502                                          gint              column,
503                                          GtkJustification  justification);
504
505 /* set visibility of a column */
506 void gtk_cmclist_set_column_visibility (GtkCMCList *clist,
507                                       gint      column,
508                                       gboolean  visible);
509
510 /* enable/disable column resize operations by mouse */
511 void gtk_cmclist_set_column_resizeable (GtkCMCList *clist,
512                                       gint      column,
513                                       gboolean  resizeable);
514
515 /* resize column automatically to its optimal width */
516 void gtk_cmclist_set_column_auto_resize (GtkCMCList *clist,
517                                        gint      column,
518                                        gboolean  auto_resize);
519
520 gint gtk_cmclist_columns_autosize (GtkCMCList *clist);
521
522 /* return the optimal column width, i.e. maximum of all cell widths */
523 gint gtk_cmclist_optimal_column_width (GtkCMCList *clist,
524                                      gint      column);
525
526 /* set the pixel width of a column; this is a necessary step in
527  * creating a CList because otherwise the column width is chozen from
528  * the width of the column title, which will never be right
529  */
530 void gtk_cmclist_set_column_width (GtkCMCList *clist,
531                                  gint      column,
532                                  gint      width);
533
534 /* set column minimum/maximum width. min/max_width < 0 => no restriction */
535 void gtk_cmclist_set_column_min_width (GtkCMCList *clist,
536                                      gint      column,
537                                      gint      min_width);
538 void gtk_cmclist_set_column_max_width (GtkCMCList *clist,
539                                      gint      column,
540                                      gint      max_width);
541
542 /* change the height of the rows, the default (height=0) is
543  * the hight of the current font.
544  */
545 void gtk_cmclist_set_row_height (GtkCMCList *clist,
546                                guint     height);
547
548 /* scroll the viewing area of the list to the given column and row;
549  * row_align and col_align are between 0-1 representing the location the
550  * row should appear on the screnn, 0.0 being top or left, 1.0 being
551  * bottom or right; if row or column is -1 then then there is no change
552  */
553 void gtk_cmclist_moveto (GtkCMCList *clist,
554                        gint      row,
555                        gint      column,
556                        gfloat    row_align,
557                        gfloat    col_align);
558
559 /* returns whether the row is visible */
560 GtkVisibility gtk_cmclist_row_is_visible (GtkCMCList *clist,
561                                         gint      row);
562
563 /* returns the cell type */
564 GtkCMCellType gtk_cmclist_get_cell_type (GtkCMCList *clist,
565                                      gint      row,
566                                      gint      column);
567
568 /* sets a given cell's text, replacing its current contents */
569 void gtk_cmclist_set_text (GtkCMCList    *clist,
570                          gint         row,
571                          gint         column,
572                          const gchar *text);
573
574 /* for the "get" functions, any of the return pointer can be
575  * NULL if you are not interested
576  */
577 gint gtk_cmclist_get_text (GtkCMCList  *clist,
578                          gint       row,
579                          gint       column,
580                          gchar    **text);
581
582 /* sets a given cell's pixbuf, replacing its current contents */
583 void gtk_cmclist_set_pixbuf (GtkCMCList  *clist,
584                            gint       row,
585                            gint       column,
586                            GdkPixbuf *pixbuf);
587
588 gint gtk_cmclist_get_pixbuf (GtkCMCList   *clist,
589                            gint        row,
590                            gint        column,
591                            GdkPixbuf **pixbuf);
592
593 /* sets a given cell's pixbuf and text, replacing its current contents */
594 void gtk_cmclist_set_pixtext (GtkCMCList    *clist,
595                             gint         row,
596                             gint         column,
597                             const gchar *text,
598                             guint8       spacing,
599                             GdkPixbuf   *pixbuf);
600
601 gint gtk_cmclist_get_pixtext (GtkCMCList   *clist,
602                             gint        row,
603                             gint        column,
604                             gchar     **text,
605                             guint8     *spacing,
606                             GdkPixbuf **pixbuf);
607
608 /* sets the foreground color of a row, the color must already
609  * be allocated
610  */
611 void gtk_cmclist_set_foreground (GtkCMCList       *clist,
612                                gint            row,
613                                const GdkColor *color);
614
615 /* sets the background color of a row, the color must already
616  * be allocated
617  */
618 void gtk_cmclist_set_background (GtkCMCList       *clist,
619                                gint            row,
620                                const GdkColor *color);
621
622 /* set / get cell styles */
623 void gtk_cmclist_set_cell_style (GtkCMCList *clist,
624                                gint      row,
625                                gint      column,
626                                GtkStyle *style);
627
628 GtkStyle *gtk_cmclist_get_cell_style (GtkCMCList *clist,
629                                     gint      row,
630                                     gint      column);
631
632 void gtk_cmclist_set_row_style (GtkCMCList *clist,
633                               gint      row,
634                               GtkStyle *style);
635
636 GtkStyle *gtk_cmclist_get_row_style (GtkCMCList *clist,
637                                    gint      row);
638
639 /* this sets a horizontal and vertical shift for drawing
640  * the contents of a cell; it can be positive or negitive;
641  * this is particulary useful for indenting items in a column
642  */
643 void gtk_cmclist_set_shift (GtkCMCList *clist,
644                           gint      row,
645                           gint      column,
646                           gint      vertical,
647                           gint      horizontal);
648
649 /* set/get selectable flag of a single row */
650 void gtk_cmclist_set_selectable (GtkCMCList *clist,
651                                gint      row,
652                                gboolean  selectable);
653 gboolean gtk_cmclist_get_selectable (GtkCMCList *clist,
654                                    gint      row);
655
656 /* prepend/append returns the index of the row you just added,
657  * making it easier to append and modify a row
658  */
659 gint gtk_cmclist_prepend (GtkCMCList    *clist,
660                         gchar       *text[]);
661 gint gtk_cmclist_append  (GtkCMCList    *clist,
662                         gchar       *text[]);
663
664 /* inserts a row at index row and returns the row where it was
665  * actually inserted (may be different from "row" in auto_sort mode)
666  */
667 gint gtk_cmclist_insert (GtkCMCList    *clist,
668                        gint         row,
669                        gchar       *text[]);
670
671 /* removes row at index row */
672 void gtk_cmclist_remove (GtkCMCList *clist,
673                        gint      row);
674
675 /* sets a arbitrary data pointer for a given row */
676 void gtk_cmclist_set_row_data (GtkCMCList *clist,
677                              gint      row,
678                              gpointer  data);
679
680 /* sets a data pointer for a given row with destroy notification */
681 void gtk_cmclist_set_row_data_full (GtkCMCList         *clist,
682                                   gint              row,
683                                   gpointer          data,
684                                   GDestroyNotify  destroy);
685
686 /* returns the data set for a row */
687 gpointer gtk_cmclist_get_row_data (GtkCMCList *clist,
688                                  gint      row);
689
690 /* givin a data pointer, find the first (and hopefully only!)
691  * row that points to that data, or -1 if none do
692  */
693 gint gtk_cmclist_find_row_from_data (GtkCMCList *clist,
694                                    gpointer  data);
695
696 /* force selection of a row */
697 void gtk_cmclist_select_row (GtkCMCList *clist,
698                            gint      row,
699                            gint      column);
700
701 /* force unselection of a row */
702 void gtk_cmclist_unselect_row (GtkCMCList *clist,
703                              gint      row,
704                              gint      column);
705
706 /* undo the last select/unselect operation */
707 void gtk_cmclist_undo_selection (GtkCMCList *clist);
708
709 /* clear the entire list -- this is much faster than removing
710  * each item with gtk_cmclist_remove
711  */
712 void gtk_cmclist_clear (GtkCMCList *clist);
713
714 /* return the row column corresponding to the x and y coordinates,
715  * the returned values are only valid if the x and y coordinates
716  * are respectively to a window == clist->clist_window
717  */
718 gint gtk_cmclist_get_selection_info (GtkCMCList *clist,
719                                    gint      x,
720                                    gint      y,
721                                    gint     *row,
722                                    gint     *column);
723
724 /* in multiple or extended mode, select all rows */
725 void gtk_cmclist_select_all (GtkCMCList *clist);
726
727 /* in all modes except browse mode, deselect all rows */
728 void gtk_cmclist_unselect_all (GtkCMCList *clist);
729
730 /* swap the position of two rows */
731 void gtk_cmclist_swap_rows (GtkCMCList *clist,
732                           gint      row1,
733                           gint      row2);
734
735 /* move row from source_row position to dest_row position */
736 void gtk_cmclist_row_move (GtkCMCList *clist,
737                          gint      source_row,
738                          gint      dest_row);
739
740 /* sets a compare function different to the default */
741 void gtk_cmclist_set_compare_func (GtkCMCList            *clist,
742                                  GtkCMCListCompareFunc  cmp_func);
743
744 /* the column to sort by */
745 void gtk_cmclist_set_sort_column (GtkCMCList *clist,
746                                 gint      column);
747
748 /* how to sort : ascending or descending */
749 void gtk_cmclist_set_sort_type (GtkCMCList    *clist,
750                               GtkSortType  sort_type);
751
752 /* sort the list with the current compare function */
753 void gtk_cmclist_sort (GtkCMCList *clist);
754
755 /* Automatically sort upon insertion */
756 void gtk_cmclist_set_auto_sort (GtkCMCList *clist,
757                               gboolean  auto_sort);
758
759 /* Private function for clist, ctree */
760
761 PangoLayout *_gtk_cmclist_create_cell_layout (GtkCMCList       *clist,
762                                             GtkCMCListRow    *clist_row,
763                                             gint            column);
764
765
766 G_END_DECLS
767
768
769 #endif                          /* __GTK_CMCLIST_H__ */