2 * Copyright (C) 2000 Red Hat, Inc., Jonathan Blandford <jrb@redhat.com>
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.
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.
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.
20 #ifndef __GTK_TREE_PRIVATE_H__
21 #define __GTK_TREE_PRIVATE_H__
26 #endif /* __cplusplus */
28 #include <gtk/gtktreeview.h>
29 #include <gtk/gtktreeselection.h>
30 #include <gtk/gtkrbtree.h>
34 GTK_TREE_VIEW_IS_LIST = 1 << 0,
35 GTK_TREE_VIEW_SHOW_EXPANDERS = 1 << 1,
36 GTK_TREE_VIEW_IN_COLUMN_RESIZE = 1 << 2,
37 GTK_TREE_VIEW_ARROW_PRELIT = 1 << 3,
38 GTK_TREE_VIEW_HEADERS_VISIBLE = 1 << 4,
39 GTK_TREE_VIEW_DRAW_KEYFOCUS = 1 << 5,
40 GTK_TREE_VIEW_MODEL_SETUP = 1 << 6
43 #define GTK_TREE_VIEW_SET_FLAG(tree_view, flag) G_STMT_START{ (tree_view->priv->flags|=flag); }G_STMT_END
44 #define GTK_TREE_VIEW_UNSET_FLAG(tree_view, flag) G_STMT_START{ (tree_view->priv->flags&=~(flag)); }G_STMT_END
45 #define GTK_TREE_VIEW_FLAG_SET(tree_view, flag) ((tree_view->priv->flags&flag)==flag)
46 #define TREE_VIEW_HEADER_HEIGHT(tree_view) (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE)?tree_view->priv->header_height:0)
47 #define TREE_VIEW_COLUMN_WIDTH(column) (CLAMP (column->width, (column->min_width!=-1)?column->min_width:column->width, (column->max_width!=-1)?column->max_width:column->width))
48 #define TREE_VIEW_DRAW_EXPANDERS(tree_view) (!GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_IS_LIST)&>K_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_SHOW_EXPANDERS))
50 struct _GtkTreeViewPrivate
55 /* tree information */
59 GtkRBNode *button_pressed_node;
60 GtkRBTree *button_pressed_tree;
66 GtkAdjustment *hadjustment;
67 GtkAdjustment *vadjustment;
69 GdkWindow *bin_window;
70 GdkWindow *header_window;
75 GtkTreeRowReference *anchor;
76 GtkTreeRowReference *cursor;
79 GdkCursor *cursor_drag;
84 /* Prelight information */
85 GtkRBNode *prelight_node;
86 GtkRBTree *prelight_tree;
88 /* Selection information */
89 GtkTreeSelection *selection;
91 /* Header information */
96 /* Scroll timeout (e.g. during dnd) */
99 /* Row drag-and-drop */
100 GtkTreeRowReference *drag_dest_row;
101 GtkTreeViewDropPosition drag_dest_pos;
102 guint open_dest_timeout;
108 /* Scroll-to functionality when unrealized */
109 GtkTreePath *scroll_to_path;
110 GtkTreeViewColumn *scroll_to_column;
111 gfloat scroll_to_row_align;
112 gfloat scroll_to_col_align;
114 /* hint to display rows in alternating colors */
120 #define TREE_VIEW_INTERNAL_ASSERT(expr, ret) G_STMT_START{ \
123 g_log (G_LOG_DOMAIN, \
124 G_LOG_LEVEL_CRITICAL, \
125 "file %s: line %d (%s): assertion `%s' failed.\n" \
126 "There is a disparity between the internal view of the GtkTreeView,\n" \
127 "and the GtkTreeModel. This generally means that the model has changed\n"\
128 "without letting the view know. Any display from now on is likely to\n" \
132 __PRETTY_FUNCTION__, \
137 #define TREE_VIEW_INTERNAL_ASSERT_VOID(expr) G_STMT_START{ \
140 g_log (G_LOG_DOMAIN, \
141 G_LOG_LEVEL_CRITICAL, \
142 "file %s: line %d (%s): assertion `%s' failed.\n" \
143 "There is a disparity between the internal view of the GtkTreeView,\n" \
144 "and the GtkTreeModel. This generally means that the model has changed\n"\
145 "without letting the view know. Any display from now on is likely to\n" \
149 __PRETTY_FUNCTION__, \
156 #define TREE_VIEW_INTERNAL_ASSERT(expr, ret) G_STMT_START{ \
159 g_log (G_LOG_DOMAIN, \
160 G_LOG_LEVEL_CRITICAL, \
161 "file %s: line %d: assertion `%s' failed.\n" \
162 "There is a disparity between the internal view of the GtkTreeView,\n" \
163 "and the GtkTreeModel. This generally means that the model has changed\n"\
164 "without letting the view know. Any display from now on is likely to\n" \
172 #define TREE_VIEW_INTERNAL_ASSERT_VOID(expr) G_STMT_START{ \
175 g_log (G_LOG_DOMAIN, \
176 G_LOG_LEVEL_CRITICAL, \
177 "file %s: line %d: assertion '%s' failed.\n" \
178 "There is a disparity between the internal view of the GtkTreeView,\n" \
179 "and the GtkTreeModel. This generally means that the model has changed\n"\
180 "without letting the view know. Any display from now on is likely to\n" \
189 /* functions that shouldn't be exported */
190 void _gtk_tree_selection_internal_select_node (GtkTreeSelection *selection,
194 GdkModifierType state);
195 gboolean _gtk_tree_view_find_node (GtkTreeView *tree_view,
199 GtkTreePath *_gtk_tree_view_find_path (GtkTreeView *tree_view,
202 void _gtk_tree_view_set_size (GtkTreeView *tree_view,
207 GtkTreeSelection* _gtk_tree_selection_new (void);
208 GtkTreeSelection* _gtk_tree_selection_new_with_tree_view (GtkTreeView *tree_view);
209 void _gtk_tree_selection_set_tree_view (GtkTreeSelection *selection,
210 GtkTreeView *tree_view);
214 #endif /* __cplusplus */
217 #endif /* __GTK_TREE_PRIVATE_H__ */