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 CPWL_Timer::CPWL_Timer(CPWL_TimerHandler* pAttached, | 19 CPWL_Timer::CPWL_Timer(CPWL_TimerHandler* pAttached, |
20 IFX_SystemHandler* pSystemHandler) | 20 CFX_SystemHandler* pSystemHandler) |
21 : m_nTimerID(0), m_pAttached(pAttached), m_pSystemHandler(pSystemHandler) { | 21 : m_nTimerID(0), m_pAttached(pAttached), m_pSystemHandler(pSystemHandler) { |
22 ASSERT(m_pAttached); | 22 ASSERT(m_pAttached); |
23 ASSERT(m_pSystemHandler); | 23 ASSERT(m_pSystemHandler); |
24 } | 24 } |
25 | 25 |
26 CPWL_Timer::~CPWL_Timer() { | 26 CPWL_Timer::~CPWL_Timer() { |
27 KillPWLTimer(); | 27 KillPWLTimer(); |
28 } | 28 } |
29 | 29 |
30 int32_t CPWL_Timer::SetPWLTimer(int32_t nElapse) { | 30 int32_t CPWL_Timer::SetPWLTimer(int32_t nElapse) { |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 rcRefresh.Intersect(rcClip); | 391 rcRefresh.Intersect(rcClip); |
392 } | 392 } |
393 } | 393 } |
394 | 394 |
395 FX_RECT rcWin = PWLtoWnd(rcRefresh); | 395 FX_RECT rcWin = PWLtoWnd(rcRefresh); |
396 rcWin.left -= PWL_INVALIDATE_INFLATE; | 396 rcWin.left -= PWL_INVALIDATE_INFLATE; |
397 rcWin.top -= PWL_INVALIDATE_INFLATE; | 397 rcWin.top -= PWL_INVALIDATE_INFLATE; |
398 rcWin.right += PWL_INVALIDATE_INFLATE; | 398 rcWin.right += PWL_INVALIDATE_INFLATE; |
399 rcWin.bottom += PWL_INVALIDATE_INFLATE; | 399 rcWin.bottom += PWL_INVALIDATE_INFLATE; |
400 | 400 |
401 if (IFX_SystemHandler* pSH = GetSystemHandler()) { | 401 if (CFX_SystemHandler* pSH = GetSystemHandler()) { |
402 if (FX_HWND hWnd = GetAttachedHWnd()) { | 402 if (FX_HWND hWnd = GetAttachedHWnd()) { |
403 pSH->InvalidateRect(hWnd, rcWin); | 403 pSH->InvalidateRect(hWnd, rcWin); |
404 } | 404 } |
405 } | 405 } |
406 } | 406 } |
407 } | 407 } |
408 | 408 |
409 #define PWL_IMPLEMENT_KEY_METHOD(key_method_name) \ | 409 #define PWL_IMPLEMENT_KEY_METHOD(key_method_name) \ |
410 FX_BOOL CPWL_Wnd::key_method_name(uint16_t nChar, uint32_t nFlag) { \ | 410 FX_BOOL CPWL_Wnd::key_method_name(uint16_t nChar, uint32_t nFlag) { \ |
411 if (IsValid() && IsVisible() && IsEnabled()) { \ | 411 if (IsValid() && IsVisible() && IsEnabled()) { \ |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 rcContent.right - 1.0f, rcContent.top); | 737 rcContent.right - 1.0f, rcContent.top); |
738 | 738 |
739 if (pVSB) | 739 if (pVSB) |
740 pVSB->Move(rcVScroll, TRUE, FALSE); | 740 pVSB->Move(rcVScroll, TRUE, FALSE); |
741 } | 741 } |
742 | 742 |
743 void CPWL_Wnd::CreateChildWnd(const PWL_CREATEPARAM& cp) {} | 743 void CPWL_Wnd::CreateChildWnd(const PWL_CREATEPARAM& cp) {} |
744 | 744 |
745 void CPWL_Wnd::SetCursor() { | 745 void CPWL_Wnd::SetCursor() { |
746 if (IsValid()) { | 746 if (IsValid()) { |
747 if (IFX_SystemHandler* pSH = GetSystemHandler()) { | 747 if (CFX_SystemHandler* pSH = GetSystemHandler()) { |
748 int32_t nCursorType = GetCreationParam().eCursorType; | 748 int32_t nCursorType = GetCreationParam().eCursorType; |
749 pSH->SetCursor(nCursorType); | 749 pSH->SetCursor(nCursorType); |
750 } | 750 } |
751 } | 751 } |
752 } | 752 } |
753 | 753 |
754 void CPWL_Wnd::CreateMsgControl() { | 754 void CPWL_Wnd::CreateMsgControl() { |
755 if (!m_sPrivateParam.pMsgControl) | 755 if (!m_sPrivateParam.pMsgControl) |
756 m_sPrivateParam.pMsgControl = new CPWL_MsgControl(this); | 756 m_sPrivateParam.pMsgControl = new CPWL_MsgControl(this); |
757 } | 757 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 } | 796 } |
797 | 797 |
798 FX_FLOAT CPWL_Wnd::GetFontSize() const { | 798 FX_FLOAT CPWL_Wnd::GetFontSize() const { |
799 return m_sPrivateParam.fFontSize; | 799 return m_sPrivateParam.fFontSize; |
800 } | 800 } |
801 | 801 |
802 void CPWL_Wnd::SetFontSize(FX_FLOAT fFontSize) { | 802 void CPWL_Wnd::SetFontSize(FX_FLOAT fFontSize) { |
803 m_sPrivateParam.fFontSize = fFontSize; | 803 m_sPrivateParam.fFontSize = fFontSize; |
804 } | 804 } |
805 | 805 |
806 IFX_SystemHandler* CPWL_Wnd::GetSystemHandler() const { | 806 CFX_SystemHandler* CPWL_Wnd::GetSystemHandler() const { |
807 return m_sPrivateParam.pSystemHandler; | 807 return m_sPrivateParam.pSystemHandler; |
808 } | 808 } |
809 | 809 |
810 IPWL_FocusHandler* CPWL_Wnd::GetFocusHandler() const { | 810 IPWL_FocusHandler* CPWL_Wnd::GetFocusHandler() const { |
811 return m_sPrivateParam.pFocusHandler; | 811 return m_sPrivateParam.pFocusHandler; |
812 } | 812 } |
813 | 813 |
814 IPWL_Provider* CPWL_Wnd::GetProvider() const { | 814 IPWL_Provider* CPWL_Wnd::GetProvider() const { |
815 return m_sPrivateParam.pProvider; | 815 return m_sPrivateParam.pProvider; |
816 } | 816 } |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 | 1000 |
1001 FX_BOOL CPWL_Wnd::IsEnabled() { | 1001 FX_BOOL CPWL_Wnd::IsEnabled() { |
1002 return m_bEnabled; | 1002 return m_bEnabled; |
1003 } | 1003 } |
1004 | 1004 |
1005 void CPWL_Wnd::OnEnabled() {} | 1005 void CPWL_Wnd::OnEnabled() {} |
1006 | 1006 |
1007 void CPWL_Wnd::OnDisabled() {} | 1007 void CPWL_Wnd::OnDisabled() {} |
1008 | 1008 |
1009 FX_BOOL CPWL_Wnd::IsCTRLpressed(uint32_t nFlag) const { | 1009 FX_BOOL CPWL_Wnd::IsCTRLpressed(uint32_t nFlag) const { |
1010 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) { | 1010 if (CFX_SystemHandler* pSystemHandler = GetSystemHandler()) { |
1011 return pSystemHandler->IsCTRLKeyDown(nFlag); | 1011 return pSystemHandler->IsCTRLKeyDown(nFlag); |
1012 } | 1012 } |
1013 | 1013 |
1014 return FALSE; | 1014 return FALSE; |
1015 } | 1015 } |
1016 | 1016 |
1017 FX_BOOL CPWL_Wnd::IsSHIFTpressed(uint32_t nFlag) const { | 1017 FX_BOOL CPWL_Wnd::IsSHIFTpressed(uint32_t nFlag) const { |
1018 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) { | 1018 if (CFX_SystemHandler* pSystemHandler = GetSystemHandler()) { |
1019 return pSystemHandler->IsSHIFTKeyDown(nFlag); | 1019 return pSystemHandler->IsSHIFTKeyDown(nFlag); |
1020 } | 1020 } |
1021 | 1021 |
1022 return FALSE; | 1022 return FALSE; |
1023 } | 1023 } |
1024 | 1024 |
1025 FX_BOOL CPWL_Wnd::IsALTpressed(uint32_t nFlag) const { | 1025 FX_BOOL CPWL_Wnd::IsALTpressed(uint32_t nFlag) const { |
1026 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) { | 1026 if (CFX_SystemHandler* pSystemHandler = GetSystemHandler()) { |
1027 return pSystemHandler->IsALTKeyDown(nFlag); | 1027 return pSystemHandler->IsALTKeyDown(nFlag); |
1028 } | 1028 } |
1029 | 1029 |
1030 return FALSE; | 1030 return FALSE; |
1031 } | 1031 } |
1032 | 1032 |
1033 FX_BOOL CPWL_Wnd::IsINSERTpressed(uint32_t nFlag) const { | 1033 FX_BOOL CPWL_Wnd::IsINSERTpressed(uint32_t nFlag) const { |
1034 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) { | 1034 if (CFX_SystemHandler* pSystemHandler = GetSystemHandler()) { |
1035 return pSystemHandler->IsINSERTKeyDown(nFlag); | 1035 return pSystemHandler->IsINSERTKeyDown(nFlag); |
1036 } | 1036 } |
1037 | 1037 |
1038 return FALSE; | 1038 return FALSE; |
1039 } | 1039 } |
OLD | NEW |