| 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/include/pdfwindow/PDFWindow.h" | |
| 8 #include "fpdfsdk/include/pdfwindow/PWL_ComboBox.h" | 7 #include "fpdfsdk/include/pdfwindow/PWL_ComboBox.h" |
| 8 |
| 9 #include "fpdfsdk/include/pdfwindow/PWL_Edit.h" | 9 #include "fpdfsdk/include/pdfwindow/PWL_Edit.h" |
| 10 #include "fpdfsdk/include/pdfwindow/PWL_EditCtrl.h" | 10 #include "fpdfsdk/include/pdfwindow/PWL_EditCtrl.h" |
| 11 #include "fpdfsdk/include/pdfwindow/PWL_ListBox.h" | 11 #include "fpdfsdk/include/pdfwindow/PWL_ListBox.h" |
| 12 #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" | 12 #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" |
| 13 #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" | 13 #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" |
| 14 #include "public/fpdf_fwlevent.h" |
| 14 | 15 |
| 15 #define PWLCB_DEFAULTFONTSIZE 12.0f | 16 #define PWLCB_DEFAULTFONTSIZE 12.0f |
| 16 | 17 |
| 17 #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001) | 18 #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001) |
| 18 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) | 19 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) |
| 19 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) | 20 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) |
| 20 #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb)) | 21 #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb)) |
| 21 | 22 |
| 22 /* ---------------------------- CPWL_CBListBox ---------------------------- */ | |
| 23 | |
| 24 FX_BOOL CPWL_CBListBox::OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) { | 23 FX_BOOL CPWL_CBListBox::OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) { |
| 25 CPWL_Wnd::OnLButtonUp(point, nFlag); | 24 CPWL_Wnd::OnLButtonUp(point, nFlag); |
| 26 | 25 |
| 27 if (m_bMouseDown) { | 26 if (m_bMouseDown) { |
| 28 ReleaseCapture(); | 27 ReleaseCapture(); |
| 29 m_bMouseDown = FALSE; | 28 m_bMouseDown = FALSE; |
| 30 | 29 |
| 31 if (ClientHitTest(point)) { | 30 if (ClientHitTest(point)) { |
| 32 if (CPWL_Wnd* pParent = GetParentWindow()) { | 31 if (CPWL_Wnd* pParent = GetParentWindow()) { |
| 33 pParent->OnNotify(this, PNM_LBUTTONUP, 0, | 32 pParent->OnNotify(this, PNM_LBUTTONUP, 0, |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 100 |
| 102 if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetParentWindow()) { | 101 if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetParentWindow()) { |
| 103 pComboBox->SetSelectText(); | 102 pComboBox->SetSelectText(); |
| 104 } | 103 } |
| 105 | 104 |
| 106 OnNotifySelChanged(TRUE, bExit, nFlag); | 105 OnNotifySelChanged(TRUE, bExit, nFlag); |
| 107 | 106 |
| 108 return TRUE; | 107 return TRUE; |
| 109 } | 108 } |
| 110 | 109 |
| 111 /* ---------------------------- CPWL_CBButton ---------------------------- */ | |
| 112 | |
| 113 void CPWL_CBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { | 110 void CPWL_CBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { |
| 114 CPWL_Wnd::GetThisAppearanceStream(sAppStream); | 111 CPWL_Wnd::GetThisAppearanceStream(sAppStream); |
| 115 | 112 |
| 116 CPDF_Rect rectWnd = CPWL_Wnd::GetWindowRect(); | 113 CPDF_Rect rectWnd = CPWL_Wnd::GetWindowRect(); |
| 117 | 114 |
| 118 if (IsVisible() && !rectWnd.IsEmpty()) { | 115 if (IsVisible() && !rectWnd.IsEmpty()) { |
| 119 CFX_ByteTextBuf sButton; | 116 CFX_ByteTextBuf sButton; |
| 120 | 117 |
| 121 CPDF_Point ptCenter = GetCenterPoint(); | 118 CPDF_Point ptCenter = GetCenterPoint(); |
| 122 | 119 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 189 } |
| 193 | 190 |
| 194 FX_BOOL CPWL_CBButton::OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) { | 191 FX_BOOL CPWL_CBButton::OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) { |
| 195 CPWL_Wnd::OnLButtonUp(point, nFlag); | 192 CPWL_Wnd::OnLButtonUp(point, nFlag); |
| 196 | 193 |
| 197 ReleaseCapture(); | 194 ReleaseCapture(); |
| 198 | 195 |
| 199 return TRUE; | 196 return TRUE; |
| 200 } | 197 } |
| 201 | 198 |
| 202 /* ---------------------------- CPWL_ComboBox ---------------------------- */ | |
| 203 | |
| 204 CPWL_ComboBox::CPWL_ComboBox() | 199 CPWL_ComboBox::CPWL_ComboBox() |
| 205 : m_pEdit(NULL), | 200 : m_pEdit(NULL), |
| 206 m_pButton(NULL), | 201 m_pButton(NULL), |
| 207 m_pList(NULL), | 202 m_pList(NULL), |
| 208 m_bPopup(FALSE), | 203 m_bPopup(FALSE), |
| 209 m_nPopupWhere(0), | 204 m_nPopupWhere(0), |
| 210 m_nSelectItem(-1), | 205 m_nSelectItem(-1), |
| 211 m_pFillerNotify(NULL) {} | 206 m_pFillerNotify(NULL) {} |
| 212 | 207 |
| 213 CFX_ByteString CPWL_ComboBox::GetClassName() const { | 208 CFX_ByteString CPWL_ComboBox::GetClassName() const { |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 | 598 |
| 604 void CPWL_ComboBox::SetFillerNotify(IPWL_Filler_Notify* pNotify) { | 599 void CPWL_ComboBox::SetFillerNotify(IPWL_Filler_Notify* pNotify) { |
| 605 m_pFillerNotify = pNotify; | 600 m_pFillerNotify = pNotify; |
| 606 | 601 |
| 607 if (m_pEdit) | 602 if (m_pEdit) |
| 608 m_pEdit->SetFillerNotify(pNotify); | 603 m_pEdit->SetFillerNotify(pNotify); |
| 609 | 604 |
| 610 if (m_pList) | 605 if (m_pList) |
| 611 m_pList->SetFillerNotify(pNotify); | 606 m_pList->SetFillerNotify(pNotify); |
| 612 } | 607 } |
| OLD | NEW |