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

ucontext.hpp

00001 /* ==================================================== ======== ======= *
00002  *
00003  *  ucontext.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 _ucontext_hpp_
00026 #define _ucontext_hpp_
00027 //pragma ident  "@(#)ucontext.hpp       ubit:03.06.03"
00028 #include <ubit/ufont.hpp>
00029 #include <ubit/uborder.hpp>
00030 
00031 
00032 //package_private: ====[internal implementation]===========================
00033 //NOTE: this header is reserved to Ubit intrinsics
00034 
00035 struct ULocalProps {
00036   char valign, halign;
00037   u_dim width, height;
00038   u_pos xpos, ypos;
00039 
00040   // for alpha blending
00041   float alpha;
00042   //short layer; not used
00043 
00044   // horizontal and vertical spacing between included items
00045   short vspacing, hspacing;
00046 
00047   // space beween content and border (if any)
00048   UMargins padding;
00049 
00050   class UBorder* border; 
00051 
00052   // if this group is not null the object it contains are added 
00053   // to children for normal display (this feature can for instance be used 
00054   // for adding list-item markers, checkbox markers, etc.
00055   class UGroup* content;        //NB: = null in most cases
00056 
00057   // shape of the component
00058   class UShape* shape;          //NB: = null in most cases
00059 
00060   // image or color background of the component
00061   const class UBackground* background;
00062 
00063   // used if the component is editable
00064   class UEdit* edit;
00065 
00066   void rescale(float xyscale);
00067 };
00068 
00069 /* ==================================================== ======== ======= */
00070 // UContext =  a subcontext (not the first layer of the context cstack)
00071 // and a base for UWinContext (the first layer of the cstack)
00072  
00073 class UContext {
00074 public:
00075   class UGroup* obj;
00076   class UBox*   parent_box;
00077   class UView * winview;
00078   ULocalProps   local;
00079 
00080   // current Colors, Font descriptor and Cursor
00081   const class UColor  *color, *bgcolor;
00082   const class UCursor *cursor;
00083   class UFontDesc fontdesc;
00084 
00085   // curent LOGICAL scale level (NB: the scale can be > 0 or < 0)
00086   short lscale;
00087   float xyscale;
00088   
00089   // true if the object is Horizontally or Vertically Flexible
00090   bool boxIsHFlex, boxIsVFlex;
00091 
00092   // number of valid flagdefs for this stack level
00093   // (only the first flagdefCard elements are valid for this level)
00094   // the flag vector is shared by all stacked Contexts
00095 
00096   unsigned short flagdefCount;
00097   const class UFlagdef ***pflagdefs;
00098 
00099   // creates a subcontext (not the first layer of the context stack)
00100   UContext(UGroup*, UView* box_view, const UContext& parent_context);
00101   UContext() {}
00102 
00103   void rescale();
00104 
00105   void addFlagdef(const class UFlagdef*);
00106 
00107   const class UFlagdef* getFlagdef(const class UFlag&) const;
00108   const class UFlagdef* getFlagdef(const class UFlag*) const;
00109 
00110   const class UPropdef* getPropdef(const class UFlag&) const;
00111   const class UPropdef* getPropdef(const class UFlag*) const;
00112 };
00113 
00114 /* ==================================================== ======== ======= */
00115 // UWinContext = the first layer of the context cstack
00116 
00117 class UWinContext : public UContext {
00118 public:
00119   // references for pflags in subcontexts
00120   const class UFlagdef **flagdefs;
00121 
00122   // creates the first layer of the context stack
00123   // -- !Warning: 'win_view' must be a valid (NOT null) window view!
00124   UWinContext(UView* win_view);
00125   UWinContext(){}
00126   ~UWinContext();
00127 
00128   // this method recopies the internal flag array
00129   void copy(UWinContext&);
00130 };
00131 
00132 
00133 #endif
00134 /* ==================================================== [TheEnd] ======= */
00135 /* ==================================================== [Elc:03] ======= */

Generated on Thu Mar 3 06:33:20 2005 for Ubit[Eric.Lecolinet@enst.fr] by  doxygen 1.4.1