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