ustyle.hpp

00001 /* ==================================================== ======== ======= *
00002 *
00003 *  ustyle.hpp
00004 *  Ubit Project
00005 *  Part of the Ubit Toolkit: A Brick Construction Game Model for Creating GUIs
00006 *  (C) 1999-2005 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 _ustyle_hpp_
00021 #define _ustyle_hpp_
00022 //pragma ident  "@(#)ustyle.hpp ubit:05.05.00"
00023 #include <ubit/umode.hpp>
00024 #include <ubit/uprop.hpp>
00025 #include <ubit/uborder.hpp>
00026 #include <ubit/ufont.hpp>
00027 namespace ubit {
00028 
00029 /* ==================================================== ===== ======= */
00030 
00031 struct ULocalProps {  
00032   float alpha;          // for alpha blending
00033   UMargins margins;     // space beween content and border (if any)
00034   UBorder* border;
00035   const UBackground* background;   // image or color background of the component
00036   UWidth*  pwidth;
00037   UHeight* pheight;
00038   
00039   // if this group is not null the objects it contains are added
00040   // to children for normal display (this feature can for instance be used
00041   // for adding list-item markers, checkbox markers, etc.
00042   class UGroup* content;    // NB: = null in most cases
00043   // class UShape* shape;   // shape of the component
00044 };
00045 
00046 /* ==================================================== ===== ======= */
00050 class UStyle {
00051 public:
00052   UStyle();
00053   virtual ~UStyle();
00054   virtual const UStyle& getStyle(UContext*) const {return *this;}
00055   
00056   const UColor* getColor(const UControl*) const;
00057   const UColor* getBgcolor(const UControl*) const;
00058   
00059   void setColors(UColor& all_colors);
00060   void setColors(UColor& unselected_colors, UColor& selected_colors);
00061   
00062   void setBgcolors(UColor& all_colors);
00063   void setBgcolors(UColor& unselected_colors, UColor& selected_colors);
00064   
00065   void setColor(int action, UColor&);
00066   void setBgcolor(int action, UColor&);
00067 
00068   mutable ULocalProps local;
00069   mutable char orient;
00070   char  valign, halign;        // heritables
00071   short vspacing, hspacing;    // idem
00072   mutable UEdit* edit;
00073   mutable UFont* font;
00074   mutable UCursor* cursor;
00075   mutable UBackground* background;
00076   mutable UViewStyle* viewStyle;
00077   mutable UStr* textSeparator;  // text separator between children when printing
00078   mutable UColor* colors[2 * UMode::ACTION_COUNT];
00079   mutable UColor* bgcolors[2 * UMode::ACTION_COUNT];
00080 };
00081 
00082 }
00083 #endif
00084 /* ==================================================== [TheEnd] ======= */
00085 /* ==================================================== [(c)Elc] ======= */

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