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

uviewImpl.hpp

00001 /* ==================================================== ======== ======= *
00002  *
00003  *  uviewImpl.hpp [internal implementation: do not use]
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:02] ======= *
00023  * ==================================================== ======== ======= */
00024 
00025 //pragma ident  "@(#)uviewImpl.hpp      ubit:03.06.03"
00026 #ifndef _uviewImpl_hh
00027 #define _uviewImpl_hh
00028 #include <ubit/uevent.hpp>
00029 #include <ubit/uborder.hpp>
00030 
00031 // ====[internal implementation]===========================
00032 
00033 struct UMultiList {
00034 public:
00035   static const int MAXCOUNT = 2;
00036 private:
00037   ULink *list_tab[MAXCOUNT];
00038   int count;
00039   bool is_softwin_list;
00040 public:
00041   // parses the child list of grp, finds the 1st visible element (UElem or UGroup)
00042   // and adds it (and its followers) as a sublist
00043   // also checks HARDWIN and SOFTWIN_LIST
00044   UMultiList(class UContext& curp, UGroup* grp, bool rescale);
00045 
00046   bool isSoftwinList() {return is_softwin_list;}
00047 
00048   // adds an Elem (and its followers) as a sublist of the MultiList
00049   void addList(ULink *l);
00050   void addSoftwinList(UGroup *grp);
00051 
00052   // !! doit imperativement etre appele en premier!!
00053   ULink* first() {return list_tab[count = 0];}
00054 
00055   ULink* next(ULink *ch) {
00056     if (ch->getNext()) return ch->getNext();
00057     else if (++count < MAXCOUNT) return list_tab[count];
00058     else return null;
00059   }
00060 };
00061 
00062 // ==================================================== [Elc:02] ======= //
00063 // ==================================================== ======== ======= //
00064 // View extensions: used by certain views when useful
00065 
00066 struct UViewExt {
00067   // used by viewMove and viewResize callbacks
00068   // for checking if pos or size has changed
00069   URegion* old_region;
00070 
00071   u_dim kept_width, kept_height;
00072 
00073   UViewExt();
00074   ~UViewExt();
00075 };
00076 
00077 // ==================================================== [Elc:02] ======= //
00078 // ==================================================== ======== ======= //
00079 
00080 struct UViewLayout {
00081   enum {NORMAL=0, GET_HINTS, IMPOSE_WIDTH, NESTED} strategy;
00082   u_dim spec_w, spec_h, cmin_w, cmax_w, cmin_h, cmax_h, line_h, line_w;
00083   UViewLayout() : strategy(NORMAL) {}
00084 };
00085 
00086 /* ==================================================== ======== ======= */
00087 
00088 struct UViewLayoutImpl {
00089   UView *view;
00090   int visibleElemCount;  // UBox or UElem (not UGroup, not floating)
00091   int children_w, children_h;
00092   unsigned char orient;
00093   bool mustLayoutAgain;
00094 
00095   UViewLayoutImpl(UView*);
00096   void computeWidth(const UContext& curp, const UMargins&,
00097                     class UViewLayout&, bool minmax_defined = false);
00098   void computeHeight(const UContext& curp, const UMargins&,
00099                      class UViewLayout&, bool minmax_defined = false);
00100 };
00101 
00102 // ==================================================== [Elc:02] ======= //
00103 // ==================================================== ======== ======= //
00104 
00105 struct UViewUpdate {
00106   // !BEWARE: order is MEANINGFUL: all ITEM operations must be > ITEM_OPS
00107   enum Mode {
00108     PAINT_ALL,       // Paint all objects in clipping area
00109     PAINT_DAMAGED,   // Just paint damaged objects and their children,
00110     //MAIS AUSSI toutes les vues soeurs qui suivent (a cause des vues 
00111     //evntuellement superposees, voir note dans UViewUpdateData ci-dessous)
00112     //PAINT_CHANGED, // Just paint objects whose size or pos has changed
00113     UPDATE_DATA,     // Just update data, do not paint
00114     LOCATE_ELEM_POS, // Locate an UElem from its pos - do NOT paint it
00115     LOCATE_ELEM_PTR  // Locate an UElem from a link or a pointer
00116   } mode;
00117   UEvent *e;
00118   class UElemProps* elem_props;  // optional, used when searching UElems
00119 
00120   // when applicable (mode PAINT_DAMAGED) : 0 before drawing any damaged,
00121   // > 0 No (depth) of the damaged view, < 0 after painting the first damaged
00122   int damaged_level;
00123   // true when one or several damaged views have been processed
00124   bool after_damaged;
00125   // number of views to repaint above damaged objects
00126   int above_damaged_count;
00127 
00128   UViewUpdate(Mode _mode) {
00129     mode = _mode;
00130     e = null; 
00131     elem_props = null;
00132     // overlapp = 0;
00133     damaged_level = 0;
00134     after_damaged = false;
00135     above_damaged_count = 0;
00136   }
00137 
00138   void setMode(Mode _mode) {mode = _mode;}
00139   Mode getMode() {return mode;}
00140 };
00141 
00142 /* ==================================================== ======== ======= */
00143 
00144 struct UViewUpdateImpl : public URegion {
00145   UView*  view;
00146   UMargins margins;        // a enlever a terme?
00147   URegion chr, chclip;
00148   u_dim   vflex_space, hflex_space;
00149   bool    can_paint;
00150   unsigned char orient;
00151   UViewUpdate& upmode;
00152   class UTableView* tabview;
00153   class UEdit* edit;
00154 
00155   UViewUpdateImpl(UView*, const URegion& r, UViewUpdate&);
00156   virtual ~UViewUpdateImpl();
00157 
00158   virtual void updateBackground(class UWinGraph&, UContext &curp, 
00159                                 const URegion &r, const URegion& clip);
00160   virtual void setMargins(class UWinGraph&, const UContext &curp, 
00161                           const URegion &r, bool add_frame_and_paddind);
00162   virtual void setFloating(UContext& curp, UGroup* grp, URegion& r);
00163   virtual void callbacks(UGroup*, UView* winview);
00164 };
00165 
00166 
00167 #endif
00168 /* ==================================================== [TheEnd] ======= */
00169 /* ==================================================== [Elc:02] ======= */
00170 

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