2007-04-23 [colin] 2.9.1cvs17
[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         gint selecting_range;
37         gboolean sorting;
38
39         /* (dis)allow fancy color stripes */
40         gboolean show_stripes;
41         GtkTooltips *tips;
42         gboolean always_expand_recursively;
43         gboolean force_additive_sel;
44 };
45
46 struct _GtkSCTreeClass {
47         GtkCTreeClass parent_class;
48     
49         /* Signal: invoke the popup menu for rows */
50         void (* row_popup_menu) (GtkSCTree *sctree, GdkEventButton *event);
51     
52         /* Signal: invoke the popup menu for empty areas */
53         void (* empty_popup_menu) (GtkSCTree *sctree, GdkEventButton *event);
54
55         /* Signal: open the file in the selected row */
56         void (* open_row) (GtkSCTree *sctree);
57
58         /* Signal: initiate a drag and drop operation */
59         void (* start_drag) (GtkSCTree *sctree, gint button, GdkEvent *event);
60 };
61
62
63 GType gtk_sctree_get_type (void);
64
65 GtkWidget *gtk_sctree_new_with_titles   (gint            columns, 
66                                          gint            tree_column, 
67                                          gchar          *titles[]);
68 void gtk_sctree_select                  (GtkSCTree      *sctree,
69                                          GtkCTreeNode   *node);
70 void gtk_sctree_select_with_state       (GtkSCTree      *sctree,
71                                          GtkCTreeNode   *node,
72                                          int             state);
73 void gtk_sctree_unselect_all            (GtkSCTree      *sctree);
74
75 void gtk_sctree_set_anchor_row          (GtkSCTree      *sctree,
76                                          GtkCTreeNode   *node);
77
78 void gtk_sctree_remove_node             (GtkSCTree      *sctree,
79                                          GtkCTreeNode   *node);
80
81 void gtk_sctree_set_stripes(GtkSCTree  *sctree, gboolean show_stripes);
82 void gtk_sctree_set_recursive_expand(GtkSCTree  *sctree, gboolean rec_exp);
83
84 /***********************************************************
85  *             Tree sorting functions                      *
86  ***********************************************************/
87
88 void gtk_sctree_sort_node (GtkCTree *ctree, GtkCTreeNode *node);
89
90 void gtk_sctree_sort_recursive (GtkCTree *ctree, GtkCTreeNode *node);
91
92 GtkCTreeNode* gtk_sctree_insert_node        (GtkCTree *ctree,
93                                              GtkCTreeNode *parent,
94                                              GtkCTreeNode *sibling,
95                                              gchar *text[],
96                                              guint8 spacing,
97                                              GdkPixmap *pixmap_closed,
98                                              GdkBitmap *mask_closed,
99                                              GdkPixmap *pixmap_opened,
100                                              GdkBitmap *mask_opened,
101                                              gboolean is_leaf,
102                                              gboolean expanded);
103 void        gtk_sctree_set_node_info        (GtkCTree *ctree,
104                                              GtkCTreeNode *node,
105                                              const gchar *text,
106                                              guint8 spacing,
107                                              GdkPixmap *pixmap_closed,
108                                              GdkBitmap *mask_closed,
109                                              GdkPixmap *pixmap_opened,
110                                              GdkBitmap *mask_opened,
111                                              gboolean is_leaf,
112                                              gboolean expanded);
113 GtkCTreeNode *
114 gtk_sctree_insert_gnode                     (GtkCTree          *ctree,
115                                              GtkCTreeNode      *parent,
116                                              GtkCTreeNode      *sibling,
117                                              GNode             *gnode,
118                                              GtkCTreeGNodeFunc  func,
119                                              gpointer           data);
120
121 void gtk_sctree_set_column_tooltip          (GtkSCTree          *sctree,
122                                              int                 column,
123                                              const gchar        *tip);
124 #endif /* __GTK_SCTREE_H__ */