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