comparison console/libgnt/gnttree.h @ 13850:0e1e59770cb0

[gaim-migrate @ 16308] This is my first commit here. So don't yell at me if things get borked. Also, I haven't looked at the auto-thingies yet. So don't puke at the Makefiles. Files in console/libgnt/ are for the 'Gaim/GObjectified Ncurses Toolkit' library. Files in console/ uses libgaim and libgnt. Currently, only the buddylist-ui is 'functional', ie. the buddy-list updates when someone logs on or logs off. It still needs a lot of work. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 22 Jun 2006 08:33:54 +0000
parents
children a4c30c1d9de8
comparison
equal deleted inserted replaced
13849:8d1c55309e3c 13850:0e1e59770cb0
1 #ifndef GNT_TREE_H
2 #define GNT_TREE_H
3
4 #include "gntwidget.h"
5 #include "gnt.h"
6 #include "gntcolors.h"
7 #include "gntkeys.h"
8
9 #define GNT_TYPE_TREE (gnt_tree_get_gtype())
10 #define GNT_TREE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_TREE, GntTree))
11 #define GNT_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_TREE, GntTreeClass))
12 #define GNT_IS_TREE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_TREE))
13 #define GNT_IS_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_TREE))
14 #define GNT_TREE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_TREE, GntTreeClass))
15
16 #define GNT_TREE_FLAGS(obj) (GNT_TREE(obj)->priv.flags)
17 #define GNT_TREE_SET_FLAGS(obj, flags) (GNT_TREE_FLAGS(obj) |= flags)
18 #define GNT_TREE_UNSET_FLAGS(obj, flags) (GNT_TREE_FLAGS(obj) &= ~(flags))
19
20 typedef struct _GnTree GntTree;
21 typedef struct _GnTreePriv GntTreePriv;
22 typedef struct _GnTreeClass GntTreeClass;
23
24 typedef struct _GnTreeRow GntTreeRow;
25
26 struct _GnTree
27 {
28 GntWidget parent;
29
30 WINDOW *scroll;
31
32 int current; /* current selection */
33
34 int top; /* The index in 'list' of the topmost visible item */
35 int bottom; /* The index in 'list' of the bottommost visible item */
36
37 GntTreeRow *root; /* The root of all evil */
38
39 GList *list; /* List of GntTreeRow s */
40 GHashTable *hash; /* XXX: We may need this for quickly referencing the rows */
41 };
42
43 struct _GnTreeClass
44 {
45 GntWidgetClass parent;
46
47 void (*gnt_reserved1)(void);
48 void (*gnt_reserved2)(void);
49 void (*gnt_reserved3)(void);
50 void (*gnt_reserved4)(void);
51 };
52
53 G_BEGIN_DECLS
54
55 GType gnt_tree_get_gtype(void);
56
57 GntWidget *gnt_tree_new();
58
59 void gnt_tree_set_visible_rows(GntTree *tree, int rows);
60
61 int gnt_tree_get_visible_rows(GntTree *tree);
62
63 void gnt_tree_scroll(GntTree *tree, int count);
64
65 void gnt_tree_add_row_after(GntTree *tree, void *key, const char *text, void *parent, void *bigbro);
66
67 gpointer gnt_tree_get_selection_data(GntTree *tree);
68
69 int gnt_tree_get_selection_index(GntTree *tree);
70
71 void gnt_tree_remove(GntTree *tree, gpointer key);
72
73 G_END_DECLS
74
75 #endif /* GNT_TREE_H */