Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cpwl_special_button.cpp
Go to the documentation of this file.
1// Copyright 2014 The PDFium Authors
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 "fpdfsdk/pwl/cpwl_special_button.h"
8
9#include <utility>
10
11#include "fpdfsdk/pwl/cpwl_button.h"
12#include "fpdfsdk/pwl/cpwl_wnd.h"
13
14CPWL_PushButton::CPWL_PushButton(
15 const CreateParams& cp,
16 std::unique_ptr<IPWL_FillerNotify::PerWindowData> pAttachedData)
17 : CPWL_Button(cp, std::move(pAttachedData)) {}
18
19CPWL_PushButton::~CPWL_PushButton() = default;
20
21CFX_FloatRect CPWL_PushButton::GetFocusRect() const {
22 return GetWindowRect().GetDeflated(static_cast<float>(GetBorderWidth()),
23 static_cast<float>(GetBorderWidth()));
24}
25
26CPWL_CheckBox::CPWL_CheckBox(
27 const CreateParams& cp,
28 std::unique_ptr<IPWL_FillerNotify::PerWindowData> pAttachedData)
29 : CPWL_Button(cp, std::move(pAttachedData)) {}
30
31CPWL_CheckBox::~CPWL_CheckBox() = default;
32
33bool CPWL_CheckBox::OnLButtonUp(Mask<FWL_EVENTFLAG> nFlag,
34 const CFX_PointF& point) {
35 if (IsReadOnly())
36 return false;
37
39 return true;
40}
41
42bool CPWL_CheckBox::OnChar(uint16_t nChar, Mask<FWL_EVENTFLAG> nFlag) {
43 if (IsReadOnly())
44 return false;
45
47 return true;
48}
49
50CPWL_RadioButton::CPWL_RadioButton(
51 const CreateParams& cp,
52 std::unique_ptr<IPWL_FillerNotify::PerWindowData> pAttachedData)
53 : CPWL_Button(cp, std::move(pAttachedData)) {}
54
55CPWL_RadioButton::~CPWL_RadioButton() = default;
56
57bool CPWL_RadioButton::OnLButtonUp(Mask<FWL_EVENTFLAG> nFlag,
58 const CFX_PointF& point) {
59 if (IsReadOnly())
60 return false;
61
62 SetCheck(true);
63 return true;
64}
65
66bool CPWL_RadioButton::OnChar(uint16_t nChar, Mask<FWL_EVENTFLAG> nFlag) {
67 if (IsReadOnly())
68 return false;
69
70 SetCheck(true);
71 return true;
72}
bool OnChar(uint16_t nChar, Mask< FWL_EVENTFLAG > nFlag) override
~CPWL_CheckBox() override
CPWL_CheckBox(const CreateParams &cp, std::unique_ptr< IPWL_FillerNotify::PerWindowData > pAttachedData)
bool IsChecked() const
void SetCheck(bool bCheck)
bool OnLButtonUp(Mask< FWL_EVENTFLAG > nFlag, const CFX_PointF &point) override
CFX_FloatRect GetFocusRect() const override
CPWL_PushButton(const CreateParams &cp, std::unique_ptr< IPWL_FillerNotify::PerWindowData > pAttachedData)
~CPWL_PushButton() override
~CPWL_RadioButton() override
void SetCheck(bool bCheck)
bool OnChar(uint16_t nChar, Mask< FWL_EVENTFLAG > nFlag) override
CPWL_RadioButton(const CreateParams &cp, std::unique_ptr< IPWL_FillerNotify::PerWindowData > pAttachedData)
bool OnLButtonUp(Mask< FWL_EVENTFLAG > nFlag, const CFX_PointF &point) override
CFX_FloatRect GetWindowRect() const
Definition cpwl_wnd.cpp:440
int32_t GetBorderWidth() const
Definition cpwl_wnd.cpp:482
bool IsReadOnly() const
Definition cpwl_wnd.cpp:610