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 "fpdfsdk/pdfwindow/PWL_ScrollBar.h" | 9 #include "fpdfsdk/pdfwindow/PWL_ScrollBar.h" |
10 #include "fpdfsdk/pdfwindow/PWL_Utils.h" | 10 #include "fpdfsdk/pdfwindow/PWL_Utils.h" |
11 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" | 11 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" |
12 | 12 |
13 static std::map<int32_t, CPWL_Timer*>& GetPWLTimeMap() { | 13 static std::map<int32_t, CPWL_Timer*>& GetPWLTimeMap() { |
14 // Leak the object at shutdown. | 14 // Leak the object at shutdown. |
15 static auto timeMap = new std::map<int32_t, CPWL_Timer*>; | 15 static auto timeMap = new std::map<int32_t, CPWL_Timer*>; |
16 return *timeMap; | 16 return *timeMap; |
17 } | 17 } |
18 | 18 |
19 PWL_CREATEPARAM::PWL_CREATEPARAM() | 19 PWL_CREATEPARAM::PWL_CREATEPARAM() |
20 : rcRectWnd(0, 0, 0, 0), | 20 : rcRectWnd(0, 0, 0, 0), |
21 pSystemHandler(nullptr), | 21 pSystemHandler(nullptr), |
22 pFontMap(nullptr), | 22 pFontMap(nullptr), |
23 pProvider(nullptr), | 23 pProvider(nullptr), |
24 pFocusHandler(nullptr), | 24 pFocusHandler(nullptr), |
25 dwFlags(0), | 25 dwFlags(0), |
26 sBackgroundColor(), | 26 sBackgroundColor(), |
27 hAttachedWnd(nullptr), | 27 pAttachedWidget(nullptr), |
28 nBorderStyle(BorderStyle::SOLID), | 28 nBorderStyle(BorderStyle::SOLID), |
29 dwBorderWidth(1), | 29 dwBorderWidth(1), |
30 sBorderColor(), | 30 sBorderColor(), |
31 sTextColor(), | 31 sTextColor(), |
32 sTextStrokeColor(), | 32 sTextStrokeColor(), |
33 nTransparency(255), | 33 nTransparency(255), |
34 fFontSize(PWL_DEFAULT_FONTSIZE), | 34 fFontSize(PWL_DEFAULT_FONTSIZE), |
35 sDash(3, 0, 0), | 35 sDash(3, 0, 0), |
36 pAttachedData(nullptr), | 36 pAttachedData(nullptr), |
37 pParentWnd(nullptr), | 37 pParentWnd(nullptr), |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 } | 415 } |
416 } | 416 } |
417 | 417 |
418 FX_RECT rcWin = PWLtoWnd(rcRefresh); | 418 FX_RECT rcWin = PWLtoWnd(rcRefresh); |
419 rcWin.left -= PWL_INVALIDATE_INFLATE; | 419 rcWin.left -= PWL_INVALIDATE_INFLATE; |
420 rcWin.top -= PWL_INVALIDATE_INFLATE; | 420 rcWin.top -= PWL_INVALIDATE_INFLATE; |
421 rcWin.right += PWL_INVALIDATE_INFLATE; | 421 rcWin.right += PWL_INVALIDATE_INFLATE; |
422 rcWin.bottom += PWL_INVALIDATE_INFLATE; | 422 rcWin.bottom += PWL_INVALIDATE_INFLATE; |
423 | 423 |
424 if (CFX_SystemHandler* pSH = GetSystemHandler()) { | 424 if (CFX_SystemHandler* pSH = GetSystemHandler()) { |
425 if (FX_HWND hWnd = GetAttachedHWnd()) { | 425 if (CPDFSDK_Widget* widget = m_sPrivateParam.pAttachedWidget) |
426 pSH->InvalidateRect(hWnd, rcWin); | 426 pSH->InvalidateRect(widget, rcWin); |
427 } | |
428 } | 427 } |
429 } | 428 } |
430 } | 429 } |
431 | 430 |
432 #define PWL_IMPLEMENT_KEY_METHOD(key_method_name) \ | 431 #define PWL_IMPLEMENT_KEY_METHOD(key_method_name) \ |
433 FX_BOOL CPWL_Wnd::key_method_name(uint16_t nChar, uint32_t nFlag) { \ | 432 FX_BOOL CPWL_Wnd::key_method_name(uint16_t nChar, uint32_t nFlag) { \ |
434 if (IsValid() && IsVisible() && IsEnabled()) { \ | 433 if (IsValid() && IsVisible() && IsEnabled()) { \ |
435 if (IsWndCaptureKeyboard(this)) { \ | 434 if (IsWndCaptureKeyboard(this)) { \ |
436 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { \ | 435 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { \ |
437 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { \ | 436 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { \ |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
900 } | 899 } |
901 | 900 |
902 FX_RECT CPWL_Wnd::PWLtoWnd(const CFX_FloatRect& rect) const { | 901 FX_RECT CPWL_Wnd::PWLtoWnd(const CFX_FloatRect& rect) const { |
903 CFX_FloatRect rcTemp = rect; | 902 CFX_FloatRect rcTemp = rect; |
904 CFX_Matrix mt = GetWindowMatrix(); | 903 CFX_Matrix mt = GetWindowMatrix(); |
905 mt.TransformRect(rcTemp); | 904 mt.TransformRect(rcTemp); |
906 return FX_RECT((int32_t)(rcTemp.left + 0.5), (int32_t)(rcTemp.bottom + 0.5), | 905 return FX_RECT((int32_t)(rcTemp.left + 0.5), (int32_t)(rcTemp.bottom + 0.5), |
907 (int32_t)(rcTemp.right + 0.5), (int32_t)(rcTemp.top + 0.5)); | 906 (int32_t)(rcTemp.right + 0.5), (int32_t)(rcTemp.top + 0.5)); |
908 } | 907 } |
909 | 908 |
910 FX_HWND CPWL_Wnd::GetAttachedHWnd() const { | |
911 return m_sPrivateParam.hAttachedWnd; | |
912 } | |
913 | |
914 CFX_FloatPoint CPWL_Wnd::ChildToParent(const CFX_FloatPoint& point) const { | 909 CFX_FloatPoint CPWL_Wnd::ChildToParent(const CFX_FloatPoint& point) const { |
915 CFX_Matrix mt = GetChildMatrix(); | 910 CFX_Matrix mt = GetChildMatrix(); |
916 if (mt.IsIdentity()) | 911 if (mt.IsIdentity()) |
917 return point; | 912 return point; |
918 | 913 |
919 CFX_FloatPoint pt = point; | 914 CFX_FloatPoint pt = point; |
920 mt.Transform(pt.x, pt.y); | 915 mt.Transform(pt.x, pt.y); |
921 return pt; | 916 return pt; |
922 } | 917 } |
923 | 918 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 return FALSE; | 1032 return FALSE; |
1038 } | 1033 } |
1039 | 1034 |
1040 FX_BOOL CPWL_Wnd::IsALTpressed(uint32_t nFlag) const { | 1035 FX_BOOL CPWL_Wnd::IsALTpressed(uint32_t nFlag) const { |
1041 if (CFX_SystemHandler* pSystemHandler = GetSystemHandler()) { | 1036 if (CFX_SystemHandler* pSystemHandler = GetSystemHandler()) { |
1042 return pSystemHandler->IsALTKeyDown(nFlag); | 1037 return pSystemHandler->IsALTKeyDown(nFlag); |
1043 } | 1038 } |
1044 | 1039 |
1045 return FALSE; | 1040 return FALSE; |
1046 } | 1041 } |
OLD | NEW |