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