1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser 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  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser 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 /*
21  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
22  * file for a list of people on the GTK+ Team.  See the ChangeLog
23  * files for a list of changes.  These files are distributed with
24  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
25  */
26 
27 #ifdef GTK_ENABLE_BROKEN
28 
29 #ifndef __GTK_TREE_H__
30 #define __GTK_TREE_H__
31 
32 
33 #include <gtk/gtkcontainer.h>
34 
35 
36 G_BEGIN_DECLS
37 
38 /* set this flag to enable tree debugging output */
39 /* #define TREE_DEBUG */
40 
41 #define GTK_TYPE_TREE                  (gtk_tree_get_type ())
42 #define GTK_TREE(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TREE, GtkTree))
43 #define GTK_TREE_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TREE, GtkTreeClass))
44 #define GTK_IS_TREE(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TREE))
45 #define GTK_IS_TREE_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TREE))
46 #define GTK_TREE_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TREE, GtkTreeClass))
47 
48 
49 #define GTK_IS_ROOT_TREE(obj)   ((GtkObject*) GTK_TREE(obj)->root_tree == (GtkObject*)obj)
50 #define GTK_TREE_ROOT_TREE(obj) (GTK_TREE(obj)->root_tree ? GTK_TREE(obj)->root_tree : GTK_TREE(obj))
51 #define GTK_TREE_SELECTION_OLD(obj) (GTK_TREE_ROOT_TREE(obj)->selection)
52 
53 typedef enum
54 {
55   GTK_TREE_VIEW_LINE,  /* default view mode */
56   GTK_TREE_VIEW_ITEM
57 } GtkTreeViewMode;
58 
59 typedef struct _GtkTree       GtkTree;
60 typedef struct _GtkTreeClass  GtkTreeClass;
61 
62 struct _GtkTree
63 {
64   GtkContainer container;
65 
66   GList *children;
67 
68   GtkTree* root_tree; /* owner of selection list */
69   GtkWidget* tree_owner;
70   GList *selection;
71   guint level;
72   guint indent_value;
73   guint current_indent;
74   guint selection_mode : 2;
75   guint view_mode : 1;
76   guint view_line : 1;
77 };
78 
79 struct _GtkTreeClass
80 {
81   GtkContainerClass parent_class;
82 
83   void (* selection_changed) (GtkTree   *tree);
84   void (* select_child)      (GtkTree   *tree,
85 			      GtkWidget *child);
86   void (* unselect_child)    (GtkTree   *tree,
87 			      GtkWidget *child);
88 };
89 
90 
91 GType      gtk_tree_get_type           (void) G_GNUC_CONST;
92 GtkWidget* gtk_tree_new                (void);
93 void       gtk_tree_append             (GtkTree          *tree,
94 				        GtkWidget        *tree_item);
95 void       gtk_tree_prepend            (GtkTree          *tree,
96 				        GtkWidget        *tree_item);
97 void       gtk_tree_insert             (GtkTree          *tree,
98 				        GtkWidget        *tree_item,
99 				        gint              position);
100 void       gtk_tree_remove_items       (GtkTree          *tree,
101 				        GList            *items);
102 void       gtk_tree_clear_items        (GtkTree          *tree,
103 				        gint              start,
104 				        gint              end);
105 void       gtk_tree_select_item        (GtkTree          *tree,
106 				        gint              item);
107 void       gtk_tree_unselect_item      (GtkTree          *tree,
108 				        gint              item);
109 void       gtk_tree_select_child       (GtkTree          *tree,
110 				        GtkWidget        *tree_item);
111 void       gtk_tree_unselect_child     (GtkTree          *tree,
112 				        GtkWidget        *tree_item);
113 gint       gtk_tree_child_position     (GtkTree          *tree,
114 				        GtkWidget        *child);
115 void       gtk_tree_set_selection_mode (GtkTree          *tree,
116 				        GtkSelectionMode  mode);
117 void       gtk_tree_set_view_mode      (GtkTree          *tree,
118 				        GtkTreeViewMode   mode);
119 void       gtk_tree_set_view_lines     (GtkTree          *tree,
120 					gboolean	  flag);
121 
122 /* deprecated function, use gtk_container_remove instead.
123  */
124 void       gtk_tree_remove_item        (GtkTree          *tree,
125 				        GtkWidget        *child);
126 
127 
128 G_END_DECLS
129 
130 #endif /* __GTK_TREE_H__ */
131 
132 #endif /* GTK_ENABLE_BROKEN */
133