blob: 018a20e1fb84c2094f6249d01618c25420d710d9 [file] [log] [blame]
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001// 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.
Lei Zhanga6d9f0e2015-06-13 00:48:38 -07004
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07005// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
Dan Sinclairc411eb92017-07-25 09:39:30 -04007#ifndef FPDFSDK_PWL_CPWL_SPECIAL_BUTTON_H_
8#define FPDFSDK_PWL_CPWL_SPECIAL_BUTTON_H_
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07009
Tom Sepez6fe32f82018-10-25 23:25:58 +000010#include <memory>
11
Dan Sinclairc411eb92017-07-25 09:39:30 -040012#include "fpdfsdk/pwl/cpwl_button.h"
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070013
Tom Sepez55865452018-08-27 20:18:04 +000014class CPWL_PushButton final : public CPWL_Button {
Nico Weber9d8ec5a2015-08-04 13:00:21 -070015 public:
Tom Sepezea9130d2019-08-06 21:55:57 +000016 CPWL_PushButton(
17 const CreateParams& cp,
Tom Sepez02cb5702022-05-09 23:41:19 +000018 std::unique_ptr<IPWL_FillerNotify::PerWindowData> pAttachedData);
Lei Zhang2b1a2d52015-08-14 22:16:22 -070019 ~CPWL_PushButton() override;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070020
Tom Sepez6fe32f82018-10-25 23:25:58 +000021 // CPWL_Button:
Tom Sepez281a9ea2016-02-26 14:24:28 -080022 CFX_FloatRect GetFocusRect() const override;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070023};
24
Tom Sepez55865452018-08-27 20:18:04 +000025class CPWL_CheckBox final : public CPWL_Button {
Nico Weber9d8ec5a2015-08-04 13:00:21 -070026 public:
Tom Sepezea9130d2019-08-06 21:55:57 +000027 CPWL_CheckBox(
28 const CreateParams& cp,
Tom Sepez02cb5702022-05-09 23:41:19 +000029 std::unique_ptr<IPWL_FillerNotify::PerWindowData> pAttachedData);
Lei Zhang2b1a2d52015-08-14 22:16:22 -070030 ~CPWL_CheckBox() override;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070031
Tom Sepez6fe32f82018-10-25 23:25:58 +000032 // CPWL_Button:
Tom Sepez6f9e9f62021-08-11 17:01:53 +000033 bool OnLButtonUp(Mask<FWL_EVENTFLAG> nFlag, const CFX_PointF& point) override;
34 bool OnChar(uint16_t nChar, Mask<FWL_EVENTFLAG> nFlag) override;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070035
Tom Sepez6fe32f82018-10-25 23:25:58 +000036 bool IsChecked() const { return m_bChecked; }
37 void SetCheck(bool bCheck) { m_bChecked = bCheck; }
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070038
Nico Weber9d8ec5a2015-08-04 13:00:21 -070039 private:
Tom Sepez6fe32f82018-10-25 23:25:58 +000040 bool m_bChecked = false;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070041};
42
Tom Sepez55865452018-08-27 20:18:04 +000043class CPWL_RadioButton final : public CPWL_Button {
Nico Weber9d8ec5a2015-08-04 13:00:21 -070044 public:
Tom Sepezea9130d2019-08-06 21:55:57 +000045 CPWL_RadioButton(
46 const CreateParams& cp,
Tom Sepez02cb5702022-05-09 23:41:19 +000047 std::unique_ptr<IPWL_FillerNotify::PerWindowData> pAttachedData);
Lei Zhang2b1a2d52015-08-14 22:16:22 -070048 ~CPWL_RadioButton() override;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070049
Lei Zhang2b1a2d52015-08-14 22:16:22 -070050 // CPWL_Button
Tom Sepez6f9e9f62021-08-11 17:01:53 +000051 bool OnLButtonUp(Mask<FWL_EVENTFLAG> nFlag, const CFX_PointF& point) override;
52 bool OnChar(uint16_t nChar, Mask<FWL_EVENTFLAG> nFlag) override;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070053
Tom Sepez6fe32f82018-10-25 23:25:58 +000054 bool IsChecked() const { return m_bChecked; }
55 void SetCheck(bool bCheck) { m_bChecked = bCheck; }
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070056
Nico Weber9d8ec5a2015-08-04 13:00:21 -070057 private:
Tom Sepez6fe32f82018-10-25 23:25:58 +000058 bool m_bChecked = false;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070059};
60
Dan Sinclairc411eb92017-07-25 09:39:30 -040061#endif // FPDFSDK_PWL_CPWL_SPECIAL_BUTTON_H_