| 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/PWL_Button.h" | 7 #include "fpdfsdk/include/pdfwindow/PWL_Button.h" |
| 8 #include "fpdfsdk/include/pdfwindow/PWL_SpecialButton.h" | 8 #include "fpdfsdk/include/pdfwindow/PWL_SpecialButton.h" |
| 9 #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" | 9 #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" |
| 10 #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" | 10 #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" |
| 11 | 11 |
| 12 CPWL_PushButton::CPWL_PushButton() {} | 12 CPWL_PushButton::CPWL_PushButton() {} |
| 13 | 13 |
| 14 CPWL_PushButton::~CPWL_PushButton() {} | 14 CPWL_PushButton::~CPWL_PushButton() {} |
| 15 | 15 |
| 16 CFX_ByteString CPWL_PushButton::GetClassName() const { | 16 CFX_ByteString CPWL_PushButton::GetClassName() const { |
| 17 return "CPWL_PushButton"; | 17 return "CPWL_PushButton"; |
| 18 } | 18 } |
| 19 | 19 |
| 20 CFX_FloatRect CPWL_PushButton::GetFocusRect() const { | 20 CPDF_Rect CPWL_PushButton::GetFocusRect() const { |
| 21 return CPWL_Utils::DeflateRect(GetWindowRect(), (FX_FLOAT)GetBorderWidth()); | 21 return CPWL_Utils::DeflateRect(GetWindowRect(), (FX_FLOAT)GetBorderWidth()); |
| 22 } | 22 } |
| 23 | 23 |
| 24 CPWL_CheckBox::CPWL_CheckBox() : m_bChecked(FALSE) {} | 24 CPWL_CheckBox::CPWL_CheckBox() : m_bChecked(FALSE) {} |
| 25 | 25 |
| 26 CPWL_CheckBox::~CPWL_CheckBox() {} | 26 CPWL_CheckBox::~CPWL_CheckBox() {} |
| 27 | 27 |
| 28 CFX_ByteString CPWL_CheckBox::GetClassName() const { | 28 CFX_ByteString CPWL_CheckBox::GetClassName() const { |
| 29 return "CPWL_CheckBox"; | 29 return "CPWL_CheckBox"; |
| 30 } | 30 } |
| 31 | 31 |
| 32 void CPWL_CheckBox::SetCheck(FX_BOOL bCheck) { | 32 void CPWL_CheckBox::SetCheck(FX_BOOL bCheck) { |
| 33 m_bChecked = bCheck; | 33 m_bChecked = bCheck; |
| 34 } | 34 } |
| 35 | 35 |
| 36 FX_BOOL CPWL_CheckBox::IsChecked() const { | 36 FX_BOOL CPWL_CheckBox::IsChecked() const { |
| 37 return m_bChecked; | 37 return m_bChecked; |
| 38 } | 38 } |
| 39 | 39 |
| 40 FX_BOOL CPWL_CheckBox::OnLButtonUp(const CFX_FloatPoint& point, | 40 FX_BOOL CPWL_CheckBox::OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) { |
| 41 FX_DWORD nFlag) { | |
| 42 if (IsReadOnly()) | 41 if (IsReadOnly()) |
| 43 return FALSE; | 42 return FALSE; |
| 44 | 43 |
| 45 SetCheck(!IsChecked()); | 44 SetCheck(!IsChecked()); |
| 46 return TRUE; | 45 return TRUE; |
| 47 } | 46 } |
| 48 | 47 |
| 49 FX_BOOL CPWL_CheckBox::OnChar(FX_WORD nChar, FX_DWORD nFlag) { | 48 FX_BOOL CPWL_CheckBox::OnChar(FX_WORD nChar, FX_DWORD nFlag) { |
| 50 SetCheck(!IsChecked()); | 49 SetCheck(!IsChecked()); |
| 51 return TRUE; | 50 return TRUE; |
| 52 } | 51 } |
| 53 | 52 |
| 54 CPWL_RadioButton::CPWL_RadioButton() : m_bChecked(FALSE) {} | 53 CPWL_RadioButton::CPWL_RadioButton() : m_bChecked(FALSE) {} |
| 55 | 54 |
| 56 CPWL_RadioButton::~CPWL_RadioButton() {} | 55 CPWL_RadioButton::~CPWL_RadioButton() {} |
| 57 | 56 |
| 58 CFX_ByteString CPWL_RadioButton::GetClassName() const { | 57 CFX_ByteString CPWL_RadioButton::GetClassName() const { |
| 59 return "CPWL_RadioButton"; | 58 return "CPWL_RadioButton"; |
| 60 } | 59 } |
| 61 | 60 |
| 62 FX_BOOL CPWL_RadioButton::OnLButtonUp(const CFX_FloatPoint& point, | 61 FX_BOOL CPWL_RadioButton::OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) { |
| 63 FX_DWORD nFlag) { | |
| 64 if (IsReadOnly()) | 62 if (IsReadOnly()) |
| 65 return FALSE; | 63 return FALSE; |
| 66 | 64 |
| 67 SetCheck(TRUE); | 65 SetCheck(TRUE); |
| 68 return TRUE; | 66 return TRUE; |
| 69 } | 67 } |
| 70 | 68 |
| 71 void CPWL_RadioButton::SetCheck(FX_BOOL bCheck) { | 69 void CPWL_RadioButton::SetCheck(FX_BOOL bCheck) { |
| 72 m_bChecked = bCheck; | 70 m_bChecked = bCheck; |
| 73 } | 71 } |
| 74 | 72 |
| 75 FX_BOOL CPWL_RadioButton::IsChecked() const { | 73 FX_BOOL CPWL_RadioButton::IsChecked() const { |
| 76 return m_bChecked; | 74 return m_bChecked; |
| 77 } | 75 } |
| 78 | 76 |
| 79 FX_BOOL CPWL_RadioButton::OnChar(FX_WORD nChar, FX_DWORD nFlag) { | 77 FX_BOOL CPWL_RadioButton::OnChar(FX_WORD nChar, FX_DWORD nFlag) { |
| 80 SetCheck(TRUE); | 78 SetCheck(TRUE); |
| 81 return TRUE; | 79 return TRUE; |
| 82 } | 80 } |
| OLD | NEW |