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 "../../include/pdfwindow/PDFWindow.h" | 7 #include "../../include/pdfwindow/PDFWindow.h" |
8 #include "../../include/pdfwindow/PWL_Wnd.h" | 8 #include "../../include/pdfwindow/PWL_Wnd.h" |
9 #include "../../include/pdfwindow/PWL_Button.h" | 9 #include "../../include/pdfwindow/PWL_Button.h" |
10 #include "../../include/pdfwindow/PWL_SpecialButton.h" | 10 #include "../../include/pdfwindow/PWL_SpecialButton.h" |
11 #include "../../include/pdfwindow/PWL_Utils.h" | 11 #include "../../include/pdfwindow/PWL_Utils.h" |
12 | 12 |
13 /* --------------------------- CPWL_PushButton ---------------------------- */ | 13 /* --------------------------- CPWL_PushButton ---------------------------- */ |
14 | 14 |
15 CPWL_PushButton::CPWL_PushButton() | 15 CPWL_PushButton::CPWL_PushButton() { |
16 { | |
17 } | 16 } |
18 | 17 |
19 CPWL_PushButton::~CPWL_PushButton() | 18 CPWL_PushButton::~CPWL_PushButton() { |
20 { | |
21 } | 19 } |
22 | 20 |
23 CFX_ByteString CPWL_PushButton::GetClassName() const | 21 CFX_ByteString CPWL_PushButton::GetClassName() const { |
24 { | 22 return "CPWL_PushButton"; |
25 » return "CPWL_PushButton"; | |
26 } | 23 } |
27 | 24 |
28 CPDF_Rect CPWL_PushButton::GetFocusRect() const | 25 CPDF_Rect CPWL_PushButton::GetFocusRect() const { |
29 { | 26 return CPWL_Utils::DeflateRect(this->GetWindowRect(), |
30 » return CPWL_Utils::DeflateRect(this->GetWindowRect(),(FX_FLOAT)GetBorder
Width()); | 27 (FX_FLOAT)GetBorderWidth()); |
31 } | 28 } |
32 | 29 |
33 /* --------------------------- CPWL_CheckBox ---------------------------- */ | 30 /* --------------------------- CPWL_CheckBox ---------------------------- */ |
34 | 31 |
35 CPWL_CheckBox::CPWL_CheckBox() : m_bChecked(FALSE) | 32 CPWL_CheckBox::CPWL_CheckBox() : m_bChecked(FALSE) { |
36 { | |
37 } | 33 } |
38 | 34 |
39 CPWL_CheckBox::~CPWL_CheckBox() | 35 CPWL_CheckBox::~CPWL_CheckBox() { |
40 { | |
41 } | 36 } |
42 | 37 |
43 CFX_ByteString CPWL_CheckBox::GetClassName() const | 38 CFX_ByteString CPWL_CheckBox::GetClassName() const { |
44 { | 39 return "CPWL_CheckBox"; |
45 » return "CPWL_CheckBox"; | |
46 } | 40 } |
47 | 41 |
48 void CPWL_CheckBox::SetCheck(FX_BOOL bCheck) | 42 void CPWL_CheckBox::SetCheck(FX_BOOL bCheck) { |
49 { | 43 m_bChecked = bCheck; |
50 » m_bChecked = bCheck; | |
51 } | 44 } |
52 | 45 |
53 FX_BOOL CPWL_CheckBox::IsChecked() const | 46 FX_BOOL CPWL_CheckBox::IsChecked() const { |
54 { | 47 return m_bChecked; |
55 » return m_bChecked; | |
56 } | 48 } |
57 | 49 |
58 FX_BOOL CPWL_CheckBox::OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag) | 50 FX_BOOL CPWL_CheckBox::OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) { |
59 { | 51 if (IsReadOnly()) |
60 » if (IsReadOnly()) return FALSE; | 52 return FALSE; |
61 | 53 |
62 » SetCheck(!IsChecked()); | 54 SetCheck(!IsChecked()); |
63 » return TRUE; | 55 return TRUE; |
64 } | 56 } |
65 | 57 |
66 FX_BOOL CPWL_CheckBox::OnChar(FX_WORD nChar, FX_DWORD nFlag) | 58 FX_BOOL CPWL_CheckBox::OnChar(FX_WORD nChar, FX_DWORD nFlag) { |
67 { | 59 SetCheck(!IsChecked()); |
68 » SetCheck(!IsChecked()); | 60 return TRUE; |
69 » return TRUE; | |
70 } | 61 } |
71 | 62 |
72 /* --------------------------- CPWL_RadioButton ---------------------------- */ | 63 /* --------------------------- CPWL_RadioButton ---------------------------- */ |
73 | 64 |
74 CPWL_RadioButton::CPWL_RadioButton() : m_bChecked(FALSE) | 65 CPWL_RadioButton::CPWL_RadioButton() : m_bChecked(FALSE) { |
75 { | |
76 } | 66 } |
77 | 67 |
78 CPWL_RadioButton::~CPWL_RadioButton() | 68 CPWL_RadioButton::~CPWL_RadioButton() { |
79 { | |
80 } | 69 } |
81 | 70 |
82 CFX_ByteString CPWL_RadioButton::GetClassName() const | 71 CFX_ByteString CPWL_RadioButton::GetClassName() const { |
83 { | 72 return "CPWL_RadioButton"; |
84 » return "CPWL_RadioButton"; | |
85 } | 73 } |
86 | 74 |
87 FX_BOOL»CPWL_RadioButton::OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag) | 75 FX_BOOL CPWL_RadioButton::OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) { |
88 { | 76 if (IsReadOnly()) |
89 » if (IsReadOnly()) return FALSE; | 77 return FALSE; |
90 | 78 |
91 » SetCheck(TRUE); | 79 SetCheck(TRUE); |
92 » return TRUE; | 80 return TRUE; |
93 } | 81 } |
94 | 82 |
95 void CPWL_RadioButton::SetCheck(FX_BOOL bCheck) | 83 void CPWL_RadioButton::SetCheck(FX_BOOL bCheck) { |
96 { | 84 m_bChecked = bCheck; |
97 » m_bChecked = bCheck; | |
98 } | 85 } |
99 | 86 |
100 FX_BOOL CPWL_RadioButton::IsChecked() const | 87 FX_BOOL CPWL_RadioButton::IsChecked() const { |
101 { | 88 return m_bChecked; |
102 » return m_bChecked; | |
103 } | 89 } |
104 | 90 |
105 FX_BOOL CPWL_RadioButton::OnChar(FX_WORD nChar, FX_DWORD nFlag) | 91 FX_BOOL CPWL_RadioButton::OnChar(FX_WORD nChar, FX_DWORD nFlag) { |
106 { | 92 SetCheck(TRUE); |
107 » SetCheck(TRUE); | 93 return TRUE; |
108 » return TRUE; | |
109 } | 94 } |
110 | |
OLD | NEW |