| 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 "fpdfsdk/pdfwindow/PWL_ListBox.h" | 7 #include "fpdfsdk/pdfwindow/PWL_ListBox.h" |
| 8 | 8 |
| 9 #include "fpdfsdk/pdfwindow/PWL_Edit.h" | 9 #include "fpdfsdk/pdfwindow/PWL_Edit.h" |
| 10 #include "fpdfsdk/pdfwindow/PWL_EditCtrl.h" | 10 #include "fpdfsdk/pdfwindow/PWL_EditCtrl.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 void CPWL_List_Notify::IOnSetScrollPosY(FX_FLOAT fy) { | 59 void CPWL_List_Notify::IOnSetScrollPosY(FX_FLOAT fy) { |
| 60 m_pList->OnNotify(m_pList, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&fy); | 60 m_pList->OnNotify(m_pList, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&fy); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void CPWL_List_Notify::IOnInvalidateRect(CFX_FloatRect* pRect) { | 63 void CPWL_List_Notify::IOnInvalidateRect(CFX_FloatRect* pRect) { |
| 64 m_pList->InvalidateRect(pRect); | 64 m_pList->InvalidateRect(pRect); |
| 65 } | 65 } |
| 66 | 66 |
| 67 CPWL_ListBox::CPWL_ListBox() | 67 CPWL_ListBox::CPWL_ListBox() |
| 68 : m_pList(NULL), | 68 : m_pList(nullptr), |
| 69 m_pListNotify(NULL), | 69 m_pListNotify(nullptr), |
| 70 m_bMouseDown(FALSE), | 70 m_bMouseDown(FALSE), |
| 71 m_bHoverSel(FALSE), | 71 m_bHoverSel(FALSE), |
| 72 m_pFillerNotify(NULL) { | 72 m_pFillerNotify(nullptr) { |
| 73 m_pList = IFX_List::NewList(); | 73 m_pList = IFX_List::NewList(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 CPWL_ListBox::~CPWL_ListBox() { | 76 CPWL_ListBox::~CPWL_ListBox() { |
| 77 IFX_List::DelList(m_pList); | 77 IFX_List::DelList(m_pList); |
| 78 delete m_pListNotify; | 78 delete m_pListNotify; |
| 79 m_pListNotify = NULL; | 79 m_pListNotify = nullptr; |
| 80 } | 80 } |
| 81 | 81 |
| 82 CFX_ByteString CPWL_ListBox::GetClassName() const { | 82 CFX_ByteString CPWL_ListBox::GetClassName() const { |
| 83 return "CPWL_ListBox"; | 83 return "CPWL_ListBox"; |
| 84 } | 84 } |
| 85 | 85 |
| 86 void CPWL_ListBox::OnCreated() { | 86 void CPWL_ListBox::OnCreated() { |
| 87 if (m_pList) { | 87 if (m_pList) { |
| 88 delete m_pListNotify; | 88 delete m_pListNotify; |
| 89 | 89 |
| 90 m_pList->SetFontMap(GetFontMap()); | 90 m_pList->SetFontMap(GetFontMap()); |
| 91 m_pList->SetNotify(m_pListNotify = new CPWL_List_Notify(this)); | 91 m_pList->SetNotify(m_pListNotify = new CPWL_List_Notify(this)); |
| 92 | 92 |
| 93 SetHoverSel(HasFlag(PLBS_HOVERSEL)); | 93 SetHoverSel(HasFlag(PLBS_HOVERSEL)); |
| 94 m_pList->SetMultipleSel(HasFlag(PLBS_MULTIPLESEL)); | 94 m_pList->SetMultipleSel(HasFlag(PLBS_MULTIPLESEL)); |
| 95 m_pList->SetFontSize(GetCreationParam().fFontSize); | 95 m_pList->SetFontSize(GetCreationParam().fFontSize); |
| 96 | 96 |
| 97 m_bHoverSel = HasFlag(PLBS_HOVERSEL); | 97 m_bHoverSel = HasFlag(PLBS_HOVERSEL); |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 | 100 |
| 101 void CPWL_ListBox::OnDestroy() { | 101 void CPWL_ListBox::OnDestroy() { |
| 102 delete m_pListNotify; | 102 delete m_pListNotify; |
| 103 m_pListNotify = NULL; | 103 m_pListNotify = nullptr; |
| 104 } | 104 } |
| 105 | 105 |
| 106 void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { | 106 void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { |
| 107 CPWL_Wnd::GetThisAppearanceStream(sAppStream); | 107 CPWL_Wnd::GetThisAppearanceStream(sAppStream); |
| 108 | 108 |
| 109 CFX_ByteTextBuf sListItems; | 109 CFX_ByteTextBuf sListItems; |
| 110 | 110 |
| 111 if (m_pList) { | 111 if (m_pList) { |
| 112 CFX_FloatRect rcPlate = m_pList->GetPlateRect(); | 112 CFX_FloatRect rcPlate = m_pList->GetPlateRect(); |
| 113 for (int32_t i = 0, sz = m_pList->GetCount(); i < sz; i++) { | 113 for (int32_t i = 0, sz = m_pList->GetCount(); i < sz; i++) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 rcItem.Intersect(rcClient); | 180 rcItem.Intersect(rcClient); |
| 181 } | 181 } |
| 182 | 182 |
| 183 if (m_pList->IsItemSelected(i)) { | 183 if (m_pList->IsItemSelected(i)) { |
| 184 CFX_SystemHandler* pSysHandler = GetSystemHandler(); | 184 CFX_SystemHandler* pSysHandler = GetSystemHandler(); |
| 185 if (pSysHandler && pSysHandler->IsSelectionImplemented()) { | 185 if (pSysHandler && pSysHandler->IsSelectionImplemented()) { |
| 186 IFX_Edit::DrawEdit( | 186 IFX_Edit::DrawEdit( |
| 187 pDevice, pUser2Device, m_pList->GetItemEdit(i), | 187 pDevice, pUser2Device, m_pList->GetItemEdit(i), |
| 188 CPWL_Utils::PWLColorToFXColor(GetTextColor()), | 188 CPWL_Utils::PWLColorToFXColor(GetTextColor()), |
| 189 CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()), rcList, | 189 CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()), rcList, |
| 190 ptOffset, NULL, pSysHandler, m_pFormFiller); | 190 ptOffset, nullptr, pSysHandler, m_pFormFiller); |
| 191 pSysHandler->OutputSelectedRect(m_pFormFiller, rcItem); | 191 pSysHandler->OutputSelectedRect(m_pFormFiller, rcItem); |
| 192 } else { | 192 } else { |
| 193 CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcItem, | 193 CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcItem, |
| 194 ArgbEncode(255, 0, 51, 113)); | 194 ArgbEncode(255, 0, 51, 113)); |
| 195 IFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i), | 195 IFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i), |
| 196 ArgbEncode(255, 255, 255, 255), 0, rcList, | 196 ArgbEncode(255, 255, 255, 255), 0, rcList, |
| 197 ptOffset, NULL, pSysHandler, m_pFormFiller); | 197 ptOffset, nullptr, pSysHandler, m_pFormFiller); |
| 198 } | 198 } |
| 199 } else { | 199 } else { |
| 200 CFX_SystemHandler* pSysHandler = GetSystemHandler(); | 200 CFX_SystemHandler* pSysHandler = GetSystemHandler(); |
| 201 IFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i), | 201 IFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i), |
| 202 CPWL_Utils::PWLColorToFXColor(GetTextColor()), | 202 CPWL_Utils::PWLColorToFXColor(GetTextColor()), |
| 203 CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()), | 203 CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()), |
| 204 rcList, ptOffset, NULL, pSysHandler, NULL); | 204 rcList, ptOffset, nullptr, pSysHandler, nullptr); |
| 205 } | 205 } |
| 206 } | 206 } |
| 207 } | 207 } |
| 208 } | 208 } |
| 209 | 209 |
| 210 FX_BOOL CPWL_ListBox::OnKeyDown(uint16_t nChar, uint32_t nFlag) { | 210 FX_BOOL CPWL_ListBox::OnKeyDown(uint16_t nChar, uint32_t nFlag) { |
| 211 CPWL_Wnd::OnKeyDown(nChar, nFlag); | 211 CPWL_Wnd::OnKeyDown(nChar, nFlag); |
| 212 | 212 |
| 213 if (!m_pList) | 213 if (!m_pList) |
| 214 return FALSE; | 214 return FALSE; |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 if (zDelta < 0) { | 528 if (zDelta < 0) { |
| 529 m_pList->OnVK_DOWN(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); | 529 m_pList->OnVK_DOWN(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); |
| 530 } else { | 530 } else { |
| 531 m_pList->OnVK_UP(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); | 531 m_pList->OnVK_UP(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); |
| 532 } | 532 } |
| 533 | 533 |
| 534 FX_BOOL bExit = FALSE; | 534 FX_BOOL bExit = FALSE; |
| 535 OnNotifySelChanged(FALSE, bExit, nFlag); | 535 OnNotifySelChanged(FALSE, bExit, nFlag); |
| 536 return TRUE; | 536 return TRUE; |
| 537 } | 537 } |
| OLD | NEW |