Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

uchoice.hpp

00001 /* ==================================================== ======== ======= *
00002  *
00003  *  uchoice.hpp
00004  *  Ubit Project [Elc][2003]
00005  *  Author: Eric Lecolinet
00006  *
00007  *  Part of the Ubit Toolkit: A Brick Construction Game Model for Creating GUIs
00008  *
00009  *  (C) 1999-2003 Eric Lecolinet @ ENST Paris
00010  *  WWW: http://www.enst.fr/~elc/ubit   Email: elc@enst.fr (subject: ubit)
00011  *
00012  * ***********************************************************************
00013  * COPYRIGHT NOTICE : 
00014  * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY AND WITHOUT EVEN THE 
00015  * IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 
00016  * YOU CAN REDISTRIBUTE IT AND/OR MODIFY IT UNDER THE TERMS OF THE GNU 
00017  * GENERAL PUBLIC LICENSE AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION; 
00018  * EITHER VERSION 2 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
00019  * SEE FILES 'COPYRIGHT' AND 'COPYING' FOR MORE DETAILS.
00020  * ***********************************************************************
00021  *
00022  * ==================================================== [Elc:03] ======= *
00023  * ==================================================== ======== ======= */
00024 
00025 #ifndef _uchoice_hpp_
00026 #define _uchoice_hpp_
00027 //pragma ident  "@(#)uchoice.hpp                ubit:03.06.00"
00028 #include <ubit/uprop.hpp>
00029 
00030 
00033 class UChoice : public UProp {
00034 public:
00035   UChoice(UBox* container = null);
00037   
00038   friend UChoice& uchoice() {return *(new UChoice());}
00040 
00041   virtual ~UChoice();
00043 
00044   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00045 
00046   virtual void setCanUnselectMode(bool);
00047   virtual bool isCanUnselectMode() const;
00049 
00050   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00051 
00052   virtual UBox* getItem() const;
00054 
00055   virtual UBox* getLastItem() const;
00056   virtual int   getLastIndex() const;
00057 
00058   virtual UBox* setItem(UBox*, bool update = true);
00059   virtual UBox* setItem(UBox&, bool update = true);
00060   virtual void select(UBox&);
00065   virtual void unselect();
00067 
00068   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00069 
00070   virtual int getIndex() const;
00072 
00073   virtual UBox* setIndex(int, bool update = true);
00074   virtual void select(int);
00078   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00079 
00080   virtual void update();
00082 
00083   //EX: virtual void changed(bool update_now);
00084   void changed(bool update_now, UBox* target);
00092 #ifndef NO_DOC
00093   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00094   // implementation
00095 
00096   virtual void putProp(UContext*, class UCtrl*);
00097 
00098   virtual void addingTo(ULink *selflink, UGroup *parent);
00099   // NB: removingFrom() requires a destructor to be defined
00100   virtual void removingFrom(ULink *selflink, UGroup *parent);
00101 
00102   UBox* itemChanged(UEvent&);  // return the selcetd item if any
00103 
00104 protected:
00105   int   index;
00106   bool  can_unselect_mode;
00107   uptr<UBox> container;
00108 #endif
00109 };
00110 
00111 /* ==================================================== [Elc:03] ======= */
00112 /* ==================================================== ======== ======= */
00113 
00127 class URadioSelect : public UProp {
00128 public:
00129   URadioSelect();
00130   URadioSelect(UIntg& index);
00138   friend URadioSelect& uradioSelect() {return *(new URadioSelect());}
00140 
00141   virtual ~URadioSelect();
00143 
00144   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00145 
00146   virtual void setCanUnselectMode(bool);
00147   virtual bool isCanUnselectMode() const;
00149 
00150   virtual UGroup* getItem() const;
00152 
00153   virtual void setItem(UGroup*);
00154   virtual void setItem(UGroup&);
00155   virtual void select(UGroup&);
00157 
00158   virtual void unselect();
00160 
00161   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00162 
00163   UIntg& index() const {return *pindex;}
00164   virtual int  getIndex() const;
00166 
00167   virtual void setIndex(int);
00168   virtual void setIndex(const UIntg&);
00169   virtual void select(int);
00171 
00172   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00173 
00174   virtual void update();
00176 
00177   virtual void changed(bool update_now);
00185   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00186   // implementation
00187 
00188 #ifndef NO_DOC
00189 
00190   virtual void putProp(UContext*, class UCtrl*);
00191 
00192   virtual void addingTo(ULink *selflink, UGroup *parent);
00193   // NB: removingFrom() requires a destructor to be defined
00194   virtual void removingFrom(ULink *selflink, UGroup *parent);
00195 
00196 protected:
00197   void setIndexImpl();
00198 
00199   bool  can_unselect_mode;
00200   uptr<UIntg> pindex;
00201   uptr<UCall> pselect_callback;
00202   void itemChanged(UEvent&);
00203 #endif
00204 };
00205 
00206 
00207 #endif
00208 /* ==================================================== [TheEnd] ======= */
00209 /* ==================================================== [Elc:03] ======= */

Generated on Thu May 19 11:39:58 2005 for Ubit[Eric.Lecolinet@enst.fr] by  doxygen 1.4.2