update.hpp

00001 /* ==================================================== ======== ======= *
00002  *
00003  *  update.hpp : graphics update
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 _update_hpp_
00021 #define _update_hpp_
00022 //pragma ident  "@(#)update.hpp ubit:05.05.00
00023 #include <ubit/udefs.hpp>
00024 namespace ubit {
00025 
00026 /* ==================================================== ===== ======= */
00030 class UUpdate {
00031 public:
00032   enum {
00033     PAINT = 1<<0,
00035     
00036     LAYOUT = 1<<1,
00038     
00039     LAYOUT_PAINT = (LAYOUT | PAINT),
00040     
00041     NO_DELAY = 1<<2,
00047     HIDDEN_OBJECTS = 1<<3,
00052     SOFT_DBF = 1<<4,
00057     NO_SOFT_DBF = 1<<5,
00062     SHOW = 1<<6,
00063     HIDE = 1<<7,
00064     ADJUST_WIN_SIZE = 1<<8
00065   };
00066   
00067   static const UUpdate paint;
00069   
00070   static const UUpdate layoutAndPaint;
00072   
00073   ~UUpdate();
00074 
00075   UUpdate(unsigned int mode_mask = LAYOUT|PAINT);  
00088   UUpdate(const UUpdate&);
00089   UUpdate& operator=(const UUpdate&);
00090   
00091   bool operator==(const UUpdate&);
00092 
00093   void noDelay() {modes |= NO_DELAY;}
00095   
00096   void hiddenObjects() {modes |= HIDDEN_OBJECTS;}
00098 
00099   void softDbf() {modes |= SOFT_DBF;}
00101 
00102   UMask getModes() const {return modes;}
00104 
00105   void addModes(unsigned int m) {modes |= m;}
00106   int  getDbfMode() const;
00107   bool isHiddenObjectsMode() const {return (modes & HIDDEN_OBJECTS) != 0;}
00108   
00109   void setPaintData(const UData*);
00111   
00112   void setPaintStr(const UStr*, int strpos1, int strpos2);
00114   
00115   void setMove(float delta_x, float delta_y, bool is_percent);
00117   
00118   void setScroll(float delta_x, float delta_y, bool is_percent);
00120   
00121   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00122 private:
00123   friend class UGroup;
00124   friend class UBox;
00125   friend class UWin;
00126   friend class UHardWinImpl;
00127   friend class USoftWinImpl;
00128   friend class UAppliImpl;
00129 
00130   enum {
00131     PROCESS_REQUESTS = 1<<10,
00132     ADD_REMOVE = 1<<11,
00133     STR_DATA = 1<<12,  // doit impliquer PAINT
00134     SCROLL = 1<<13,    // appel direct de updateView() par Scrollpane sans update()
00135     MOVE   = 1<<14     // appel en NO_DELAY par UPos
00136   };
00137 
00138   UMask modes;
00139 
00140 public:  // a cause d'un bug de CC
00141   struct ScrollMove {
00142     ScrollMove(float dx, float dy, bool pd);
00143     float delta_x, delta_y;
00144     bool percent_delta;
00145     int refcount;
00146   };
00147   
00148   struct StrData {
00149     StrData(const UData* d, int p1, int p2);
00150     const UData* data;
00151     const URegion* region;
00152     int pos1, pos2;
00153     int refcount;
00154   };
00155   
00156 private:
00157   // IMPL NOTE: il ne DOIT pas y avoir de subclasses car UUpdate est copie
00158   // directement dans UpdateRequest (voir uappliImpl.hpp)  
00159   union UpdateImpl {
00160     StrData* sd;
00161     ScrollMove* sm;
00162   } props;
00163 };
00164 
00165 }
00166 #endif
00167 /* ==================================================== [TheEnd] ======= */
00168 /* ==================================================== [(c)Elc] ======= */

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