2005-10-18 [colin] 1.9.15cvs72
[claws.git] / src / gtk / gtksctree.h
1 /* Mail Summary tree widget for Sylpheed */
2
3 #ifndef __GTK_SCTREE_H__
4 #define __GTK_SCTREE_H__
5
6 #include <gtk/gtk.h>
7 #include <gtk/gtkclist.h>
8 #include <gtk/gtkctree.h>
9
10 /* This code is based on "gtkflist.{h,c}" from mc-4.5.42 .*/
11
12 #define TYPE_GTK_SCTREE                 (gtk_sctree_get_type ())
13 #define GTK_SCTREE(obj)                 (GTK_CHECK_CAST ((obj), TYPE_GTK_SCTREE, GtkSCTree))
14 #define GTK_SCTREE_CLASS(klass)         (GTK_CHECK_CLASS_CAST ((klass), TYPE_GTK_SCTREE, GtkSCTreeClass))
15 #define GTK_IS_SCTREE(obj)              (GTK_CHECK_TYPE ((obj), TYPE_GTK_SCTREE))
16 #define GTK_IS_SCTREE_CLASS(klass)      (GTK_CHECK_CLASS_TYPE ((klass), TYPE_GTK_SCTREE))
17
18
19 typedef struct _GtkSCTree GtkSCTree;
20 typedef struct _GtkSCTreeClass GtkSCTreeClass;
21
22 struct _GtkSCTree {
23         GtkCTree ctree;
24
25         /* The anchor row for range selections */
26         GtkCTreeNode *anchor_row;
27
28         /* Mouse button and position saved on button press */
29         gint dnd_press_button;
30         gint dnd_press_x, dnd_press_y;
31
32         /* Delayed selection information */
33         gint dnd_select_pending;
34         guint dnd_select_pending_state;
35         gint dnd_select_pending_row;
36         gboolean selecting_range;
37 };
38
39 struct _GtkSCTreeClass {
40         GtkCTreeClass parent_class;
41     
42         /* Signal: invoke the popup menu for rows */
43         void (* row_popup_menu) (GtkSCTree *sctree, GdkEventButton *event);
44     
45         /* Signal: invoke the popup menu for empty areas */
46         void (* empty_popup_menu) (GtkSCTree *sctree, GdkEventButton *event);
47
48         /* Signal: open the file in the selected row */
49         void (* open_row) (GtkSCTree *sctree);
50
51         /* Signal: initiate a drag and drop operation */
52         void (* start_drag) (GtkSCTree *sctree, gint button, GdkEvent *event);
53 };
54
55
56 GType gtk_sctree_get_type (void);
57
58 GtkWidget *gtk_sctree_new_with_titles   (gint            columns, 
59                                          gint            tree_column, 
60                                          gchar          *titles[]);
61 void gtk_sctree_select                  (GtkSCTree      *sctree,
62                                          GtkCTreeNode   *node);
63 void gtk_sctree_select_with_state       (GtkSCTree      *sctree,
64                                          GtkCTreeNode   *node,
65                                          int             state);
66 void gtk_sctree_unselect_all            (GtkSCTree      *sctree);
67
68 void gtk_sctree_set_anchor_row          (GtkSCTree      *sctree,
69                                          GtkCTreeNode   *node);
70
71 /***********************************************************
72  *             Tree sorting functions                      *
73  ***********************************************************/
74
75 void gtk_sctree_sort_node (GtkCTree *ctree, GtkCTreeNode *node);
76
77 void gtk_sctree_sort_recursive (GtkCTree *ctree, GtkCTreeNode *node);
78
79 GtkCTreeNode* gtk_sctree_insert_node        (GtkCTree *ctree,
80                                              GtkCTreeNode *parent,
81                                              GtkCTreeNode *sibling,
82                                              gchar *text[],
83                                              guint8 spacing,
84                                              GdkPixmap *pixmap_closed,
85                                              GdkBitmap *mask_closed,
86                                              GdkPixmap *pixmap_opened,
87                                              GdkBitmap *mask_opened,
88                                              gboolean is_leaf,
89                                              gboolean expanded);
90 void        gtk_sctree_set_node_info        (GtkCTree *ctree,
91                                              GtkCTreeNode *node,
92                                              const gchar *text,
93                                              guint8 spacing,
94                                              GdkPixmap *pixmap_closed,
95                                              GdkBitmap *mask_closed,
96                                              GdkPixmap *pixmap_opened,
97                                              GdkBitmap *mask_opened,
98                                              gboolean is_leaf,
99                                              gboolean expanded);
100
101 #endif /* __GTK_SCTREE_H__ */