uviewImpl.hpp

00001 /* ==================================================== ======== ======= *
00002  *
00003  *  uviewImpl.hpp : internal implementation (do not use)
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
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 //pragma ident  "@(#)uviewImpl.hpp      ubit:05.05.00"
00021 #ifndef _uviewImpl_hpp_
00022 #define _uviewImpl_hpp_
00023 #include <ubit/uevent.hpp>
00024 #include <ubit/uborder.hpp>
00025 namespace ubit {
00026 
00027 // ====[internal implementation]===========================
00028 
00029 struct UViewLayout {
00030   enum Strategy {BOXVIEW, GET_HINTS, IMPOSE_WIDTH, NESTED} strategy;
00031   int w, spec_w, min_w, max_w;
00032   int h, spec_h, min_h, max_h;
00033   UViewLayout() : strategy(BOXVIEW) {}
00034 };
00035 
00036 // ==================================================== ===== =======
00037 
00038 struct UViewLayoutImpl {
00039   UViewLayoutImpl(UView*);
00040   void computeWidth(const UContext& curp, const UMargins&,
00041                     UViewLayout&, bool minmax_defined);
00042   void computeHeight(const UContext& curp, const UMargins&,
00043                      UViewLayout&, bool minmax_defined);
00044   
00045   UView* view;
00046   int visibleElemCount;  // UBox or UData (not UGroup, not a PosBox)
00047   int chwidth, pos_chwidth, chheight, pos_chheight;
00048   unsigned char orient;
00049   bool mustLayoutAgain;
00050 };
00051 
00052 // ==================================================== ===== =======
00053 
00054 struct UViewUpdate {
00055   // !BEWARE: order is MEANINGFUL: all ITEM operations must be > ITEM_OPS
00056   enum Mode {
00057     PAINT_ALL,       // Paint all objects in clipping area
00058     PAINT_DAMAGED,   // Just paint damaged objects and their children,
00059     //MAIS AUSSI toutes les vues soeurs qui suivent (a cause des vues
00060     //evntuellement superposees, voir note dans UViewUpdateData ci-dessous)
00061     //PAINT_CHANGED, // Just paint objects whose size or pos has changed
00062     UPDATE_DATA,     // Just update data, do not paint
00063     FIND_DATA_POS,   // Locate an UData from its pos - do NOT paint it
00064     FIND_DATA_PTR    // Locate an UData from a link or a pointer
00065   };
00066   
00067   UViewUpdate(Mode _mode) {
00068     mode = _mode;
00069     e = null;
00070     data_props = null;
00071     // overlapp = 0;
00072     damaged_level = 0;
00073     after_damaged = false;
00074     above_damaged_count = 0;
00075   }
00076 
00077   void setMode(Mode _mode) {mode = _mode;}
00078   Mode getMode() {return mode;}
00079 
00080   Mode mode;
00081   UMouseEvent* e;
00082   UDataProps* data_props;  // optional, used when searching UDatas
00083 
00084   // when applicable (mode PAINT_DAMAGED) : 0 before drawing any damaged,
00085   // > 0 No (depth) of the damaged view, < 0 after painting the first damaged
00086   int damaged_level;
00087   // true when one or several damaged views have been processed
00088   bool after_damaged;
00089   // number of views to repaint above damaged objects
00090   int above_damaged_count;
00091 };
00092 
00093 // ==================================================== ===== =======
00094 
00095 struct UViewUpdateImpl : public URegion {
00096 
00097   UViewUpdateImpl(UView*, const URegion& r, UViewUpdate&);
00098   virtual ~UViewUpdateImpl();
00099 
00100   virtual void updateBackground(UGraph&, UContext&, 
00101                                 const URegion &r, const URegion& clip);
00102   virtual void setMargins(UGraph&, const UContext&, 
00103                           const URegion &r, bool add_frame_and_paddind);
00104   virtual void callResizeCallbacks(UGroup*, UContext&);
00105   virtual void callPaintCallbacks(UGroup*, UContext&);
00106 
00107   UView* view;
00108   UMargins margins;
00109   URegion chr, chclip;
00110   int  vflex_space, hflex_space;
00111   bool can_paint;
00112   unsigned char orient;
00113   UViewUpdate& upmode;
00114   class UTableView* tabview;
00115   class UEdit* edit;  
00116 };
00117 
00118 // ==================================================== ===== =======
00119 
00120 struct UMultiList {
00121   static const int MAXCOUNT = 2;
00122   
00123   // parses the child list of grp, finds the 1st visible element (UData or UGroup)
00124   // and adds it (and its followers) as a sublist
00125   // also checks HARDWIN and SOFTWIN_LIST
00126   UMultiList(UContext& curp, UGroup* grp);
00127   
00128   UChildIter begin() {return sublists[current = 0].begin;}
00129   UChildIter end() {return sublists[current].end;}
00130   // att: end() doit etre celui de current car cette valeur est utilisee ds le code.
00131   
00132   void next(UChildIter& c);
00133   void addChildList(UChildIter begin, UChildIter end);
00134   UChildren* getSoftwinList(UGroup*);
00135   
00136   //private:
00137   struct SubList {UChildIter begin, end;};
00138   SubList sublists[MAXCOUNT];
00139   int card, current;
00140   bool in_softwin_list;
00141 };
00142 
00143 }
00144 #endif
00145 /* ==================================================== [TheEnd] ======= */
00146 /* ==================================================== [(c)Elc] ======= */
00147 

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