Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | Related Pages

vdkctree.h

00001 /*
00002  * ===========================
00003  * VDK Visual Development Kit
00004  * Version 0.5
00005  * December 1998
00006  * ===========================
00007  *
00008  * Copyright (C) 1998, Mario Motta
00009  * Developed by Mario Motta <mmotta@guest.net>
00010  *
00011  * This library is free software; you can redistribute it and/or
00012  * modify it under the terms of the GNU Library General Public
00013  * License as published by the Free Software Foundation; either
00014  * version 2 of the License, or (at your option) any later version.
00015  *
00016  * This library is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019  * Library General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Library General Public
00022  * License along with this library; if not, write to the Free Software
00023  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00024  * 02111-130
00025  */ 
00026 
00027 #ifndef VDKCTREE_H
00028 #define VDKCTREE_H
00029 #include <vdk/vdkcustom.h>
00030 /*
00031  */
00032 typedef GtkCTreeNode*                  VDKTreeNode;
00033 typedef VDKArray<VDKTreeNode>          VDKTreeNodeArray;
00034 typedef VDKList<GtkCTreeNode>          VDKTreeNodeList;
00035 typedef VDKListIterator<GtkCTreeNode>  VDKTreeNodeListIterator;
00055 class VDKCustomTree: public VDKCustom
00056 {
00057   int tree_column;
00058  protected:
00059   VDKTreeNodeArray WideSelection;
00060 
00061   static void ColumnClick(GtkWidget* w,
00062                   gint column,
00063                   gpointer s);
00064   static void NodeSelection(GtkWidget* ,
00065                   GtkCTreeNode* node,
00066                   int column,
00067                   gpointer s);
00068   static void NodeUnselection(GtkWidget* ,
00069                   GtkCTreeNode* node,
00070                   int column,
00071                   gpointer s);
00072   static int  ButtonPress (GtkWidget* wid, 
00073                            GdkEventButton *ev, 
00074                            gpointer s);
00075 
00076   void SetStyle(VDKTreeNode node);
00077   void ConnectSignals();
00078   void SetSpacing(int sp)
00079     { gtk_ctree_set_spacing(GTK_CTREE(custom_widget), sp); }
00080   void SetLineStyle(GtkCTreeLineStyle ls)
00081     { gtk_ctree_set_line_style (GTK_CTREE(custom_widget), ls); }
00082   void SetExpanderStyle(GtkCTreeExpanderStyle es)
00083     { gtk_ctree_set_expander_style (GTK_CTREE(custom_widget), es); }
00084   void SetSelectedNode(VDKTreeNode node);
00085   void SetUnselectedNode(VDKTreeNode node);
00086   // properties
00087  public:
00091   __rwproperty(VDKCustomTree,int) Spacing;
00096   __rwproperty(VDKCustomTree,VDKTreeNode) SelectedNode;
00101   __rproperty(VDKCustomTree,int) SelectedColumn;
00106   __rwproperty(VDKCustomTree,VDKTreeNode) UnselectedNode;
00111   __rproperty(VDKCustomTree,int) UnselectedColumn;
00115   __rwproperty(VDKCustomTree,GtkCTreeLineStyle) LineStyle;
00119   __rwproperty(VDKCustomTree,GtkCTreeExpanderStyle) ExpanderStyle;
00120  public:
00128   VDKCustomTree(VDKForm* owner,
00129                 int columns = 1,
00130                 char **titles = NULL,
00131                 GtkSelectionMode mode = GTK_SELECTION_SINGLE,
00132                 int tree_column = 0);
00136   virtual ~VDKCustomTree();
00146   VDKTreeNode AddNode(char  *text[],
00147                       GtkCTreeNode *parent,
00148                       bool expanded = true,
00149                       bool isLeaf = false,
00150                       char **pixmap_closed = NULL,
00151                       char** pixmap_opened = NULL );
00156   bool RemoveNode(VDKTreeNode node);
00160   int RemoveKey(char* key);
00161   virtual void Clear();
00162   // selection (most for similarity with VDKCustomList)
00166   VDKTreeNode Selection() { return SelectedNode; }
00170   VDKTreeNode Unselection() { return UnselectedNode; }
00175   VDKTreeNodeArray& Selections();
00176   // access operator
00182   Tuple operator[](VDKTreeNode node);
00187   VDKTreeNodeList* Find(char* key);
00188   // some useful functions on nodes
00193   bool IsLeaf(VDKTreeNode node);
00198   char* Key(VDKTreeNode node);
00203   bool IsExpanded(VDKTreeNode node);
00204 #ifdef USE_SIGCPLUSPLUS
00205  public:
00212   VDKSignal2<void, VDKTreeNode, int> OnNodeSelect;
00219   VDKSignal2<void, VDKTreeNode, int> OnNodeUnselect;
00227   VDKSignal3<void, VDKTreeNode, VDKTreeNode, VDKTreeNode> OnTreeMove;
00233   VDKSignal1<void, VDKTreeNode> OnTreeExpand;
00234  protected:  
00235   static void make_gtksigc_connection(VDKCustomTree* obj);
00236  private:
00237   static void _handle_tree_move(GtkWidget*, GtkCTreeNode* node, 
00238                                 GtkCTreeNode* new_parent,
00239                                 GtkCTreeNode* new_sibling, 
00240                                 gpointer obj);
00241   static void _handle_tree_expand(GtkWidget*, GtkCTreeNode* node,
00242                                   gpointer obj);
00243 #endif /* USE_SIGCPLUSPLUS */
00244 };
00245 
00246 #endif

Generated on Wed Aug 6 11:01:51 2003 for vdk 2.0.3 by doxygen 1.3.2