fix #568: disable event "activate" handler for the range entry field. see the added...
[obnox/wireshark/wip.git] / gtk / ethclist.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  * $Id$
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22
23 /*
24  * Modified by the GTK+ Team and others 1997-1999.  See the AUTHORS
25  * file for a list of people on the GTK+ Team.  See the ChangeLog
26  * files for a list of changes.  These files are distributed with
27  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
28  */
29
30 /** @file
31  *  GtkCList for GTK1.2 lib versions, copied from GTK sources. 
32  *  @todo is this correct?
33  */
34
35 #ifndef __ETH_CLIST_H__
36 #define __ETH_CLIST_H__
37
38 #include <gdk/gdk.h>
39 #include <gtk/gtksignal.h>
40 #include <gtk/gtkalignment.h>
41 #include <gtk/gtklabel.h>
42 #include <gtk/gtkbutton.h>
43 #include <gtk/gtkhscrollbar.h>
44 #include <gtk/gtkvscrollbar.h>
45 #include <gtk/gtkenums.h>
46
47 #ifdef __cplusplus
48 extern "C" {
49 #endif /* __cplusplus */
50
51 /* clist flags */
52 enum {
53   ETH_CLIST_IN_DRAG             = 1 <<  0,
54   ETH_CLIST_ROW_HEIGHT_SET      = 1 <<  1,
55   ETH_CLIST_SHOW_TITLES         = 1 <<  2,
56   ETH_CLIST_CHILD_HAS_FOCUS     = 1 <<  3,
57   ETH_CLIST_ADD_MODE            = 1 <<  4,
58   ETH_CLIST_AUTO_SORT           = 1 <<  5,
59   ETH_CLIST_AUTO_RESIZE_BLOCKED = 1 <<  6,
60   ETH_CLIST_REORDERABLE         = 1 <<  7,
61   ETH_CLIST_USE_DRAG_ICONS      = 1 <<  8,
62   ETH_CLIST_DRAW_DRAG_LINE      = 1 <<  9,
63   ETH_CLIST_DRAW_DRAG_RECT      = 1 << 10
64 };
65
66 /* cell types */
67 typedef enum
68 {
69   ETH_CELL_EMPTY,
70   ETH_CELL_TEXT,
71   ETH_CELL_PIXMAP,
72   ETH_CELL_PIXTEXT,
73   ETH_CELL_WIDGET
74 } EthCellType;
75
76 typedef enum
77 {
78   ETH_CLIST_DRAG_NONE,
79   ETH_CLIST_DRAG_BEFORE,
80   ETH_CLIST_DRAG_INTO,
81   ETH_CLIST_DRAG_AFTER
82 } EthCListDragPos;
83
84 typedef enum
85 {
86   ETH_BUTTON_IGNORED = 0,
87   ETH_BUTTON_SELECTS = 1 << 0,
88   ETH_BUTTON_DRAGS   = 1 << 1,
89   ETH_BUTTON_EXPANDS = 1 << 2
90 } EthButtonAction;
91
92 extern GtkType eth_clist_type;
93 void init_eth_clist_type (void);
94
95 #define ETH_TYPE_CLIST            (eth_clist_type)
96 #define ETH_CLIST(obj)            (GTK_CHECK_CAST ((obj), ETH_TYPE_CLIST, EthCList))
97 #define ETH_CLIST_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), ETH_TYPE_CLIST, EthCListClass))
98 #define ETH_IS_CLIST(obj)         (GTK_CHECK_TYPE ((obj), ETH_TYPE_CLIST))
99 #define ETH_IS_CLIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), ETH_TYPE_CLIST))
100
101 #define ETH_CLIST_FLAGS(clist)             (ETH_CLIST (clist)->flags)
102 #define ETH_CLIST_SET_FLAG(clist,flag)     (ETH_CLIST_FLAGS (clist) |= (ETH_ ## flag))
103 #define ETH_CLIST_UNSET_FLAG(clist,flag)   (ETH_CLIST_FLAGS (clist) &= ~(ETH_ ## flag))
104
105 #define ETH_CLIST_IN_DRAG(clist)           (ETH_CLIST_FLAGS (clist) & ETH_CLIST_IN_DRAG)
106 #define ETH_CLIST_ROW_HEIGHT_SET(clist)    (ETH_CLIST_FLAGS (clist) & ETH_CLIST_ROW_HEIGHT_SET)
107 #define ETH_CLIST_SHOW_TITLES(clist)       (ETH_CLIST_FLAGS (clist) & ETH_CLIST_SHOW_TITLES)
108 #define ETH_CLIST_CHILD_HAS_FOCUS(clist)   (ETH_CLIST_FLAGS (clist) & ETH_CLIST_CHILD_HAS_FOCUS)
109 #define ETH_CLIST_ADD_MODE(clist)          (ETH_CLIST_FLAGS (clist) & ETH_CLIST_ADD_MODE)
110 #define ETH_CLIST_AUTO_SORT(clist)         (ETH_CLIST_FLAGS (clist) & ETH_CLIST_AUTO_SORT)
111 #define ETH_CLIST_AUTO_RESIZE_BLOCKED(clist) (ETH_CLIST_FLAGS (clist) & ETH_CLIST_AUTO_RESIZE_BLOCKED)
112 #define ETH_CLIST_REORDERABLE(clist)       (ETH_CLIST_FLAGS (clist) & ETH_CLIST_REORDERABLE)
113 #define ETH_CLIST_USE_DRAG_ICONS(clist)    (ETH_CLIST_FLAGS (clist) & ETH_CLIST_USE_DRAG_ICONS)
114 #define ETH_CLIST_DRAW_DRAG_LINE(clist)    (ETH_CLIST_FLAGS (clist) & ETH_CLIST_DRAW_DRAG_LINE)
115 #define ETH_CLIST_DRAW_DRAG_RECT(clist)    (ETH_CLIST_FLAGS (clist) & ETH_CLIST_DRAW_DRAG_RECT)
116
117 #define ETH_CLIST_ROW(_glist_) ((EthCListRow *)((_glist_)->data))
118
119 /* pointer casting for cells */
120 #define ETH_CELL_TEXT(cell)     (((EthCellText *) &(cell)))
121 #define ETH_CELL_PIXMAP(cell)   (((EthCellPixmap *) &(cell)))
122 #define ETH_CELL_PIXTEXT(cell)  (((EthCellPixText *) &(cell)))
123 #define ETH_CELL_WIDGET(cell)   (((EthCellWidget *) &(cell)))
124
125 typedef struct _EthCList EthCList;
126 typedef struct _EthCListClass EthCListClass;
127 typedef struct _EthCListColumn EthCListColumn;
128 typedef struct _EthCListRow EthCListRow;
129
130 typedef struct _EthCell EthCell;
131 typedef struct _EthCellText EthCellText;
132 typedef struct _EthCellPixmap EthCellPixmap;
133 typedef struct _EthCellPixText EthCellPixText;
134 typedef struct _EthCellWidget EthCellWidget;
135
136 typedef gint (*EthCListCompareFunc) (EthCList     *clist,
137                                      gconstpointer ptr1,
138                                      gconstpointer ptr2);
139
140 typedef struct _EthCListCellInfo EthCListCellInfo;
141 typedef struct _EthCListDestInfo EthCListDestInfo;
142
143 struct _EthCListCellInfo
144 {
145   gint row;
146   gint column;
147 };
148
149 struct _EthCListDestInfo
150 {
151   EthCListCellInfo cell;
152   EthCListDragPos  insert_pos;
153 };
154
155 struct _EthCList
156 {
157   GtkContainer container;
158
159   guint16 flags;
160
161   /* mem chunks */
162   GMemChunk *row_mem_chunk;
163   GMemChunk *cell_mem_chunk;
164
165   guint freeze_count;
166
167   /* allocation rectangle after the conatiner_border_width
168    * and the width of the shadow border */
169   GdkRectangle internal_allocation;
170
171   /* rows */
172   gint rows;
173   gint row_center_offset;
174   gint row_height;
175   GList *row_list;
176   GList *row_list_end;
177
178   /* columns */
179   gint columns;
180   GdkRectangle column_title_area;
181   GdkWindow *title_window;
182
183   /* dynamicly allocated array of column structures */
184   EthCListColumn *column;
185
186   /* the scrolling window and its height and width to
187    * make things a little speedier */
188   GdkWindow *clist_window;
189   gint clist_window_width;
190   gint clist_window_height;
191
192   /* offsets for scrolling */
193   gint hoffset;
194   gint voffset;
195
196   /* border shadow style */
197   GtkShadowType shadow_type;
198
199   /* the list's selection mode (gtkenums.h) */
200   GtkSelectionMode selection_mode;
201
202   /* list of selected rows */
203   GList *selection;
204   GList *selection_end;
205
206   GList *undo_selection;
207   GList *undo_unselection;
208   gint undo_anchor;
209
210   /* mouse buttons */
211   guint8 button_actions[5];
212
213   guint8 drag_button;
214
215   /* dnd */
216   EthCListCellInfo click_cell;
217
218   /* scroll adjustments */
219   GtkAdjustment *hadjustment;
220   GtkAdjustment *vadjustment;
221
222   /* xor GC for the vertical drag line */
223   GdkGC *xor_gc;
224
225   /* gc for drawing unselected cells */
226   GdkGC *fg_gc;
227   GdkGC *bg_gc;
228
229   /* cursor used to indicate dragging */
230   GdkCursor *cursor_drag;
231
232   /* the current x-pixel location of the xor-drag line */
233   gint x_drag;
234
235   /* focus handling */
236   gint focus_row;
237
238   /* dragging the selection */
239   gint anchor;
240   GtkStateType anchor_state;
241   gint drag_pos;
242   gint htimer;
243   gint vtimer;
244
245   GtkSortType sort_type;
246   EthCListCompareFunc compare;
247   gint sort_column;
248 };
249
250 struct _EthCListClass
251 {
252   GtkContainerClass parent_class;
253
254   void  (*set_scroll_adjustments) (EthCList       *clist,
255                                    GtkAdjustment  *hadjustment,
256                                    GtkAdjustment  *vadjustment);
257   void   (*refresh)             (EthCList       *clist);
258   void   (*select_row)          (EthCList       *clist,
259                                  gint            row,
260                                  gint            column,
261                                  GdkEvent       *event);
262   void   (*unselect_row)        (EthCList       *clist,
263                                  gint            row,
264                                  gint            column,
265                                  GdkEvent       *event);
266   void   (*row_move)            (EthCList       *clist,
267                                  gint            source_row,
268                                  gint            dest_row);
269   void   (*click_column)        (EthCList       *clist,
270                                  gint            column);
271   void   (*resize_column)       (EthCList       *clist,
272                                  gint            column,
273                                  gint            width);
274   void   (*toggle_focus_row)    (EthCList       *clist);
275   void   (*select_all)          (EthCList       *clist);
276   void   (*unselect_all)        (EthCList       *clist);
277   void   (*undo_selection)      (EthCList       *clist);
278   void   (*start_selection)     (EthCList       *clist);
279   void   (*end_selection)       (EthCList       *clist);
280   void   (*extend_selection)    (EthCList       *clist,
281                                  GtkScrollType   scroll_type,
282                                  gfloat          position,
283                                  gboolean        auto_start_selection);
284   void   (*scroll_horizontal)   (EthCList       *clist,
285                                  GtkScrollType   scroll_type,
286                                  gfloat          position);
287   void   (*scroll_vertical)     (EthCList       *clist,
288                                  GtkScrollType   scroll_type,
289                                  gfloat          position);
290   void   (*toggle_add_mode)     (EthCList       *clist);
291   void   (*abort_column_resize) (EthCList       *clist);
292   void   (*resync_selection)    (EthCList       *clist,
293                                  GdkEvent       *event);
294   GList* (*selection_find)      (EthCList       *clist,
295                                  gint            row_number,
296                                  GList          *row_list_element);
297   void   (*draw_row)            (EthCList       *clist,
298                                  GdkRectangle   *area,
299                                  gint            row,
300                                  EthCListRow    *clist_row);
301   void   (*draw_drag_highlight) (EthCList        *clist,
302                                  EthCListRow     *target_row,
303                                  gint             target_row_number,
304                                  EthCListDragPos  drag_pos);
305   void   (*clear)               (EthCList       *clist);
306   void   (*fake_unselect_all)   (EthCList       *clist,
307                                  gint            row);
308   void   (*sort_list)           (EthCList       *clist);
309   gint   (*insert_row)          (EthCList       *clist,
310                                  gint            row,
311                                  gchar          *text[]);
312   void   (*remove_row)          (EthCList       *clist,
313                                  gint            row);
314   void   (*set_cell_contents)   (EthCList       *clist,
315                                  EthCListRow    *clist_row,
316                                  gint            column,
317                                  EthCellType     type,
318                                  const gchar    *text,
319                                  guint8          spacing,
320                                  GdkPixmap      *pixmap,
321                                  GdkBitmap      *mask);
322   void   (*cell_size_request)   (EthCList       *clist,
323                                  EthCListRow    *clist_row,
324                                  gint            column,
325                                  GtkRequisition *requisition);
326
327 };
328
329 struct _EthCListColumn
330 {
331   gchar *title;
332   GdkRectangle area;
333
334   GtkWidget *button;
335   GdkWindow *window;
336
337   gint width;
338   gint min_width;
339   gint max_width;
340   GtkJustification justification;
341
342   guint visible        : 1;
343   guint width_set      : 1;
344   guint resizeable     : 1;
345   guint auto_resize    : 1;
346   guint button_passive : 1;
347 };
348
349 struct _EthCListRow
350 {
351   EthCell *cell;
352   GtkStateType state;
353
354   GdkColor foreground;
355   GdkColor background;
356
357   GtkStyle *style;
358
359   gpointer data;
360   GtkDestroyNotify destroy;
361
362   guint fg_set     : 1;
363   guint bg_set     : 1;
364   guint selectable : 1;
365 };
366
367 /* Cell Structures */
368 struct _EthCellText
369 {
370   EthCellType type;
371
372   gint16 vertical;
373   gint16 horizontal;
374
375   GtkStyle *style;
376
377   gchar *text;
378 };
379
380 struct _EthCellPixmap
381 {
382   EthCellType type;
383
384   gint16 vertical;
385   gint16 horizontal;
386
387   GtkStyle *style;
388
389   GdkPixmap *pixmap;
390   GdkBitmap *mask;
391 };
392
393 struct _EthCellPixText
394 {
395   EthCellType type;
396
397   gint16 vertical;
398   gint16 horizontal;
399
400   GtkStyle *style;
401
402   gchar *text;
403   guint8 spacing;
404   GdkPixmap *pixmap;
405   GdkBitmap *mask;
406 };
407
408 struct _EthCellWidget
409 {
410   EthCellType type;
411
412   gint16 vertical;
413   gint16 horizontal;
414
415   GtkStyle *style;
416
417   GtkWidget *widget;
418 };
419
420 struct _EthCell
421 {
422   EthCellType type;
423
424   gint16 vertical;
425   gint16 horizontal;
426
427   GtkStyle *style;
428
429   union {
430     gchar *text;
431
432     struct {
433       GdkPixmap *pixmap;
434       GdkBitmap *mask;
435     } pm;
436
437     struct {
438       gchar *text;
439       guint8 spacing;
440       GdkPixmap *pixmap;
441       GdkBitmap *mask;
442     } pt;
443
444     GtkWidget *widget;
445   } u;
446 };
447
448 /* constructors useful for gtk-- wrappers */
449 void eth_clist_construct (EthCList *clist,
450                           gint      columns,
451                           gchar    *titles[]);
452
453 /* create a new EthCList */
454 GtkWidget* eth_clist_new             (gint   columns);
455 GtkWidget* eth_clist_new_with_titles (gint   columns,
456                                       gchar *titles[]);
457
458 /* set adjustments of clist */
459 void eth_clist_set_hadjustment (EthCList      *clist,
460                                 GtkAdjustment *adjustment);
461 void eth_clist_set_vadjustment (EthCList      *clist,
462                                 GtkAdjustment *adjustment);
463
464 /* get adjustments of clist */
465 GtkAdjustment* eth_clist_get_hadjustment (EthCList *clist);
466 GtkAdjustment* eth_clist_get_vadjustment (EthCList *clist);
467
468 /* set the border style of the clist */
469 void eth_clist_set_shadow_type (EthCList      *clist,
470                                 GtkShadowType  type);
471
472 /* set the clist's selection mode */
473 void eth_clist_set_selection_mode (EthCList         *clist,
474                                    GtkSelectionMode  mode);
475
476 /* enable clists reorder ability */
477 void eth_clist_set_reorderable (EthCList *clist,
478                                 gboolean  reorderable);
479 void eth_clist_set_use_drag_icons (EthCList *clist,
480                                    gboolean  use_icons);
481 void eth_clist_set_button_actions (EthCList *clist,
482                                    guint     button,
483                                    guint8    button_actions);
484
485 /* freeze all visual updates of the list, and then thaw the list after
486  * you have made a number of changes and the updates wil occure in a
487  * more efficent mannor than if you made them on a unfrozen list
488  */
489 void eth_clist_freeze (EthCList *clist);
490 void eth_clist_thaw   (EthCList *clist);
491
492 /* show and hide the column title buttons */
493 void eth_clist_column_titles_show (EthCList *clist);
494 void eth_clist_column_titles_hide (EthCList *clist);
495
496 /* set the column title to be a active title (responds to button presses,
497  * prelights, and grabs keyboard focus), or passive where it acts as just
498  * a title
499  */
500 void eth_clist_column_title_active   (EthCList *clist,
501                                       gint      column);
502 void eth_clist_column_title_passive  (EthCList *clist,
503                                       gint      column);
504 void eth_clist_column_titles_active  (EthCList *clist);
505 void eth_clist_column_titles_passive (EthCList *clist);
506
507 /* set the title in the column title button */
508 void eth_clist_set_column_title (EthCList    *clist,
509                                  gint         column,
510                                  const gchar *title);
511
512 /* returns the title of column. Returns NULL if title is not set */
513 gchar * eth_clist_get_column_title (EthCList *clist,
514                                     gint      column);
515
516 /* set a widget instead of a title for the column title button */
517 void eth_clist_set_column_widget (EthCList  *clist,
518                                   gint       column,
519                                   GtkWidget *widget);
520
521 /* returns the column widget */
522 GtkWidget * eth_clist_get_column_widget (EthCList *clist,
523                                          gint      column);
524
525 /* set the justification on a column */
526 void eth_clist_set_column_justification (EthCList         *clist,
527                                          gint              column,
528                                          GtkJustification  justification);
529
530 /* set visibility of a column */
531 void eth_clist_set_column_visibility (EthCList *clist,
532                                       gint      column,
533                                       gboolean  visible);
534
535 /* enable/disable column resize operations by mouse */
536 void eth_clist_set_column_resizeable (EthCList *clist,
537                                       gint      column,
538                                       gboolean  resizeable);
539
540 /* resize column automatically to its optimal width */
541 void eth_clist_set_column_auto_resize (EthCList *clist,
542                                        gint      column,
543                                        gboolean  auto_resize);
544
545 gint eth_clist_columns_autosize (EthCList *clist);
546
547 /* return the optimal column width, i.e. maximum of all cell widths */
548 gint eth_clist_optimal_column_width (EthCList *clist,
549                                      gint      column);
550
551 /* set the pixel width of a column; this is a necessary step in
552  * creating a CList because otherwise the column width is chozen from
553  * the width of the column title, which will never be right
554  */
555 void eth_clist_set_column_width (EthCList *clist,
556                                  gint      column,
557                                  gint      width);
558
559 /* set column minimum/maximum width. min/max_width < 0 => no restriction */
560 void eth_clist_set_column_min_width (EthCList *clist,
561                                      gint      column,
562                                      gint      min_width);
563 void eth_clist_set_column_max_width (EthCList *clist,
564                                      gint      column,
565                                      gint      max_width);
566
567 /* change the height of the rows, the default (height=0) is
568  * the hight of the current font.
569  */
570 void eth_clist_set_row_height (EthCList *clist,
571                                guint     height);
572
573 /* scroll the viewing area of the list to the given column and row;
574  * row_align and col_align are between 0-1 representing the location the
575  * row should appear on the screnn, 0.0 being top or left, 1.0 being
576  * bottom or right; if row or column is -1 then then there is no change
577  */
578 void eth_clist_moveto (EthCList *clist,
579                        gint      row,
580                        gint      column,
581                        gfloat    row_align,
582                        gfloat    col_align);
583
584 /* returns whether the row is visible */
585 GtkVisibility eth_clist_row_is_visible (EthCList *clist,
586                                         gint      row);
587
588 /* returns the cell type */
589 EthCellType eth_clist_get_cell_type (EthCList *clist,
590                                      gint      row,
591                                      gint      column);
592
593 /* sets a given cell's text, replacing its current contents */
594 void eth_clist_set_text (EthCList    *clist,
595                          gint         row,
596                          gint         column,
597                          const gchar *text);
598
599 /* for the "get" functions, any of the return pointer can be
600  * NULL if you are not interested
601  */
602 gint eth_clist_get_text (EthCList  *clist,
603                          gint       row,
604                          gint       column,
605                          gchar    **text);
606
607 /* sets a given cell's pixmap, replacing its current contents */
608 void eth_clist_set_pixmap (EthCList  *clist,
609                            gint       row,
610                            gint       column,
611                            GdkPixmap *pixmap,
612                            GdkBitmap *mask);
613
614 gint eth_clist_get_pixmap (EthCList   *clist,
615                            gint        row,
616                            gint        column,
617                            GdkPixmap **pixmap,
618                            GdkBitmap **mask);
619
620 /* sets a given cell's pixmap and text, replacing its current contents */
621 void eth_clist_set_pixtext (EthCList    *clist,
622                             gint         row,
623                             gint         column,
624                             const gchar *text,
625                             guint8       spacing,
626                             GdkPixmap   *pixmap,
627                             GdkBitmap   *mask);
628
629 gint eth_clist_get_pixtext (EthCList   *clist,
630                             gint        row,
631                             gint        column,
632                             gchar     **text,
633                             guint8     *spacing,
634                             GdkPixmap **pixmap,
635                             GdkBitmap **mask);
636
637 /* sets the foreground color of a row, the color must already
638  * be allocated
639  */
640 void eth_clist_set_foreground (EthCList *clist,
641                                gint      row,
642                                GdkColor *color);
643
644 /* sets the background color of a row, the color must already
645  * be allocated
646  */
647 void eth_clist_set_background (EthCList *clist,
648                                gint      row,
649                                GdkColor *color);
650
651 /* set / get cell styles */
652 void eth_clist_set_cell_style (EthCList *clist,
653                                gint      row,
654                                gint      column,
655                                GtkStyle *style);
656
657 GtkStyle *eth_clist_get_cell_style (EthCList *clist,
658                                     gint      row,
659                                     gint      column);
660
661 void eth_clist_set_row_style (EthCList *clist,
662                               gint      row,
663                               GtkStyle *style);
664
665 GtkStyle *eth_clist_get_row_style (EthCList *clist,
666                                    gint      row);
667
668 /* this sets a horizontal and vertical shift for drawing
669  * the contents of a cell; it can be positive or negitive;
670  * this is particulary useful for indenting items in a column
671  */
672 void eth_clist_set_shift (EthCList *clist,
673                           gint      row,
674                           gint      column,
675                           gint      vertical,
676                           gint      horizontal);
677
678 /* set/get selectable flag of a single row */
679 void eth_clist_set_selectable (EthCList *clist,
680                                gint      row,
681                                gboolean  selectable);
682 gboolean eth_clist_get_selectable (EthCList *clist,
683                                    gint      row);
684
685 /* prepend/append returns the index of the row you just added,
686  * making it easier to append and modify a row
687  */
688 gint eth_clist_prepend (EthCList    *clist,
689                         gchar       *text[]);
690 gint eth_clist_append  (EthCList    *clist,
691                         gchar       *text[]);
692
693 /* inserts a row at index row and returns the row where it was
694  * actually inserted (may be different from "row" in auto_sort mode)
695  */
696 gint eth_clist_insert (EthCList    *clist,
697                        gint         row,
698                        gchar       *text[]);
699
700 /* removes row at index row */
701 void eth_clist_remove (EthCList *clist,
702                        gint      row);
703
704 /* sets a arbitrary data pointer for a given row */
705 void eth_clist_set_row_data (EthCList *clist,
706                              gint      row,
707                              gpointer  data);
708
709 /* sets a data pointer for a given row with destroy notification */
710 void eth_clist_set_row_data_full (EthCList         *clist,
711                                   gint              row,
712                                   gpointer          data,
713                                   GtkDestroyNotify  destroy);
714
715 /* returns the data set for a row */
716 gpointer eth_clist_get_row_data (EthCList *clist,
717                                  gint      row);
718
719 /* givin a data pointer, find the first (and hopefully only!)
720  * row that points to that data, or -1 if none do
721  */
722 gint eth_clist_find_row_from_data (EthCList *clist,
723                                    gpointer  data);
724
725 /* force selection of a row */
726 void eth_clist_select_row (EthCList *clist,
727                            gint      row,
728                            gint      column);
729
730 /* force unselection of a row */
731 void eth_clist_unselect_row (EthCList *clist,
732                              gint      row,
733                              gint      column);
734
735 /* undo the last select/unselect operation */
736 void eth_clist_undo_selection (EthCList *clist);
737
738 /* clear the entire list -- this is much faster than removing
739  * each item with eth_clist_remove
740  */
741 void eth_clist_clear (EthCList *clist);
742
743 /* return the row column corresponding to the x and y coordinates,
744  * the returned values are only valid if the x and y coordinates
745  * are respectively to a window == clist->clist_window
746  */
747 gint eth_clist_get_selection_info (EthCList *clist,
748                                    gint      x,
749                                    gint      y,
750                                    gint     *row,
751                                    gint     *column);
752
753 /* in multiple or extended mode, select all rows */
754 void eth_clist_select_all (EthCList *clist);
755
756 /* in all modes except browse mode, deselect all rows */
757 void eth_clist_unselect_all (EthCList *clist);
758
759 /* swap the position of two rows */
760 void eth_clist_swap_rows (EthCList *clist,
761                           gint      row1,
762                           gint      row2);
763
764 /* move row from source_row position to dest_row position */
765 void eth_clist_row_move (EthCList *clist,
766                          gint      source_row,
767                          gint      dest_row);
768
769 /* sets a compare function different to the default */
770 void eth_clist_set_compare_func (EthCList            *clist,
771                                  EthCListCompareFunc  cmp_func);
772
773 /* the column to sort by */
774 void eth_clist_set_sort_column (EthCList *clist,
775                                 gint      column);
776
777 /* how to sort : ascending or descending */
778 void eth_clist_set_sort_type (EthCList    *clist,
779                               GtkSortType  sort_type);
780
781 /* sort the list with the current compare function */
782 void eth_clist_sort (EthCList *clist);
783
784 /* Automatically sort upon insertion */
785 void eth_clist_set_auto_sort (EthCList *clist,
786                               gboolean  auto_sort);
787
788
789 #ifdef __cplusplus
790 }
791 #endif                          /* __cplusplus */
792
793 #endif                          /* __ETH_CLIST_H__ */