Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(608)

Side by Side Diff: fpdfsdk/src/pdfwindow/PWL_Wnd.cpp

Issue 1239313005: Merge to XFA - else after returns. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Fix issues. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/src/pdfwindow/PWL_FontMap.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <map> 7 #include <map>
8 8
9 #include "../../include/pdfwindow/PDFWindow.h" 9 #include "../../include/pdfwindow/PDFWindow.h"
10 #include "../../include/pdfwindow/PWL_Wnd.h" 10 #include "../../include/pdfwindow/PWL_Wnd.h"
11 #include "../../include/pdfwindow/PWL_Utils.h" 11 #include "../../include/pdfwindow/PWL_Utils.h"
12 #include "../../include/pdfwindow/PWL_ScrollBar.h" 12 #include "../../include/pdfwindow/PWL_ScrollBar.h"
13 13
14 /* -------------------------- CPWL_Timer -------------------------- */ 14 /* -------------------------- CPWL_Timer -------------------------- */
15 15
16 static std::map<int32_t, CPWL_Timer*>& GetPWLTimeMap() 16 static std::map<int32_t, CPWL_Timer*>& GetPWLTimeMap()
17 { 17 {
18 // Leak the object at shutdown. 18 // Leak the object at shutdown.
19 static auto timeMap = new std::map<int32_t, CPWL_Timer*>; 19 static auto timeMap = new std::map<int32_t, CPWL_Timer*>;
20 return *timeMap; 20 return *timeMap;
21 } 21 }
22 22
23 CPWL_Timer::CPWL_Timer(CPWL_TimerHandler* pAttached, IFX_SystemHandler* pSystemH andler) : 23 CPWL_Timer::CPWL_Timer(CPWL_TimerHandler* pAttached, IFX_SystemHandler* pSystemH andler) :
24 » m_nTimerID(0), 24 m_nTimerID(0),
25 » m_pAttached(pAttached), 25 m_pAttached(pAttached),
26 » m_pSystemHandler(pSystemHandler) 26 m_pSystemHandler(pSystemHandler)
27 { 27 {
28 » ASSERT(m_pAttached != NULL); 28 ASSERT(m_pAttached != NULL);
29 » ASSERT(m_pSystemHandler != NULL); 29 ASSERT(m_pSystemHandler != NULL);
30 } 30 }
31 31
32 CPWL_Timer::~CPWL_Timer() 32 CPWL_Timer::~CPWL_Timer()
33 { 33 {
34 » KillPWLTimer(); 34 KillPWLTimer();
35 } 35 }
36 36
37 int32_t CPWL_Timer::SetPWLTimer(int32_t nElapse) 37 int32_t CPWL_Timer::SetPWLTimer(int32_t nElapse)
38 { 38 {
39 if (m_nTimerID != 0) 39 if (m_nTimerID != 0)
40 KillPWLTimer(); 40 KillPWLTimer();
41 m_nTimerID = m_pSystemHandler->SetTimer(nElapse, TimerProc); 41 m_nTimerID = m_pSystemHandler->SetTimer(nElapse, TimerProc);
42 42
43 GetPWLTimeMap()[m_nTimerID] = this; 43 GetPWLTimeMap()[m_nTimerID] = this;
44 return m_nTimerID; 44 return m_nTimerID;
(...skipping 26 matching lines...) Expand all
71 { 71 {
72 } 72 }
73 73
74 CPWL_TimerHandler::~CPWL_TimerHandler() 74 CPWL_TimerHandler::~CPWL_TimerHandler()
75 { 75 {
76 delete m_pTimer; 76 delete m_pTimer;
77 } 77 }
78 78
79 void CPWL_TimerHandler::BeginTimer(int32_t nElapse) 79 void CPWL_TimerHandler::BeginTimer(int32_t nElapse)
80 { 80 {
81 » if (!m_pTimer) 81 if (!m_pTimer)
82 » » m_pTimer = new CPWL_Timer(this, GetSystemHandler()); 82 m_pTimer = new CPWL_Timer(this, GetSystemHandler());
83 83
84 » if (m_pTimer) 84 if (m_pTimer)
85 » » m_pTimer->SetPWLTimer(nElapse); 85 m_pTimer->SetPWLTimer(nElapse);
86 } 86 }
87 87
88 void CPWL_TimerHandler::EndTimer() 88 void CPWL_TimerHandler::EndTimer()
89 { 89 {
90 » if (m_pTimer) 90 if (m_pTimer)
91 » » m_pTimer->KillPWLTimer(); 91 m_pTimer->KillPWLTimer();
92 } 92 }
93 93
94 void CPWL_TimerHandler::TimerProc() 94 void CPWL_TimerHandler::TimerProc()
95 { 95 {
96 } 96 }
97 97
98 /* --------------------------- CPWL_MsgControl ---------------------------- */ 98 /* --------------------------- CPWL_MsgControl ---------------------------- */
99 99
100 class CPWL_MsgControl 100 class CPWL_MsgControl
101 { 101 {
102 » friend class CPWL_Wnd; 102 friend class CPWL_Wnd;
103 103
104 public: 104 public:
105 » CPWL_MsgControl(CPWL_Wnd * pWnd) 105 CPWL_MsgControl(CPWL_Wnd * pWnd)
106 » { 106 {
107 //» » PWL_TRACE("new CPWL_MsgControl\n"); 107 // PWL_TRACE("new CPWL_MsgControl\n");
108 » » m_pCreatedWnd = pWnd; 108 m_pCreatedWnd = pWnd;
109 » » Default(); 109 Default();
110 » } 110 }
111 111
112 » ~CPWL_MsgControl() 112 ~CPWL_MsgControl()
113 » { 113 {
114 //» » PWL_TRACE("~CPWL_MsgControl\n"); 114 // PWL_TRACE("~CPWL_MsgControl\n");
115 » » Default(); 115 Default();
116 » } 116 }
117 117
118 » void Default() 118 void Default()
119 » { 119 {
120 » » m_aMousePath.RemoveAll(); 120 m_aMousePath.RemoveAll();
121 » » m_aKeyboardPath.RemoveAll(); 121 m_aKeyboardPath.RemoveAll();
122 » » m_pMainMouseWnd = NULL; 122 m_pMainMouseWnd = NULL;
123 » » m_pMainKeyboardWnd = NULL; 123 m_pMainKeyboardWnd = NULL;
124 » } 124 }
125 125
126 » FX_BOOL IsWndCreated(const CPWL_Wnd * pWnd) const 126 FX_BOOL IsWndCreated(const CPWL_Wnd * pWnd) const
127 » { 127 {
128 » » return m_pCreatedWnd == pWnd; 128 return m_pCreatedWnd == pWnd;
129 » } 129 }
130 130
131 » FX_BOOL IsMainCaptureMouse(const CPWL_Wnd * pWnd) const 131 FX_BOOL IsMainCaptureMouse(const CPWL_Wnd * pWnd) const
132 » { 132 {
133 » » return pWnd == m_pMainMouseWnd; 133 return pWnd == m_pMainMouseWnd;
134 » } 134 }
135 135
136 » FX_BOOL IsWndCaptureMouse(const CPWL_Wnd * pWnd) const 136 FX_BOOL IsWndCaptureMouse(const CPWL_Wnd * pWnd) const
137 » { 137 {
138 » » if (pWnd) 138 if (pWnd)
139 » » » for( int32_t i=0,sz=m_aMousePath.GetSize(); i<sz; i++) 139 for( int32_t i=0,sz=m_aMousePath.GetSize(); i<sz; i++)
140 » » » » if (m_aMousePath.GetAt(i) == pWnd) 140 if (m_aMousePath.GetAt(i) == pWnd)
141 » » » » » return TRUE; 141 return TRUE;
142 142
143 » » return FALSE; 143 return FALSE;
144 » } 144 }
145 145
146 » FX_BOOL IsMainCaptureKeyboard(const CPWL_Wnd * pWnd) const 146 FX_BOOL IsMainCaptureKeyboard(const CPWL_Wnd * pWnd) const
147 » { 147 {
148 » » return pWnd == m_pMainKeyboardWnd; 148 return pWnd == m_pMainKeyboardWnd;
149 » } 149 }
150 150
151 151
152 » FX_BOOL IsWndCaptureKeyboard(const CPWL_Wnd * pWnd) const 152 FX_BOOL IsWndCaptureKeyboard(const CPWL_Wnd * pWnd) const
153 » { 153 {
154 » » if (pWnd) 154 if (pWnd)
155 » » » for( int32_t i=0,sz=m_aKeyboardPath.GetSize(); i<sz; i++ ) 155 for( int32_t i=0,sz=m_aKeyboardPath.GetSize(); i<sz; i++)
156 » » » » if (m_aKeyboardPath.GetAt(i) == pWnd) 156 if (m_aKeyboardPath.GetAt(i) == pWnd)
157 » » » » » return TRUE; 157 return TRUE;
158 158
159 » » return FALSE; 159 return FALSE;
160 » } 160 }
161 161
162 » void SetFocus(CPWL_Wnd * pWnd) 162 void SetFocus(CPWL_Wnd * pWnd)
163 » { 163 {
164 » » m_aKeyboardPath.RemoveAll(); 164 m_aKeyboardPath.RemoveAll();
165 165
166 » » if (pWnd) 166 if (pWnd)
167 » » { 167 {
168 » » » m_pMainKeyboardWnd = pWnd; 168 m_pMainKeyboardWnd = pWnd;
169 169
170 » » » CPWL_Wnd * pParent = pWnd; 170 CPWL_Wnd * pParent = pWnd;
171 » » » while (pParent) 171 while (pParent)
172 » » » { 172 {
173 » » » » m_aKeyboardPath.Add(pParent); 173 m_aKeyboardPath.Add(pParent);
174 » » » » pParent = pParent->GetParentWindow(); 174 pParent = pParent->GetParentWindow();
175 » » » } 175 }
176 176
177 » » » pWnd->OnSetFocus(); 177 pWnd->OnSetFocus();
178 » » } 178 }
179 » } 179 }
180 180
181 » void KillFocus() 181 void KillFocus()
182 » { 182 {
183 » » if (m_aKeyboardPath.GetSize() > 0) 183 if (m_aKeyboardPath.GetSize() > 0)
184 » » » if (CPWL_Wnd* pWnd = m_aKeyboardPath.GetAt(0)) 184 if (CPWL_Wnd* pWnd = m_aKeyboardPath.GetAt(0))
185 » » » » pWnd->OnKillFocus(); 185 pWnd->OnKillFocus();
186 186
187 » » m_pMainKeyboardWnd = NULL; 187 m_pMainKeyboardWnd = NULL;
188 » » m_aKeyboardPath.RemoveAll(); 188 m_aKeyboardPath.RemoveAll();
189 » } 189 }
190 190
191 » void SetCapture(CPWL_Wnd * pWnd) 191 void SetCapture(CPWL_Wnd * pWnd)
192 » { 192 {
193 » » m_aMousePath.RemoveAll(); 193 m_aMousePath.RemoveAll();
194 194
195 » » if (pWnd) 195 if (pWnd)
196 » » { 196 {
197 » » » m_pMainMouseWnd = pWnd; 197 m_pMainMouseWnd = pWnd;
198 198
199 » » » CPWL_Wnd * pParent = pWnd; 199 CPWL_Wnd * pParent = pWnd;
200 » » » while (pParent) 200 while (pParent)
201 » » » { 201 {
202 » » » » m_aMousePath.Add(pParent); 202 m_aMousePath.Add(pParent);
203 » » » » pParent = pParent->GetParentWindow(); 203 pParent = pParent->GetParentWindow();
204 » » » } 204 }
205 » » } 205 }
206 » } 206 }
207 207
208 » void ReleaseCapture() 208 void ReleaseCapture()
209 » { 209 {
210 » » m_pMainMouseWnd = NULL; 210 m_pMainMouseWnd = NULL;
211 » » m_aMousePath.RemoveAll(); 211 m_aMousePath.RemoveAll();
212 » } 212 }
213 213
214 private: 214 private:
215 » CFX_ArrayTemplate<CPWL_Wnd*>» m_aMousePath; 215 CFX_ArrayTemplate<CPWL_Wnd*> m_aMousePath;
216 » CFX_ArrayTemplate<CPWL_Wnd*>» m_aKeyboardPath; 216 CFX_ArrayTemplate<CPWL_Wnd*> m_aKeyboardPath;
217 » CPWL_Wnd*» » » » » » m_pCreatedWnd; 217 CPWL_Wnd* m_pCreatedWnd;
218 » CPWL_Wnd*» » » » » » m_pMainMouseWnd; 218 CPWL_Wnd* m_pMainMouseWnd;
219 » CPWL_Wnd*» » » » » » m_pMainKeyboardW nd; 219 CPWL_Wnd* m_pMainKeyboardWnd;
220 }; 220 };
221 221
222 /* --------------------------- CPWL_Wnd ---------------------------- */ 222 /* --------------------------- CPWL_Wnd ---------------------------- */
223 223
224 CPWL_Wnd::CPWL_Wnd() : 224 CPWL_Wnd::CPWL_Wnd() :
225 » m_pVScrollBar(NULL), 225 m_pVScrollBar(NULL),
226 » m_rcWindow(), 226 m_rcWindow(),
227 » m_rcClip(), 227 m_rcClip(),
228 » m_bCreated(FALSE), 228 m_bCreated(FALSE),
229 » m_bVisible(FALSE), 229 m_bVisible(FALSE),
230 » m_bNotifying(FALSE), 230 m_bNotifying(FALSE),
231 » m_bEnabled(TRUE) 231 m_bEnabled(TRUE)
232 { 232 {
233 } 233 }
234 234
235 CPWL_Wnd::~CPWL_Wnd() 235 CPWL_Wnd::~CPWL_Wnd()
236 { 236 {
237 » ASSERT(m_bCreated == FALSE); 237 ASSERT(m_bCreated == FALSE);
238 } 238 }
239 239
240 CFX_ByteString CPWL_Wnd::GetClassName() const 240 CFX_ByteString CPWL_Wnd::GetClassName() const
241 { 241 {
242 » return "CPWL_Wnd"; 242 return "CPWL_Wnd";
243 } 243 }
244 244
245 void CPWL_Wnd::Create(const PWL_CREATEPARAM & cp) 245 void CPWL_Wnd::Create(const PWL_CREATEPARAM & cp)
246 { 246 {
247 » if (!IsValid()) 247 if (!IsValid())
248 » { 248 {
249 » » m_sPrivateParam = cp; 249 m_sPrivateParam = cp;
250 250
251 » » OnCreate(m_sPrivateParam); 251 OnCreate(m_sPrivateParam);
252 252
253 » » m_sPrivateParam.rcRectWnd.Normalize(); 253 m_sPrivateParam.rcRectWnd.Normalize();
254 » » m_rcWindow = m_sPrivateParam.rcRectWnd; 254 m_rcWindow = m_sPrivateParam.rcRectWnd;
255 » » m_rcClip = CPWL_Utils::InflateRect(m_rcWindow,1.0f); 255 m_rcClip = CPWL_Utils::InflateRect(m_rcWindow,1.0f);
256 256
257 » » CreateMsgControl(); 257 CreateMsgControl();
258 258
259 » » if (m_sPrivateParam.pParentWnd) 259 if (m_sPrivateParam.pParentWnd)
260 » » » m_sPrivateParam.pParentWnd->OnNotify(this, PNM_ADDCHILD) ; 260 m_sPrivateParam.pParentWnd->OnNotify(this, PNM_ADDCHILD);
261 261
262 » » PWL_CREATEPARAM ccp = m_sPrivateParam; 262 PWL_CREATEPARAM ccp = m_sPrivateParam;
263 263
264 » » ccp.dwFlags &= 0xFFFF0000L; //remove sub styles 264 ccp.dwFlags &= 0xFFFF0000L; //remove sub styles
265 » » ccp.mtChild = CPDF_Matrix(1,0,0,1,0,0); 265 ccp.mtChild = CPDF_Matrix(1,0,0,1,0,0);
266 266
267 » » CreateScrollBar(ccp); 267 CreateScrollBar(ccp);
268 » » CreateChildWnd(ccp); 268 CreateChildWnd(ccp);
269 269
270 » » m_bVisible = HasFlag(PWS_VISIBLE); 270 m_bVisible = HasFlag(PWS_VISIBLE);
271 271
272 » » OnCreated(); 272 OnCreated();
273 273
274 » » RePosChildWnd(); 274 RePosChildWnd();
275 » » m_bCreated = TRUE; 275 m_bCreated = TRUE;
276 » } 276 }
277 } 277 }
278 278
279 void CPWL_Wnd::OnCreate(PWL_CREATEPARAM & cp) 279 void CPWL_Wnd::OnCreate(PWL_CREATEPARAM & cp)
280 { 280 {
281 } 281 }
282 282
283 void CPWL_Wnd::OnCreated() 283 void CPWL_Wnd::OnCreated()
284 { 284 {
285 } 285 }
286 286
287 void CPWL_Wnd::OnDestroy() 287 void CPWL_Wnd::OnDestroy()
288 { 288 {
289 } 289 }
290 290
291 void CPWL_Wnd::Destroy() 291 void CPWL_Wnd::Destroy()
292 { 292 {
293 » KillFocus(); 293 KillFocus();
294 294
295 » OnDestroy(); 295 OnDestroy();
296 296
297 » if (m_bCreated) 297 if (m_bCreated)
298 » { 298 {
299 » » for (int32_t i = m_aChildren.GetSize()-1; i >= 0; i --) 299 for (int32_t i = m_aChildren.GetSize()-1; i >= 0; i --)
300 » » { 300 {
301 » » » if (CPWL_Wnd * pChild = m_aChildren[i]) 301 if (CPWL_Wnd * pChild = m_aChildren[i])
302 » » » { 302 {
303 » » » » pChild->Destroy(); 303 pChild->Destroy();
304 » » » » delete pChild; 304 delete pChild;
305 » » » » pChild = NULL; 305 pChild = NULL;
306 » » » } 306 }
307 » » } 307 }
308 308
309 » » if (m_sPrivateParam.pParentWnd) 309 if (m_sPrivateParam.pParentWnd)
310 » » » m_sPrivateParam.pParentWnd->OnNotify(this, PNM_REMOVECHI LD); 310 m_sPrivateParam.pParentWnd->OnNotify(this, PNM_REMOVECHILD);
311 » » m_bCreated = FALSE; 311 m_bCreated = FALSE;
312 » } 312 }
313 313
314 » DestroyMsgControl(); 314 DestroyMsgControl();
315 315
316 » FXSYS_memset(&m_sPrivateParam, 0, sizeof(PWL_CREATEPARAM)); 316 FXSYS_memset(&m_sPrivateParam, 0, sizeof(PWL_CREATEPARAM));
317 » m_aChildren.RemoveAll(); 317 m_aChildren.RemoveAll();
318 » m_pVScrollBar = NULL; 318 m_pVScrollBar = NULL;
319 } 319 }
320 320
321 void CPWL_Wnd::Move(const CPDF_Rect & rcNew, FX_BOOL bReset,FX_BOOL bRefresh) 321 void CPWL_Wnd::Move(const CPDF_Rect & rcNew, FX_BOOL bReset,FX_BOOL bRefresh)
322 { 322 {
323 » if (IsValid()) 323 if (IsValid())
324 » { 324 {
325 » » CPDF_Rect rcOld = GetWindowRect(); 325 CPDF_Rect rcOld = GetWindowRect();
326 326
327 » » m_rcWindow = rcNew; 327 m_rcWindow = rcNew;
328 » » m_rcWindow.Normalize(); 328 m_rcWindow.Normalize();
329 329
330 » » if (rcOld.left != rcNew.left || rcOld.right != rcNew.right || 330 if (rcOld.left != rcNew.left || rcOld.right != rcNew.right ||
331 » » » rcOld.top != rcNew.top || rcOld.bottom != rcNew.bottom) 331 rcOld.top != rcNew.top || rcOld.bottom != rcNew.bottom)
332 » » { 332 {
333 » » » if (bReset) 333 if (bReset)
334 » » » { 334 {
335 » » » » RePosChildWnd(); 335 RePosChildWnd();
336 » » » } 336 }
337 337
338 » » } 338 }
339 » » if (bRefresh) 339 if (bRefresh)
340 » » { 340 {
341 » » » InvalidateRectMove(rcOld,rcNew); 341 InvalidateRectMove(rcOld,rcNew);
342 » » } 342 }
343 343
344 » » m_sPrivateParam.rcRectWnd = m_rcWindow; 344 m_sPrivateParam.rcRectWnd = m_rcWindow;
345 » } 345 }
346 } 346 }
347 347
348 void CPWL_Wnd::InvalidateRectMove(const CPDF_Rect & rcOld, const CPDF_Rect & rc New) 348 void CPWL_Wnd::InvalidateRectMove(const CPDF_Rect & rcOld, const CPDF_Rect & rc New)
349 { 349 {
350 » CPDF_Rect rcUnion = rcOld; 350 CPDF_Rect rcUnion = rcOld;
351 » rcUnion.Union(rcNew); 351 rcUnion.Union(rcNew);
352 352
353 » InvalidateRect(&rcUnion); 353 InvalidateRect(&rcUnion);
354 } 354 }
355 355
356 void CPWL_Wnd::GetAppearanceStream(CFX_ByteString & sAppStream) 356 void CPWL_Wnd::GetAppearanceStream(CFX_ByteString & sAppStream)
357 { 357 {
358 » if (IsValid()) 358 if (IsValid())
359 » { 359 {
360 » » CFX_ByteTextBuf sTextBuf; 360 CFX_ByteTextBuf sTextBuf;
361 » » GetAppearanceStream(sTextBuf); 361 GetAppearanceStream(sTextBuf);
362 » » sAppStream += sTextBuf.GetByteString(); 362 sAppStream += sTextBuf.GetByteString();
363 » } 363 }
364 } 364 }
365 365
366 void CPWL_Wnd::GetAppearanceStream(CFX_ByteTextBuf & sAppStream) 366 void CPWL_Wnd::GetAppearanceStream(CFX_ByteTextBuf & sAppStream)
367 { 367 {
368 » if (IsValid() && IsVisible()) 368 if (IsValid() && IsVisible())
369 » { 369 {
370 » » GetThisAppearanceStream(sAppStream); 370 GetThisAppearanceStream(sAppStream);
371 » » GetChildAppearanceStream(sAppStream); 371 GetChildAppearanceStream(sAppStream);
372 » } 372 }
373 } 373 }
374 374
375 //if don't set,Get default apperance stream 375 //if don't set,Get default apperance stream
376 void CPWL_Wnd::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) 376 void CPWL_Wnd::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream)
377 { 377 {
378 CPDF_Rect rectWnd = GetWindowRect(); 378 CPDF_Rect rectWnd = GetWindowRect();
379 if (!rectWnd.IsEmpty()) { 379 if (!rectWnd.IsEmpty()) {
380 CFX_ByteTextBuf sThis; 380 CFX_ByteTextBuf sThis;
381 381
382 if (HasFlag(PWS_BACKGROUND)) 382 if (HasFlag(PWS_BACKGROUND))
383 sThis << CPWL_Utils::GetRectFillAppStream(rectWnd, GetBackgroundColo r()); 383 sThis << CPWL_Utils::GetRectFillAppStream(rectWnd, GetBackgroundColo r());
384 384
385 if (HasFlag(PWS_BORDER)) { 385 if (HasFlag(PWS_BORDER)) {
386 sThis << CPWL_Utils::GetBorderAppStream( 386 sThis << CPWL_Utils::GetBorderAppStream(
387 rectWnd, 387 rectWnd,
388 (FX_FLOAT)GetBorderWidth(), 388 (FX_FLOAT)GetBorderWidth(),
389 GetBorderColor(), 389 GetBorderColor(),
390 GetBorderLeftTopColor(GetBorderStyle()), 390 GetBorderLeftTopColor(GetBorderStyle()),
391 GetBorderRightBottomColor(GetBorderStyle()), 391 GetBorderRightBottomColor(GetBorderStyle()),
392 GetBorderStyle(), 392 GetBorderStyle(),
393 GetBorderDash()); 393 GetBorderDash());
394 } 394 }
395 395
396 sAppStream << sThis; 396 sAppStream << sThis;
397 } 397 }
398 } 398 }
399 399
400 void CPWL_Wnd::GetChildAppearanceStream(CFX_ByteTextBuf & sAppStream) 400 void CPWL_Wnd::GetChildAppearanceStream(CFX_ByteTextBuf & sAppStream)
401 { 401 {
402 » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++) 402 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)
403 » { 403 {
404 » » if (CPWL_Wnd * pChild = m_aChildren.GetAt(i)) 404 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))
405 » » { 405 {
406 » » » pChild->GetAppearanceStream(sAppStream); 406 pChild->GetAppearanceStream(sAppStream);
407 » » } 407 }
408 » } 408 }
409 } 409 }
410 410
411 void CPWL_Wnd::DrawAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Devi ce) 411 void CPWL_Wnd::DrawAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Devi ce)
412 { 412 {
413 » if (IsValid() && IsVisible()) 413 if (IsValid() && IsVisible())
414 » { 414 {
415 » » DrawThisAppearance(pDevice,pUser2Device); 415 DrawThisAppearance(pDevice,pUser2Device);
416 » » DrawChildAppearance(pDevice,pUser2Device); 416 DrawChildAppearance(pDevice,pUser2Device);
417 » } 417 }
418 } 418 }
419 419
420 void CPWL_Wnd::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2 Device) 420 void CPWL_Wnd::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2 Device)
421 { 421 {
422 » CPDF_Rect rectWnd = GetWindowRect(); 422 CPDF_Rect rectWnd = GetWindowRect();
423 » if (!rectWnd.IsEmpty()) 423 if (!rectWnd.IsEmpty())
424 » { 424 {
425 » » if (HasFlag(PWS_BACKGROUND)) 425 if (HasFlag(PWS_BACKGROUND))
426 » » { 426 {
427 » » » CPDF_Rect rcClient = CPWL_Utils::DeflateRect(rectWnd,(FX _FLOAT)(GetBorderWidth()+GetInnerBorderWidth())); 427 CPDF_Rect rcClient = CPWL_Utils::DeflateRect(rectWnd,(FX_FLOAT)(GetB orderWidth()+GetInnerBorderWidth()));
428 » » » CPWL_Utils::DrawFillRect(pDevice,pUser2Device,rcClient, GetBackgroundColor(), GetTransparency()); 428 CPWL_Utils::DrawFillRect(pDevice,pUser2Device,rcClient, GetBackgroun dColor(), GetTransparency());
429 » » } 429 }
430 430
431 » » if (HasFlag(PWS_BORDER)) 431 if (HasFlag(PWS_BORDER))
432 » » » CPWL_Utils::DrawBorder(pDevice, 432 CPWL_Utils::DrawBorder(pDevice,
433 » » » » » » » » pUser2Device, 433 pUser2Device,
434 » » » » » » » » rectWnd, 434 rectWnd,
435 » » » » » » » » (FX_FLOAT)GetBor derWidth(), 435 (FX_FLOAT)GetBorderWidth(),
436 » » » » » » » » GetBorderColor() , 436 GetBorderColor(),
437 » » » » » » » » GetBorderLeftTop Color(GetBorderStyle()), 437 GetBorderLeftTopColor(GetBorderStyle()),
438 » » » » » » » » GetBorderRightBo ttomColor(GetBorderStyle()), 438 GetBorderRightBottomColor(GetBorderStyle()),
439 » » » » » » » » GetBorderStyle() , 439 GetBorderStyle(),
440 » » » » » » » » GetBorderDash(), 440 GetBorderDash(),
441 » » » » » » » » GetTransparency( )); 441 GetTransparency());
442 » } 442 }
443 } 443 }
444 444
445 void CPWL_Wnd::DrawChildAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser 2Device) 445 void CPWL_Wnd::DrawChildAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser 2Device)
446 { 446 {
447 » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++) 447 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)
448 » { 448 {
449 » » if (CPWL_Wnd * pChild = m_aChildren.GetAt(i)) 449 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))
450 » » { 450 {
451 » » » CPDF_Matrix mt = pChild->GetChildMatrix(); 451 CPDF_Matrix mt = pChild->GetChildMatrix();
452 » » » if (mt.IsIdentity()) 452 if (mt.IsIdentity())
453 » » » { 453 {
454 » » » » pChild->DrawAppearance(pDevice,pUser2Device); 454 pChild->DrawAppearance(pDevice,pUser2Device);
455 » » » } 455 }
456 » » » else 456 else
457 » » » { 457 {
458 » » » » mt.Concat(*pUser2Device); 458 mt.Concat(*pUser2Device);
459 » » » » pChild->DrawAppearance(pDevice,&mt); 459 pChild->DrawAppearance(pDevice,&mt);
460 » » » } 460 }
461 » » } 461 }
462 » } 462 }
463 } 463 }
464 464
465 void CPWL_Wnd::InvalidateRect(CPDF_Rect* pRect) 465 void CPWL_Wnd::InvalidateRect(CPDF_Rect* pRect)
466 { 466 {
467 » if (IsValid()) 467 if (IsValid())
468 » { 468 {
469 » » CPDF_Rect rcRefresh = pRect ? *pRect : GetWindowRect(); 469 CPDF_Rect rcRefresh = pRect ? *pRect : GetWindowRect();
470 470
471 » » if (!HasFlag(PWS_NOREFRESHCLIP)) 471 if (!HasFlag(PWS_NOREFRESHCLIP))
472 » » { 472 {
473 » » » CPDF_Rect rcClip = GetClipRect(); 473 CPDF_Rect rcClip = GetClipRect();
474 » » » if (!rcClip.IsEmpty()) 474 if (!rcClip.IsEmpty())
475 » » » { 475 {
476 » » » » rcRefresh.Intersect(rcClip); 476 rcRefresh.Intersect(rcClip);
477 » » » } 477 }
478 » » } 478 }
479 479
480 » » FX_RECT rcWin = PWLtoWnd(rcRefresh); 480 FX_RECT rcWin = PWLtoWnd(rcRefresh);
481 » » rcWin.left -= PWL_INVALIDATE_INFLATE; 481 rcWin.left -= PWL_INVALIDATE_INFLATE;
482 » » rcWin.top -= PWL_INVALIDATE_INFLATE; 482 rcWin.top -= PWL_INVALIDATE_INFLATE;
483 » » rcWin.right += PWL_INVALIDATE_INFLATE; 483 rcWin.right += PWL_INVALIDATE_INFLATE;
484 » » rcWin.bottom += PWL_INVALIDATE_INFLATE; 484 rcWin.bottom += PWL_INVALIDATE_INFLATE;
485 485
486 » » if (IFX_SystemHandler* pSH = GetSystemHandler()) 486 if (IFX_SystemHandler* pSH = GetSystemHandler())
487 » » { 487 {
488 » » » if (FX_HWND hWnd = GetAttachedHWnd()) 488 if (FX_HWND hWnd = GetAttachedHWnd())
489 » » » { 489 {
490 » » » » pSH->InvalidateRect(hWnd, rcWin); 490 pSH->InvalidateRect(hWnd, rcWin);
491 » » » } 491 }
492 » » } 492 }
493 » } 493 }
494 } 494 }
495 495
496 #define PWL_IMPLEMENT_KEY_METHOD(key_method_name)\ 496 #define PWL_IMPLEMENT_KEY_METHOD(key_method_name)\
497 FX_BOOL CPWL_Wnd::key_method_name(FX_WORD nChar, FX_DWORD nFlag)\ 497 FX_BOOL CPWL_Wnd::key_method_name(FX_WORD nChar, FX_DWORD nFlag)\
498 {\ 498 {\
499 » if (IsValid() && IsVisible() && IsEnabled())\ 499 if (IsValid() && IsVisible() && IsEnabled())\
500 » {\ 500 {\
501 » » if (IsWndCaptureKeyboard(this))\ 501 if (IsWndCaptureKeyboard(this))\
502 » » {\ 502 {\
503 » » » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)\ 503 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)\
504 » » » {\ 504 {\
505 » » » » if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))\ 505 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))\
506 » » » » {\ 506 {\
507 » » » » » if (IsWndCaptureKeyboard(pChild))\ 507 if (IsWndCaptureKeyboard(pChild))\
508 » » » » » {\ 508 {\
509 » » » » » » return pChild->key_method_name(n Char,nFlag);\ 509 return pChild->key_method_name(nChar,nFlag);\
510 » » » » » }\ 510 }\
511 » » » » }\ 511 }\
512 » » » }\ 512 }\
513 » » }\ 513 }\
514 » }\ 514 }\
515 » return FALSE;\ 515 return FALSE;\
516 } 516 }
517 517
518 #define PWL_IMPLEMENT_MOUSE_METHOD(mouse_method_name)\ 518 #define PWL_IMPLEMENT_MOUSE_METHOD(mouse_method_name)\
519 FX_BOOL CPWL_Wnd::mouse_method_name(const CPDF_Point & point, FX_DWORD nFlag)\ 519 FX_BOOL CPWL_Wnd::mouse_method_name(const CPDF_Point & point, FX_DWORD nFlag)\
520 {\ 520 {\
521 » if (IsValid() && IsVisible() && IsEnabled())\ 521 if (IsValid() && IsVisible() && IsEnabled())\
522 » {\ 522 {\
523 » » if (IsWndCaptureMouse(this))\ 523 if (IsWndCaptureMouse(this))\
524 » » {\ 524 {\
525 » » » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)\ 525 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)\
526 » » » {\ 526 {\
527 » » » » if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))\ 527 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))\
528 » » » » {\ 528 {\
529 » » » » » if (IsWndCaptureMouse(pChild))\ 529 if (IsWndCaptureMouse(pChild))\
530 » » » » » {\ 530 {\
531 » » » » » » return pChild->mouse_method_name (pChild->ParentToChild(point),nFlag);\ 531 return pChild->mouse_method_name(pChild->ParentToChild(p oint),nFlag);\
532 » » » » » }\ 532 }\
533 » » » » }\ 533 }\
534 » » » }\ 534 }\
535 » » » SetCursor();\ 535 SetCursor();\
536 » » }\ 536 }\
537 » » else\ 537 else\
538 » » {\ 538 {\
539 » » » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)\ 539 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)\
540 » » » {\ 540 {\
541 » » » » if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))\ 541 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))\
542 » » » » {\ 542 {\
543 » » » » » if (pChild->WndHitTest(pChild->ParentToC hild(point)))\ 543 if (pChild->WndHitTest(pChild->ParentToChild(point)))\
544 » » » » » {\ 544 {\
545 » » » » » » return pChild->mouse_method_name (pChild->ParentToChild(point),nFlag);\ 545 return pChild->mouse_method_name(pChild->ParentToChild(p oint),nFlag);\
546 » » » » » }\ 546 }\
547 » » » » }\ 547 }\
548 » » » }\ 548 }\
549 » » » if (WndHitTest(point))\ 549 if (WndHitTest(point))\
550 » » » » SetCursor();\ 550 SetCursor();\
551 » » }\ 551 }\
552 » }\ 552 }\
553 » return FALSE;\ 553 return FALSE;\
554 } 554 }
555 555
556 PWL_IMPLEMENT_KEY_METHOD(OnKeyDown) 556 PWL_IMPLEMENT_KEY_METHOD(OnKeyDown)
557 PWL_IMPLEMENT_KEY_METHOD(OnKeyUp) 557 PWL_IMPLEMENT_KEY_METHOD(OnKeyUp)
558 PWL_IMPLEMENT_KEY_METHOD(OnChar) 558 PWL_IMPLEMENT_KEY_METHOD(OnChar)
559 559
560 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonDblClk) 560 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonDblClk)
561 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonDown) 561 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonDown)
562 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonUp) 562 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonUp)
563 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonDblClk) 563 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonDblClk)
564 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonDown) 564 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonDown)
565 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonUp) 565 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonUp)
566 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonDblClk) 566 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonDblClk)
567 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonDown) 567 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonDown)
568 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonUp) 568 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonUp)
569 PWL_IMPLEMENT_MOUSE_METHOD(OnMouseMove) 569 PWL_IMPLEMENT_MOUSE_METHOD(OnMouseMove)
570 570
571 FX_BOOL»CPWL_Wnd::OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag) 571 FX_BOOL CPWL_Wnd::OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag)
572 { 572 {
573 » if (IsValid() && IsVisible() && IsEnabled()) 573 if (IsValid() && IsVisible() && IsEnabled())
574 » { 574 {
575 » » SetCursor(); 575 SetCursor();
576 » » if (IsWndCaptureKeyboard(this)) 576 if (IsWndCaptureKeyboard(this))
577 » » { 577 {
578 » » » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++) 578 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)
579 » » » { 579 {
580 » » » » if (CPWL_Wnd * pChild = m_aChildren.GetAt(i)) 580 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))
581 » » » » { 581 {
582 » » » » » if (IsWndCaptureKeyboard(pChild)) 582 if (IsWndCaptureKeyboard(pChild))
583 » » » » » { 583 {
584 » » » » » » return pChild->OnMouseWheel(zDel ta,pChild->ParentToChild(point), nFlag); 584 return pChild->OnMouseWheel(zDelta,pChild->ParentToChild (point), nFlag);
585 » » » » » } 585 }
586 » » » » } 586 }
587 » » » } 587 }
588 » » } 588 }
589 » } 589 }
590 » return FALSE; 590 return FALSE;
591 } 591 }
592 592
593 void CPWL_Wnd::AddChild(CPWL_Wnd * pWnd) 593 void CPWL_Wnd::AddChild(CPWL_Wnd * pWnd)
594 { 594 {
595 » m_aChildren.Add(pWnd); 595 m_aChildren.Add(pWnd);
596 } 596 }
597 597
598 void CPWL_Wnd::RemoveChild(CPWL_Wnd * pWnd) 598 void CPWL_Wnd::RemoveChild(CPWL_Wnd * pWnd)
599 { 599 {
600 » for (int32_t i = m_aChildren.GetSize()-1; i >= 0; i --) 600 for (int32_t i = m_aChildren.GetSize()-1; i >= 0; i --)
601 » { 601 {
602 » » if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) 602 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i))
603 » » { 603 {
604 » » » if (pChild == pWnd) 604 if (pChild == pWnd)
605 » » » { 605 {
606 » » » » m_aChildren.RemoveAt(i); 606 m_aChildren.RemoveAt(i);
607 » » » » break; 607 break;
608 » » » } 608 }
609 » » } 609 }
610 » } 610 }
611 } 611 }
612 612
613 void CPWL_Wnd::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intptr_t lParam) 613 void CPWL_Wnd::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intptr_t lParam)
614 { 614 {
615 » switch (msg) 615 switch (msg)
616 » { 616 {
617 » case PNM_ADDCHILD: 617 case PNM_ADDCHILD:
618 » » AddChild(pWnd); 618 AddChild(pWnd);
619 » » break; 619 break;
620 » case PNM_REMOVECHILD: 620 case PNM_REMOVECHILD:
621 » » RemoveChild(pWnd); 621 RemoveChild(pWnd);
622 » » break; 622 break;
623 » default: 623 default:
624 » » break; 624 break;
625 » } 625 }
626 } 626 }
627 627
628 FX_BOOL CPWL_Wnd::IsValid() const 628 FX_BOOL CPWL_Wnd::IsValid() const
629 { 629 {
630 » return m_bCreated; 630 return m_bCreated;
631 } 631 }
632 632
633 PWL_CREATEPARAM CPWL_Wnd::GetCreationParam() const 633 PWL_CREATEPARAM CPWL_Wnd::GetCreationParam() const
634 { 634 {
635 » return m_sPrivateParam; 635 return m_sPrivateParam;
636 } 636 }
637 637
638 CPWL_Wnd* CPWL_Wnd::GetParentWindow() const 638 CPWL_Wnd* CPWL_Wnd::GetParentWindow() const
639 { 639 {
640 » return m_sPrivateParam.pParentWnd; 640 return m_sPrivateParam.pParentWnd;
641 } 641 }
642 642
643 CPDF_Rect CPWL_Wnd::GetOriginWindowRect() const 643 CPDF_Rect CPWL_Wnd::GetOriginWindowRect() const
644 { 644 {
645 » return m_sPrivateParam.rcRectWnd; 645 return m_sPrivateParam.rcRectWnd;
646 } 646 }
647 647
648 CPDF_Rect CPWL_Wnd::GetWindowRect() const 648 CPDF_Rect CPWL_Wnd::GetWindowRect() const
649 { 649 {
650 » return m_rcWindow; 650 return m_rcWindow;
651 } 651 }
652 652
653 CPDF_Rect CPWL_Wnd::GetClientRect() const 653 CPDF_Rect CPWL_Wnd::GetClientRect() const
654 { 654 {
655 » CPDF_Rect rcWindow = GetWindowRect(); 655 CPDF_Rect rcWindow = GetWindowRect();
656 » CPDF_Rect rcClient = CPWL_Utils::DeflateRect(rcWindow,(FX_FLOAT)(GetBord erWidth()+GetInnerBorderWidth())); 656 CPDF_Rect rcClient = CPWL_Utils::DeflateRect(rcWindow,(FX_FLOAT)(GetBorderWi dth()+GetInnerBorderWidth()));
657 657 if (CPWL_ScrollBar* pVSB = GetVScrollBar())
658 » if (CPWL_ScrollBar * pVSB = GetVScrollBar()) 658 rcClient.right -= pVSB->GetScrollBarWidth();
659 » » rcClient.right -= pVSB->GetScrollBarWidth(); 659
660 660 rcClient.Normalize();
661 » rcClient.Normalize(); 661 return rcWindow.Contains(rcClient) ? rcClient : CPDF_Rect();
662
663 » if (rcWindow.Contains(rcClient))
664 » » return rcClient;
665 » else
666 » » return CPDF_Rect();
667 } 662 }
668 663
669 CPDF_Point CPWL_Wnd::GetCenterPoint() const 664 CPDF_Point CPWL_Wnd::GetCenterPoint() const
670 { 665 {
671 » CPDF_Rect rcClient = GetClientRect(); 666 CPDF_Rect rcClient = GetClientRect();
672 667 return CPDF_Point((rcClient.left + rcClient.right) * 0.5f,
673 » return CPDF_Point((rcClient.left + rcClient.right) * 0.5f, 668 (rcClient.top + rcClient.bottom) * 0.5f);
674 » » (rcClient.top + rcClient.bottom) * 0.5f);
675 } 669 }
676 670
677 CPDF_Rect CPWL_Wnd::GetClientCenterSquare() const 671 CPDF_Rect CPWL_Wnd::GetClientCenterSquare() const
678 { 672 {
679 » return CPWL_Utils::GetCenterSquare(GetClientRect()); 673 return CPWL_Utils::GetCenterSquare(GetClientRect());
680 } 674 }
681 675
682 CPDF_Rect CPWL_Wnd::GetWindowCenterSquare() const 676 CPDF_Rect CPWL_Wnd::GetWindowCenterSquare() const
683 { 677 {
684 » return CPWL_Utils::GetCenterSquare(CPWL_Utils::DeflateRect(GetWindowRect (),0.1f)); 678 return CPWL_Utils::GetCenterSquare(CPWL_Utils::DeflateRect(GetWindowRect(),0 .1f));
685 } 679 }
686 680
687 FX_BOOL CPWL_Wnd::HasFlag(FX_DWORD dwFlags) const 681 FX_BOOL CPWL_Wnd::HasFlag(FX_DWORD dwFlags) const
688 { 682 {
689 » return (m_sPrivateParam.dwFlags & dwFlags) != 0; 683 return (m_sPrivateParam.dwFlags & dwFlags) != 0;
690 } 684 }
691 685
692 void CPWL_Wnd::RemoveFlag(FX_DWORD dwFlags) 686 void CPWL_Wnd::RemoveFlag(FX_DWORD dwFlags)
693 { 687 {
694 » m_sPrivateParam.dwFlags &= ~dwFlags; 688 m_sPrivateParam.dwFlags &= ~dwFlags;
695 } 689 }
696 690
697 void CPWL_Wnd::AddFlag(FX_DWORD dwFlags) 691 void CPWL_Wnd::AddFlag(FX_DWORD dwFlags)
698 { 692 {
699 » m_sPrivateParam.dwFlags |= dwFlags; 693 m_sPrivateParam.dwFlags |= dwFlags;
700 } 694 }
701 695
702 CPWL_Color CPWL_Wnd::GetBackgroundColor() const 696 CPWL_Color CPWL_Wnd::GetBackgroundColor() const
703 { 697 {
704 » return m_sPrivateParam.sBackgroundColor; 698 return m_sPrivateParam.sBackgroundColor;
705 } 699 }
706 700
707 void CPWL_Wnd::SetBackgroundColor(const CPWL_Color & color) 701 void CPWL_Wnd::SetBackgroundColor(const CPWL_Color & color)
708 { 702 {
709 » m_sPrivateParam.sBackgroundColor = color; 703 m_sPrivateParam.sBackgroundColor = color;
710 } 704 }
711 705
712 void CPWL_Wnd::SetTextColor(const CPWL_Color & color) 706 void CPWL_Wnd::SetTextColor(const CPWL_Color & color)
713 { 707 {
714 » m_sPrivateParam.sTextColor = color; 708 m_sPrivateParam.sTextColor = color;
715 } 709 }
716 710
717 void CPWL_Wnd::SetTextStrokeColor(const CPWL_Color & color) 711 void CPWL_Wnd::SetTextStrokeColor(const CPWL_Color & color)
718 { 712 {
719 » m_sPrivateParam.sTextStrokeColor = color; 713 m_sPrivateParam.sTextStrokeColor = color;
720 } 714 }
721 715
722 CPWL_Color CPWL_Wnd::GetTextColor() const 716 CPWL_Color CPWL_Wnd::GetTextColor() const
723 { 717 {
724 » return m_sPrivateParam.sTextColor; 718 return m_sPrivateParam.sTextColor;
725 } 719 }
726 720
727 CPWL_Color CPWL_Wnd::GetTextStrokeColor() const 721 CPWL_Color CPWL_Wnd::GetTextStrokeColor() const
728 { 722 {
729 » return m_sPrivateParam.sTextStrokeColor; 723 return m_sPrivateParam.sTextStrokeColor;
730 } 724 }
731 725
732 int32_t CPWL_Wnd::GetBorderStyle() const 726 int32_t CPWL_Wnd::GetBorderStyle() const
733 { 727 {
734 » return m_sPrivateParam.nBorderStyle; 728 return m_sPrivateParam.nBorderStyle;
735 } 729 }
736 730
737 void CPWL_Wnd::SetBorderStyle(int32_t nBorderStyle) 731 void CPWL_Wnd::SetBorderStyle(int32_t nBorderStyle)
738 { 732 {
739 » if (HasFlag(PWS_BORDER)) 733 if (HasFlag(PWS_BORDER))
740 » » m_sPrivateParam.nBorderStyle = nBorderStyle; 734 m_sPrivateParam.nBorderStyle = nBorderStyle;
741 } 735 }
742 736
743 int32_t CPWL_Wnd::GetBorderWidth() const 737 int32_t CPWL_Wnd::GetBorderWidth() const
744 { 738 {
745 » if (HasFlag(PWS_BORDER)) 739 if (HasFlag(PWS_BORDER))
746 » » return m_sPrivateParam.dwBorderWidth; 740 return m_sPrivateParam.dwBorderWidth;
747 741
748 » return 0; 742 return 0;
749 } 743 }
750 744
751 int32_t CPWL_Wnd::GetInnerBorderWidth() const 745 int32_t CPWL_Wnd::GetInnerBorderWidth() const
752 { 746 {
753 » /* 747 /*
754 » switch (GetBorderStyle()) 748 switch (GetBorderStyle())
755 » { 749 {
756 » case PBS_BEVELED: 750 case PBS_BEVELED:
757 » case PBS_INSET: 751 case PBS_INSET:
758 » » return GetBorderWidth() / 2; 752 return GetBorderWidth() / 2;
759 » } 753 }
760 » */ 754 */
761 » return 0; 755 return 0;
762 } 756 }
763 757
764 void CPWL_Wnd::SetBorderWidth(int32_t nBorderWidth) 758 void CPWL_Wnd::SetBorderWidth(int32_t nBorderWidth)
765 { 759 {
766 » if (HasFlag(PWS_BORDER)) 760 if (HasFlag(PWS_BORDER))
767 » » m_sPrivateParam.dwBorderWidth = nBorderWidth; 761 m_sPrivateParam.dwBorderWidth = nBorderWidth;
768 } 762 }
769 763
770 CPWL_Color CPWL_Wnd::GetBorderColor() const 764 CPWL_Color CPWL_Wnd::GetBorderColor() const
771 { 765 {
772 » if (HasFlag(PWS_BORDER)) 766 if (HasFlag(PWS_BORDER))
773 » » return m_sPrivateParam.sBorderColor; 767 return m_sPrivateParam.sBorderColor;
774 768
775 » return CPWL_Color(); 769 return CPWL_Color();
776 } 770 }
777 771
778 void CPWL_Wnd::SetBorderColor(const CPWL_Color & color) 772 void CPWL_Wnd::SetBorderColor(const CPWL_Color & color)
779 { 773 {
780 » if (HasFlag(PWS_BORDER)) 774 if (HasFlag(PWS_BORDER))
781 » » m_sPrivateParam.sBorderColor = color; 775 m_sPrivateParam.sBorderColor = color;
782 } 776 }
783 777
784 CPWL_Dash CPWL_Wnd::GetBorderDash() const 778 CPWL_Dash CPWL_Wnd::GetBorderDash() const
785 { 779 {
786 » return m_sPrivateParam.sDash; 780 return m_sPrivateParam.sDash;
787 } 781 }
788 782
789 void* CPWL_Wnd::GetAttachedData() const 783 void* CPWL_Wnd::GetAttachedData() const
790 { 784 {
791 » return m_sPrivateParam.pAttachedData; 785 return m_sPrivateParam.pAttachedData;
792 } 786 }
793 787
794 void CPWL_Wnd::SetBorderDash(const CPWL_Dash & sDash) 788 void CPWL_Wnd::SetBorderDash(const CPWL_Dash & sDash)
795 { 789 {
796 » if (HasFlag(PWS_BORDER)) 790 if (HasFlag(PWS_BORDER))
797 » » m_sPrivateParam.sDash = sDash; 791 m_sPrivateParam.sDash = sDash;
798 } 792 }
799 793
800 CPWL_ScrollBar* CPWL_Wnd::GetVScrollBar() const 794 CPWL_ScrollBar* CPWL_Wnd::GetVScrollBar() const
801 { 795 {
802 » if (HasFlag(PWS_VSCROLL)) 796 if (HasFlag(PWS_VSCROLL))
803 » » return m_pVScrollBar; 797 return m_pVScrollBar;
804 798
805 » return NULL; 799 return NULL;
806 } 800 }
807 801
808 void CPWL_Wnd::CreateScrollBar(const PWL_CREATEPARAM & cp) 802 void CPWL_Wnd::CreateScrollBar(const PWL_CREATEPARAM & cp)
809 { 803 {
810 » CreateVScrollBar(cp); 804 CreateVScrollBar(cp);
811 } 805 }
812 806
813 void CPWL_Wnd::CreateVScrollBar(const PWL_CREATEPARAM & cp) 807 void CPWL_Wnd::CreateVScrollBar(const PWL_CREATEPARAM & cp)
814 { 808 {
815 » if (!m_pVScrollBar && HasFlag(PWS_VSCROLL)) 809 if (!m_pVScrollBar && HasFlag(PWS_VSCROLL))
816 » { 810 {
817 » » PWL_CREATEPARAM scp = cp; 811 PWL_CREATEPARAM scp = cp;
818 812
819 » » //flags 813 //flags
820 » » scp.dwFlags = PWS_CHILD| PWS_BACKGROUND | PWS_AUTOTRANSPARENT | PWS_NOREFRESHCLIP; 814 scp.dwFlags = PWS_CHILD| PWS_BACKGROUND | PWS_AUTOTRANSPARENT | PWS_NORE FRESHCLIP;
821 815
822 » » scp.pParentWnd = this; 816 scp.pParentWnd = this;
823 » » scp.sBackgroundColor = PWL_DEFAULT_WHITECOLOR; 817 scp.sBackgroundColor = PWL_DEFAULT_WHITECOLOR;
824 » » scp.eCursorType = FXCT_ARROW; 818 scp.eCursorType = FXCT_ARROW;
825 » » scp.nTransparency = PWL_SCROLLBAR_TRANSPARANCY; 819 scp.nTransparency = PWL_SCROLLBAR_TRANSPARANCY;
826 820
827 » » if ((m_pVScrollBar = new CPWL_ScrollBar(SBT_VSCROLL))) 821 if ((m_pVScrollBar = new CPWL_ScrollBar(SBT_VSCROLL)))
828 » » » m_pVScrollBar->Create(scp); 822 m_pVScrollBar->Create(scp);
829 » } 823 }
830 } 824 }
831 825
832 void CPWL_Wnd::SetCapture() 826 void CPWL_Wnd::SetCapture()
833 { 827 {
834 » if (CPWL_MsgControl * pMsgCtrl = GetMsgControl()) 828 if (CPWL_MsgControl * pMsgCtrl = GetMsgControl())
835 » » pMsgCtrl->SetCapture(this); 829 pMsgCtrl->SetCapture(this);
836 } 830 }
837 831
838 void CPWL_Wnd::ReleaseCapture() 832 void CPWL_Wnd::ReleaseCapture()
839 { 833 {
840 » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++) 834 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)
841 » » if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) 835 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i))
842 » » » pChild->ReleaseCapture(); 836 pChild->ReleaseCapture();
843 837
844 » if (CPWL_MsgControl * pMsgCtrl = GetMsgControl()) 838 if (CPWL_MsgControl * pMsgCtrl = GetMsgControl())
845 » » pMsgCtrl->ReleaseCapture(); 839 pMsgCtrl->ReleaseCapture();
846 } 840 }
847 841
848 void CPWL_Wnd::SetFocus() 842 void CPWL_Wnd::SetFocus()
849 { 843 {
850 » if (CPWL_MsgControl * pMsgCtrl = GetMsgControl()) 844 if (CPWL_MsgControl * pMsgCtrl = GetMsgControl())
851 » { 845 {
852 » » if (!pMsgCtrl->IsMainCaptureKeyboard(this)) 846 if (!pMsgCtrl->IsMainCaptureKeyboard(this))
853 » » » pMsgCtrl->KillFocus(); 847 pMsgCtrl->KillFocus();
854 » » pMsgCtrl->SetFocus(this); 848 pMsgCtrl->SetFocus(this);
855 » } 849 }
856 } 850 }
857 851
858 void CPWL_Wnd::KillFocus() 852 void CPWL_Wnd::KillFocus()
859 { 853 {
860 » if (CPWL_MsgControl * pMsgCtrl = GetMsgControl()) 854 if (CPWL_MsgControl * pMsgCtrl = GetMsgControl())
861 » { 855 {
862 » » if (pMsgCtrl->IsWndCaptureKeyboard(this)) 856 if (pMsgCtrl->IsWndCaptureKeyboard(this))
863 » » » pMsgCtrl->KillFocus(); 857 pMsgCtrl->KillFocus();
864 » } 858 }
865 } 859 }
866 860
867 void CPWL_Wnd::OnSetFocus() 861 void CPWL_Wnd::OnSetFocus()
868 { 862 {
869 } 863 }
870 864
871 void CPWL_Wnd::OnKillFocus() 865 void CPWL_Wnd::OnKillFocus()
872 { 866 {
873 } 867 }
874 868
875 FX_BOOL»CPWL_Wnd::WndHitTest(const CPDF_Point & point) const 869 FX_BOOL CPWL_Wnd::WndHitTest(const CPDF_Point & point) const
876 { 870 {
877 » return IsValid() && IsVisible() && GetWindowRect().Contains(point.x,poin t.y); 871 return IsValid() && IsVisible() && GetWindowRect().Contains(point.x,point.y) ;
878 } 872 }
879 873
880 FX_BOOL CPWL_Wnd::ClientHitTest(const CPDF_Point & point) const 874 FX_BOOL CPWL_Wnd::ClientHitTest(const CPDF_Point & point) const
881 { 875 {
882 » return IsValid() && IsVisible() && GetClientRect().Contains(point.x,poin t.y); 876 return IsValid() && IsVisible() && GetClientRect().Contains(point.x,point.y) ;
883 } 877 }
884 878
885 const CPWL_Wnd * CPWL_Wnd::GetRootWnd() const 879 const CPWL_Wnd* CPWL_Wnd::GetRootWnd() const
886 { 880 {
887 » if (m_sPrivateParam.pParentWnd) 881 if (m_sPrivateParam.pParentWnd)
888 » » return m_sPrivateParam.pParentWnd->GetRootWnd(); 882 return m_sPrivateParam.pParentWnd->GetRootWnd();
889 » else 883
890 » » return this; 884 return this;
891 } 885 }
892 886
893 void CPWL_Wnd::SetVisible(FX_BOOL bVisible) 887 void CPWL_Wnd::SetVisible(FX_BOOL bVisible)
894 { 888 {
895 » if (IsValid()) 889 if (IsValid())
896 » { 890 {
897 » » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++) 891 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)
898 » » { 892 {
899 » » » if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) 893 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i))
900 » » » { 894 {
901 » » » » pChild->SetVisible(bVisible); 895 pChild->SetVisible(bVisible);
902 » » » } 896 }
903 » » } 897 }
904 898
905 » » if (bVisible != m_bVisible) 899 if (bVisible != m_bVisible)
906 » » { 900 {
907 » » » m_bVisible = bVisible; 901 m_bVisible = bVisible;
908 » » » RePosChildWnd(); 902 RePosChildWnd();
909 » » » InvalidateRect(); 903 InvalidateRect();
910 » » } 904 }
911 » } 905 }
912 } 906 }
913 907
914 void CPWL_Wnd::SetClipRect(const CPDF_Rect & rect) 908 void CPWL_Wnd::SetClipRect(const CPDF_Rect & rect)
915 { 909 {
916 » m_rcClip = rect; 910 m_rcClip = rect;
917 » m_rcClip.Normalize(); 911 m_rcClip.Normalize();
918 } 912 }
919 913
920 CPDF_Rect CPWL_Wnd::GetClipRect() const 914 CPDF_Rect CPWL_Wnd::GetClipRect() const
921 { 915 {
922 » return m_rcClip; 916 return m_rcClip;
923 } 917 }
924 918
925 FX_BOOL»CPWL_Wnd::IsReadOnly() const 919 FX_BOOL CPWL_Wnd::IsReadOnly() const
926 { 920 {
927 » return HasFlag(PWS_READONLY); 921 return HasFlag(PWS_READONLY);
928 } 922 }
929 923
930 void CPWL_Wnd::RePosChildWnd() 924 void CPWL_Wnd::RePosChildWnd()
931 { 925 {
932 » CPDF_Rect rcContent = CPWL_Utils::DeflateRect(GetWindowRect(),(FX_FLOAT) (GetBorderWidth()+GetInnerBorderWidth())); 926 CPDF_Rect rcContent = CPWL_Utils::DeflateRect(GetWindowRect(),(FX_FLOAT)(Get BorderWidth()+GetInnerBorderWidth()));
933 927
934 » CPWL_ScrollBar * pVSB = GetVScrollBar(); 928 CPWL_ScrollBar * pVSB = GetVScrollBar();
935 929
936 » CPDF_Rect rcVScroll = CPDF_Rect(rcContent.right - PWL_SCROLLBAR_WIDTH, 930 CPDF_Rect rcVScroll = CPDF_Rect(rcContent.right - PWL_SCROLLBAR_WIDTH,
937 » » » » » » » rcContent.bottom, 931 rcContent.bottom,
938 » » » » » » » rcContent.right-1.0f, 932 rcContent.right-1.0f,
939 » » » » » » » rcContent.top); 933 rcContent.top);
940 934
941 » if (pVSB) pVSB->Move(rcVScroll,TRUE,FALSE); 935 if (pVSB) pVSB->Move(rcVScroll,TRUE,FALSE);
942 } 936 }
943 937
944 void CPWL_Wnd::CreateChildWnd(const PWL_CREATEPARAM & cp) 938 void CPWL_Wnd::CreateChildWnd(const PWL_CREATEPARAM & cp)
945 { 939 {
946 } 940 }
947 941
948 void CPWL_Wnd::SetCursor() 942 void CPWL_Wnd::SetCursor()
949 { 943 {
950 » if (IsValid()) 944 if (IsValid())
951 » { 945 {
952 » » if (IFX_SystemHandler* pSH = GetSystemHandler()) 946 if (IFX_SystemHandler* pSH = GetSystemHandler())
953 » » { 947 {
954 » » » int32_t nCursorType = GetCreationParam().eCursorType; 948 int32_t nCursorType = GetCreationParam().eCursorType;
955 » » » pSH->SetCursor(nCursorType); 949 pSH->SetCursor(nCursorType);
956 » » } 950 }
957 » } 951 }
958 } 952 }
959 953
960 void CPWL_Wnd::CreateMsgControl() 954 void CPWL_Wnd::CreateMsgControl()
961 { 955 {
962 » if (!m_sPrivateParam.pMsgControl) 956 if (!m_sPrivateParam.pMsgControl)
963 » » m_sPrivateParam.pMsgControl = new CPWL_MsgControl(this); 957 m_sPrivateParam.pMsgControl = new CPWL_MsgControl(this);
964 } 958 }
965 959
966 void CPWL_Wnd::DestroyMsgControl() 960 void CPWL_Wnd::DestroyMsgControl()
967 { 961 {
968 » if (CPWL_MsgControl* pMsgControl = GetMsgControl()) 962 if (CPWL_MsgControl* pMsgControl = GetMsgControl())
969 » » if (pMsgControl->IsWndCreated(this)) 963 if (pMsgControl->IsWndCreated(this))
970 » » » delete pMsgControl; 964 delete pMsgControl;
971 } 965 }
972 966
973 CPWL_MsgControl* CPWL_Wnd::GetMsgControl() const 967 CPWL_MsgControl* CPWL_Wnd::GetMsgControl() const
974 { 968 {
975 » return m_sPrivateParam.pMsgControl; 969 return m_sPrivateParam.pMsgControl;
976 } 970 }
977 971
978 FX_BOOL CPWL_Wnd::IsCaptureMouse() const 972 FX_BOOL CPWL_Wnd::IsCaptureMouse() const
979 { 973 {
980 » return IsWndCaptureMouse(this); 974 return IsWndCaptureMouse(this);
981 } 975 }
982 976
983 FX_BOOL CPWL_Wnd::IsWndCaptureMouse(const CPWL_Wnd * pWnd) const 977 FX_BOOL CPWL_Wnd::IsWndCaptureMouse(const CPWL_Wnd * pWnd) const
984 { 978 {
985 » if (CPWL_MsgControl * pCtrl = GetMsgControl()) 979 if (CPWL_MsgControl * pCtrl = GetMsgControl())
986 » » return pCtrl->IsWndCaptureMouse(pWnd); 980 return pCtrl->IsWndCaptureMouse(pWnd);
987 981
988 » return FALSE; 982 return FALSE;
989 } 983 }
990 984
991 FX_BOOL CPWL_Wnd::IsWndCaptureKeyboard(const CPWL_Wnd * pWnd) const 985 FX_BOOL CPWL_Wnd::IsWndCaptureKeyboard(const CPWL_Wnd * pWnd) const
992 { 986 {
993 » if (CPWL_MsgControl * pCtrl = GetMsgControl()) 987 if (CPWL_MsgControl * pCtrl = GetMsgControl())
994 » » return pCtrl->IsWndCaptureKeyboard(pWnd); 988 return pCtrl->IsWndCaptureKeyboard(pWnd);
995 989
996 » return FALSE; 990 return FALSE;
997 } 991 }
998 992
999 FX_BOOL CPWL_Wnd::IsFocused() const 993 FX_BOOL CPWL_Wnd::IsFocused() const
1000 { 994 {
1001 » if (CPWL_MsgControl * pCtrl = GetMsgControl()) 995 if (CPWL_MsgControl * pCtrl = GetMsgControl())
1002 » » return pCtrl->IsMainCaptureKeyboard(this); 996 return pCtrl->IsMainCaptureKeyboard(this);
1003 997
1004 » return FALSE; 998 return FALSE;
1005 } 999 }
1006 1000
1007 CPDF_Rect CPWL_Wnd::GetFocusRect() const 1001 CPDF_Rect CPWL_Wnd::GetFocusRect() const
1008 { 1002 {
1009 » return CPWL_Utils::InflateRect(GetWindowRect(),1); 1003 return CPWL_Utils::InflateRect(GetWindowRect(),1);
1010 } 1004 }
1011 1005
1012 FX_FLOAT CPWL_Wnd::GetFontSize() const 1006 FX_FLOAT CPWL_Wnd::GetFontSize() const
1013 { 1007 {
1014 » return m_sPrivateParam.fFontSize; 1008 return m_sPrivateParam.fFontSize;
1015 } 1009 }
1016 1010
1017 void CPWL_Wnd::SetFontSize(FX_FLOAT fFontSize) 1011 void CPWL_Wnd::SetFontSize(FX_FLOAT fFontSize)
1018 { 1012 {
1019 » m_sPrivateParam.fFontSize = fFontSize; 1013 m_sPrivateParam.fFontSize = fFontSize;
1020 } 1014 }
1021 1015
1022 IFX_SystemHandler* CPWL_Wnd::GetSystemHandler() const 1016 IFX_SystemHandler* CPWL_Wnd::GetSystemHandler() const
1023 { 1017 {
1024 » return m_sPrivateParam.pSystemHandler; 1018 return m_sPrivateParam.pSystemHandler;
1025 } 1019 }
1026 1020
1027 IPWL_FocusHandler* CPWL_Wnd::GetFocusHandler() const 1021 IPWL_FocusHandler* CPWL_Wnd::GetFocusHandler() const
1028 { 1022 {
1029 » return m_sPrivateParam.pFocusHandler; 1023 return m_sPrivateParam.pFocusHandler;
1030 } 1024 }
1031 1025
1032 IPWL_Provider* CPWL_Wnd::GetProvider() const 1026 IPWL_Provider* CPWL_Wnd::GetProvider() const
1033 { 1027 {
1034 » return m_sPrivateParam.pProvider; 1028 return m_sPrivateParam.pProvider;
1035 } 1029 }
1036 1030
1037 IFX_Edit_FontMap* CPWL_Wnd::GetFontMap() const 1031 IFX_Edit_FontMap* CPWL_Wnd::GetFontMap() const
1038 { 1032 {
1039 » return m_sPrivateParam.pFontMap; 1033 return m_sPrivateParam.pFontMap;
1040 } 1034 }
1041 1035
1042 CPWL_Color CPWL_Wnd::GetBorderLeftTopColor(int32_t nBorderStyle) const 1036 CPWL_Color CPWL_Wnd::GetBorderLeftTopColor(int32_t nBorderStyle) const
1043 { 1037 {
1044 » CPWL_Color color; 1038 CPWL_Color color;
1045 1039
1046 » switch (nBorderStyle) 1040 switch (nBorderStyle)
1047 » { 1041 {
1048 » » case PBS_SOLID: 1042 case PBS_SOLID:
1049 » » » break; 1043 break;
1050 » » case PBS_DASH: 1044 case PBS_DASH:
1051 » » » break; 1045 break;
1052 » » case PBS_BEVELED: 1046 case PBS_BEVELED:
1053 » » » color = CPWL_Color(COLORTYPE_GRAY,1); 1047 color = CPWL_Color(COLORTYPE_GRAY,1);
1054 » » » break; 1048 break;
1055 » » case PBS_INSET: 1049 case PBS_INSET:
1056 » » » color = CPWL_Color(COLORTYPE_GRAY,0.5f); 1050 color = CPWL_Color(COLORTYPE_GRAY,0.5f);
1057 » » » break; 1051 break;
1058 » » case PBS_UNDERLINED: 1052 case PBS_UNDERLINED:
1059 » » » break; 1053 break;
1060 » } 1054 }
1061 1055
1062 » return color; 1056 return color;
1063 } 1057 }
1064 1058
1065 CPWL_Color CPWL_Wnd::GetBorderRightBottomColor(int32_t nBorderStyle) const 1059 CPWL_Color CPWL_Wnd::GetBorderRightBottomColor(int32_t nBorderStyle) const
1066 { 1060 {
1067 » CPWL_Color color; 1061 CPWL_Color color;
1068 1062
1069 » switch (nBorderStyle) 1063 switch (nBorderStyle)
1070 » { 1064 {
1071 » » case PBS_SOLID: 1065 case PBS_SOLID:
1072 » » » break; 1066 break;
1073 » » case PBS_DASH: 1067 case PBS_DASH:
1074 » » » break; 1068 break;
1075 » » case PBS_BEVELED: 1069 case PBS_BEVELED:
1076 » » » color = CPWL_Utils::DevideColor(GetBackgroundColor(),2); 1070 color = CPWL_Utils::DevideColor(GetBackgroundColor(),2);
1077 » » » break; 1071 break;
1078 » » case PBS_INSET: 1072 case PBS_INSET:
1079 » » » color = CPWL_Color(COLORTYPE_GRAY,0.75f); 1073 color = CPWL_Color(COLORTYPE_GRAY,0.75f);
1080 » » » break; 1074 break;
1081 » » case PBS_UNDERLINED: 1075 case PBS_UNDERLINED:
1082 » » » break; 1076 break;
1083 » } 1077 }
1084 1078
1085 » return color; 1079 return color;
1086 } 1080 }
1087 1081
1088 /* ----------------------------------------------------------------- */ 1082 /* ----------------------------------------------------------------- */
1089 1083
1090 int32_t CPWL_Wnd::GetTransparency() 1084 int32_t CPWL_Wnd::GetTransparency()
1091 { 1085 {
1092 » return m_sPrivateParam.nTransparency; 1086 return m_sPrivateParam.nTransparency;
1093 } 1087 }
1094 1088
1095 void CPWL_Wnd::SetTransparency(int32_t nTransparency) 1089 void CPWL_Wnd::SetTransparency(int32_t nTransparency)
1096 { 1090 {
1097 » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++) 1091 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)
1098 » { 1092 {
1099 » » if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) 1093 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i))
1100 » » { 1094 {
1101 » » » pChild->SetTransparency(nTransparency); 1095 pChild->SetTransparency(nTransparency);
1102 » » } 1096 }
1103 » } 1097 }
1104 1098
1105 » m_sPrivateParam.nTransparency = nTransparency; 1099 m_sPrivateParam.nTransparency = nTransparency;
1106 } 1100 }
1107 1101
1108 CPDF_Matrix» CPWL_Wnd::GetWindowMatrix() const 1102 CPDF_Matrix CPWL_Wnd::GetWindowMatrix() const
1109 { 1103 {
1110 » CPDF_Matrix mt = GetChildToRoot(); 1104 CPDF_Matrix mt = GetChildToRoot();
1111 1105
1112 » if (IPWL_Provider* pProvider = GetProvider()) 1106 if (IPWL_Provider* pProvider = GetProvider())
1113 » { 1107 {
1114 » » mt.Concat(pProvider->GetWindowMatrix(GetAttachedData())); 1108 mt.Concat(pProvider->GetWindowMatrix(GetAttachedData()));
1115 » » return mt; 1109 return mt;
1116 » } 1110 }
1117 1111
1118 » return mt; 1112 return mt;
1119 } 1113 }
1120 1114
1121 void CPWL_Wnd::PWLtoWnd(const CPDF_Point& point, int32_t& x, int32_t& y) const 1115 void CPWL_Wnd::PWLtoWnd(const CPDF_Point& point, int32_t& x, int32_t& y) const
1122 { 1116 {
1123 » CPDF_Matrix mt = GetWindowMatrix(); 1117 CPDF_Matrix mt = GetWindowMatrix();
1124 » CPDF_Point pt = point; 1118 CPDF_Point pt = point;
1125 » mt.Transform(pt.x,pt.y); 1119 mt.Transform(pt.x,pt.y);
1126 » x = (int32_t)(pt.x+0.5); 1120 x = (int32_t)(pt.x+0.5);
1127 » y = (int32_t)(pt.y+0.5); 1121 y = (int32_t)(pt.y+0.5);
1128 } 1122 }
1129 1123
1130 FX_RECT CPWL_Wnd::PWLtoWnd(const CPDF_Rect & rect) const 1124 FX_RECT CPWL_Wnd::PWLtoWnd(const CPDF_Rect & rect) const
1131 { 1125 {
1132 » CPDF_Rect rcTemp = rect; 1126 CPDF_Rect rcTemp = rect;
1133 » CPDF_Matrix mt = GetWindowMatrix(); 1127 CPDF_Matrix mt = GetWindowMatrix();
1134 » mt.TransformRect(rcTemp); 1128 mt.TransformRect(rcTemp);
1135 » return FX_RECT((int32_t)(rcTemp.left+0.5), (int32_t)(rcTemp.bottom+0.5), (int32_t)(rcTemp.right+0.5), (int32_t)(rcTemp.top+0.5)); 1129 return FX_RECT((int32_t)(rcTemp.left+0.5), (int32_t)(rcTemp.bottom+0.5), (in t32_t)(rcTemp.right+0.5), (int32_t)(rcTemp.top+0.5));
1136 } 1130 }
1137 1131
1138 FX_HWND CPWL_Wnd::GetAttachedHWnd() const 1132 FX_HWND CPWL_Wnd::GetAttachedHWnd() const
1139 { 1133 {
1140 » return m_sPrivateParam.hAttachedWnd; 1134 return m_sPrivateParam.hAttachedWnd;
1141 } 1135 }
1142 1136
1143 CPDF_Point CPWL_Wnd::ChildToParent(const CPDF_Point& point) const 1137 CPDF_Point CPWL_Wnd::ChildToParent(const CPDF_Point& point) const
1144 { 1138 {
1145 » CPDF_Matrix mt = GetChildMatrix(); 1139 CPDF_Matrix mt = GetChildMatrix();
1146 » if (mt.IsIdentity()) 1140 if (mt.IsIdentity())
1147 » » return point; 1141 return point;
1148 » else 1142
1149 » { 1143 CPDF_Point pt = point;
1150 » » CPDF_Point pt = point; 1144 mt.Transform(pt.x,pt.y);
1151 » » mt.Transform(pt.x,pt.y); 1145 return pt;
1152 » » return pt;
1153 » }
1154 } 1146 }
1155 1147
1156 CPDF_Rect CPWL_Wnd::ChildToParent(const CPDF_Rect& rect) const 1148 CPDF_Rect CPWL_Wnd::ChildToParent(const CPDF_Rect& rect) const
1157 { 1149 {
1158 » CPDF_Matrix mt = GetChildMatrix(); 1150 CPDF_Matrix mt = GetChildMatrix();
1159 » if (mt.IsIdentity()) 1151 if (mt.IsIdentity())
1160 » » return rect; 1152 return rect;
1161 » else 1153
1162 » { 1154 CPDF_Rect rc = rect;
1163 » » CPDF_Rect rc = rect; 1155 mt.TransformRect(rc);
1164 » » mt.TransformRect(rc); 1156 return rc;
1165 » » return rc;
1166 » }
1167 } 1157 }
1168 1158
1169 CPDF_Point CPWL_Wnd::ParentToChild(const CPDF_Point& point) const 1159 CPDF_Point CPWL_Wnd::ParentToChild(const CPDF_Point& point) const
1170 { 1160 {
1171 » CPDF_Matrix mt = GetChildMatrix(); 1161 CPDF_Matrix mt = GetChildMatrix();
1172 » if (mt.IsIdentity()) 1162 if (mt.IsIdentity())
1173 » » return point; 1163 return point;
1174 » else 1164
1175 » { 1165 mt.SetReverse(mt);
1176 » » mt.SetReverse(mt); 1166 CPDF_Point pt = point;
1177 » » CPDF_Point pt = point; 1167 mt.Transform(pt.x,pt.y);
1178 » » mt.Transform(pt.x,pt.y); 1168 return pt;
1179 » » return pt;
1180 » }
1181 } 1169 }
1182 1170
1183 CPDF_Rect CPWL_Wnd::ParentToChild(const CPDF_Rect& rect) const 1171 CPDF_Rect CPWL_Wnd::ParentToChild(const CPDF_Rect& rect) const
1184 { 1172 {
1185 » CPDF_Matrix mt = GetChildMatrix(); 1173 CPDF_Matrix mt = GetChildMatrix();
1186 » if (mt.IsIdentity()) 1174 if (mt.IsIdentity())
1187 » » return rect; 1175 return rect;
1188 » else 1176
1189 » { 1177 mt.SetReverse(mt);
1190 » » mt.SetReverse(mt); 1178 CPDF_Rect rc = rect;
1191 » » CPDF_Rect rc = rect; 1179 mt.TransformRect(rc);
1192 » » mt.TransformRect(rc); 1180 return rc;
1193 » » return rc;
1194 » }
1195 } 1181 }
1196 1182
1197 CPDF_Matrix CPWL_Wnd::GetChildToRoot() const 1183 CPDF_Matrix CPWL_Wnd::GetChildToRoot() const
1198 { 1184 {
1199 » CPDF_Matrix mt(1,0,0,1,0,0); 1185 CPDF_Matrix mt(1, 0, 0, 1, 0, 0);
1200 1186 if (HasFlag(PWS_CHILD))
1201 » if (HasFlag(PWS_CHILD)) 1187 {
1202 » { 1188 const CPWL_Wnd* pParent = this;
1203 » » const CPWL_Wnd* pParent = this; 1189 while (pParent)
1204 » » while (pParent) 1190 {
1205 » » { 1191 mt.Concat(pParent->GetChildMatrix());
1206 » » » mt.Concat(pParent->GetChildMatrix()); 1192 pParent = pParent->GetParentWindow();
1207 » » » pParent = pParent->GetParentWindow(); 1193 }
1208 » » } 1194 }
1209 » } 1195 return mt;
1210
1211 » return mt;
1212 } 1196 }
1213 1197
1214 CPDF_Matrix CPWL_Wnd::GetChildMatrix() const 1198 CPDF_Matrix CPWL_Wnd::GetChildMatrix() const
1215 { 1199 {
1216 » if (HasFlag(PWS_CHILD)) 1200 if (HasFlag(PWS_CHILD))
1217 » » return m_sPrivateParam.mtChild; 1201 return m_sPrivateParam.mtChild;
1218 1202
1219 » return CPDF_Matrix(1,0,0,1,0,0); 1203 return CPDF_Matrix(1,0,0,1,0,0);
1220 } 1204 }
1221 1205
1222 void CPWL_Wnd::SetChildMatrix(const CPDF_Matrix& mt) 1206 void CPWL_Wnd::SetChildMatrix(const CPDF_Matrix& mt)
1223 { 1207 {
1224 » m_sPrivateParam.mtChild = mt; 1208 m_sPrivateParam.mtChild = mt;
1225 } 1209 }
1226 1210
1227 const CPWL_Wnd*»CPWL_Wnd::GetFocused() const 1211 const CPWL_Wnd* CPWL_Wnd::GetFocused() const
1228 { 1212 {
1229 » if (CPWL_MsgControl * pMsgCtrl = GetMsgControl()) 1213 if (CPWL_MsgControl * pMsgCtrl = GetMsgControl())
1230 » { 1214 {
1231 » » return pMsgCtrl->m_pMainKeyboardWnd; 1215 return pMsgCtrl->m_pMainKeyboardWnd;
1232 » } 1216 }
1233 1217
1234 » return NULL; 1218 return NULL;
1235 } 1219 }
1236 1220
1237 void CPWL_Wnd::EnableWindow(FX_BOOL bEnable) 1221 void CPWL_Wnd::EnableWindow(FX_BOOL bEnable)
1238 { 1222 {
1239 » if (m_bEnabled != bEnable) 1223 if (m_bEnabled != bEnable)
1240 » { 1224 {
1241 » » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++) 1225 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)
1242 » » { 1226 {
1243 » » » if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) 1227 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i))
1244 » » » { 1228 {
1245 » » » » pChild->EnableWindow(bEnable); 1229 pChild->EnableWindow(bEnable);
1246 » » » } 1230 }
1247 » » } 1231 }
1248 1232
1249 » » m_bEnabled = bEnable; 1233 m_bEnabled = bEnable;
1250 1234
1251 » » if (bEnable) 1235 if (bEnable)
1252 » » » OnEnabled(); 1236 OnEnabled();
1253 » » else 1237 else
1254 » » » OnDisabled(); 1238 OnDisabled();
1255 » } 1239 }
1256 } 1240 }
1257 1241
1258 FX_BOOL CPWL_Wnd::IsEnabled() 1242 FX_BOOL CPWL_Wnd::IsEnabled()
1259 { 1243 {
1260 » return m_bEnabled; 1244 return m_bEnabled;
1261 } 1245 }
1262 1246
1263 void CPWL_Wnd::OnEnabled() 1247 void CPWL_Wnd::OnEnabled()
1264 { 1248 {
1265 } 1249 }
1266 1250
1267 void CPWL_Wnd::OnDisabled() 1251 void CPWL_Wnd::OnDisabled()
1268 { 1252 {
1269 } 1253 }
1270 1254
1271 FX_BOOL CPWL_Wnd::IsCTRLpressed(FX_DWORD nFlag) const 1255 FX_BOOL CPWL_Wnd::IsCTRLpressed(FX_DWORD nFlag) const
1272 { 1256 {
1273 » if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) 1257 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler())
1274 » { 1258 {
1275 » » return pSystemHandler->IsCTRLKeyDown(nFlag); 1259 return pSystemHandler->IsCTRLKeyDown(nFlag);
1276 » } 1260 }
1277 1261
1278 » return FALSE; 1262 return FALSE;
1279 } 1263 }
1280 1264
1281 FX_BOOL»CPWL_Wnd::IsSHIFTpressed(FX_DWORD nFlag) const 1265 FX_BOOL CPWL_Wnd::IsSHIFTpressed(FX_DWORD nFlag) const
1282 { 1266 {
1283 » if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) 1267 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler())
1284 » { 1268 {
1285 » » return pSystemHandler->IsSHIFTKeyDown(nFlag); 1269 return pSystemHandler->IsSHIFTKeyDown(nFlag);
1286 » } 1270 }
1287 1271
1288 » return FALSE; 1272 return FALSE;
1289 } 1273 }
1290 1274
1291 FX_BOOL»CPWL_Wnd::IsALTpressed(FX_DWORD nFlag) const 1275 FX_BOOL CPWL_Wnd::IsALTpressed(FX_DWORD nFlag) const
1292 { 1276 {
1293 » if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) 1277 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler())
1294 » { 1278 {
1295 » » return pSystemHandler->IsALTKeyDown(nFlag); 1279 return pSystemHandler->IsALTKeyDown(nFlag);
1296 » } 1280 }
1297 1281
1298 » return FALSE; 1282 return FALSE;
1299 } 1283 }
1300 1284
1301 FX_BOOL»CPWL_Wnd::IsINSERTpressed(FX_DWORD nFlag) const 1285 FX_BOOL CPWL_Wnd::IsINSERTpressed(FX_DWORD nFlag) const
1302 { 1286 {
1303 » if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) 1287 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler())
1304 » { 1288 {
1305 » » return pSystemHandler->IsINSERTKeyDown(nFlag); 1289 return pSystemHandler->IsINSERTKeyDown(nFlag);
1306 » } 1290 }
1307 1291
1308 » return FALSE; 1292 return FALSE;
1309 } 1293 }
1310
OLDNEW
« no previous file with comments | « fpdfsdk/src/pdfwindow/PWL_FontMap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698