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

ucond.hpp

00001 /* ==================================================== ======== ======= * 00002 * 00003 * ucond.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 _ucond_hpp_ 00026 #define _ucond_hpp_ 00027 //pragma ident "@(#)ucond.hpp ubit:03.05.03" 00028 00029 /* ==================================================== [Elc:03] ======= */ 00030 /* ==================================================== ======== ======= */ 00037 class UCond { 00038 public: 00039 virtual bool verifies(const UContext*, const class UCtrl*) const = 0; 00040 virtual void setParentModes(UCtrl *parent) const {}; 00041 }; 00042 00043 /* ==================================================== ======== ======= */ 00044 00045 class UNotCond : public UCond { 00046 public: 00047 UNotCond(const UCond&); 00048 virtual bool verifies(const UContext*, const class UCtrl*) const; 00049 00050 private: 00051 const UCond& cond; 00052 }; 00053 00054 /* ==================================================== [Elc:03] ======= */ 00055 /* ==================================================== ======== ======= */ 00056 00064 class UOn : public UCond { 00065 public: 00066 00067 static UOn 00071 idle, 00072 00080 action, 00081 00091 arm, disarm, 00092 00100 enter, leave, 00101 mpress, //mpress1, mpress2, mpress3, //mlongpress, 00102 mrelease, //mrelease1, mrelease2, mrelease3, 00103 mdrag, mmove, mrelax, 00104 00115 mclick, mbiclick, mtriclick, mquadclick, 00116 00123 ktype, kpress, krelease, 00124 00136 select, unselect, 00137 00145 change, 00146 00156 propChange, elemChange, strChange, //caretChange, 00157 00165 add, remove, 00166 00170 destruct, 00171 00175 close, 00176 00179 dragStart, dragDone, dropEnter, dropLeave, dropDone, 00180 00186 viewPaint, viewResize, viewMove, 00187 00214 preChildEvent, 00215 00220 //input, 00221 //timeout, 00222 00228 umessage, 00229 notifyEvent, 00230 rawEvent; 00231 00232 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 00233 // implementation 00234 00235 enum ISTATE { // interaction state 00236 ANY = -1, 00237 IDLE = 0, // must be 0 (index in style arrays) 00238 DISABLED, ENTERED, ARMED, ACTIONED, DRAGGED, DROP_ENTERED, 00239 ACTION_COUNT // (used in Style Arrays) 00240 // !! BEWARE must be coherent with typedef u_state in udefs.hh !! 00241 }; 00242 00243 UOn(u_state istate, u_modes bmodes, u_modes cmodes); 00244 //< !CAUTION: NEVER delete UOn instances. 00245 00246 virtual bool verifies(const UContext*, const class UCtrl*) const; 00247 virtual void setParentModes(UCtrl *parent) const; 00248 00249 private: 00250 friend class UCtrl; 00251 friend class UGroup; 00252 u_modes bmodes, cmodes; 00253 u_state istate; 00254 }; 00255 00256 /* ==================================================== [Elc:03] ======= */ 00257 /* ==================================================== ======== ======= */ 00258 00266 class UFlag : public UCond { 00267 public: 00268 static const UFlag none; 00269 00270 UFlag(const char* name = null); 00271 friend UFlag& uflag(const char* name = null) {return *new UFlag(name);} 00273 00274 UCond& operator!() const; 00275 00276 const char* getName() const {return name;} 00277 virtual bool verifies(const UContext*, const class UCtrl*) const; 00278 00279 protected: 00280 const char *name; 00281 mutable class UNotCond* not_cond; 00282 }; 00283 00284 /* ==================================================== [Elc:03] ======= */ 00285 /* ==================================================== ======== ======= */ 00286 00294 class USrange : public UCond { 00295 public: 00296 USrange(int, int); 00297 friend USrange& usrange(int scale_min, int scale_max); 00299 00300 int getMin() const {return scale_min;} 00301 int getMax() const {return scale_max;} 00302 00303 virtual bool verifies(const UContext*, const class UCtrl*) const; 00304 00305 private: 00306 int scale_min, scale_max; 00307 }; 00308 00309 /* ==================================================== [TheEnd] ======= */ 00310 /* ==================================================== [Elc:03] ======= */ 00311 #endif 00312

Generated on Tue Jul 27 18:01:55 2004 for Ubit[Eric.Lecolinet@enst.fr] by doxygen 1.3.7