vdk 2.4.0
vdkctree.h
1/*
2 * ===========================
3 * VDK Visual Development Kit
4 * Version 0.5
5 * December 1998
6 * ===========================
7 *
8 * Copyright (C) 1998, Mario Motta
9 * Developed by Mario Motta <mmotta@guest.net>
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
20 *
21 * You should have received a copy of the GNU Library General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24 * 02111-130
25 */
26
27#ifndef VDKCTREE_H
28#define VDKCTREE_H
29#include <vdk/vdkcustom.h>
30/*
31 */
32typedef GtkCTreeNode* VDKTreeNode;
35typedef VDKListIterator<GtkCTreeNode> VDKTreeNodeListIterator;
56{
57 int tree_column;
58 protected:
59 VDKTreeNodeArray WideSelection;
60
61 static void ColumnClick(GtkWidget* w,
62 gint column,
63 gpointer s);
64 static void NodeSelection(GtkWidget* ,
65 GtkCTreeNode* node,
66 int column,
67 gpointer s);
68 static void NodeUnselection(GtkWidget* ,
69 GtkCTreeNode* node,
70 int column,
71 gpointer s);
72 static int ButtonPress (GtkWidget* wid,
73 GdkEventButton *ev,
74 gpointer s);
75
76 void SetStyle(VDKTreeNode node);
77 void ConnectSignals();
78 void SetSpacing(int sp)
79 { gtk_ctree_set_spacing(GTK_CTREE(custom_widget), sp); }
80 void SetLineStyle(GtkCTreeLineStyle ls)
81 { gtk_ctree_set_line_style (GTK_CTREE(custom_widget), ls); }
82 void SetExpanderStyle(GtkCTreeExpanderStyle es)
83 { gtk_ctree_set_expander_style (GTK_CTREE(custom_widget), es); }
84 void SetSelectedNode(VDKTreeNode node);
85 void SetUnselectedNode(VDKTreeNode node);
86 // properties
87 public:
96 __rwproperty(VDKCustomTree,VDKTreeNode) SelectedNode;
101 __rproperty(VDKCustomTree,int) SelectedColumn;
106 __rwproperty(VDKCustomTree,VDKTreeNode) UnselectedNode;
111 __rproperty(VDKCustomTree,int) UnselectedColumn;
115 __rwproperty(VDKCustomTree,GtkCTreeLineStyle) LineStyle;
119 __rwproperty(VDKCustomTree,GtkCTreeExpanderStyle) ExpanderStyle;
120 public:
128 VDKCustomTree(VDKForm* owner,
129 int columns = 1,
130 char **titles = NULL,
131 GtkSelectionMode mode = GTK_SELECTION_SINGLE,
132 int tree_column = 0);
136 virtual ~VDKCustomTree();
146 VDKTreeNode AddNode(char *text[],
147 GtkCTreeNode *parent,
148 bool expanded = true,
149 bool isLeaf = false,
150 char **pixmap_closed = NULL,
151 char** pixmap_opened = NULL );
156 bool RemoveNode(VDKTreeNode node);
160 int RemoveKey(char* key);
161 virtual void Clear();
162 // selection (most for similarity with VDKCustomList)
166 VDKTreeNode Selection() { return SelectedNode; }
170 VDKTreeNode Unselection() { return UnselectedNode; }
176 // access operator
182 Tuple operator[](VDKTreeNode node);
187 VDKTreeNodeList* Find(char* key);
188 // some useful functions on nodes
193 bool IsLeaf(VDKTreeNode node);
198 char* Key(VDKTreeNode node);
203 bool IsExpanded(VDKTreeNode node);
204#ifdef USE_SIGCPLUSPLUS
205 public:
212 VDKSignal2<void, VDKTreeNode, int> OnNodeSelect;
219 VDKSignal2<void, VDKTreeNode, int> OnNodeUnselect;
227 VDKSignal3<void, VDKTreeNode, VDKTreeNode, VDKTreeNode> OnTreeMove;
233 VDKSignal1<void, VDKTreeNode> OnTreeExpand;
234 protected:
235 static void make_gtksigc_connection(VDKCustomTree* obj);
236 private:
237 static void _handle_tree_move(GtkWidget*, GtkCTreeNode* node,
238 GtkCTreeNode* new_parent,
239 GtkCTreeNode* new_sibling,
240 gpointer obj);
241 static void _handle_tree_expand(GtkWidget*, GtkCTreeNode* node,
242 gpointer obj);
243#endif /* USE_SIGCPLUSPLUS */
244};
245
246#endif
Definition: vdkcustom.h:44
This class wraps gtkctree widget.
Definition: vdkctree.h:56
virtual void Clear()
Definition: vdkctree.cc:416
char * Key(VDKTreeNode node)
Definition: vdkctree.cc:385
__rwproperty(VDKCustomTree, VDKTreeNode) SelectedNode
bool IsLeaf(VDKTreeNode node)
Definition: vdkctree.cc:369
VDKTreeNodeArray & Selections()
Definition: vdkctree.cc:339
VDKTreeNodeList * Find(char *key)
Definition: vdkctree.cc:483
VDKCustomTree(VDKForm *owner, int columns=1, char **titles=NULL, GtkSelectionMode mode=GTK_SELECTION_SINGLE, int tree_column=0)
Definition: vdkctree.cc:126
bool RemoveNode(VDKTreeNode node)
Definition: vdkctree.cc:426
virtual ~VDKCustomTree()
Definition: vdkctree.cc:247
__rproperty(VDKCustomTree, int) SelectedColumn
__rwproperty(VDKCustomTree, GtkCTreeLineStyle) LineStyle
__rwproperty(VDKCustomTree, int) Spacing
__rwproperty(VDKCustomTree, GtkCTreeExpanderStyle) ExpanderStyle
Tuple operator[](VDKTreeNode node)
Definition: vdkctree.cc:306
VDKTreeNode Unselection()
Definition: vdkctree.h:170
bool IsExpanded(VDKTreeNode node)
Definition: vdkctree.cc:402
VDKTreeNode AddNode(char *text[], GtkCTreeNode *parent, bool expanded=true, bool isLeaf=false, char **pixmap_closed=NULL, char **pixmap_opened=NULL)
Definition: vdkctree.cc:256
__rwproperty(VDKCustomTree, VDKTreeNode) UnselectedNode
__rproperty(VDKCustomTree, int) UnselectedColumn
int RemoveKey(char *key)
Definition: vdkctree.cc:498
VDKTreeNode Selection()
Definition: vdkctree.h:166
This is a base class for derived VDKCustomList and VDKCustomTree Provides common functionalities for ...
Definition: vdkcustom.h:96
VDKForm widgets, generally the outermost widget container.
Definition: forms.h:69
Provides a reference semantic double linked list.
Definition: dlist.h:65
VDKObject * parent
Definition: vdkobj.h:253