Mercurial > pidgin
annotate finch/libgnt/gnttree.h @ 16493:e40d216f1368
merge of '723918ad23d423582cf7442116a810b6a2eb16d4'
and '74b5097c85b1bba90e2508d4d5a477306a49704e'
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Fri, 27 Apr 2007 04:04:31 +0000 |
parents | 790d1d003825 |
children | 8410511f4dbb |
rev | line source |
---|---|
15817 | 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 #include "gnttextview.h" | |
9 | |
10 #define GNT_TYPE_TREE (gnt_tree_get_gtype()) | |
11 #define GNT_TREE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_TREE, GntTree)) | |
12 #define GNT_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_TREE, GntTreeClass)) | |
13 #define GNT_IS_TREE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_TREE)) | |
14 #define GNT_IS_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_TREE)) | |
15 #define GNT_TREE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_TREE, GntTreeClass)) | |
16 | |
17 #define GNT_TREE_FLAGS(obj) (GNT_TREE(obj)->priv.flags) | |
18 #define GNT_TREE_SET_FLAGS(obj, flags) (GNT_TREE_FLAGS(obj) |= flags) | |
19 #define GNT_TREE_UNSET_FLAGS(obj, flags) (GNT_TREE_FLAGS(obj) &= ~(flags)) | |
20 | |
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
21 typedef struct _GntTree GntTree; |
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
22 typedef struct _GntTreePriv GntTreePriv; |
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
23 typedef struct _GntTreeClass GntTreeClass; |
15817 | 24 |
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
25 typedef struct _GntTreeRow GntTreeRow; |
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
26 typedef struct _GntTreeCol GntTreeCol; |
15817 | 27 |
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
28 struct _GntTree |
15817 | 29 { |
30 GntWidget parent; | |
31 | |
32 GntTreeRow *current; /* current selection */ | |
33 | |
34 GntTreeRow *top; /* The topmost visible item */ | |
35 GntTreeRow *bottom; /* The bottommost visible item */ | |
36 | |
37 GntTreeRow *root; /* The root of all evil */ | |
38 | |
39 GList *list; /* List of GntTreeRow s */ | |
40 GHashTable *hash; /* We need this for quickly referencing the rows */ | |
41 guint (*hash_func)(gconstpointer); | |
42 gboolean (*hash_eq_func)(gconstpointer, gconstpointer); | |
43 GDestroyNotify key_destroy; | |
44 GDestroyNotify value_destroy; | |
45 | |
46 int ncol; /* No. of columns */ | |
47 struct _GntTreeColInfo | |
48 { | |
49 int width; | |
50 char *title; | |
15970
790d1d003825
Allow making some columns invisible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15928
diff
changeset
|
51 gboolean invisible; |
15817 | 52 } *columns; /* Would a GList be better? */ |
53 gboolean show_title; | |
54 gboolean show_separator; /* Whether to show column separators */ | |
55 | |
56 GString *search; | |
57 int search_timeout; | |
58 | |
59 GCompareFunc compare; | |
60 }; | |
61 | |
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
62 struct _GntTreeClass |
15817 | 63 { |
64 GntWidgetClass parent; | |
65 | |
66 void (*selection_changed)(GntTreeRow *old, GntTreeRow * current); | |
67 void (*toggled)(GntTree *tree, gpointer key); | |
68 | |
69 void (*gnt_reserved1)(void); | |
70 void (*gnt_reserved2)(void); | |
71 void (*gnt_reserved3)(void); | |
72 void (*gnt_reserved4)(void); | |
73 }; | |
74 | |
75 G_BEGIN_DECLS | |
76 | |
77 GType gnt_tree_get_gtype(void); | |
78 | |
79 GntWidget *gnt_tree_new(void); /* A tree with just one column */ | |
80 | |
81 GntWidget *gnt_tree_new_with_columns(int columns); | |
82 | |
83 void gnt_tree_set_visible_rows(GntTree *tree, int rows); | |
84 | |
85 int gnt_tree_get_visible_rows(GntTree *tree); | |
86 | |
87 void gnt_tree_scroll(GntTree *tree, int count); | |
88 | |
89 GntTreeRow *gnt_tree_add_row_after(GntTree *tree, void *key, GntTreeRow *row, void *parent, void *bigbro); | |
90 | |
91 GntTreeRow *gnt_tree_add_row_last(GntTree *tree, void *key, GntTreeRow *row, void *parent); | |
92 | |
93 gpointer gnt_tree_get_selection_data(GntTree *tree); | |
94 | |
95 /* Returned string needs to be freed */ | |
96 char *gnt_tree_get_selection_text(GntTree *tree); | |
97 | |
98 GList *gnt_tree_get_selection_text_list(GntTree *tree); | |
99 | |
100 const GList *gnt_tree_get_rows(GntTree *tree); | |
101 | |
102 void gnt_tree_remove(GntTree *tree, gpointer key); | |
103 | |
104 void gnt_tree_remove_all(GntTree *tree); | |
105 | |
106 /* Returns the visible line number of the selected row */ | |
107 int gnt_tree_get_selection_visible_line(GntTree *tree); | |
108 | |
109 void gnt_tree_change_text(GntTree *tree, gpointer key, int colno, const char *text); | |
110 | |
111 GntTreeRow *gnt_tree_add_choice(GntTree *tree, void *key, GntTreeRow *row, void *parent, void *bigbro); | |
112 | |
113 void gnt_tree_set_choice(GntTree *tree, void *key, gboolean set); | |
114 | |
115 gboolean gnt_tree_get_choice(GntTree *tree, void *key); | |
116 | |
117 void gnt_tree_set_row_flags(GntTree *tree, void *key, GntTextFormatFlags flags); | |
118 | |
119 void gnt_tree_set_selected(GntTree *tree , void *key); | |
120 | |
121 GntTreeRow *gnt_tree_create_row(GntTree *tree, ...); | |
122 | |
123 GntTreeRow *gnt_tree_create_row_from_list(GntTree *tree, GList *list); | |
124 | |
125 void gnt_tree_set_col_width(GntTree *tree, int col, int width); | |
126 | |
127 void gnt_tree_set_column_titles(GntTree *tree, ...); | |
128 | |
129 void gnt_tree_set_show_title(GntTree *tree, gboolean set); | |
130 | |
131 void gnt_tree_set_compare_func(GntTree *tree, GCompareFunc func); | |
132 | |
133 void gnt_tree_set_expanded(GntTree *tree, void *key, gboolean expanded); | |
134 | |
135 void gnt_tree_set_show_separator(GntTree *tree, gboolean set); | |
136 | |
137 void gnt_tree_sort_row(GntTree *tree, void *row); | |
138 | |
139 /* This will try to automatically adjust the width of the columns in the tree */ | |
140 void gnt_tree_adjust_columns(GntTree *tree); | |
141 | |
142 void gnt_tree_set_hash_fns(GntTree *tree, gpointer hash, gpointer eq, gpointer kd); | |
143 | |
15970
790d1d003825
Allow making some columns invisible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15928
diff
changeset
|
144 /* This can be useful when, for example, we want to store some data |
790d1d003825
Allow making some columns invisible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15928
diff
changeset
|
145 * which we don't want/need to display. */ |
790d1d003825
Allow making some columns invisible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15928
diff
changeset
|
146 void gnt_tree_set_column_visible(GntTree *tree, int col, gboolean vis); |
790d1d003825
Allow making some columns invisible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15928
diff
changeset
|
147 |
15817 | 148 G_END_DECLS |
149 | |
150 /* The following functions should NOT be used by applications. */ | |
151 | |
152 /* This should be called by the subclasses of GntTree's in their _new function */ | |
153 void _gnt_tree_init_internals(GntTree *tree, int col); | |
154 | |
155 #endif /* GNT_TREE_H */ |