uboxLayout.hpp

00001 /* ==================================================== ======== ======= *
00002 *
00003 *  uboxLayout.hpp: layout properties
00004 *  Ubit Project
00005 *  Part of the Ubit Toolkit: A Brick Construction Game Model for Creating GUIs
00006 *  (C) 1999-2006 EricLecolinet / 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 _uboxlayout_hpp_
00021 #define _uboxlayout_hpp_
00022 //pragma ident  "@(#)uboxLayout.hpp     ubit:05.05.00"
00023 #include <ubit/uprop.hpp>
00024 namespace ubit {
00025   
00026 /* ==================================================== ===== ======= */
00031 class UOrient : public UProp {
00032 public:
00033   UBIT_ATTR_CLASS(UOrient,UProp)
00034 
00035   static UOrient horizontal, vertical;
00036 
00037   UOrient();
00038   UOrient(const UOrient&);
00039   friend UOrient& uorient(const UOrient&);
00040 
00041   UOrient& operator=(const UOrient& v);
00042   bool operator==(const UOrient& v) const {return value == v.value;}
00043 
00044   virtual void update();
00045   virtual void putProp(UContext*, UControl*);
00046 
00047   // - impl. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00048 #ifndef NO_DOC
00049   enum {HORIZONTAL=0, VERTICAL=1, INHERIT=2}; //dont change values
00050   void addingTo(UChild* self, UGroup *parent);
00051   void removingFrom(UChild* self, UGroup *parent);
00052 private:
00053   char value;
00054   UOrient(char value, UMask = 0);
00055 #endif
00056 };
00057 
00058 /* ==================================================== ===== ======= */
00072 class UHalign : public UProp {
00073 public:
00074   UBIT_ATTR_CLASS(UHalign,UProp)
00075 
00076   static UHalign left, right, flex, center;
00077 
00078   UHalign();
00079   UHalign(const UHalign&);
00080   friend UHalign& uhalign(const UHalign&);
00081 
00082   UHalign& operator=(const UHalign&);
00083   bool operator==(const UHalign& v) const {return value == v.value;}
00084 
00085   friend UHalign& uleft() {return UHalign::left;}
00086   friend UHalign& uright() {return UHalign::right;}
00094   friend UHalign& uhcenter() {return UHalign::center;}
00100   friend UHalign& uhflex() {return UHalign::flex;}
00107   virtual void update();
00108   virtual void putProp(UContext*, UControl*);
00109 
00110   // - impl. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00111   enum {INHERIT, LEFT, RIGHT, FLEX, CENTER};
00112 private:
00113   char value;
00114   UHalign(char value, UMask = 0);
00115 };
00116 
00117 /* ==================================================== ===== ======= */
00126 class UValign : public UProp {
00127 public:
00128   UBIT_ATTR_CLASS(UValign,UProp)
00129 
00130   static UValign top, bottom, flex, center;
00131 
00132   UValign();
00133   UValign(const UValign&);
00134   friend UValign& uvalign(const UValign&);
00135 
00136   UValign& operator=(const UValign& v);
00137   bool operator==(const UValign& v) const {return value == v.value;}
00138 
00139   friend UValign& utop()     {return UValign::top;}
00140   friend UValign& ubottom()  {return UValign::bottom;}
00141   friend UValign& uvcenter() {return UValign::center;}
00142   friend UValign& uvflex()   {return UValign::flex;}
00143 
00144   virtual void update();
00145   virtual void putProp(UContext*, UControl*);
00146 
00147   // - impl. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00148   enum {INHERIT, TOP, BOTTOM, FLEX, CENTER};
00149 private:
00150   char value;
00151   UValign(char value, UMask = 0);
00152 };
00153 
00154 /* ==================================================== ===== ======= */
00157 class UVspacing : public UProp {
00158 public:
00159   UBIT_ATTR_CLASS(UVspacing,UProp)
00160 
00161   static UVspacing none;
00162   
00163   UVspacing(int = 0);
00164   friend UVspacing& uvspacing(int = 0);
00165   
00166   operator int() const {return value;}
00168   
00169   UVspacing& operator=(int);
00170   UVspacing& operator=(const UVspacing&);
00171   
00172   bool operator==(int v) const {return value == v;}  
00173   bool operator==(const UVspacing& v) const {return value == v.value;}
00174   
00175   virtual void update();
00176   
00177   // - impl. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00178   enum {INHERIT = -1};
00179   virtual void putProp(UContext*, UControl*);
00180 private:
00181     int value;
00182 };
00183 
00184 /* ==================================================== ======== ======= */
00187 class UHspacing : public UProp {
00188 public:
00189   UBIT_ATTR_CLASS(UHspacing,UProp)
00190 
00191   static UHspacing none;
00192   
00193   UHspacing(int = 0);
00194   friend UHspacing& uhspacing(int = 0);
00195   
00196   operator int() const {return value;}
00198   
00199   UHspacing& operator=(int);
00200   UHspacing& operator=(const UHspacing&);
00201   
00202   bool operator==(int v) const {return value == v;}  
00203   bool operator==(const UHspacing& v) const {return value == v.value;}
00204   
00205   virtual void update();
00206   
00207   // - impl. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00208   enum {INHERIT = -1};
00209   virtual void putProp(UContext*, UControl*);
00210 private:
00211   int value;
00212 };
00213 
00214 /* ==================================================== ===== ======= */
00217 class UVmargin : public UProp {
00218 public:
00219   UBIT_ATTR_CLASS(UVmargin,UProp)
00220 
00221   static UVmargin none;
00222   
00223   UVmargin(int margins = 0);
00224   UVmargin(int top_margin, int bottom_margin);
00225   
00226   friend UVmargin& uvmargin(int margins = 0);
00227   friend UVmargin& uvmargin(int top_margin, int bottom_margin);
00228   
00229   UVmargin& operator=(int margins) {set(margins); return *this;} 
00230   virtual void set(int margins);
00231   virtual void set(int top_margin, int bottom_margin);
00232   
00233   int getTopMargin()    const {return top_value;}
00234   int getBottomMargin() const {return bottom_value;}
00235   
00236   virtual void update();
00237   
00238   // - impl. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00239   virtual void putProp(UContext*, UControl*);
00240 private:
00241   int top_value, bottom_value;
00242 };
00243 
00244 /* ==================================================== ======== ======= */
00247 class UHmargin : public UProp {
00248 public:
00249   UBIT_ATTR_CLASS(UHmargin,UProp)
00250 
00251   static UHmargin none;
00252   
00253   UHmargin(int margins = 0);
00254   UHmargin(int left_margin, int right_margin);
00255   
00256   friend UHmargin& uhmargin(int margins = 0);
00257   friend UHmargin& uhmargin(int left_margin, int right_margin);
00258   
00259   UHmargin& operator=(int margins) {set(margins); return *this;} 
00260   virtual void set(int margins);
00261   virtual void set(int left_margin, int right_margin);
00262   
00263   int getLeftMargin()  const {return left_value;}
00264   int getRightMargin() const {return right_value;}
00265   
00266   virtual void update();
00267   
00268   // - impl. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
00269 
00270   virtual void putProp(UContext*, UControl*);
00271 private:
00272   int left_value, right_value;
00273 };
00274 
00275 }
00276 #endif
00277 /* ==================================================== [TheEnd] ======= */
00278 /* ==================================================== [(c)Elc] ======= */
00279 
00280 
00281 

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