Back to index

nux  3.0.0
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_ROUND5,
00044     eSHAPE_CORNER_ROUND6,
00045     eSHAPE_CORNER_ROUND10,
00046 
00047     eSHAPE_CORNER_ROUND10_SHADOW,
00048     eSHAPE_CORNER_ROUND4_SHADOW,
00049     eSHAPE_CORNER_SHADOW,
00050 
00051     eTRIANGLE_UP,
00052     eTRIANGLE_DOWN,
00053     eTRIANGLE_LEFT,
00054     eTRIANGLE_RIGHT,
00055 
00056     eWINDOW_SIZEGRIP,
00057 
00058     eSHAPE_CHECK_MARK,
00059     eSHAPE_CHECK_BOX_FOCUS,
00060     eSHAPE_CHECK_BOX_PRELIGHT,
00061     eSHAPE_CHECK_BOX,
00062 
00063     eCHECKBOX_NORMAL_ON,
00064     eCHECKBOX_NORMAL_OFF,
00065     eCHECKBOX_FOCUS_ON,
00066     eCHECKBOX_FOCUS_OFF,
00067     eCHECKBOX_PRELIGHT_ON,
00068     eCHECKBOX_PRELIGHT_OFF,
00069 
00070     eRADIO_NORMAL_ON,
00071     eRADIO_NORMAL_OFF,
00072     eRADIO_FOCUS_ON,
00073     eRADIO_FOCUS_OFF,
00074     eRADIO_PRELIGHT_ON,
00075     eRADIO_PRELIGHT_OFF,
00076 
00077     eBUTTON_NORMAL,
00078     eBUTTON_FOCUS,
00079     eBUTTON_PRELIGHT,
00080 
00081     eSPINNERUP,
00082     eSPINNERDOWN,
00083 
00084     eCOMBOBOX_OPEN_BUTTON,
00085     eTAB_LEFT,
00086     eTAB_RIGHT,
00087     eSPINER_UP,
00088     eSPINER_DOWN,
00089     eTREE_NODE_OPEN,
00090     eTREE_NODE_CLOSE,
00091 
00092     eSCROLLBAR_TRIANGLE_UP,
00093     eSCROLLBAR_TRIANGLE_DOWN,
00094     eSCROLLBAR_TRIANGLE_LEFT,
00095     eSCROLLBAR_TRIANGLE_RIGHT,
00096 
00097     eVECTORXLABEL,
00098     eVECTORYLABEL,
00099     eVECTORZLABEL,
00100     eVECTORWLABEL,
00101 
00102     eVALUATORVERTICALMOVE,
00103     eVALUATORHORIZONTALMOVE,
00104     eVALUATORMOVE,
00105 
00106     eHSCROLLBAR,
00107     eVSCROLLBAR,
00108 
00109     eMATRIX3PREVIEW,
00110     eMATRIX4PREVIEW,
00111 
00112     eDOT6x6,
00113 
00114     eGraphIcon,
00115     eGraphBarIcon,
00116 
00117     eWindowCloseButton,
00118   };
00119 
00120   struct PainterImage
00121   {
00122     BaseTexture *texture;
00123     UXStyleImageRef style;
00124 
00125     int border_left;
00126     int border_right;
00127     int border_top;
00128     int border_bottom;
00129     bool draw_borders_only;
00130   };
00131 
00133 
00136   class UXTheme
00137   {
00138   public:
00139     UXTheme();
00140     ~UXTheme();
00141 
00142     const PainterImage *GetImage(UXStyleImageRef style);
00143     Rect GetImageGeometry(UXStyleImageRef style);
00144 
00145 
00146   private:
00147     void LoadPainterImages();
00148     BaseTexture *Load2DTextureFile(const char *filename);
00149     //BaseTexture *Load2DRectangleTextureFile(const char *filename);
00150     BaseTexture *Load2DTextureFileGenerateAlpha(const char *filename, int red, int green, int blue);
00151 
00152     std::list<PainterImage *> m_PainterImageList;
00153 
00154   };
00155 }
00156 
00157 #endif // UXTHEME_H