nux-0.9.48

Nux/Theme.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 2010 Inalogic® Inc.
00003  *
00004  * This program is free software: you can redistribute it and/or modify it
00005  * under the terms of the GNU Lesser General Public License, as
00006  * published by the  Free Software Foundation; either version 2.1 or 3.0
00007  * of the License.
00008  *
00009  * This program is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranties of
00011  * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
00012  * PURPOSE.  See the applicable version of the GNU Lesser General Public
00013  * License for more details.
00014  *
00015  * You should have received a copy of both the GNU Lesser General Public
00016  * License along with this program. If not, see <http://www.gnu.org/licenses/>
00017  *
00018  * Authored by: Jay Taoko <jaytaoko@inalogic.com>
00019  *
00020  */
00021 
00022 
00023 #ifndef UXTHEME_H
00024 #define UXTHEME_H
00025 
00026 
00027 namespace nux
00028 {
00029 
00030   enum UXStyleImageRef
00031   {
00032     eIMAGE_STYLE_NONE = 0,
00033     eSTROKE_CORNER_SQUARE,
00034     eSTROKE_CORNER_ROUND1,
00035     eSTROKE_CORNER_ROUND2,
00036     eSTROKE_CORNER_ROUND4,
00037     eSTROKE_CORNER_ROUND10,
00038 
00039     eSHAPE_CORNER_SQUARE,
00040     eSHAPE_CORNER_ROUND1,
00041     eSHAPE_CORNER_ROUND2,
00042     eSHAPE_CORNER_ROUND4,
00043     eSHAPE_CORNER_ROUND10,
00044 
00045     eSHAPE_CORNER_ROUND10_SHADOW,
00046     eSHAPE_CORNER_ROUND4_SHADOW,
00047     eSHAPE_CORNER_SHADOW,
00048 
00049     eTRIANGLE_UP,
00050     eTRIANGLE_DOWN,
00051     eTRIANGLE_LEFT,
00052     eTRIANGLE_RIGHT,
00053 
00054     eWINDOW_SIZEGRIP,
00055 
00056     eSHAPE_CHECK_MARK,
00057     eSHAPE_CHECK_BOX_FOCUS,
00058     eSHAPE_CHECK_BOX_PRELIGHT,
00059     eSHAPE_CHECK_BOX,
00060 
00061     eCHECKBOX_NORMAL_ON,
00062     eCHECKBOX_NORMAL_OFF,
00063     eCHECKBOX_FOCUS_ON,
00064     eCHECKBOX_FOCUS_OFF,
00065     eCHECKBOX_PRELIGHT_ON,
00066     eCHECKBOX_PRELIGHT_OFF,
00067 
00068     eRADIO_NORMAL_ON,
00069     eRADIO_NORMAL_OFF,
00070     eRADIO_FOCUS_ON,
00071     eRADIO_FOCUS_OFF,
00072     eRADIO_PRELIGHT_ON,
00073     eRADIO_PRELIGHT_OFF,
00074 
00075     eBUTTON_NORMAL,
00076     eBUTTON_FOCUS,
00077     eBUTTON_PRELIGHT,
00078 
00079     eSPINNERUP,
00080     eSPINNERDOWN,
00081 
00082     eCOMBOBOX_OPEN_BUTTON,
00083     eTAB_LEFT,
00084     eTAB_RIGHT,
00085     eSPINER_UP,
00086     eSPINER_DOWN,
00087     eTREE_NODE_OPEN,
00088     eTREE_NODE_CLOSE,
00089 
00090     eSCROLLBAR_TRIANGLE_UP,
00091     eSCROLLBAR_TRIANGLE_DOWN,
00092     eSCROLLBAR_TRIANGLE_LEFT,
00093     eSCROLLBAR_TRIANGLE_RIGHT,
00094 
00095     eVECTORXLABEL,
00096     eVECTORYLABEL,
00097     eVECTORZLABEL,
00098     eVECTORWLABEL,
00099 
00100     eVALUATORVERTICALMOVE,
00101     eVALUATORHORIZONTALMOVE,
00102     eVALUATORMOVE,
00103 
00104     eHSCROLLBAR,
00105     eVSCROLLBAR,
00106 
00107     eMATRIX3PREVIEW,
00108     eMATRIX4PREVIEW,
00109 
00110     eDOT6x6,
00111 
00112     eGraphIcon,
00113     eGraphBarIcon,
00114 
00115     eWindowCloseButton,
00116   };
00117 
00118   struct PainterImage
00119   {
00120     BaseTexture *texture;
00121     UXStyleImageRef style;
00122 
00123     int border_left;
00124     int border_right;
00125     int border_top;
00126     int border_bottom;
00127     bool draw_borders_only;
00128   };
00129 
00130   class UXTheme
00131   {
00132   public:
00133     UXTheme();
00134     ~UXTheme();
00135 
00136     const PainterImage *GetImage (UXStyleImageRef style);
00137     Rect GetImageGeometry (UXStyleImageRef style);
00138 
00139 
00140   private:
00141     void LoadPainterImages();
00142     BaseTexture *Load2DTextureFile (const char *filename);
00143     //BaseTexture *Load2DRectangleTextureFile (const char *filename);
00144     BaseTexture *Load2DTextureFileGenerateAlpha (const char *filename, int red, int green, int blue);
00145 
00146     std::list<PainterImage *> m_PainterImageList;
00147 
00148   };
00149 
00150 
00151 }
00152 
00153 #endif // UXTHEME_H