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

uctrl.hpp

00001 /* ==================================================== ======== ======= *
00002  *
00003  *  uctrl.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 _uctrl_hpp_
00026 #define _uctrl_hpp_
00027 //pragma ident  "@(#)uctrl.hpp  ubit:03.06.00"
00028 #include <ubit/umode.hpp>
00029 
00030 
00042 class UCtrl: public UBrick {    // abstract class
00043 public:
00044   UCtrl();
00046 
00047   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00048 
00049   virtual void enable(bool state, bool call_callbacks = true);
00050   void setEnabled(bool b) {enable(b);}
00057   bool isEnabled() const;
00065   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00066 
00067   virtual void select(bool state, bool call_callbacks = true);
00068   void setSelected(bool b) {select(b);}
00075   bool isSelected() const {return (cmodes & UMode::SELECTED) != 0;}
00082   bool isSelectable() const {return (cmodes & UMode::CAN_SELECT) != 0;}
00090   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00091 
00092   virtual bool isShown() const;
00102   bool isShowable() const {return (cmodes & UMode::CAN_SHOW) != 0;}
00111   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00112 
00113   virtual void update() = 0;
00114   virtual void update(UUpdate) = 0;
00120   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00121   // implementation
00122 
00123   bool isCmode(u_modes _cmodes) const {return ((cmodes & _cmodes) != 0);}
00125 
00126   u_modes getCmodes() const {return cmodes;}
00128 
00129   void setCmodes(u_modes _cmodes, bool state);
00131 
00132   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00133 
00134   bool isDef(UMode &m) const 
00135   {return ((cmodes & m.cmodes) != 0 || (bmodes & m.bmodes) != 0);}
00137 
00138   bool isDef(u_modes some_Bmodes, u_modes some_Cmodes) const 
00139   {return ((cmodes & some_Cmodes) != 0 || (bmodes & some_Bmodes) != 0);}
00141 
00142   bool isAllDef(u_modes all_Bmodes, u_modes all_Cmodes) const 
00143   {return ((cmodes&all_Cmodes)==all_Cmodes && (bmodes&all_Bmodes)==all_Bmodes);}
00145 
00146   void setState(u_state istate);
00147   u_state getState()  const {return istate;}
00149 
00150   // inherited: virtual void fire(UEvent*, const UOn&);   // fires callbacks
00151 
00152   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00153 
00154 #ifndef NO_DOC
00155 protected:
00156   friend class UMode;
00157   friend class UOn;
00158   friend class UAppli;
00159   friend class UFlow;
00160 
00161   enum {STANDARD, BROWSING, TYPING};
00162   u_modes cmodes;
00163   u_state istate;
00164 
00165   virtual void updateView(UEvent&, class UView*, const class UUpdate&) = 0;
00166  
00167   virtual void enterBehavior(class UFlow&, UEvent&, int bstyle);
00168   virtual void leaveBehavior(class UFlow&, UEvent&);
00169   virtual void armBehavior(class UFlow&, UEvent&, int bstyle);
00170   virtual bool disarmBehavior(class UFlow&, UEvent&, int bstyle);
00171   virtual bool actionBehavior(class UFlow&, UEvent&);
00172   virtual void keyPressBehavior(class UFlow&, UEvent&);
00173   virtual void keyReleaseBehavior(class UFlow&, UEvent&);
00174 };
00175 #endif
00176 
00177 /* ==================================================== [TheEnd] ======= */
00178 /* ==================================================== [Elc:03] ======= */
00179 #endif
00180 

Generated on Thu Mar 3 06:33:20 2005 for Ubit[Eric.Lecolinet@enst.fr] by  doxygen 1.4.1