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