1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef XFA_FWL_THEME_CFWL_WIDGETTP_H_
#define XFA_FWL_THEME_CFWL_WIDGETTP_H_
#include <memory>
#include <vector>
#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_system.h"
#include "xfa/fgas/font/cfgas_gefont.h"
#include "xfa/fwl/fwl_error.h"
#include "xfa/fwl/theme/cfwl_utils.h"
#include "xfa/fxgraphics/cfx_graphics.h"
class CFDE_TextOut;
class CFGAS_GEFont;
class CFWL_ThemeBackground;
class CFWL_ThemePart;
class CFWL_ThemeText;
class CFGAS_FontMgr;
class CFWL_Widget;
#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
class CFX_FontSourceEnum_File;
#endif
class CFWL_WidgetTP {
public:
virtual ~CFWL_WidgetTP();
virtual void Initialize();
virtual void Finalize();
virtual void DrawBackground(CFWL_ThemeBackground* pParams);
virtual void DrawText(CFWL_ThemeText* pParams);
const CFX_RetainPtr<CFGAS_GEFont>& GetFont() const { return m_pFDEFont; }
protected:
struct CColorData {
FX_ARGB clrBorder[4];
FX_ARGB clrStart[4];
FX_ARGB clrEnd[4];
FX_ARGB clrSign[4];
};
CFWL_WidgetTP();
void InitializeArrowColorData();
void InitTTO();
void FinalizeTTO();
void DrawBorder(CFX_Graphics* pGraphics,
const CFX_RectF* pRect,
CFX_Matrix* pMatrix = nullptr);
void FillBackground(CFX_Graphics* pGraphics,
const CFX_RectF* pRect,
CFX_Matrix* pMatrix = nullptr);
void FillSoildRect(CFX_Graphics* pGraphics,
FX_ARGB fillColor,
const CFX_RectF* pRect,
CFX_Matrix* pMatrix = nullptr);
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 = nullptr);
void DrawFocus(CFX_Graphics* pGraphics,
const CFX_RectF* pRect,
CFX_Matrix* pMatrix = nullptr);
void DrawArrow(CFX_Graphics* pGraphics,
const CFX_RectF* pRect,
FWLTHEME_DIRECTION eDict,
FX_ARGB argSign,
CFX_Matrix* pMatrix = nullptr);
void DrawBtn(CFX_Graphics* pGraphics,
const CFX_RectF* pRect,
FWLTHEME_STATE eState,
CFX_Matrix* pMatrix = nullptr);
void DrawArrowBtn(CFX_Graphics* pGraphics,
const CFX_RectF* pRect,
FWLTHEME_DIRECTION eDict,
FWLTHEME_STATE eState,
CFX_Matrix* pMatrix = nullptr);
uint32_t m_dwRefCount;
std::unique_ptr<CFDE_TextOut> m_pTextOut;
CFX_RetainPtr<CFGAS_GEFont> m_pFDEFont;
std::unique_ptr<CColorData> m_pColorData;
};
void FWLTHEME_Release();
class CFWL_FontData {
public:
CFWL_FontData();
virtual ~CFWL_FontData();
bool Equal(const CFX_WideStringC& wsFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage);
bool LoadFont(const CFX_WideStringC& wsFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage);
CFX_RetainPtr<CFGAS_GEFont> GetFont() const { return m_pFont; }
protected:
CFX_WideString m_wsFamily;
uint32_t m_dwStyles;
uint32_t m_dwCodePage;
#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
std::unique_ptr<CFX_FontSourceEnum_File> m_pFontSource;
#endif
std::unique_ptr<CFGAS_FontMgr> m_pFontMgr;
CFX_RetainPtr<CFGAS_GEFont> m_pFont;
};
class CFWL_FontManager {
public:
static CFWL_FontManager* GetInstance();
static void DestroyInstance();
CFX_RetainPtr<CFGAS_GEFont> FindFont(const CFX_WideStringC& wsFontFamily,
uint32_t dwFontStyles,
uint16_t dwCodePage);
protected:
CFWL_FontManager();
virtual ~CFWL_FontManager();
static CFWL_FontManager* s_FontManager;
std::vector<std::unique_ptr<CFWL_FontData>> m_FontsArray;
};
#endif // XFA_FWL_THEME_CFWL_WIDGETTP_H_
|