1 | /* gtktreeviewcolumn.h |
2 | * Copyright (C) 2000 Red Hat, Inc., Jonathan Blandford <[email protected]> |
3 | * |
4 | * This library is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU Library General Public |
6 | * License as published by the Free Software Foundation; either |
7 | * version 2 of the License, or (at your option) any later version. |
8 | * |
9 | * This library is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | * Library General Public License for more details. |
13 | * |
14 | * You should have received a copy of the GNU Library General Public |
15 | * License along with this library; if not, write to the |
16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | * Boston, MA 02111-1307, USA. |
18 | */ |
19 | |
20 | #ifndef __GTK_TREE_VIEW_COLUMN_H__ |
21 | #define __GTK_TREE_VIEW_COLUMN_H__ |
22 | |
23 | #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) |
24 | #error "Only <gtk/gtk.h> can be included directly." |
25 | #endif |
26 | |
27 | #include <gtk/gtkcellrenderer.h> |
28 | #include <gtk/gtktreemodel.h> |
29 | #include <gtk/gtktreesortable.h> |
30 | |
31 | /* Not needed, retained for compatibility -Yosh */ |
32 | #include <gtk/gtkobject.h> |
33 | |
34 | |
35 | G_BEGIN_DECLS |
36 | |
37 | |
38 | #define GTK_TYPE_TREE_VIEW_COLUMN (gtk_tree_view_column_get_type ()) |
39 | #define GTK_TREE_VIEW_COLUMN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TREE_VIEW_COLUMN, GtkTreeViewColumn)) |
40 | #define GTK_TREE_VIEW_COLUMN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TREE_VIEW_COLUMN, GtkTreeViewColumnClass)) |
41 | #define GTK_IS_TREE_VIEW_COLUMN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TREE_VIEW_COLUMN)) |
42 | #define GTK_IS_TREE_VIEW_COLUMN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TREE_VIEW_COLUMN)) |
43 | #define GTK_TREE_VIEW_COLUMN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TREE_VIEW_COLUMN, GtkTreeViewColumnClass)) |
44 | |
45 | typedef enum |
46 | { |
47 | GTK_TREE_VIEW_COLUMN_GROW_ONLY, |
48 | GTK_TREE_VIEW_COLUMN_AUTOSIZE, |
49 | GTK_TREE_VIEW_COLUMN_FIXED |
50 | } GtkTreeViewColumnSizing; |
51 | |
52 | typedef struct _GtkTreeViewColumn GtkTreeViewColumn; |
53 | typedef struct _GtkTreeViewColumnClass GtkTreeViewColumnClass; |
54 | |
55 | typedef void (* GtkTreeCellDataFunc) (GtkTreeViewColumn *tree_column, |
56 | GtkCellRenderer *cell, |
57 | GtkTreeModel *tree_model, |
58 | GtkTreeIter *iter, |
59 | gpointer data); |
60 | |
61 | |
62 | struct _GtkTreeViewColumn |
63 | { |
64 | GtkObject parent; |
65 | |
66 | GtkWidget *GSEAL (tree_view); |
67 | GtkWidget *GSEAL (button); |
68 | GtkWidget *GSEAL (child); |
69 | GtkWidget *GSEAL (arrow); |
70 | GtkWidget *GSEAL (alignment); |
71 | GdkWindow *GSEAL (window); |
72 | GtkCellEditable *GSEAL (editable_widget); |
73 | gfloat GSEAL (xalign); |
74 | guint GSEAL (property_changed_signal); |
75 | gint GSEAL (spacing); |
76 | |
77 | /* Sizing fields */ |
78 | /* see gtk+/doc/tree-column-sizing.txt for more information on them */ |
79 | GtkTreeViewColumnSizing GSEAL (column_type); |
80 | gint GSEAL (requested_width); |
81 | gint GSEAL (button_request); |
82 | gint GSEAL (resized_width); |
83 | gint GSEAL (width); |
84 | gint GSEAL (fixed_width); |
85 | gint GSEAL (min_width); |
86 | gint GSEAL (max_width); |
87 | |
88 | /* dragging columns */ |
89 | gint GSEAL (drag_x); |
90 | gint GSEAL (drag_y); |
91 | |
92 | gchar *GSEAL (title); |
93 | GList *GSEAL (cell_list); |
94 | |
95 | /* Sorting */ |
96 | guint GSEAL (sort_clicked_signal); |
97 | guint GSEAL (sort_column_changed_signal); |
98 | gint GSEAL (sort_column_id); |
99 | GtkSortType GSEAL (sort_order); |
100 | |
101 | /* Flags */ |
102 | guint GSEAL (visible) : 1; |
103 | guint GSEAL (resizable) : 1; |
104 | guint GSEAL (clickable) : 1; |
105 | guint GSEAL (dirty) : 1; |
106 | guint GSEAL (show_sort_indicator) : 1; |
107 | guint GSEAL (maybe_reordered) : 1; |
108 | guint GSEAL (reorderable) : 1; |
109 | guint GSEAL (use_resized_width) : 1; |
110 | guint GSEAL (expand) : 1; |
111 | }; |
112 | |
113 | struct _GtkTreeViewColumnClass |
114 | { |
115 | GtkObjectClass parent_class; |
116 | |
117 | void (*clicked) (GtkTreeViewColumn *tree_column); |
118 | |
119 | /* Padding for future expansion */ |
120 | void (*_gtk_reserved1) (void); |
121 | void (*_gtk_reserved2) (void); |
122 | void (*_gtk_reserved3) (void); |
123 | void (*_gtk_reserved4) (void); |
124 | }; |
125 | |
126 | GType gtk_tree_view_column_get_type (void) G_GNUC_CONST; |
127 | GtkTreeViewColumn *gtk_tree_view_column_new (void); |
128 | GtkTreeViewColumn *gtk_tree_view_column_new_with_attributes (const gchar *title, |
129 | GtkCellRenderer *cell, |
130 | ...) G_GNUC_NULL_TERMINATED; |
131 | void gtk_tree_view_column_pack_start (GtkTreeViewColumn *tree_column, |
132 | GtkCellRenderer *cell, |
133 | gboolean expand); |
134 | void gtk_tree_view_column_pack_end (GtkTreeViewColumn *tree_column, |
135 | GtkCellRenderer *cell, |
136 | gboolean expand); |
137 | void gtk_tree_view_column_clear (GtkTreeViewColumn *tree_column); |
138 | #ifndef GTK_DISABLE_DEPRECATED |
139 | GList *gtk_tree_view_column_get_cell_renderers (GtkTreeViewColumn *tree_column); |
140 | #endif |
141 | void gtk_tree_view_column_add_attribute (GtkTreeViewColumn *tree_column, |
142 | GtkCellRenderer *cell_renderer, |
143 | const gchar *attribute, |
144 | gint column); |
145 | void gtk_tree_view_column_set_attributes (GtkTreeViewColumn *tree_column, |
146 | GtkCellRenderer *cell_renderer, |
147 | ...) G_GNUC_NULL_TERMINATED; |
148 | void gtk_tree_view_column_set_cell_data_func (GtkTreeViewColumn *tree_column, |
149 | GtkCellRenderer *cell_renderer, |
150 | GtkTreeCellDataFunc func, |
151 | gpointer func_data, |
152 | GDestroyNotify destroy); |
153 | void gtk_tree_view_column_clear_attributes (GtkTreeViewColumn *tree_column, |
154 | GtkCellRenderer *cell_renderer); |
155 | void gtk_tree_view_column_set_spacing (GtkTreeViewColumn *tree_column, |
156 | gint spacing); |
157 | gint gtk_tree_view_column_get_spacing (GtkTreeViewColumn *tree_column); |
158 | void gtk_tree_view_column_set_visible (GtkTreeViewColumn *tree_column, |
159 | gboolean visible); |
160 | gboolean gtk_tree_view_column_get_visible (GtkTreeViewColumn *tree_column); |
161 | void gtk_tree_view_column_set_resizable (GtkTreeViewColumn *tree_column, |
162 | gboolean resizable); |
163 | gboolean gtk_tree_view_column_get_resizable (GtkTreeViewColumn *tree_column); |
164 | void gtk_tree_view_column_set_sizing (GtkTreeViewColumn *tree_column, |
165 | GtkTreeViewColumnSizing type); |
166 | GtkTreeViewColumnSizing gtk_tree_view_column_get_sizing (GtkTreeViewColumn *tree_column); |
167 | gint gtk_tree_view_column_get_width (GtkTreeViewColumn *tree_column); |
168 | gint gtk_tree_view_column_get_fixed_width (GtkTreeViewColumn *tree_column); |
169 | void gtk_tree_view_column_set_fixed_width (GtkTreeViewColumn *tree_column, |
170 | gint fixed_width); |
171 | void gtk_tree_view_column_set_min_width (GtkTreeViewColumn *tree_column, |
172 | gint min_width); |
173 | gint gtk_tree_view_column_get_min_width (GtkTreeViewColumn *tree_column); |
174 | void gtk_tree_view_column_set_max_width (GtkTreeViewColumn *tree_column, |
175 | gint max_width); |
176 | gint gtk_tree_view_column_get_max_width (GtkTreeViewColumn *tree_column); |
177 | void gtk_tree_view_column_clicked (GtkTreeViewColumn *tree_column); |
178 | |
179 | |
180 | |
181 | /* Options for manipulating the column headers |
182 | */ |
183 | void gtk_tree_view_column_set_title (GtkTreeViewColumn *tree_column, |
184 | const gchar *title); |
185 | const gchar * gtk_tree_view_column_get_title (GtkTreeViewColumn *tree_column); |
186 | void gtk_tree_view_column_set_expand (GtkTreeViewColumn *tree_column, |
187 | gboolean expand); |
188 | gboolean gtk_tree_view_column_get_expand (GtkTreeViewColumn *tree_column); |
189 | void gtk_tree_view_column_set_clickable (GtkTreeViewColumn *tree_column, |
190 | gboolean clickable); |
191 | gboolean gtk_tree_view_column_get_clickable (GtkTreeViewColumn *tree_column); |
192 | void gtk_tree_view_column_set_widget (GtkTreeViewColumn *tree_column, |
193 | GtkWidget *widget); |
194 | GtkWidget *gtk_tree_view_column_get_widget (GtkTreeViewColumn *tree_column); |
195 | void gtk_tree_view_column_set_alignment (GtkTreeViewColumn *tree_column, |
196 | gfloat xalign); |
197 | gfloat gtk_tree_view_column_get_alignment (GtkTreeViewColumn *tree_column); |
198 | void gtk_tree_view_column_set_reorderable (GtkTreeViewColumn *tree_column, |
199 | gboolean reorderable); |
200 | gboolean gtk_tree_view_column_get_reorderable (GtkTreeViewColumn *tree_column); |
201 | |
202 | |
203 | |
204 | /* You probably only want to use gtk_tree_view_column_set_sort_column_id. The |
205 | * other sorting functions exist primarily to let others do their own custom sorting. |
206 | */ |
207 | void gtk_tree_view_column_set_sort_column_id (GtkTreeViewColumn *tree_column, |
208 | gint sort_column_id); |
209 | gint gtk_tree_view_column_get_sort_column_id (GtkTreeViewColumn *tree_column); |
210 | void gtk_tree_view_column_set_sort_indicator (GtkTreeViewColumn *tree_column, |
211 | gboolean setting); |
212 | gboolean gtk_tree_view_column_get_sort_indicator (GtkTreeViewColumn *tree_column); |
213 | void gtk_tree_view_column_set_sort_order (GtkTreeViewColumn *tree_column, |
214 | GtkSortType order); |
215 | GtkSortType gtk_tree_view_column_get_sort_order (GtkTreeViewColumn *tree_column); |
216 | |
217 | |
218 | /* These functions are meant primarily for interaction between the GtkTreeView and the column. |
219 | */ |
220 | void gtk_tree_view_column_cell_set_cell_data (GtkTreeViewColumn *tree_column, |
221 | GtkTreeModel *tree_model, |
222 | GtkTreeIter *iter, |
223 | gboolean is_expander, |
224 | gboolean is_expanded); |
225 | void gtk_tree_view_column_cell_get_size (GtkTreeViewColumn *tree_column, |
226 | const GdkRectangle *cell_area, |
227 | gint *x_offset, |
228 | gint *y_offset, |
229 | gint *width, |
230 | gint *height); |
231 | gboolean gtk_tree_view_column_cell_is_visible (GtkTreeViewColumn *tree_column); |
232 | void gtk_tree_view_column_focus_cell (GtkTreeViewColumn *tree_column, |
233 | GtkCellRenderer *cell); |
234 | gboolean gtk_tree_view_column_cell_get_position (GtkTreeViewColumn *tree_column, |
235 | GtkCellRenderer *cell_renderer, |
236 | gint *start_pos, |
237 | gint *width); |
238 | void gtk_tree_view_column_queue_resize (GtkTreeViewColumn *tree_column); |
239 | GtkWidget *gtk_tree_view_column_get_tree_view (GtkTreeViewColumn *tree_column); |
240 | |
241 | |
242 | G_END_DECLS |
243 | |
244 | |
245 | #endif /* __GTK_TREE_VIEW_COLUMN_H__ */ |
246 | |