1 // Copyright 2014 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #ifndef _FWL_THEME_H 8 #define _FWL_THEME_H 9 class IFWL_Widget; 10 class CFWL_ThemePart; 11 class CFWL_ThemeBackground; 12 class CFWL_ThemeText; 13 class CFWL_ThemeElement; 14 class IFWL_ThemeProvider; 15 #define FWL_WGTCAPACITY_CXBorder 1 16 #define FWL_WGTCAPACITY_CYBorder 2 17 #define FWL_WGTCAPACITY_ScrollBarWidth 3 18 #define FWL_WGTCAPACITY_EdgeFlat 4 19 #define FWL_WGTCAPACITY_EdgeRaised 5 20 #define FWL_WGTCAPACITY_EdgeSunken 6 21 #define FWL_WGTCAPACITY_Font 7 22 #define FWL_WGTCAPACITY_FontSize 8 23 #define FWL_WGTCAPACITY_TextColor 9 24 #define FWL_WGTCAPACITY_TextSelColor 10 25 #define FWL_WGTCAPACITY_LineHeight 11 26 #define FWL_WGTCAPACITY_UIMargin 12 27 #define FWL_WGTCAPACITY_SpaceAboveBelow 13 28 #define FWL_WGTCAPACITY_MAX 65535 29 class CFWL_ThemePart { 30 public: CFWL_ThemePart()31 CFWL_ThemePart() 32 : m_pWidget(NULL), m_iPart(0), m_dwStates(0), m_dwData(0), m_pData(NULL) { 33 m_rtPart.Reset(); 34 m_matrix.SetIdentity(); 35 } 36 CFX_Matrix m_matrix; 37 CFX_RectF m_rtPart; 38 IFWL_Widget* m_pWidget; 39 int32_t m_iPart; 40 FX_DWORD m_dwStates; 41 FX_DWORD m_dwData; 42 void* m_pData; 43 }; 44 class CFWL_ThemeBackground : public CFWL_ThemePart { 45 public: CFWL_ThemeBackground()46 CFWL_ThemeBackground() : m_pGraphics(NULL), m_pImage(NULL), m_pPath(NULL) {} 47 CFX_Graphics* m_pGraphics; 48 CFX_DIBitmap* m_pImage; 49 CFX_Path* m_pPath; 50 }; 51 class CFWL_ThemeText : public CFWL_ThemePart { 52 public: CFWL_ThemeText()53 CFWL_ThemeText() : m_pGraphics(NULL) {} 54 CFX_WideString m_wsText; 55 FX_DWORD m_dwTTOStyles; 56 int32_t m_iTTOAlign; 57 CFX_Graphics* m_pGraphics; 58 }; 59 class IFWL_ThemeProvider { 60 public: ~IFWL_ThemeProvider()61 virtual ~IFWL_ThemeProvider() {} 62 virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget) = 0; 63 virtual FX_DWORD GetThemeID(IFWL_Widget* pWidget) = 0; 64 virtual FX_DWORD SetThemeID(IFWL_Widget* pWidget, 65 FX_DWORD dwThemeID, 66 FX_BOOL bChildren = TRUE) = 0; 67 virtual FWL_ERR GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) = 0; 68 virtual FWL_ERR SetThemeMatrix(IFWL_Widget* pWidget, 69 const CFX_Matrix& matrix) = 0; 70 virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) = 0; 71 virtual FX_BOOL DrawText(CFWL_ThemeText* pParams) = 0; 72 virtual void* GetCapacity(CFWL_ThemePart* pThemePart, 73 FX_DWORD dwCapacity) = 0; 74 virtual FX_BOOL IsCustomizedLayout(IFWL_Widget* pWidget) = 0; 75 virtual FWL_ERR GetPartRect(CFWL_ThemePart* pThemePart, 76 CFX_RectF& rtPart) = 0; 77 virtual FX_BOOL IsInPart(CFWL_ThemePart* pThemePart, 78 FX_FLOAT fx, 79 FX_FLOAT fy) = 0; 80 virtual FX_BOOL CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) = 0; 81 }; 82 #endif 83