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 FPDFSDK_INCLUDE_PDFWINDOW_PWL_WND_H_ | 7 #ifndef FPDFSDK_INCLUDE_PDFWINDOW_PWL_WND_H_ |
8 #define FPDFSDK_INCLUDE_PDFWINDOW_PWL_WND_H_ | 8 #define FPDFSDK_INCLUDE_PDFWINDOW_PWL_WND_H_ |
9 | 9 |
10 #include "../../../core/include/fxcrt/fx_basic.h" | 10 #include "../../../core/include/fxcrt/fx_basic.h" |
11 #include "../../../core/include/fpdfdoc/fpdf_doc.h" | 11 #include "../../../core/include/fpdfdoc/fpdf_doc.h" |
12 #include "../fx_systemhandler.h" | 12 #include "../fx_systemhandler.h" |
13 | 13 |
14 class CPWL_MsgControl; | 14 class CPWL_MsgControl; |
15 class CPWL_ScrollBar; | 15 class CPWL_ScrollBar; |
16 class CPWL_Timer; | 16 class CPWL_Timer; |
17 class CPWL_TimerHandler; | 17 class CPWL_TimerHandler; |
18 class CPWL_Wnd; | 18 class CPWL_Wnd; |
19 class IFX_Edit_FontMap; | 19 class IFX_Edit_FontMap; |
20 class IFX_SystemHandler; | 20 class IFX_SystemHandler; |
21 class IPWL_Provider; | 21 class IPWL_Provider; |
22 class IPWL_SpellCheck; | 22 class IPWL_SpellCheck; |
23 | 23 |
24 //window styles | 24 // window styles |
25 #define PWS_CHILD» » » » » » » 0x800000
00L | 25 #define PWS_CHILD 0x80000000L |
26 #define PWS_BORDER» » » » » » » 0x400000
00L | 26 #define PWS_BORDER 0x40000000L |
27 #define PWS_BACKGROUND» » » » » » 0x20000000L | 27 #define PWS_BACKGROUND 0x20000000L |
28 #define PWS_HSCROLL» » » » » » » 0x100000
00L | 28 #define PWS_HSCROLL 0x10000000L |
29 #define PWS_VSCROLL» » » » » » » 0x080000
00L | 29 #define PWS_VSCROLL 0x08000000L |
30 #define PWS_VISIBLE» » » » » » » 0x040000
00L | 30 #define PWS_VISIBLE 0x04000000L |
31 #define PWS_DISABLE» » » » » » » 0x020000
00L | 31 #define PWS_DISABLE 0x02000000L |
32 #define PWS_READONLY» » » » » » 0x01000000L | 32 #define PWS_READONLY 0x01000000L |
33 #define PWS_AUTOFONTSIZE» » » » » 0x00800000L | 33 #define PWS_AUTOFONTSIZE 0x00800000L |
34 #define PWS_AUTOTRANSPARENT» » » » » 0x00400000L | 34 #define PWS_AUTOTRANSPARENT 0x00400000L |
35 #define PWS_NOREFRESHCLIP» » » » » 0x00200000L | 35 #define PWS_NOREFRESHCLIP 0x00200000L |
36 | 36 |
37 //edit and label styles | 37 // edit and label styles |
38 #define PES_MULTILINE» » » » » » 0x0001L | 38 #define PES_MULTILINE 0x0001L |
39 #define PES_PASSWORD» » » » » » 0x0002L | 39 #define PES_PASSWORD 0x0002L |
40 #define PES_LEFT» » » » » » » 0x0004L | 40 #define PES_LEFT 0x0004L |
41 #define PES_RIGHT» » » » » » » 0x0008L | 41 #define PES_RIGHT 0x0008L |
42 #define PES_MIDDLE» » » » » » » 0x0010L | 42 #define PES_MIDDLE 0x0010L |
43 #define PES_TOP»» » » » » » » 0x0020L | 43 #define PES_TOP 0x0020L |
44 #define PES_BOTTOM» » » » » » » 0x0040L | 44 #define PES_BOTTOM 0x0040L |
45 #define PES_CENTER» » » » » » » 0x0080L | 45 #define PES_CENTER 0x0080L |
46 #define PES_CHARARRAY» » » » » » 0x0100L | 46 #define PES_CHARARRAY 0x0100L |
47 #define PES_AUTOSCROLL» » » » » » 0x0200L | 47 #define PES_AUTOSCROLL 0x0200L |
48 #define PES_AUTORETURN» » » » » » 0x0400L | 48 #define PES_AUTORETURN 0x0400L |
49 #define PES_UNDO» » » » » » » 0x0800L | 49 #define PES_UNDO 0x0800L |
50 #define PES_RICH» » » » » » » 0x1000L | 50 #define PES_RICH 0x1000L |
51 #define PES_SPELLCHECK» » » » » » 0x2000L | 51 #define PES_SPELLCHECK 0x2000L |
52 #define PES_TEXTOVERFLOW» » » » » 0x4000L | 52 #define PES_TEXTOVERFLOW 0x4000L |
53 #define PES_NOREAD» » » » » » » 0x8000L | 53 #define PES_NOREAD 0x8000L |
54 | 54 |
55 //listbox styles | 55 // listbox styles |
56 #define PLBS_MULTIPLESEL» » » » » 0x0001L | 56 #define PLBS_MULTIPLESEL 0x0001L |
57 #define PLBS_HOVERSEL» » » » » » 0x0008L | 57 #define PLBS_HOVERSEL 0x0008L |
58 | 58 |
59 //combobox styles | 59 // combobox styles |
60 #define PCBS_ALLOWCUSTOMTEXT» » » » 0x0001L | 60 #define PCBS_ALLOWCUSTOMTEXT 0x0001L |
61 | 61 |
62 //richedit styles | 62 // richedit styles |
63 #define PRES_MULTILINE» » » » » » 0x0001L | 63 #define PRES_MULTILINE 0x0001L |
64 #define PRES_AUTORETURN»» » » » » 0x0002L | 64 #define PRES_AUTORETURN 0x0002L |
65 #define PRES_AUTOSCROLL»» » » » » 0x0004L | 65 #define PRES_AUTOSCROLL 0x0004L |
66 #define PRES_SPELLCHECK»» » » » » 0x0008L | 66 #define PRES_SPELLCHECK 0x0008L |
67 #define PRES_UNDO» » » » » » » 0x0100L | 67 #define PRES_UNDO 0x0100L |
68 #define PRES_MULTIPAGES»» » » » » 0x0200L | 68 #define PRES_MULTIPAGES 0x0200L |
69 #define PRES_TEXTOVERFLOW» » » » » 0x0400L | 69 #define PRES_TEXTOVERFLOW 0x0400L |
70 | 70 |
71 //border style | 71 // border style |
72 #define PBS_SOLID» » » » » » » 0 | 72 #define PBS_SOLID 0 |
73 #define PBS_DASH» » » » » » » 1 | 73 #define PBS_DASH 1 |
74 #define PBS_BEVELED» » » » » » » 2 | 74 #define PBS_BEVELED 2 |
75 #define PBS_INSET» » » » » » » 3 | 75 #define PBS_INSET 3 |
76 #define PBS_UNDERLINED» » » » » » 4 | 76 #define PBS_UNDERLINED 4 |
77 #define PBS_SHADOW» » » » » » » 5 | 77 #define PBS_SHADOW 5 |
78 | 78 |
79 //notification messages | 79 // notification messages |
80 #define PNM_ADDCHILD» » » » » » 0x00000000L | 80 #define PNM_ADDCHILD 0x00000000L |
81 #define PNM_REMOVECHILD»» » » » » 0x00000001L | 81 #define PNM_REMOVECHILD 0x00000001L |
82 #define PNM_SETSCROLLINFO» » » » » 0x00000002L | 82 #define PNM_SETSCROLLINFO 0x00000002L |
83 #define PNM_SETSCROLLPOS» » » » » 0x00000003L | 83 #define PNM_SETSCROLLPOS 0x00000003L |
84 #define PNM_SCROLLWINDOW» » » » » 0x00000004L | 84 #define PNM_SCROLLWINDOW 0x00000004L |
85 #define PNM_LBUTTONDOWN»» » » » » 0x00000005L | 85 #define PNM_LBUTTONDOWN 0x00000005L |
86 #define PNM_LBUTTONUP» » » » » » 0x00000006L | 86 #define PNM_LBUTTONUP 0x00000006L |
87 #define PNM_MOUSEMOVE» » » » » » 0x00000007L | 87 #define PNM_MOUSEMOVE 0x00000007L |
88 #define»PNM_NOTERESET» » » » » » 0x00000008L | 88 #define PNM_NOTERESET 0x00000008L |
89 #define PNM_SETCARETINFO» » » » » 0x00000009L | 89 #define PNM_SETCARETINFO 0x00000009L |
90 #define PNM_SELCHANGED» » » » » » 0x0000000AL | 90 #define PNM_SELCHANGED 0x0000000AL |
91 #define»PNM_NOTEEDITCHANGED» » » » » 0x0000000BL | 91 #define PNM_NOTEEDITCHANGED 0x0000000BL |
92 | 92 |
93 #define PWL_CLASSNAME_EDIT» » » » » "CPWL_Edit" | 93 #define PWL_CLASSNAME_EDIT "CPWL_Edit" |
94 | 94 |
95 struct CPWL_Dash | 95 struct CPWL_Dash { |
96 { | 96 CPWL_Dash(int32_t dash, int32_t gap, int32_t phase) |
97 » CPWL_Dash(int32_t dash, int32_t gap, int32_t phase) : nDash(dash), nGap(
gap), nPhase(phase) | 97 : nDash(dash), nGap(gap), nPhase(phase) {} |
98 » {} | 98 |
99 | 99 int32_t nDash; |
100 » int32_t»» » nDash; | 100 int32_t nGap; |
101 » int32_t»» » nGap; | 101 int32_t nPhase; |
102 » int32_t»» » nPhase; | 102 }; |
103 }; | 103 |
104 | 104 struct CPWL_Color { |
105 struct CPWL_Color | 105 CPWL_Color(int32_t type = COLORTYPE_TRANSPARENT, |
106 { | 106 FX_FLOAT color1 = 0.0f, |
107 » CPWL_Color(int32_t type = COLORTYPE_TRANSPARENT, FX_FLOAT color1 = 0.0f,
FX_FLOAT color2 = 0.0f, FX_FLOAT color3 = 0.0f, FX_FLOAT color4 = 0.0f) | 107 FX_FLOAT color2 = 0.0f, |
108 » » : nColorType(type), fColor1(color1), fColor2(color2), fColor3(co
lor3), fColor4(color4) | 108 FX_FLOAT color3 = 0.0f, |
109 » {} | 109 FX_FLOAT color4 = 0.0f) |
110 | 110 : nColorType(type), |
111 » CPWL_Color(int32_t r, int32_t g, int32_t b) : | 111 fColor1(color1), |
112 » » nColorType(COLORTYPE_RGB), fColor1(r/255.0f), fColor2(g/255.0f),
fColor3(b/255.0f), fColor4(0) | 112 fColor2(color2), |
113 » {} | 113 fColor3(color3), |
114 | 114 fColor4(color4) {} |
115 » void ConvertColorType(int32_t other_nColorType); | 115 |
116 | 116 CPWL_Color(int32_t r, int32_t g, int32_t b) |
117 » /* | 117 : nColorType(COLORTYPE_RGB), |
118 » COLORTYPE_TRANSPARENT | 118 fColor1(r / 255.0f), |
119 » COLORTYPE_RGB | 119 fColor2(g / 255.0f), |
120 » COLORTYPE_CMYK | 120 fColor3(b / 255.0f), |
121 » COLORTYPE_GRAY | 121 fColor4(0) {} |
122 » */ | 122 |
123 » int32_t»» » » » nColorType; | 123 void ConvertColorType(int32_t other_nColorType); |
124 » FX_FLOAT» » » » » fColor1,fColor2,fColor3,
fColor4; | 124 |
125 }; | 125 /* |
126 | 126 COLORTYPE_TRANSPARENT |
127 inline FX_BOOL operator == (const CPWL_Color &c1, const CPWL_Color &c2) | 127 COLORTYPE_RGB |
128 { | 128 COLORTYPE_CMYK |
129 » return c1.nColorType == c2.nColorType && | 129 COLORTYPE_GRAY |
130 » » c1.fColor1 - c2.fColor1 < 0.0001 && c1.fColor1 - c2.fColor1 > -0
.0001 && | 130 */ |
131 » » c1.fColor2 - c2.fColor2 < 0.0001 && c1.fColor2 - c2.fColor2 > -0
.0001 && | 131 int32_t nColorType; |
132 » » c1.fColor3 - c2.fColor3 < 0.0001 && c1.fColor3 - c2.fColor3 > -0
.0001 && | 132 FX_FLOAT fColor1, fColor2, fColor3, fColor4; |
133 » » c1.fColor4 - c2.fColor4 < 0.0001 && c1.fColor4 - c2.fColor4 > -0
.0001; | 133 }; |
| 134 |
| 135 inline FX_BOOL operator==(const CPWL_Color& c1, const CPWL_Color& c2) { |
| 136 return c1.nColorType == c2.nColorType && c1.fColor1 - c2.fColor1 < 0.0001 && |
| 137 c1.fColor1 - c2.fColor1 > -0.0001 && |
| 138 c1.fColor2 - c2.fColor2 < 0.0001 && |
| 139 c1.fColor2 - c2.fColor2 > -0.0001 && |
| 140 c1.fColor3 - c2.fColor3 < 0.0001 && |
| 141 c1.fColor3 - c2.fColor3 > -0.0001 && |
| 142 c1.fColor4 - c2.fColor4 < 0.0001 && c1.fColor4 - c2.fColor4 > -0.0001; |
134 } | 143 } |
135 | 144 |
136 inline FX_BOOL operator != (const CPWL_Color &c1, const CPWL_Color &c2) | 145 inline FX_BOOL operator!=(const CPWL_Color& c1, const CPWL_Color& c2) { |
137 { | 146 return !operator==(c1, c2); |
138 » return !operator == (c1, c2); | |
139 } | 147 } |
140 | 148 |
141 #define PWL_SCROLLBAR_WIDTH 12.0f | 149 #define PWL_SCROLLBAR_WIDTH 12.0f |
142 #define PWL_SCROLLBAR_BUTTON_WIDTH 9.0f | 150 #define PWL_SCROLLBAR_BUTTON_WIDTH 9.0f |
143 #define PWL_SCROLLBAR_POSBUTTON_MINWIDTH 2.0f | 151 #define PWL_SCROLLBAR_POSBUTTON_MINWIDTH 2.0f |
144 #define PWL_SCROLLBAR_TRANSPARANCY 150 | 152 #define PWL_SCROLLBAR_TRANSPARANCY 150 |
145 #define PWL_SCROLLBAR_BKCOLOR CPWL_Color(COLORTYPE_RGB
,220.0f/255.0f,220.0f/255.0f,220.0f/255.0f) | 153 #define PWL_SCROLLBAR_BKCOLOR \ |
146 #define PWL_DEFAULT_SELTEXTCOLOR CPWL_Color(COLORTYPE_RGB
,1,1,1) | 154 CPWL_Color(COLORTYPE_RGB, 220.0f / 255.0f, 220.0f / 255.0f, 220.0f / 255.0f) |
147 #define PWL_DEFAULT_SELBACKCOLOR CPWL_Color(COLORTYPE_RGB
,0,51.0f/255.0f,113.0f/255.0f) | 155 #define PWL_DEFAULT_SELTEXTCOLOR CPWL_Color(COLORTYPE_RGB, 1, 1, 1) |
148 #define PWL_DEFAULT_BACKCOLOR PWL_DEFAULT_SELTEXTCOLOR | 156 #define PWL_DEFAULT_SELBACKCOLOR \ |
149 #define PWL_DEFAULT_TEXTCOLOR CPWL_Color(COLORTYPE_RGB
,0,0,0) | 157 CPWL_Color(COLORTYPE_RGB, 0, 51.0f / 255.0f, 113.0f / 255.0f) |
150 #define PWL_DEFAULT_FONTSIZE 9.0f | 158 #define PWL_DEFAULT_BACKCOLOR PWL_DEFAULT_SELTEXTCOLOR |
151 #define PWL_DEFAULT_BLACKCOLOR CPWL_Color(COLORTYPE_GRA
Y,0) | 159 #define PWL_DEFAULT_TEXTCOLOR CPWL_Color(COLORTYPE_RGB, 0, 0, 0) |
152 #define PWL_DEFAULT_WHITECOLOR CPWL_Color(COLORTYPE_GRA
Y,1) | 160 #define PWL_DEFAULT_FONTSIZE 9.0f |
153 #define PWL_DEFAULT_HEAVYGRAYCOLOR CPWL_Color(COLORTYPE_GRA
Y,0.50) | 161 #define PWL_DEFAULT_BLACKCOLOR CPWL_Color(COLORTYPE_GRAY, 0) |
154 #define PWL_DEFAULT_LIGHTGRAYCOLOR CPWL_Color(COLORTYPE_GRA
Y,0.75) | 162 #define PWL_DEFAULT_WHITECOLOR CPWL_Color(COLORTYPE_GRAY, 1) |
155 #define PWL_TRIANGLE_HALFLEN 2.0f | 163 #define PWL_DEFAULT_HEAVYGRAYCOLOR CPWL_Color(COLORTYPE_GRAY, 0.50) |
156 #define PWL_CBBUTTON_TRIANGLE_HALFLEN 3.0f | 164 #define PWL_DEFAULT_LIGHTGRAYCOLOR CPWL_Color(COLORTYPE_GRAY, 0.75) |
157 #define PWL_INVALIDATE_INFLATE 2 | 165 #define PWL_TRIANGLE_HALFLEN 2.0f |
158 | 166 #define PWL_CBBUTTON_TRIANGLE_HALFLEN 3.0f |
159 class IPWL_SpellCheck | 167 #define PWL_INVALIDATE_INFLATE 2 |
160 { | 168 |
161 public: | 169 class IPWL_SpellCheck { |
162 virtual ~IPWL_SpellCheck() { } | 170 public: |
163 virtual FX_BOOL CheckWor
d(const FX_CHAR* sWord) = 0; | 171 virtual ~IPWL_SpellCheck() {} |
164 virtual void SuggestW
ords(const FX_CHAR* sWord, CFX_ByteStringArray & sSuggest) = 0; | 172 virtual FX_BOOL CheckWord(const FX_CHAR* sWord) = 0; |
165 }; | 173 virtual void SuggestWords(const FX_CHAR* sWord, |
166 | 174 CFX_ByteStringArray& sSuggest) = 0; |
167 class IPWL_Provider | 175 }; |
168 { | 176 |
169 public: | 177 class IPWL_Provider { |
170 virtual ~IPWL_Provider() { } | 178 public: |
171 | 179 virtual ~IPWL_Provider() {} |
172 //get a matrix which map user space to CWnd client space | 180 |
173 virtual CPDF_Matrix GetWindo
wMatrix(void* pAttachedData) = 0; | 181 // get a matrix which map user space to CWnd client space |
174 | 182 virtual CPDF_Matrix GetWindowMatrix(void* pAttachedData) = 0; |
175 /* | 183 |
176 0 L"&Undo\tCtrl+Z" | 184 /* |
177 1 L"&Redo\tCtrl+Shift+Z" | 185 0 L"&Undo\tCtrl+Z" |
178 2 L"Cu&t\tCtrl+X" | 186 1 L"&Redo\tCtrl+Shift+Z" |
179 3 L"&Copy\tCtrl+C" | 187 2 L"Cu&t\tCtrl+X" |
180 4 L"&Paste\tCtrl+V" | 188 3 L"&Copy\tCtrl+C" |
181 5 L"&Delete" | 189 4 L"&Paste\tCtrl+V" |
182 6 L"&Select All\tCtrl+A" | 190 5 L"&Delete" |
183 */ | 191 6 L"&Select All\tCtrl+A" |
184 virtual CFX_WideString LoadPopupMenuStr
ing(int32_t nIndex) = 0; | 192 */ |
185 }; | 193 virtual CFX_WideString LoadPopupMenuString(int32_t nIndex) = 0; |
186 | 194 }; |
187 class IPWL_FocusHandler | 195 |
188 { | 196 class IPWL_FocusHandler { |
189 public: | 197 public: |
190 virtual ~IPWL_FocusHandler() { } | 198 virtual ~IPWL_FocusHandler() {} |
191 virtual void OnSetFoc
us(CPWL_Wnd* pWnd) = 0; | 199 virtual void OnSetFocus(CPWL_Wnd* pWnd) = 0; |
192 virtual void OnKillFo
cus(CPWL_Wnd* pWnd) = 0; | 200 virtual void OnKillFocus(CPWL_Wnd* pWnd) = 0; |
193 }; | 201 }; |
194 | 202 |
195 struct PWL_CREATEPARAM | 203 struct PWL_CREATEPARAM { |
196 { | 204 public: |
197 public: | 205 PWL_CREATEPARAM() |
198 PWL_CREATEPARAM() : rcRectWnd(0,0,0,0), | 206 : rcRectWnd(0, 0, 0, 0), |
199 pSystemHandler(NULL), | 207 pSystemHandler(NULL), |
200 pFontMap(NULL), | 208 pFontMap(NULL), |
201 pProvider(NULL), | 209 pProvider(NULL), |
202 pFocusHandler(NULL), | 210 pFocusHandler(NULL), |
203 dwFlags(0), | 211 dwFlags(0), |
204 sBackgroundColor(), | 212 sBackgroundColor(), |
205 hAttachedWnd(NULL), | 213 hAttachedWnd(NULL), |
206 pSpellCheck(NULL), | 214 pSpellCheck(NULL), |
207 nBorderStyle(PBS_SOLID), | 215 nBorderStyle(PBS_SOLID), |
208 dwBorderWidth(1), | 216 dwBorderWidth(1), |
209 sBorderColor(), | 217 sBorderColor(), |
210 sTextColor(), | 218 sTextColor(), |
211 sTextStrokeColor(), | 219 sTextStrokeColor(), |
212 nTransparency(255), | 220 nTransparency(255), |
213 fFontSize(PWL_DEFAULT_FONTSIZE), | 221 fFontSize(PWL_DEFAULT_FONTSIZE), |
214 sDash(3,0,0), | 222 sDash(3, 0, 0), |
215 pAttachedData(NULL), | 223 pAttachedData(NULL), |
216 pParentWnd(NULL), | 224 pParentWnd(NULL), |
217 pMsgControl(NULL), | 225 pMsgControl(NULL), |
218 eCursorType(FXCT_ARROW), | 226 eCursorType(FXCT_ARROW), |
219 mtChild(1,0,0,1,0,0) | 227 mtChild(1, 0, 0, 1, 0, 0) {} |
220 { | 228 |
221 } | 229 CPDF_Rect rcRectWnd; // required |
222 | 230 IFX_SystemHandler* pSystemHandler; // required |
223 CPDF_Rect rcRectWnd;
//required | 231 IFX_Edit_FontMap* pFontMap; // required for text window |
224 IFX_SystemHandler* pSystemHandler; //requir
ed | 232 IPWL_Provider* pProvider; // required for self coordinate |
225 IFX_Edit_FontMap* pFontMap;
//required for text window | 233 IPWL_FocusHandler* pFocusHandler; // optional |
226 IPWL_Provider* pProvider;
//required for self coordinate | 234 FX_DWORD dwFlags; // optional |
227 IPWL_FocusHandler* pFocusHandler; //option
al | 235 CPWL_Color sBackgroundColor; // optional |
228 FX_DWORD dwFlags;
//optional | 236 FX_HWND hAttachedWnd; // required for no-reader framework |
229 CPWL_Color sBackgroundColor;
//optional | 237 IPWL_SpellCheck* pSpellCheck; // required for spellchecking |
230 FX_HWND hAttachedWnd;
//required for no-reader framework | 238 int32_t nBorderStyle; // optional |
231 IPWL_SpellCheck* pSpellCheck; //requir
ed for spellchecking | 239 int32_t dwBorderWidth; // optional |
232 int32_t nBorderStyle; //option
al | 240 CPWL_Color sBorderColor; // optional |
233 int32_t dwBorderWidth; //option
al | 241 CPWL_Color sTextColor; // optional |
234 CPWL_Color sBorderColor;
//optional | 242 CPWL_Color sTextStrokeColor; // optional |
235 CPWL_Color sTextColor;
//optional | 243 int32_t nTransparency; // optional |
236 CPWL_Color sTextStrokeColor;
//optional | 244 FX_FLOAT fFontSize; // optional |
237 int32_t nTransparency; //option
al | 245 CPWL_Dash sDash; // optional |
238 FX_FLOAT fFontSize;
//optional | 246 void* pAttachedData; // optional |
239 CPWL_Dash sDash;
//optional | 247 CPWL_Wnd* pParentWnd; // ignore |
240 void* pAttachedData;
//optional | 248 CPWL_MsgControl* pMsgControl; // ignore |
241 CPWL_Wnd* pParentWnd;
//ignore | 249 int32_t eCursorType; // ignore |
242 CPWL_MsgControl* pMsgControl; //ignore | 250 CPDF_Matrix mtChild; // ignore |
243 int32_t eCursorType; //ignore | 251 }; |
244 CPDF_Matrix mtChild;
//ignore | 252 |
245 }; | 253 class CPWL_Timer { |
246 | 254 public: |
247 class CPWL_Timer | 255 CPWL_Timer(CPWL_TimerHandler* pAttached, IFX_SystemHandler* pSystemHandler); |
248 { | 256 virtual ~CPWL_Timer(); |
249 public: | 257 |
250 CPWL_Timer(CPWL_TimerHandler* pAttached, IFX_SystemHandler* pSystemHandl
er); | 258 int32_t SetPWLTimer(int32_t nElapse); |
251 virtual ~CPWL_Timer(); | 259 void KillPWLTimer(); |
252 | 260 static void TimerProc(int32_t idEvent); |
253 int32_t SetPWLTimer(int3
2_t nElapse); | 261 |
254 void KillPWLT
imer(); | 262 private: |
255 static void TimerProc(int32_
t idEvent); | 263 int32_t m_nTimerID; |
256 | 264 CPWL_TimerHandler* m_pAttached; |
257 private: | 265 IFX_SystemHandler* m_pSystemHandler; |
258 int32_t m_nTimerID; | 266 }; |
259 CPWL_TimerHandler* m_pAttached; | 267 |
260 IFX_SystemHandler* m_pSystemHandler
; | 268 class CPWL_TimerHandler { |
261 }; | 269 public: |
262 | 270 CPWL_TimerHandler(); |
263 class CPWL_TimerHandler | 271 virtual ~CPWL_TimerHandler(); |
264 { | 272 |
265 public: | 273 void BeginTimer(int32_t nElapse); |
266 CPWL_TimerHandler(); | 274 void EndTimer(); |
267 virtual ~CPWL_TimerHandler(); | 275 virtual void TimerProc(); |
268 | 276 virtual IFX_SystemHandler* GetSystemHandler() const = 0; |
269 void BeginTim
er(int32_t nElapse); | 277 |
270 void EndTimer
(); | 278 private: |
271 virtual void TimerProc(); | 279 CPWL_Timer* m_pTimer; |
272 virtual IFX_SystemHandler* GetSystemHandler() const
= 0; | 280 }; |
273 | 281 |
274 private: | 282 class CPWL_Wnd : public CPWL_TimerHandler { |
275 CPWL_Timer* m_pTimer
; | 283 friend class CPWL_MsgControl; |
276 }; | 284 |
277 | 285 public: |
278 class CPWL_Wnd : public CPWL_TimerHandler | 286 CPWL_Wnd(); |
279 { | 287 virtual ~CPWL_Wnd(); |
280 friend class CPWL_MsgControl; | 288 |
281 public: | 289 void Create(const PWL_CREATEPARAM& cp); |
282 CPWL_Wnd(); | 290 virtual CFX_ByteString GetClassName() const; |
283 virtual ~CPWL_Wnd(); | 291 void Destroy(); |
284 | 292 void Move(const CPDF_Rect& rcNew, FX_BOOL bReset, FX_BOOL bRefresh); |
285 void Create(const PWL
_CREATEPARAM & cp); | 293 virtual void InvalidateRect(CPDF_Rect* pRect = NULL); |
286 virtual CFX_ByteString GetClassName() const; | 294 |
287 void Destroy(); | 295 void GetAppearanceStream(CFX_ByteString& sAppStream); |
288 void Move(const CPDF_
Rect & rcNew,FX_BOOL bReset,FX_BOOL bRefresh); | 296 void DrawAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device); |
289 virtual void InvalidateRect(CPDF_Rect
* pRect = NULL); | 297 |
290 | 298 virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag); |
291 void GetAppearanceStr
eam(CFX_ByteString & sAppStream); | 299 virtual FX_BOOL OnKeyUp(FX_WORD nChar, FX_DWORD nFlag); |
292 void DrawAppearance(C
FX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device); | 300 virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag); |
293 | 301 virtual FX_BOOL OnLButtonDblClk(const CPDF_Point& point, FX_DWORD nFlag); |
294 virtual FX_BOOL OnKeyDown(FX_WORD nChar,
FX_DWORD nFlag); | 302 virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag); |
295 virtual FX_BOOL OnKeyUp(FX_WORD nChar, F
X_DWORD nFlag); | 303 virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag); |
296 virtual FX_BOOL OnChar(FX_WORD nChar, FX
_DWORD nFlag); | 304 virtual FX_BOOL OnMButtonDblClk(const CPDF_Point& point, FX_DWORD nFlag); |
297 virtual FX_BOOL OnLButtonDblClk(const CP
DF_Point & point, FX_DWORD nFlag); | 305 virtual FX_BOOL OnMButtonDown(const CPDF_Point& point, FX_DWORD nFlag); |
298 virtual FX_BOOL OnLButtonDown(const CPDF
_Point & point, FX_DWORD nFlag); | 306 virtual FX_BOOL OnMButtonUp(const CPDF_Point& point, FX_DWORD nFlag); |
299 virtual FX_BOOL OnLButtonUp(const CPDF_P
oint & point, FX_DWORD nFlag); | 307 virtual FX_BOOL OnRButtonDown(const CPDF_Point& point, FX_DWORD nFlag); |
300 virtual FX_BOOL OnMButtonDblClk(const CP
DF_Point & point, FX_DWORD nFlag); | 308 virtual FX_BOOL OnRButtonUp(const CPDF_Point& point, FX_DWORD nFlag); |
301 virtual FX_BOOL OnMButtonDown(const CPDF
_Point & point, FX_DWORD nFlag); | 309 virtual FX_BOOL OnMouseMove(const CPDF_Point& point, FX_DWORD nFlag); |
302 virtual FX_BOOL OnMButtonUp(const CPDF_P
oint & point, FX_DWORD nFlag); | 310 virtual FX_BOOL OnMouseWheel(short zDelta, |
303 virtual FX_BOOL OnRButtonDown(const CPDF
_Point & point, FX_DWORD nFlag); | 311 const CPDF_Point& point, |
304 virtual FX_BOOL OnRButtonUp(const CPDF_P
oint & point, FX_DWORD nFlag); | 312 FX_DWORD nFlag); |
305 virtual FX_BOOL OnMouseMove(const CPDF_P
oint & point, FX_DWORD nFlag); | 313 |
306 virtual FX_BOOL OnMouseWheel(short zDelt
a, const CPDF_Point & point, FX_DWORD nFlag); | 314 virtual void SetFocus(); |
307 | 315 virtual void KillFocus(); |
308 virtual void SetFocus(); | 316 void SetCapture(); |
309 virtual void KillFocus(); | 317 void ReleaseCapture(); |
310 void SetCapture(); | 318 |
311 void ReleaseCapture()
; | 319 virtual void OnNotify(CPWL_Wnd* pWnd, |
312 | 320 FX_DWORD msg, |
313 virtual void OnNotify(CPWL_Wnd* pWnd,
FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0); | 321 intptr_t wParam = 0, |
314 virtual void SetTextColor(const CPWL_
Color & color); | 322 intptr_t lParam = 0); |
315 virtual void SetTextStrokeColor(const
CPWL_Color & color); | 323 virtual void SetTextColor(const CPWL_Color& color); |
316 virtual void SetVisible(FX_BOOL bVisi
ble); | 324 virtual void SetTextStrokeColor(const CPWL_Color& color); |
317 | 325 virtual void SetVisible(FX_BOOL bVisible); |
318 virtual CPDF_Rect GetFocusRect() const; | 326 |
319 virtual CPWL_Color GetBackgroundColor() con
st; | 327 virtual CPDF_Rect GetFocusRect() const; |
320 virtual CPWL_Color GetBorderColor() const; | 328 virtual CPWL_Color GetBackgroundColor() const; |
321 virtual CPWL_Color GetTextColor() const; | 329 virtual CPWL_Color GetBorderColor() const; |
322 virtual CPWL_Color GetTextStrokeColor() con
st; | 330 virtual CPWL_Color GetTextColor() const; |
323 virtual FX_FLOAT GetFontSize() const; | 331 virtual CPWL_Color GetTextStrokeColor() const; |
324 virtual int32_t GetInnerBorderWidth() const; | 332 virtual FX_FLOAT GetFontSize() const; |
325 virtual CPWL_Color GetBorderLeftTopColor(in
t32_t nBorderStyle) const; | 333 virtual int32_t GetInnerBorderWidth() const; |
326 virtual CPWL_Color GetBorderRightBottomColo
r(int32_t nBorderStyle) const; | 334 virtual CPWL_Color GetBorderLeftTopColor(int32_t nBorderStyle) const; |
327 | 335 virtual CPWL_Color GetBorderRightBottomColor(int32_t nBorderStyle) const; |
328 virtual FX_BOOL IsModified() const {retu
rn FALSE;} | 336 |
329 | 337 virtual FX_BOOL IsModified() const { return FALSE; } |
330 virtual void SetFontSize(FX_FLOAT fFo
ntSize); | 338 |
331 | 339 virtual void SetFontSize(FX_FLOAT fFontSize); |
332 void SetBackgroundCol
or(const CPWL_Color & color); | 340 |
333 void SetBorderColor(c
onst CPWL_Color & color); | 341 void SetBackgroundColor(const CPWL_Color& color); |
334 void SetBorderWidth(i
nt32_t nBorderWidth); | 342 void SetBorderColor(const CPWL_Color& color); |
335 void SetClipRect(cons
t CPDF_Rect & rect); | 343 void SetBorderWidth(int32_t nBorderWidth); |
336 void SetBorderStyle(i
nt32_t eBorderStyle); | 344 void SetClipRect(const CPDF_Rect& rect); |
337 void SetBorderDash(co
nst CPWL_Dash & sDash); | 345 void SetBorderStyle(int32_t eBorderStyle); |
338 | 346 void SetBorderDash(const CPWL_Dash& sDash); |
339 CPDF_Rect GetOriginWindowR
ect() const; | 347 |
340 virtual CPDF_Rect GetWindowRect() const; | 348 CPDF_Rect GetOriginWindowRect() const; |
341 virtual CPDF_Rect GetClientRect() const; | 349 virtual CPDF_Rect GetWindowRect() const; |
342 CPDF_Point GetCenterPoint()
const; | 350 virtual CPDF_Rect GetClientRect() const; |
343 CPDF_Rect GetClientCenterS
quare() const; | 351 CPDF_Point GetCenterPoint() const; |
344 CPDF_Rect GetWindowCenterS
quare() const; | 352 CPDF_Rect GetClientCenterSquare() const; |
345 int32_t GetBorderWidth() const; | 353 CPDF_Rect GetWindowCenterSquare() const; |
346 FX_BOOL IsVisible() cons
t {return m_bVisible;} | 354 int32_t GetBorderWidth() const; |
347 FX_BOOL HasFlag(FX_DWORD
dwFlags) const; | 355 FX_BOOL IsVisible() const { return m_bVisible; } |
348 void AddFlag(FX_DWORD
dwFlags); | 356 FX_BOOL HasFlag(FX_DWORD dwFlags) const; |
349 void RemoveFlag(FX_DW
ORD dwFlags); | 357 void AddFlag(FX_DWORD dwFlags); |
350 CPDF_Rect GetClipRect() co
nst; | 358 void RemoveFlag(FX_DWORD dwFlags); |
351 CPWL_Wnd* GetParentWindow(
) const; | 359 CPDF_Rect GetClipRect() const; |
352 int32_t GetBorderStyle() const; | 360 CPWL_Wnd* GetParentWindow() const; |
353 CPWL_Dash GetBorderDash()
const; | 361 int32_t GetBorderStyle() const; |
354 void* GetAttachedData(
) const; | 362 CPWL_Dash GetBorderDash() const; |
355 | 363 void* GetAttachedData() const; |
356 FX_BOOL WndHitTest(const
CPDF_Point & point) const; | 364 |
357 FX_BOOL ClientHitTest(co
nst CPDF_Point & point) const; | 365 FX_BOOL WndHitTest(const CPDF_Point& point) const; |
358 FX_BOOL IsCaptureMouse()
const; | 366 FX_BOOL ClientHitTest(const CPDF_Point& point) const; |
359 | 367 FX_BOOL IsCaptureMouse() const; |
360 const CPWL_Wnd* GetFocused() const; | 368 |
361 FX_BOOL IsFocused() cons
t; | 369 const CPWL_Wnd* GetFocused() const; |
362 FX_BOOL IsReadOnly() con
st; | 370 FX_BOOL IsFocused() const; |
363 CPWL_ScrollBar* GetVScrollBar() const; | 371 FX_BOOL IsReadOnly() const; |
364 | 372 CPWL_ScrollBar* GetVScrollBar() const; |
365 IFX_Edit_FontMap* GetFontMap() const; | 373 |
366 IPWL_Provider* GetProvider() const; | 374 IFX_Edit_FontMap* GetFontMap() const; |
367 virtual IFX_SystemHandler* GetSystemHandler() const; | 375 IPWL_Provider* GetProvider() const; |
368 IPWL_FocusHandler* GetFocusHandler() const; | 376 virtual IFX_SystemHandler* GetSystemHandler() const; |
369 | 377 IPWL_FocusHandler* GetFocusHandler() const; |
370 int32_t GetTransparency(); | 378 |
371 void SetTransparency(
int32_t nTransparency); | 379 int32_t GetTransparency(); |
372 | 380 void SetTransparency(int32_t nTransparency); |
373 CPDF_Matrix GetChildToRoot()
const; | 381 |
374 CPDF_Matrix GetChildMatrix()
const; | 382 CPDF_Matrix GetChildToRoot() const; |
375 void SetChildMatrix(c
onst CPDF_Matrix& mt); | 383 CPDF_Matrix GetChildMatrix() const; |
376 CPDF_Matrix GetWindowMatrix(
) const; | 384 void SetChildMatrix(const CPDF_Matrix& mt); |
377 | 385 CPDF_Matrix GetWindowMatrix() const; |
378 virtual CPDF_Point ChildToParent(const CPDF
_Point& point) const; | 386 |
379 virtual CPDF_Rect ChildToParent(const CPDF
_Rect& rect) const; | 387 virtual CPDF_Point ChildToParent(const CPDF_Point& point) const; |
380 virtual CPDF_Point ParentToChild(const CPDF
_Point& point) const; | 388 virtual CPDF_Rect ChildToParent(const CPDF_Rect& rect) const; |
381 virtual CPDF_Rect ParentToChild(const CPDF
_Rect& rect) const; | 389 virtual CPDF_Point ParentToChild(const CPDF_Point& point) const; |
382 | 390 virtual CPDF_Rect ParentToChild(const CPDF_Rect& rect) const; |
383 //those methods only implemented by listctrl item | 391 |
384 virtual FX_FLOAT GetItemHeight(FX_FLOAT f
LimitWidth) {return 0;} | 392 // those methods only implemented by listctrl item |
385 virtual FX_FLOAT GetItemLeftMargin() {ret
urn 0;} | 393 virtual FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth) { return 0; } |
386 virtual FX_FLOAT GetItemRightMargin() {re
turn 0;} | 394 virtual FX_FLOAT GetItemLeftMargin() { return 0; } |
387 | 395 virtual FX_FLOAT GetItemRightMargin() { return 0; } |
388 void EnableWindow(FX_
BOOL bEnable); | 396 |
389 FX_BOOL IsEnabled(); | 397 void EnableWindow(FX_BOOL bEnable); |
390 virtual void SetCursor(); | 398 FX_BOOL IsEnabled(); |
391 | 399 virtual void SetCursor(); |
392 protected: | 400 |
393 virtual void CreateChildWnd(const PWL
_CREATEPARAM & cp); | 401 protected: |
394 virtual void RePosChildWnd(); | 402 virtual void CreateChildWnd(const PWL_CREATEPARAM& cp); |
395 void GetAppearanceStr
eam(CFX_ByteTextBuf & sAppStream); | 403 virtual void RePosChildWnd(); |
396 virtual void GetThisAppearanceStream(
CFX_ByteTextBuf & sAppStream); | 404 void GetAppearanceStream(CFX_ByteTextBuf& sAppStream); |
397 virtual void GetChildAppearanceStream
(CFX_ByteTextBuf & sAppStream); | 405 virtual void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream); |
398 | 406 virtual void GetChildAppearanceStream(CFX_ByteTextBuf& sAppStream); |
399 virtual void DrawThisAppearance(CFX_R
enderDevice* pDevice, CPDF_Matrix* pUser2Device); | 407 |
400 virtual void DrawChildAppearance(CFX_
RenderDevice* pDevice, CPDF_Matrix* pUser2Device); | 408 virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, |
401 | 409 CPDF_Matrix* pUser2Device); |
402 virtual void OnCreate(PWL_CREATEPARAM
& cp); | 410 virtual void DrawChildAppearance(CFX_RenderDevice* pDevice, |
403 virtual void OnCreated(); | 411 CPDF_Matrix* pUser2Device); |
404 virtual void OnDestroy(); | 412 |
405 | 413 virtual void OnCreate(PWL_CREATEPARAM& cp); |
406 virtual void OnSetFocus(); | 414 virtual void OnCreated(); |
407 virtual void OnKillFocus(); | 415 virtual void OnDestroy(); |
408 | 416 |
409 virtual void OnEnabled(); | 417 virtual void OnSetFocus(); |
410 virtual void OnDisabled(); | 418 virtual void OnKillFocus(); |
411 | 419 |
412 void SetNotifyFlag(FX
_BOOL bNotifying = TRUE){m_bNotifying = bNotifying;}; | 420 virtual void OnEnabled(); |
413 | 421 virtual void OnDisabled(); |
414 FX_BOOL IsValid() const; | 422 |
415 PWL_CREATEPARAM GetCreationParam() const
; | 423 void SetNotifyFlag(FX_BOOL bNotifying = TRUE) { m_bNotifying = bNotifying; }; |
416 FX_BOOL IsNotifying() co
nst {return m_bNotifying;} | 424 |
417 | 425 FX_BOOL IsValid() const; |
418 void InvalidateRectMo
ve(const CPDF_Rect & rcOld, const CPDF_Rect & rcNew); | 426 PWL_CREATEPARAM GetCreationParam() const; |
419 | 427 FX_BOOL IsNotifying() const { return m_bNotifying; } |
420 void PWLtoWnd(const C
PDF_Point & point, int32_t& x, int32_t& y) const; | 428 |
421 FX_RECT PWLtoWnd(const C
PDF_Rect & rect) const; | 429 void InvalidateRectMove(const CPDF_Rect& rcOld, const CPDF_Rect& rcNew); |
422 FX_HWND GetAttachedHWnd(
) const; | 430 |
423 | 431 void PWLtoWnd(const CPDF_Point& point, int32_t& x, int32_t& y) const; |
424 FX_BOOL IsWndCaptureMous
e(const CPWL_Wnd * pWnd) const; | 432 FX_RECT PWLtoWnd(const CPDF_Rect& rect) const; |
425 FX_BOOL IsWndCaptureKeyb
oard(const CPWL_Wnd * pWnd) const; | 433 FX_HWND GetAttachedHWnd() const; |
426 const CPWL_Wnd* GetRootWnd() const; | 434 |
427 | 435 FX_BOOL IsWndCaptureMouse(const CPWL_Wnd* pWnd) const; |
428 FX_BOOL IsCTRLpressed(FX
_DWORD nFlag) const; | 436 FX_BOOL IsWndCaptureKeyboard(const CPWL_Wnd* pWnd) const; |
429 FX_BOOL IsSHIFTpressed(F
X_DWORD nFlag) const; | 437 const CPWL_Wnd* GetRootWnd() const; |
430 FX_BOOL IsALTpressed(FX_
DWORD nFlag) const; | 438 |
431 FX_BOOL IsINSERTpressed(
FX_DWORD nFlag) const; | 439 FX_BOOL IsCTRLpressed(FX_DWORD nFlag) const; |
432 | 440 FX_BOOL IsSHIFTpressed(FX_DWORD nFlag) const; |
433 private: | 441 FX_BOOL IsALTpressed(FX_DWORD nFlag) const; |
434 void AddChild(CPWL_Wn
d * pWnd); | 442 FX_BOOL IsINSERTpressed(FX_DWORD nFlag) const; |
435 void RemoveChild(CPWL
_Wnd * pWnd); | 443 |
436 | 444 private: |
437 void CreateScrollBar(
const PWL_CREATEPARAM & cp); | 445 void AddChild(CPWL_Wnd* pWnd); |
438 void CreateVScrollBar
(const PWL_CREATEPARAM & cp); | 446 void RemoveChild(CPWL_Wnd* pWnd); |
439 | 447 |
440 void AjustStyle(); | 448 void CreateScrollBar(const PWL_CREATEPARAM& cp); |
441 void CreateMsgControl
(); | 449 void CreateVScrollBar(const PWL_CREATEPARAM& cp); |
442 void DestroyMsgContro
l(); | 450 |
443 | 451 void AjustStyle(); |
444 CPWL_MsgControl* GetMsgControl() const; | 452 void CreateMsgControl(); |
445 | 453 void DestroyMsgControl(); |
446 protected: | 454 |
447 CFX_ArrayTemplate<CPWL_Wnd*> m_aChildren; | 455 CPWL_MsgControl* GetMsgControl() const; |
448 | 456 |
449 private: | 457 protected: |
450 PWL_CREATEPARAM m_sPrivateParam; | 458 CFX_ArrayTemplate<CPWL_Wnd*> m_aChildren; |
451 | 459 |
452 CPWL_ScrollBar* m_pVScrollBar; | 460 private: |
453 | 461 PWL_CREATEPARAM m_sPrivateParam; |
454 CPDF_Rect m_rcWindow; | 462 |
455 CPDF_Rect m_rcClip; | 463 CPWL_ScrollBar* m_pVScrollBar; |
456 | 464 |
457 FX_BOOL m_bCreated; | 465 CPDF_Rect m_rcWindow; |
458 FX_BOOL m_bVisible; | 466 CPDF_Rect m_rcClip; |
459 FX_BOOL m_bNotifying; | 467 |
460 FX_BOOL m_bEnabled; | 468 FX_BOOL m_bCreated; |
| 469 FX_BOOL m_bVisible; |
| 470 FX_BOOL m_bNotifying; |
| 471 FX_BOOL m_bEnabled; |
461 }; | 472 }; |
462 | 473 |
463 #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_WND_H_ | 474 #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_WND_H_ |
OLD | NEW |