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 #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" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 » 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 » 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 » 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 » 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 » 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 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 CPWL_Wnd* m_pMainMouseWnd; | 218 CPWL_Wnd* m_pMainMouseWnd; |
219 CPWL_Wnd* m_pMainKeyboardW
nd; | 219 CPWL_Wnd* m_pMainKeyboardW
nd; |
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()) |
(...skipping 17 matching lines...) Expand all Loading... |
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 } |
(...skipping 15 matching lines...) Expand all Loading... |
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_REMOVECHI
LD); |
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, bool bReset,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) |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 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(n
Char,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 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))\ |
(...skipping 13 matching lines...) Expand all Loading... |
543 if (pChild->WndHitTest(pChild->ParentToC
hild(point)))\ | 543 if (pChild->WndHitTest(pChild->ParentToC
hild(point)))\ |
544 {\ | 544 {\ |
545 return pChild->mouse_method_name
(pChild->ParentToChild(point),nFlag);\ | 545 return pChild->mouse_method_name
(pChild->ParentToChild(point),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(OnRButtonDown) | 566 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonDown) |
567 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonUp) | 567 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonUp) |
568 PWL_IMPLEMENT_MOUSE_METHOD(OnMouseMove) | 568 PWL_IMPLEMENT_MOUSE_METHOD(OnMouseMove) |
569 | 569 |
570 FX_BOOL»CPWL_Wnd::OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD
nFlag) | 570 bool» CPWL_Wnd::OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD
nFlag) |
571 { | 571 { |
572 if (IsValid() && IsVisible() && IsEnabled()) | 572 if (IsValid() && IsVisible() && IsEnabled()) |
573 { | 573 { |
574 SetCursor(); | 574 SetCursor(); |
575 if (IsWndCaptureKeyboard(this)) | 575 if (IsWndCaptureKeyboard(this)) |
576 { | 576 { |
577 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++) | 577 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++) |
578 { | 578 { |
579 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i)) | 579 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i)) |
580 { | 580 { |
581 if (IsWndCaptureKeyboard(pChild)) | 581 if (IsWndCaptureKeyboard(pChild)) |
582 { | 582 { |
583 return pChild->OnMouseWheel(zDel
ta,pChild->ParentToChild(point), nFlag); | 583 return pChild->OnMouseWheel(zDel
ta,pChild->ParentToChild(point), nFlag); |
584 } | 584 } |
585 } | 585 } |
586 } | 586 } |
587 } | 587 } |
588 } | 588 } |
589 » return FALSE; | 589 » return false; |
590 } | 590 } |
591 | 591 |
592 void CPWL_Wnd::AddChild(CPWL_Wnd * pWnd) | 592 void CPWL_Wnd::AddChild(CPWL_Wnd * pWnd) |
593 { | 593 { |
594 m_aChildren.Add(pWnd); | 594 m_aChildren.Add(pWnd); |
595 } | 595 } |
596 | 596 |
597 void CPWL_Wnd::RemoveChild(CPWL_Wnd * pWnd) | 597 void CPWL_Wnd::RemoveChild(CPWL_Wnd * pWnd) |
598 { | 598 { |
599 for (int32_t i = m_aChildren.GetSize()-1; i >= 0; i --) | 599 for (int32_t i = m_aChildren.GetSize()-1; i >= 0; i --) |
(...skipping 17 matching lines...) Expand all Loading... |
617 AddChild(pWnd); | 617 AddChild(pWnd); |
618 break; | 618 break; |
619 case PNM_REMOVECHILD: | 619 case PNM_REMOVECHILD: |
620 RemoveChild(pWnd); | 620 RemoveChild(pWnd); |
621 break; | 621 break; |
622 default: | 622 default: |
623 break; | 623 break; |
624 } | 624 } |
625 } | 625 } |
626 | 626 |
627 FX_BOOL CPWL_Wnd::IsValid() const | 627 bool CPWL_Wnd::IsValid() const |
628 { | 628 { |
629 return m_bCreated; | 629 return m_bCreated; |
630 } | 630 } |
631 | 631 |
632 PWL_CREATEPARAM CPWL_Wnd::GetCreationParam() const | 632 PWL_CREATEPARAM CPWL_Wnd::GetCreationParam() const |
633 { | 633 { |
634 return m_sPrivateParam; | 634 return m_sPrivateParam; |
635 } | 635 } |
636 | 636 |
637 CPWL_Wnd* CPWL_Wnd::GetParentWindow() const | 637 CPWL_Wnd* CPWL_Wnd::GetParentWindow() const |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 CPDF_Rect CPWL_Wnd::GetClientCenterSquare() const | 676 CPDF_Rect CPWL_Wnd::GetClientCenterSquare() const |
677 { | 677 { |
678 return CPWL_Utils::GetCenterSquare(GetClientRect()); | 678 return CPWL_Utils::GetCenterSquare(GetClientRect()); |
679 } | 679 } |
680 | 680 |
681 CPDF_Rect CPWL_Wnd::GetWindowCenterSquare() const | 681 CPDF_Rect CPWL_Wnd::GetWindowCenterSquare() const |
682 { | 682 { |
683 return CPWL_Utils::GetCenterSquare(CPWL_Utils::DeflateRect(GetWindowRect
(),0.1f)); | 683 return CPWL_Utils::GetCenterSquare(CPWL_Utils::DeflateRect(GetWindowRect
(),0.1f)); |
684 } | 684 } |
685 | 685 |
686 FX_BOOL CPWL_Wnd::HasFlag(FX_DWORD dwFlags) const | 686 bool CPWL_Wnd::HasFlag(FX_DWORD dwFlags) const |
687 { | 687 { |
688 return (m_sPrivateParam.dwFlags & dwFlags) != 0; | 688 return (m_sPrivateParam.dwFlags & dwFlags) != 0; |
689 } | 689 } |
690 | 690 |
691 void CPWL_Wnd::RemoveFlag(FX_DWORD dwFlags) | 691 void CPWL_Wnd::RemoveFlag(FX_DWORD dwFlags) |
692 { | 692 { |
693 m_sPrivateParam.dwFlags &= ~dwFlags; | 693 m_sPrivateParam.dwFlags &= ~dwFlags; |
694 } | 694 } |
695 | 695 |
696 void CPWL_Wnd::AddFlag(FX_DWORD dwFlags) | 696 void CPWL_Wnd::AddFlag(FX_DWORD dwFlags) |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 } | 864 } |
865 | 865 |
866 void CPWL_Wnd::OnSetFocus() | 866 void CPWL_Wnd::OnSetFocus() |
867 { | 867 { |
868 } | 868 } |
869 | 869 |
870 void CPWL_Wnd::OnKillFocus() | 870 void CPWL_Wnd::OnKillFocus() |
871 { | 871 { |
872 } | 872 } |
873 | 873 |
874 FX_BOOL»CPWL_Wnd::WndHitTest(const CPDF_Point & point) const | 874 bool» CPWL_Wnd::WndHitTest(const CPDF_Point & point) const |
875 { | 875 { |
876 return IsValid() && IsVisible() && GetWindowRect().Contains(point.x,poin
t.y); | 876 return IsValid() && IsVisible() && GetWindowRect().Contains(point.x,poin
t.y); |
877 } | 877 } |
878 | 878 |
879 FX_BOOL CPWL_Wnd::ClientHitTest(const CPDF_Point & point) const | 879 bool CPWL_Wnd::ClientHitTest(const CPDF_Point & point) const |
880 { | 880 { |
881 return IsValid() && IsVisible() && GetClientRect().Contains(point.x,poin
t.y); | 881 return IsValid() && IsVisible() && GetClientRect().Contains(point.x,poin
t.y); |
882 } | 882 } |
883 | 883 |
884 const CPWL_Wnd * CPWL_Wnd::GetRootWnd() const | 884 const CPWL_Wnd * CPWL_Wnd::GetRootWnd() const |
885 { | 885 { |
886 if (m_sPrivateParam.pParentWnd) | 886 if (m_sPrivateParam.pParentWnd) |
887 return m_sPrivateParam.pParentWnd->GetRootWnd(); | 887 return m_sPrivateParam.pParentWnd->GetRootWnd(); |
888 else | 888 else |
889 return this; | 889 return this; |
890 } | 890 } |
891 | 891 |
892 void CPWL_Wnd::SetVisible(FX_BOOL bVisible) | 892 void CPWL_Wnd::SetVisible(bool bVisible) |
893 { | 893 { |
894 if (IsValid()) | 894 if (IsValid()) |
895 { | 895 { |
896 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++) | 896 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++) |
897 { | 897 { |
898 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) | 898 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) |
899 { | 899 { |
900 pChild->SetVisible(bVisible); | 900 pChild->SetVisible(bVisible); |
901 } | 901 } |
902 } | 902 } |
(...skipping 11 matching lines...) Expand all Loading... |
914 { | 914 { |
915 m_rcClip = rect; | 915 m_rcClip = rect; |
916 m_rcClip.Normalize(); | 916 m_rcClip.Normalize(); |
917 } | 917 } |
918 | 918 |
919 CPDF_Rect CPWL_Wnd::GetClipRect() const | 919 CPDF_Rect CPWL_Wnd::GetClipRect() const |
920 { | 920 { |
921 return m_rcClip; | 921 return m_rcClip; |
922 } | 922 } |
923 | 923 |
924 FX_BOOL»CPWL_Wnd::IsReadOnly() const | 924 bool» CPWL_Wnd::IsReadOnly() const |
925 { | 925 { |
926 return HasFlag(PWS_READONLY); | 926 return HasFlag(PWS_READONLY); |
927 } | 927 } |
928 | 928 |
929 void CPWL_Wnd::RePosChildWnd() | 929 void CPWL_Wnd::RePosChildWnd() |
930 { | 930 { |
931 CPDF_Rect rcContent = CPWL_Utils::DeflateRect(GetWindowRect(),(FX_FLOAT)
(GetBorderWidth()+GetInnerBorderWidth())); | 931 CPDF_Rect rcContent = CPWL_Utils::DeflateRect(GetWindowRect(),(FX_FLOAT)
(GetBorderWidth()+GetInnerBorderWidth())); |
932 | 932 |
933 CPWL_ScrollBar * pVSB = GetVScrollBar(); | 933 CPWL_ScrollBar * pVSB = GetVScrollBar(); |
934 | 934 |
935 CPDF_Rect rcVScroll = CPDF_Rect(rcContent.right - PWL_SCROLLBAR_WIDTH, | 935 CPDF_Rect rcVScroll = CPDF_Rect(rcContent.right - PWL_SCROLLBAR_WIDTH, |
936 rcContent.bottom, | 936 rcContent.bottom, |
937 rcContent.right-1.0f, | 937 rcContent.right-1.0f, |
938 rcContent.top); | 938 rcContent.top); |
939 | 939 |
940 » if (pVSB) pVSB->Move(rcVScroll,TRUE,FALSE); | 940 » if (pVSB) pVSB->Move(rcVScroll,true,false); |
941 } | 941 } |
942 | 942 |
943 void CPWL_Wnd::CreateChildWnd(const PWL_CREATEPARAM & cp) | 943 void CPWL_Wnd::CreateChildWnd(const PWL_CREATEPARAM & cp) |
944 { | 944 { |
945 } | 945 } |
946 | 946 |
947 void CPWL_Wnd::SetCursor() | 947 void CPWL_Wnd::SetCursor() |
948 { | 948 { |
949 if (IsValid()) | 949 if (IsValid()) |
950 { | 950 { |
(...skipping 16 matching lines...) Expand all Loading... |
967 if (CPWL_MsgControl* pMsgControl = GetMsgControl()) | 967 if (CPWL_MsgControl* pMsgControl = GetMsgControl()) |
968 if (pMsgControl->IsWndCreated(this)) | 968 if (pMsgControl->IsWndCreated(this)) |
969 delete pMsgControl; | 969 delete pMsgControl; |
970 } | 970 } |
971 | 971 |
972 CPWL_MsgControl* CPWL_Wnd::GetMsgControl() const | 972 CPWL_MsgControl* CPWL_Wnd::GetMsgControl() const |
973 { | 973 { |
974 return m_sPrivateParam.pMsgControl; | 974 return m_sPrivateParam.pMsgControl; |
975 } | 975 } |
976 | 976 |
977 FX_BOOL CPWL_Wnd::IsCaptureMouse() const | 977 bool CPWL_Wnd::IsCaptureMouse() const |
978 { | 978 { |
979 return IsWndCaptureMouse(this); | 979 return IsWndCaptureMouse(this); |
980 } | 980 } |
981 | 981 |
982 FX_BOOL CPWL_Wnd::IsWndCaptureMouse(const CPWL_Wnd * pWnd) const | 982 bool CPWL_Wnd::IsWndCaptureMouse(const CPWL_Wnd * pWnd) const |
983 { | 983 { |
984 if (CPWL_MsgControl * pCtrl = GetMsgControl()) | 984 if (CPWL_MsgControl * pCtrl = GetMsgControl()) |
985 return pCtrl->IsWndCaptureMouse(pWnd); | 985 return pCtrl->IsWndCaptureMouse(pWnd); |
986 | 986 |
987 » return FALSE; | 987 » return false; |
988 } | 988 } |
989 | 989 |
990 FX_BOOL CPWL_Wnd::IsWndCaptureKeyboard(const CPWL_Wnd * pWnd) const | 990 bool CPWL_Wnd::IsWndCaptureKeyboard(const CPWL_Wnd * pWnd) const |
991 { | 991 { |
992 if (CPWL_MsgControl * pCtrl = GetMsgControl()) | 992 if (CPWL_MsgControl * pCtrl = GetMsgControl()) |
993 return pCtrl->IsWndCaptureKeyboard(pWnd); | 993 return pCtrl->IsWndCaptureKeyboard(pWnd); |
994 | 994 |
995 » return FALSE; | 995 » return false; |
996 } | 996 } |
997 | 997 |
998 FX_BOOL CPWL_Wnd::IsFocused() const | 998 bool CPWL_Wnd::IsFocused() const |
999 { | 999 { |
1000 if (CPWL_MsgControl * pCtrl = GetMsgControl()) | 1000 if (CPWL_MsgControl * pCtrl = GetMsgControl()) |
1001 return pCtrl->IsMainCaptureKeyboard(this); | 1001 return pCtrl->IsMainCaptureKeyboard(this); |
1002 | 1002 |
1003 » return FALSE; | 1003 » return false; |
1004 } | 1004 } |
1005 | 1005 |
1006 CPDF_Rect CPWL_Wnd::GetFocusRect() const | 1006 CPDF_Rect CPWL_Wnd::GetFocusRect() const |
1007 { | 1007 { |
1008 return CPWL_Utils::InflateRect(GetWindowRect(),1); | 1008 return CPWL_Utils::InflateRect(GetWindowRect(),1); |
1009 } | 1009 } |
1010 | 1010 |
1011 FX_FLOAT CPWL_Wnd::GetFontSize() const | 1011 FX_FLOAT CPWL_Wnd::GetFontSize() const |
1012 { | 1012 { |
1013 return m_sPrivateParam.fFontSize; | 1013 return m_sPrivateParam.fFontSize; |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1226 const CPWL_Wnd* CPWL_Wnd::GetFocused() const | 1226 const CPWL_Wnd* CPWL_Wnd::GetFocused() const |
1227 { | 1227 { |
1228 if (CPWL_MsgControl * pMsgCtrl = GetMsgControl()) | 1228 if (CPWL_MsgControl * pMsgCtrl = GetMsgControl()) |
1229 { | 1229 { |
1230 return pMsgCtrl->m_pMainKeyboardWnd; | 1230 return pMsgCtrl->m_pMainKeyboardWnd; |
1231 } | 1231 } |
1232 | 1232 |
1233 return NULL; | 1233 return NULL; |
1234 } | 1234 } |
1235 | 1235 |
1236 void CPWL_Wnd::EnableWindow(FX_BOOL bEnable) | 1236 void CPWL_Wnd::EnableWindow(bool bEnable) |
1237 { | 1237 { |
1238 if (m_bEnabled != bEnable) | 1238 if (m_bEnabled != bEnable) |
1239 { | 1239 { |
1240 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++) | 1240 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++) |
1241 { | 1241 { |
1242 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) | 1242 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) |
1243 { | 1243 { |
1244 pChild->EnableWindow(bEnable); | 1244 pChild->EnableWindow(bEnable); |
1245 } | 1245 } |
1246 } | 1246 } |
1247 | 1247 |
1248 m_bEnabled = bEnable; | 1248 m_bEnabled = bEnable; |
1249 | 1249 |
1250 if (bEnable) | 1250 if (bEnable) |
1251 OnEnabled(); | 1251 OnEnabled(); |
1252 else | 1252 else |
1253 OnDisabled(); | 1253 OnDisabled(); |
1254 } | 1254 } |
1255 } | 1255 } |
1256 | 1256 |
1257 FX_BOOL CPWL_Wnd::IsEnabled() | 1257 bool CPWL_Wnd::IsEnabled() |
1258 { | 1258 { |
1259 return m_bEnabled; | 1259 return m_bEnabled; |
1260 } | 1260 } |
1261 | 1261 |
1262 void CPWL_Wnd::OnEnabled() | 1262 void CPWL_Wnd::OnEnabled() |
1263 { | 1263 { |
1264 } | 1264 } |
1265 | 1265 |
1266 void CPWL_Wnd::OnDisabled() | 1266 void CPWL_Wnd::OnDisabled() |
1267 { | 1267 { |
1268 } | 1268 } |
1269 | 1269 |
1270 FX_BOOL CPWL_Wnd::IsCTRLpressed(FX_DWORD nFlag) const | 1270 bool CPWL_Wnd::IsCTRLpressed(FX_DWORD nFlag) const |
1271 { | 1271 { |
1272 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) | 1272 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) |
1273 { | 1273 { |
1274 return pSystemHandler->IsCTRLKeyDown(nFlag); | 1274 return pSystemHandler->IsCTRLKeyDown(nFlag); |
1275 } | 1275 } |
1276 | 1276 |
1277 » return FALSE; | 1277 » return false; |
1278 } | 1278 } |
1279 | 1279 |
1280 FX_BOOL»CPWL_Wnd::IsSHIFTpressed(FX_DWORD nFlag) const | 1280 bool» CPWL_Wnd::IsSHIFTpressed(FX_DWORD nFlag) const |
1281 { | 1281 { |
1282 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) | 1282 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) |
1283 { | 1283 { |
1284 return pSystemHandler->IsSHIFTKeyDown(nFlag); | 1284 return pSystemHandler->IsSHIFTKeyDown(nFlag); |
1285 } | 1285 } |
1286 | 1286 |
1287 » return FALSE; | 1287 » return false; |
1288 } | 1288 } |
1289 | 1289 |
1290 FX_BOOL»CPWL_Wnd::IsALTpressed(FX_DWORD nFlag) const | 1290 bool» CPWL_Wnd::IsALTpressed(FX_DWORD nFlag) const |
1291 { | 1291 { |
1292 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) | 1292 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) |
1293 { | 1293 { |
1294 return pSystemHandler->IsALTKeyDown(nFlag); | 1294 return pSystemHandler->IsALTKeyDown(nFlag); |
1295 } | 1295 } |
1296 | 1296 |
1297 » return FALSE; | 1297 » return false; |
1298 } | 1298 } |
1299 | 1299 |
1300 FX_BOOL»CPWL_Wnd::IsINSERTpressed(FX_DWORD nFlag) const | 1300 bool» CPWL_Wnd::IsINSERTpressed(FX_DWORD nFlag) const |
1301 { | 1301 { |
1302 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) | 1302 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) |
1303 { | 1303 { |
1304 return pSystemHandler->IsINSERTKeyDown(nFlag); | 1304 return pSystemHandler->IsINSERTKeyDown(nFlag); |
1305 } | 1305 } |
1306 | 1306 |
1307 » return FALSE; | 1307 » return false; |
1308 } | 1308 } |
1309 | 1309 |
OLD | NEW |