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#ifndef XFA_FXFA_CXFA_FFCHECKBUTTON_H_
8#define XFA_FXFA_CXFA_FFCHECKBUTTON_H_
9
10#include "xfa/fxfa/cxfa_fffield.h"
11#include "xfa/fxfa/cxfa_ffpageview.h"
12
13class CXFA_FFCheckButton : public CXFA_FFField {
14 public:
15  explicit CXFA_FFCheckButton(CXFA_Node* pNode);
16  ~CXFA_FFCheckButton() override;
17
18  // CXFA_FFField
19  void RenderWidget(CXFA_Graphics* pGS,
20                    const CFX_Matrix& matrix,
21                    uint32_t dwStatus) override;
22
23  bool LoadWidget() override;
24  bool PerformLayout() override;
25  bool UpdateFWLData() override;
26  void UpdateWidgetProperty() override;
27  bool OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) override;
28  void OnProcessMessage(CFWL_Message* pMessage) override;
29  void OnProcessEvent(CFWL_Event* pEvent) override;
30  void OnDrawWidget(CXFA_Graphics* pGraphics,
31                    const CFX_Matrix& matrix) override;
32  FormFieldType GetFormFieldType() override;
33
34  void SetFWLCheckState(XFA_CHECKSTATE eCheckState);
35
36 private:
37  bool CommitData() override;
38  bool IsDataChanged() override;
39  void CapLeftRightPlacement(const CXFA_Margin* captionMargin);
40  void AddUIMargin(XFA_AttributeEnum iCapPlacement);
41  XFA_CHECKSTATE FWLState2XFAState();
42
43  IFWL_WidgetDelegate* m_pOldDelegate;
44  CFX_RectF m_rtCheckBox;
45};
46
47#endif  // XFA_FXFA_CXFA_FFCHECKBUTTON_H_
48