0.8.8claws33
[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 };
37
38 struct _GtkSCTreeClass {
39         GtkCTreeClass parent_class;
40     
41         /* Signal: invoke the popup menu for rows */
42         void (* row_popup_menu) (GtkSCTree *sctree, GdkEventButton *event);
43     
44         /* Signal: invoke the popup menu for empty areas */
45         void (* empty_popup_menu) (GtkSCTree *sctree, GdkEventButton *event);
46
47         /* Signal: open the file in the selected row */
48         void (* open_row) (GtkSCTree *sctree);
49
50         /* Signal: initiate a drag and drop operation */
51         void (* start_drag) (GtkSCTree *sctree, gint button, GdkEvent *event);
52 };
53
54
55 GtkType gtk_sctree_get_type (void);
56
57 GtkWidget *gtk_sctree_new_with_titles   (gint            columns, 
58                                          gint            tree_column, 
59                                          gchar          *titles[]);
60 void gtk_sctree_select                  (GtkSCTree      *sctree,
61                                          GtkCTreeNode   *node);
62 void gtk_sctree_unselect_all            (GtkSCTree      *sctree);
63
64 void gtk_sctree_set_anchor_row          (GtkSCTree      *sctree,
65                                          GtkCTreeNode   *node);
66
67 /***********************************************************
68  *             Tree sorting functions                      *
69  ***********************************************************/
70
71 void gtk_sctree_sort_node (GtkCTree *ctree, GtkCTreeNode *node);
72
73 void gtk_sctree_sort_recursive (GtkCTree *ctree, GtkCTreeNode *node);
74
75 #endif /* __GTK_SCTREE_H__ */