utreebox.hpp

00001 /* ==================================================== ======== ======= *
00002 *
00003 *  utreebox.hpp
00004 *  Ubit Project
00005 *  Part of the Ubit Toolkit: A Brick Construction Game Model for Creating GUIs
00006 *  (C) 1999-2006 / Eric Lecolinet / ENST Paris / http://www.enst.fr/~elc/ubit
00007 *
00008 * ***********************************************************************
00009 * COPYRIGHT NOTICE : 
00010 * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY AND WITHOUT EVEN THE 
00011 * IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 
00012 * YOU CAN REDISTRIBUTE IT AND/OR MODIFY IT UNDER THE TERMS OF THE GNU 
00013 * GENERAL PUBLIC LICENSE AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION; 
00014 * EITHER VERSION 2 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
00015 * SEE FILES 'COPYRIGHT' AND 'COPYING' FOR MORE DETAILS.
00016 * ***********************************************************************
00017 * ==================================================== [(c)Elc] ======= *
00018 * ==================================================== ======== ======= */
00019 
00020 #ifndef _utreebox_hpp_
00021 #define _utreebox_hpp_
00022 //pragma ident  "@(#)utreebox.hpp       ubit:05.05.00"
00023 #include <ubit/ulistbox.hpp>
00024 namespace ubit {
00025 
00026 class UTreebox : public UListbox {
00027 public:
00028   UBIT_ELEMENT_CLASS(UTreebox, UListbox)
00029   
00030   UTreebox(const UArgs& = UArgs::none);
00031   friend UTreebox& utreebox(const UArgs& = UArgs::none);
00032   
00033   virtual ~UTreebox();
00034   
00035   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00036 
00037   virtual UTreenode* getSelectedNode() const;
00039   
00040   virtual void setSelectedNode(UTreenode&);
00042   
00043   virtual int getSelectedIndex() const;
00045   
00046   virtual void setSelectedIndex(int n);
00048   
00049 private:
00050     friend class UTreenode;
00051 };
00052 /* ==================================================== ===== ======= */
00053 
00054 class UTreenode : public UVbox {
00055 public:
00056   UBIT_ELEMENT_CLASS(UTreenode, UVbox)
00057 
00058   UTreenode(const UArgs& label = UArgs::none);
00059   UTreenode(const UArgs& label, const UArgs& subnode_list);
00060   
00061   friend UTreenode& utreenode(const UArgs& label = UArgs::none);
00062   friend UTreenode& utreenode(const UArgs& label, const UArgs& subnode_list);
00063 
00064   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00065     
00066   virtual void addNode(UTreenode&);
00067   virtual void removeNode(UTreenode&);
00068 
00069   virtual void expand(bool = true);
00070   virtual void collapse() {expand(false);}
00072 
00073   //virtual void setOffset(UHmargin&);
00074 
00075   UBox& label() {return *plabel;}
00076   const UBox& label() const {return *plabel;}
00078   
00079   UBox& subnodes() {return *psubnodes;}
00080   const UBox& subnodes() const {return *psubnodes;}
00082   
00083 private:
00084   friend class UTreebox;
00085   uptr<UBox> plabel, psubnodes;
00086   uptr<UBox> pexpander;
00087   void constructs(const UArgs& label, const UArgs& subnode_list);
00088 };
00089 
00090 } 
00091 #endif
00092 /* ==================================================== [TheEnd] ======= */
00093 /* ==================================================== [(c)Elc] ======= */
00094 

Generated on Mon Jan 29 00:20:40 2007 for Ubit by  doxygen 1.4.7