Merge to XFA: Use stdint.h types throughout PDFium.
[pdfium.git] / xfa / include / fwl / theme / widgettp.h
1 // Copyright 2014 PDFium Authors. All rights reserved.\r
2 // Use of this source code is governed by a BSD-style license that can be\r
3 // found in the LICENSE file.\r
4 \r
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
6 \r
7 #ifndef _FWL_WIDGETTP_H\r
8 #define _FWL_WIDGETTP_H\r
9 class IFWL_ThemeProvider;\r
10 class IFWL_Widget;\r
11 class IFDE_TextOut;\r
12 class IFX_Font;\r
13 class IFX_FontMgr;\r
14 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_\r
15 class IFX_FontSourceEnum;\r
16 #endif\r
17 class CFWL_WidgetTP;\r
18 class CFWL_ArrowData;\r
19 class CFWL_WidgetTP\r
20 {\r
21 public:\r
22     virtual FX_BOOL             IsValidWidget(IFWL_Widget *pWidget);\r
23     virtual FX_DWORD    GetThemeID(IFWL_Widget *pWidget);\r
24     virtual FX_DWORD    SetThemeID(IFWL_Widget *pWidget, FX_DWORD dwThemeID, FX_BOOL bChildren = TRUE);\r
25     virtual FWL_ERR             GetThemeMatrix(IFWL_Widget *pWidget, CFX_Matrix &matrix);\r
26     virtual FWL_ERR             SetThemeMatrix(IFWL_Widget *pWidget, const CFX_Matrix &matrix);\r
27     virtual FX_BOOL             DrawBackground(CFWL_ThemeBackground *pParams);\r
28     virtual FX_BOOL             DrawText(CFWL_ThemeText *pParams);\r
29     virtual FX_LPVOID   GetCapacity(CFWL_ThemePart *pThemePart, FX_DWORD dwCapacity);\r
30     virtual FX_BOOL             IsCustomizedLayout(IFWL_Widget *pWidget);\r
31     virtual FWL_ERR             GetPartRect(CFWL_ThemePart *pThemePart, CFX_RectF &rtPart);\r
32     virtual FX_BOOL             IsInPart(CFWL_ThemePart *pThemePart, FX_FLOAT fx, FX_FLOAT fy);\r
33     virtual     FX_BOOL         CalcTextRect(CFWL_ThemeText *pParams, CFX_RectF &rect);\r
34     virtual FWL_ERR             Initialize();\r
35     virtual FWL_ERR             Finalize();\r
36     virtual ~CFWL_WidgetTP();\r
37     FWL_ERR             SetFont(IFWL_Widget *pWidget, FX_LPCWSTR strFont, FX_FLOAT fFontSize, FX_ARGB rgbFont);\r
38     FWL_ERR             SetFont(IFWL_Widget *pWidget, IFX_Font *pFont, FX_FLOAT fFontSize, FX_ARGB rgbFont);\r
39     IFX_Font*   GetFont(IFWL_Widget *pWidget);\r
40 protected:\r
41     CFWL_WidgetTP();\r
42     FX_ERR      InitTTO();\r
43     FX_ERR      FinalizeTTO();\r
44     void        DrawEdge(CFX_Graphics *pGraphics, FX_DWORD dwStyles, const CFX_RectF *pRect, CFX_Matrix *pMatrix = NULL);\r
45     void        Draw3DRect(CFX_Graphics *pGraphics, FWLTHEME_EDGE eType, FX_FLOAT fWidth, const CFX_RectF *pRect, FX_ARGB cr1, FX_ARGB cr2, FX_ARGB cr3, FX_ARGB cr4, CFX_Matrix *pMatrix = NULL);\r
46     void        Draw3DCircle(CFX_Graphics *pGraphics, FWLTHEME_EDGE eType, FX_FLOAT fWidth, const CFX_RectF *pRect, FX_ARGB cr1, FX_ARGB cr2, FX_ARGB cr3, FX_ARGB cr4, CFX_Matrix *pMatrix = NULL);\r
47     void        DrawBorder(CFX_Graphics *pGraphics, const CFX_RectF *pRect, CFX_Matrix *pMatrix = NULL);\r
48     void        FillBackground(CFX_Graphics *pGraphics, const CFX_RectF *pRect, CFX_Matrix *pMatrix = NULL);\r
49     void        FillSoildRect(CFX_Graphics *pGraphics, FX_ARGB fillColor, const CFX_RectF *pRect, CFX_Matrix *pMatrix = NULL);\r
50     void        DrawAxialShading(CFX_Graphics *pGraphics, FX_FLOAT fx1, FX_FLOAT fy1, FX_FLOAT fx2, FX_FLOAT fy2, FX_ARGB beginColor, FX_ARGB endColor, CFX_Path *path, int32_t fillMode = FXFILL_WINDING, CFX_Matrix *pMatrix = NULL);\r
51     void        DrawAnnulusRect(CFX_Graphics *pGraphics, FX_ARGB fillColor, const CFX_RectF *pRect, FX_FLOAT fRingWidth = 1, CFX_Matrix *pMatrix = NULL);\r
52     void        DrawAnnulusCircle(CFX_Graphics *pGraphics, FX_ARGB fillColor, const CFX_RectF *pRect, FX_FLOAT fWidth = 1, CFX_Matrix *pMatrix = NULL);\r
53     void        DrawFocus(CFX_Graphics *pGraphics, const CFX_RectF *pRect, CFX_Matrix *pMatrix = NULL);\r
54     void        DrawArrow(CFX_Graphics *pGraphics, const CFX_RectF *pRect, FWLTHEME_DIRECTION eDict, FX_ARGB argbFill, FX_BOOL bPressed, CFX_Matrix *pMatrix = NULL);\r
55     void        DrawArrow(CFX_Graphics *pGraphics, const CFX_RectF *pRect, FWLTHEME_DIRECTION eDict, FX_ARGB argSign, CFX_Matrix *pMatrix = NULL);\r
56     void        DrawBtn(CFX_Graphics *pGraphics, const CFX_RectF *pRect, FWLTHEME_STATE eState, CFX_Matrix *pMatrix = NULL);\r
57     void        DrawArrowBtn(CFX_Graphics *pGraphics, const CFX_RectF *pRect, FWLTHEME_DIRECTION eDict, FWLTHEME_STATE eState, CFX_Matrix *pMatrix = NULL);\r
58     FWLCOLOR BlendColor(FWLCOLOR srcColor, FWLCOLOR renderColor, uint8_t scale);\r
59     FX_DWORD            m_dwRefCount;\r
60     IFDE_TextOut   *m_pTextOut;\r
61     IFX_Font       *m_pFDEFont;\r
62     FX_FLOAT            m_fValue;\r
63     FX_DWORD            m_dwValue;\r
64     CFX_RectF           m_rtMargin;\r
65     FX_DWORD            m_dwThemeID;\r
66     CFX_Matrix          _ctm;\r
67 };\r
68 FX_BOOL FWLTHEME_Init();\r
69 void    FWLTHEME_Release();\r
70 FX_DWORD FWL_GetThemeLayout(FX_DWORD dwThemeID);\r
71 FX_DWORD FWL_GetThemeColor(FX_DWORD dwThemeID);\r
72 FX_DWORD FWL_MakeThemeID(FX_DWORD dwLayout, FX_DWORD dwColor);\r
73 class CFWL_ArrowData\r
74 {\r
75 public:\r
76     static CFWL_ArrowData* GetInstance();\r
77     static FX_BOOL IsInstance();\r
78     static void DestroyInstance();\r
79     virtual ~CFWL_ArrowData();\r
80     void SetColorData(FX_DWORD  dwID);\r
81 \r
82     class CColorData\r
83     {\r
84     public:\r
85         FX_ARGB clrBorder[4];\r
86         FX_ARGB clrStart[4];\r
87         FX_ARGB clrEnd[4];\r
88         FX_ARGB clrSign[4];\r
89     } *m_pColorData;\r
90 protected:\r
91     CFWL_ArrowData();\r
92     static CFWL_ArrowData *m_pInstance;\r
93 };\r
94 class CFWL_FontData\r
95 {\r
96 public:\r
97     CFWL_FontData();\r
98     virtual ~CFWL_FontData();\r
99     FX_BOOL Equal(FX_WSTR wsFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage);\r
100     FX_BOOL LoadFont(FX_WSTR wsFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage);\r
101     IFX_Font*  GetFont() const\r
102     {\r
103         return m_pFont;\r
104     }\r
105 protected:\r
106     CFX_WideString                      m_wsFamily;\r
107     FX_DWORD                            m_dwStyles;\r
108     FX_DWORD                            m_dwCodePage;\r
109     IFX_Font                            *m_pFont;\r
110     IFX_FontMgr                         *m_pFontMgr;\r
111 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_\r
112     IFX_FontSourceEnum          *m_pFontSource;\r
113 #endif\r
114 };\r
115 class CFWL_FontManager\r
116 {\r
117 public:\r
118     CFWL_FontManager();\r
119     virtual ~CFWL_FontManager();\r
120     IFX_Font* FindFont(FX_WSTR wsFontFamily, FX_DWORD dwFontStyles, FX_WORD dwCodePage);\r
121 protected:\r
122     CFX_PtrArray    m_arrFonts;\r
123 };\r
124 CFWL_FontManager *FWL_GetFontManager();\r
125 #endif\r