• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #include "../../include/pdfwindow/PDFWindow.h"
8 #include "../../include/pdfwindow/PWL_Wnd.h"
9 #include "../../include/pdfwindow/PWL_Button.h"
10 #include "../../include/pdfwindow/PWL_SpecialButton.h"
11 #include "../../include/pdfwindow/PWL_Utils.h"
12 
13 /* --------------------------- CPWL_PushButton ---------------------------- */
14 
CPWL_PushButton()15 CPWL_PushButton::CPWL_PushButton()
16 {
17 }
18 
~CPWL_PushButton()19 CPWL_PushButton::~CPWL_PushButton()
20 {
21 }
22 
GetClassName() const23 CFX_ByteString CPWL_PushButton::GetClassName() const
24 {
25 	return "CPWL_PushButton";
26 }
27 
GetFocusRect() const28 CPDF_Rect CPWL_PushButton::GetFocusRect() const
29 {
30 	return CPWL_Utils::DeflateRect(this->GetWindowRect(),(FX_FLOAT)GetBorderWidth());
31 }
32 
33 /* --------------------------- CPWL_CheckBox ---------------------------- */
34 
CPWL_CheckBox()35 CPWL_CheckBox::CPWL_CheckBox() : m_bChecked(FALSE)
36 {
37 }
38 
~CPWL_CheckBox()39 CPWL_CheckBox::~CPWL_CheckBox()
40 {
41 }
42 
GetClassName() const43 CFX_ByteString CPWL_CheckBox::GetClassName() const
44 {
45 	return "CPWL_CheckBox";
46 }
47 
SetCheck(FX_BOOL bCheck)48 void CPWL_CheckBox::SetCheck(FX_BOOL bCheck)
49 {
50 	m_bChecked = bCheck;
51 }
52 
IsChecked() const53 FX_BOOL CPWL_CheckBox::IsChecked() const
54 {
55 	return m_bChecked;
56 }
57 
OnLButtonUp(const CPDF_Point & point)58 FX_BOOL CPWL_CheckBox::OnLButtonUp(const CPDF_Point & point)
59 {
60 	if (IsReadOnly()) return FALSE;
61 
62 	SetCheck(!IsChecked());
63 	return TRUE;
64 }
65 
OnChar(FX_WORD nChar)66 FX_BOOL CPWL_CheckBox::OnChar(FX_WORD nChar)
67 {
68 	SetCheck(!IsChecked());
69 	return TRUE;
70 }
71 
72 /* --------------------------- CPWL_RadioButton ---------------------------- */
73 
CPWL_RadioButton()74 CPWL_RadioButton::CPWL_RadioButton() : m_bChecked(FALSE)
75 {
76 }
77 
~CPWL_RadioButton()78 CPWL_RadioButton::~CPWL_RadioButton()
79 {
80 }
81 
GetClassName() const82 CFX_ByteString CPWL_RadioButton::GetClassName() const
83 {
84 	return "CPWL_RadioButton";
85 }
86 
OnLButtonUp(const CPDF_Point & point)87 FX_BOOL	CPWL_RadioButton::OnLButtonUp(const CPDF_Point & point)
88 {
89 	if (IsReadOnly()) return FALSE;
90 
91 	SetCheck(TRUE);
92 	return TRUE;
93 }
94 
SetCheck(FX_BOOL bCheck)95 void CPWL_RadioButton::SetCheck(FX_BOOL bCheck)
96 {
97 	m_bChecked = bCheck;
98 }
99 
IsChecked() const100 FX_BOOL CPWL_RadioButton::IsChecked() const
101 {
102 	return m_bChecked;
103 }
104 
OnChar(FX_WORD nChar)105 FX_BOOL CPWL_RadioButton::OnChar(FX_WORD nChar)
106 {
107 	SetCheck(TRUE);
108 	return TRUE;
109 }
110 
111