ucontext.hpp

00001 /* ==================================================== ======== ======= *
00002 *
00003 *  uucontext.hpp
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 _ucontext_hpp_
00021 #define _ucontext_hpp_
00022 //pragma ident  "@(#)ucontext.hpp       ubit:05.05.00"
00023 #include <ubit/ustyle.hpp>
00024 #include <ubit/ufontImpl.hpp>
00025 #include <ubit/uview.hpp>
00026 #include <ubit/uviewImpl.hpp>
00027 #include <vector>
00028 namespace ubit {
00029 
00030 // ====[internal implementation]=========================================
00031 // NOTE: this header is part of the Ubit intrinsics and subject to change
00032 
00036 class UContext {
00037 public:
00038   UContext(UGroup*, UView*, const UContext& parent_ctx, UViewUpdateImpl*);
00040 
00041   UGroup* getObj() {return obj;}
00043   
00044   UBox* getBoxParent() {return view->getBoxParent();}
00045   /*< returns the direct or *indirect* box parent of getObj().
00046     * 'boxes' are UBox objects or objects that derive from UBox.
00047     */  
00048     
00049   UView* getView() {return view;}
00051 
00052   UView* getWinView();
00054   
00055   UGraph* getGraph();
00056   UDisp* getDisp();
00057 
00058   void rescale();
00060 
00061   void addFlagdef(const UFlagdef*);
00062   const UFlagdef* getFlagdef(const UFlag&) const;
00063   const UFlagdef* getFlagdef(const UFlag*) const;
00064   const UPropdef* getPropdef(const UFlag&) const;
00065   const UPropdef* getPropdef(const UFlag*) const;
00066 
00067   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00068 #ifndef NO_DOC 
00069   ULocalProps local;
00070   UFontDesc fontdesc;
00071   char valign, halign;      // heritable
00072   short vspacing, hspacing; // idem
00073   UEdit* edit;              // idem
00074   const UColor  *color, *bgcolor;
00075   UCursor *cursor;
00076   UPos* pos;                // UPos ou U3dpos, UPos peut etre proportionnelle
00077   float xyscale;            // current scale
00078   bool boxIsHFlex, boxIsVFlex; // true if the object is Horiz or Vert Flexible
00079   unsigned short flag_count;   // number of valid flagdefs for this stack level
00080   UGroup* obj;
00081   UView* view;
00082   const UContext* parent_ctx;
00083   UWinContext* win_ctx;  // not const because of the flags vector
00084   UViewUpdateImpl* view_impl; 
00085   
00086 protected:
00087   UContext() {}  // for UWinContext
00088 #endif
00089 };
00090 
00091 /* ==================================================== ======== ======= */
00094 class UWinContext : public UContext {
00095 public:
00096   UWinContext(UView* winview, UGraph* = null);
00101   UGraph* getGraph() {return graph;}
00102 
00103 private:
00104   friend class UContext;
00105   std::vector<const UFlagdef*> flags;
00106   UGraph* graph;
00107 };
00108 
00109 /* ==================================================== ======== ======= */
00110 
00111 inline UView*  UContext::getWinView() {return win_ctx->view;}
00112 inline UDisp*  UContext::getDisp()    {return win_ctx->view->getDisp();}
00113 inline UGraph* UContext::getGraph()   {return win_ctx->graph;}
00114 
00115 }
00116 #endif
00117 /* ==================================================== [TheEnd] ======= */
00118 /* ==================================================== [(c)Elc] ======= */

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