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

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

Issue 1254703002: FX_BOOL considered harmful, part 2. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 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_Utils.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"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
218 CPWL_Wnd* m_pMainMouseWnd; 218 CPWL_Wnd* m_pMainMouseWnd;
219 CPWL_Wnd* m_pMainKeyboardWnd; 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())
(...skipping 17 matching lines...) Expand all
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
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_REMOVECHILD); 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, 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
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(nChar,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 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
543 if (pChild->WndHitTest(pChild->ParentToChild(point)))\ 543 if (pChild->WndHitTest(pChild->ParentToChild(point)))\
544 {\ 544 {\
545 return pChild->mouse_method_name(pChild->ParentToChild(p oint),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(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 nFl ag)
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(zDelta,pChild->ParentToChild (point), nFlag); 583 return pChild->OnMouseWheel(zDelta,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
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 CPDF_Rect CPWL_Wnd::GetClientCenterSquare() const 670 CPDF_Rect CPWL_Wnd::GetClientCenterSquare() const
671 { 671 {
672 return CPWL_Utils::GetCenterSquare(GetClientRect()); 672 return CPWL_Utils::GetCenterSquare(GetClientRect());
673 } 673 }
674 674
675 CPDF_Rect CPWL_Wnd::GetWindowCenterSquare() const 675 CPDF_Rect CPWL_Wnd::GetWindowCenterSquare() const
676 { 676 {
677 return CPWL_Utils::GetCenterSquare(CPWL_Utils::DeflateRect(GetWindowRect(),0 .1f)); 677 return CPWL_Utils::GetCenterSquare(CPWL_Utils::DeflateRect(GetWindowRect(),0 .1f));
678 } 678 }
679 679
680 FX_BOOL CPWL_Wnd::HasFlag(FX_DWORD dwFlags) const 680 bool CPWL_Wnd::HasFlag(FX_DWORD dwFlags) const
681 { 681 {
682 return (m_sPrivateParam.dwFlags & dwFlags) != 0; 682 return (m_sPrivateParam.dwFlags & dwFlags) != 0;
683 } 683 }
684 684
685 void CPWL_Wnd::RemoveFlag(FX_DWORD dwFlags) 685 void CPWL_Wnd::RemoveFlag(FX_DWORD dwFlags)
686 { 686 {
687 m_sPrivateParam.dwFlags &= ~dwFlags; 687 m_sPrivateParam.dwFlags &= ~dwFlags;
688 } 688 }
689 689
690 void CPWL_Wnd::AddFlag(FX_DWORD dwFlags) 690 void CPWL_Wnd::AddFlag(FX_DWORD dwFlags)
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 } 858 }
859 859
860 void CPWL_Wnd::OnSetFocus() 860 void CPWL_Wnd::OnSetFocus()
861 { 861 {
862 } 862 }
863 863
864 void CPWL_Wnd::OnKillFocus() 864 void CPWL_Wnd::OnKillFocus()
865 { 865 {
866 } 866 }
867 867
868 FX_BOOL CPWL_Wnd::WndHitTest(const CPDF_Point & point) const 868 bool CPWL_Wnd::WndHitTest(const CPDF_Point & point) const
869 { 869 {
870 return IsValid() && IsVisible() && GetWindowRect().Contains(point.x,point.y) ; 870 return IsValid() && IsVisible() && GetWindowRect().Contains(point.x,point.y) ;
871 } 871 }
872 872
873 FX_BOOL CPWL_Wnd::ClientHitTest(const CPDF_Point & point) const 873 bool CPWL_Wnd::ClientHitTest(const CPDF_Point & point) const
874 { 874 {
875 return IsValid() && IsVisible() && GetClientRect().Contains(point.x,point.y) ; 875 return IsValid() && IsVisible() && GetClientRect().Contains(point.x,point.y) ;
876 } 876 }
877 877
878 const CPWL_Wnd* CPWL_Wnd::GetRootWnd() const 878 const CPWL_Wnd* CPWL_Wnd::GetRootWnd() const
879 { 879 {
880 if (m_sPrivateParam.pParentWnd) 880 if (m_sPrivateParam.pParentWnd)
881 return m_sPrivateParam.pParentWnd->GetRootWnd(); 881 return m_sPrivateParam.pParentWnd->GetRootWnd();
882 882
883 return this; 883 return this;
884 } 884 }
885 885
886 void CPWL_Wnd::SetVisible(FX_BOOL bVisible) 886 void CPWL_Wnd::SetVisible(bool bVisible)
887 { 887 {
888 if (IsValid()) 888 if (IsValid())
889 { 889 {
890 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++) 890 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)
891 { 891 {
892 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) 892 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i))
893 { 893 {
894 pChild->SetVisible(bVisible); 894 pChild->SetVisible(bVisible);
895 } 895 }
896 } 896 }
(...skipping 11 matching lines...) Expand all
908 { 908 {
909 m_rcClip = rect; 909 m_rcClip = rect;
910 m_rcClip.Normalize(); 910 m_rcClip.Normalize();
911 } 911 }
912 912
913 CPDF_Rect CPWL_Wnd::GetClipRect() const 913 CPDF_Rect CPWL_Wnd::GetClipRect() const
914 { 914 {
915 return m_rcClip; 915 return m_rcClip;
916 } 916 }
917 917
918 FX_BOOL CPWL_Wnd::IsReadOnly() const 918 bool CPWL_Wnd::IsReadOnly() const
919 { 919 {
920 return HasFlag(PWS_READONLY); 920 return HasFlag(PWS_READONLY);
921 } 921 }
922 922
923 void CPWL_Wnd::RePosChildWnd() 923 void CPWL_Wnd::RePosChildWnd()
924 { 924 {
925 CPDF_Rect rcContent = CPWL_Utils::DeflateRect(GetWindowRect(),(FX_FLOAT)(Get BorderWidth()+GetInnerBorderWidth())); 925 CPDF_Rect rcContent = CPWL_Utils::DeflateRect(GetWindowRect(),(FX_FLOAT)(Get BorderWidth()+GetInnerBorderWidth()));
926 926
927 CPWL_ScrollBar * pVSB = GetVScrollBar(); 927 CPWL_ScrollBar * pVSB = GetVScrollBar();
928 928
929 CPDF_Rect rcVScroll = CPDF_Rect(rcContent.right - PWL_SCROLLBAR_WIDTH, 929 CPDF_Rect rcVScroll = CPDF_Rect(rcContent.right - PWL_SCROLLBAR_WIDTH,
930 rcContent.bottom, 930 rcContent.bottom,
931 rcContent.right-1.0f, 931 rcContent.right-1.0f,
932 rcContent.top); 932 rcContent.top);
933 933
934 if (pVSB) pVSB->Move(rcVScroll,TRUE,FALSE); 934 if (pVSB) pVSB->Move(rcVScroll,true,false);
935 } 935 }
936 936
937 void CPWL_Wnd::CreateChildWnd(const PWL_CREATEPARAM & cp) 937 void CPWL_Wnd::CreateChildWnd(const PWL_CREATEPARAM & cp)
938 { 938 {
939 } 939 }
940 940
941 void CPWL_Wnd::SetCursor() 941 void CPWL_Wnd::SetCursor()
942 { 942 {
943 if (IsValid()) 943 if (IsValid())
944 { 944 {
(...skipping 16 matching lines...) Expand all
961 if (CPWL_MsgControl* pMsgControl = GetMsgControl()) 961 if (CPWL_MsgControl* pMsgControl = GetMsgControl())
962 if (pMsgControl->IsWndCreated(this)) 962 if (pMsgControl->IsWndCreated(this))
963 delete pMsgControl; 963 delete pMsgControl;
964 } 964 }
965 965
966 CPWL_MsgControl* CPWL_Wnd::GetMsgControl() const 966 CPWL_MsgControl* CPWL_Wnd::GetMsgControl() const
967 { 967 {
968 return m_sPrivateParam.pMsgControl; 968 return m_sPrivateParam.pMsgControl;
969 } 969 }
970 970
971 FX_BOOL CPWL_Wnd::IsCaptureMouse() const 971 bool CPWL_Wnd::IsCaptureMouse() const
972 { 972 {
973 return IsWndCaptureMouse(this); 973 return IsWndCaptureMouse(this);
974 } 974 }
975 975
976 FX_BOOL CPWL_Wnd::IsWndCaptureMouse(const CPWL_Wnd * pWnd) const 976 bool CPWL_Wnd::IsWndCaptureMouse(const CPWL_Wnd * pWnd) const
977 { 977 {
978 if (CPWL_MsgControl * pCtrl = GetMsgControl()) 978 if (CPWL_MsgControl * pCtrl = GetMsgControl())
979 return pCtrl->IsWndCaptureMouse(pWnd); 979 return pCtrl->IsWndCaptureMouse(pWnd);
980 980
981 return FALSE; 981 return false;
982 } 982 }
983 983
984 FX_BOOL CPWL_Wnd::IsWndCaptureKeyboard(const CPWL_Wnd * pWnd) const 984 bool CPWL_Wnd::IsWndCaptureKeyboard(const CPWL_Wnd * pWnd) const
985 { 985 {
986 if (CPWL_MsgControl * pCtrl = GetMsgControl()) 986 if (CPWL_MsgControl * pCtrl = GetMsgControl())
987 return pCtrl->IsWndCaptureKeyboard(pWnd); 987 return pCtrl->IsWndCaptureKeyboard(pWnd);
988 988
989 return FALSE; 989 return false;
990 } 990 }
991 991
992 FX_BOOL CPWL_Wnd::IsFocused() const 992 bool CPWL_Wnd::IsFocused() const
993 { 993 {
994 if (CPWL_MsgControl * pCtrl = GetMsgControl()) 994 if (CPWL_MsgControl * pCtrl = GetMsgControl())
995 return pCtrl->IsMainCaptureKeyboard(this); 995 return pCtrl->IsMainCaptureKeyboard(this);
996 996
997 return FALSE; 997 return false;
998 } 998 }
999 999
1000 CPDF_Rect CPWL_Wnd::GetFocusRect() const 1000 CPDF_Rect CPWL_Wnd::GetFocusRect() const
1001 { 1001 {
1002 return CPWL_Utils::InflateRect(GetWindowRect(),1); 1002 return CPWL_Utils::InflateRect(GetWindowRect(),1);
1003 } 1003 }
1004 1004
1005 FX_FLOAT CPWL_Wnd::GetFontSize() const 1005 FX_FLOAT CPWL_Wnd::GetFontSize() const
1006 { 1006 {
1007 return m_sPrivateParam.fFontSize; 1007 return m_sPrivateParam.fFontSize;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 const CPWL_Wnd* CPWL_Wnd::GetFocused() const 1210 const CPWL_Wnd* CPWL_Wnd::GetFocused() const
1211 { 1211 {
1212 if (CPWL_MsgControl * pMsgCtrl = GetMsgControl()) 1212 if (CPWL_MsgControl * pMsgCtrl = GetMsgControl())
1213 { 1213 {
1214 return pMsgCtrl->m_pMainKeyboardWnd; 1214 return pMsgCtrl->m_pMainKeyboardWnd;
1215 } 1215 }
1216 1216
1217 return NULL; 1217 return NULL;
1218 } 1218 }
1219 1219
1220 void CPWL_Wnd::EnableWindow(FX_BOOL bEnable) 1220 void CPWL_Wnd::EnableWindow(bool bEnable)
1221 { 1221 {
1222 if (m_bEnabled != bEnable) 1222 if (m_bEnabled != bEnable)
1223 { 1223 {
1224 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++) 1224 for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)
1225 { 1225 {
1226 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) 1226 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i))
1227 { 1227 {
1228 pChild->EnableWindow(bEnable); 1228 pChild->EnableWindow(bEnable);
1229 } 1229 }
1230 } 1230 }
1231 1231
1232 m_bEnabled = bEnable; 1232 m_bEnabled = bEnable;
1233 1233
1234 if (bEnable) 1234 if (bEnable)
1235 OnEnabled(); 1235 OnEnabled();
1236 else 1236 else
1237 OnDisabled(); 1237 OnDisabled();
1238 } 1238 }
1239 } 1239 }
1240 1240
1241 FX_BOOL CPWL_Wnd::IsEnabled() 1241 bool CPWL_Wnd::IsEnabled()
1242 { 1242 {
1243 return m_bEnabled; 1243 return m_bEnabled;
1244 } 1244 }
1245 1245
1246 void CPWL_Wnd::OnEnabled() 1246 void CPWL_Wnd::OnEnabled()
1247 { 1247 {
1248 } 1248 }
1249 1249
1250 void CPWL_Wnd::OnDisabled() 1250 void CPWL_Wnd::OnDisabled()
1251 { 1251 {
1252 } 1252 }
1253 1253
1254 FX_BOOL CPWL_Wnd::IsCTRLpressed(FX_DWORD nFlag) const 1254 bool CPWL_Wnd::IsCTRLpressed(FX_DWORD nFlag) const
1255 { 1255 {
1256 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) 1256 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler())
1257 { 1257 {
1258 return pSystemHandler->IsCTRLKeyDown(nFlag); 1258 return pSystemHandler->IsCTRLKeyDown(nFlag);
1259 } 1259 }
1260 1260
1261 return FALSE; 1261 return false;
1262 } 1262 }
1263 1263
1264 FX_BOOL CPWL_Wnd::IsSHIFTpressed(FX_DWORD nFlag) const 1264 bool CPWL_Wnd::IsSHIFTpressed(FX_DWORD nFlag) const
1265 { 1265 {
1266 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) 1266 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler())
1267 { 1267 {
1268 return pSystemHandler->IsSHIFTKeyDown(nFlag); 1268 return pSystemHandler->IsSHIFTKeyDown(nFlag);
1269 } 1269 }
1270 1270
1271 return FALSE; 1271 return false;
1272 } 1272 }
1273 1273
1274 FX_BOOL CPWL_Wnd::IsALTpressed(FX_DWORD nFlag) const 1274 bool CPWL_Wnd::IsALTpressed(FX_DWORD nFlag) const
1275 { 1275 {
1276 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) 1276 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler())
1277 { 1277 {
1278 return pSystemHandler->IsALTKeyDown(nFlag); 1278 return pSystemHandler->IsALTKeyDown(nFlag);
1279 } 1279 }
1280 1280
1281 return FALSE; 1281 return false;
1282 } 1282 }
1283 1283
1284 FX_BOOL CPWL_Wnd::IsINSERTpressed(FX_DWORD nFlag) const 1284 bool CPWL_Wnd::IsINSERTpressed(FX_DWORD nFlag) const
1285 { 1285 {
1286 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) 1286 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler())
1287 { 1287 {
1288 return pSystemHandler->IsINSERTKeyDown(nFlag); 1288 return pSystemHandler->IsINSERTKeyDown(nFlag);
1289 } 1289 }
1290 1290
1291 return FALSE; 1291 return false;
1292 } 1292 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/pdfwindow/PWL_Utils.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698