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 #ifndef XFA_FXFA_CXFA_FFCHECKBUTTON_H_ 8 #define XFA_FXFA_CXFA_FFCHECKBUTTON_H_ 9 10 #include "v8/include/cppgc/member.h" 11 #include "xfa/fxfa/cxfa_fffield.h" 12 #include "xfa/fxfa/cxfa_ffpageview.h" 13 #include "xfa/fxfa/parser/cxfa_node.h" 14 15 class CXFA_CheckButton; 16 17 class CXFA_FFCheckButton final : public CXFA_FFField { 18 public: 19 CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED; 20 ~CXFA_FFCheckButton() override; 21 22 void Trace(cppgc::Visitor* visitor) const override; 23 24 // CXFA_FFField 25 void RenderWidget(CFGAS_GEGraphics* pGS, 26 const CFX_Matrix& matrix, 27 HighlightOption highlight) override; 28 29 bool LoadWidget() override; 30 bool PerformLayout() override; 31 bool UpdateFWLData() override; 32 void UpdateWidgetProperty() override; 33 bool OnLButtonUp(Mask<XFA_FWL_KeyFlag> dwFlags, 34 const CFX_PointF& point) override; 35 void OnProcessMessage(CFWL_Message* pMessage) override; 36 void OnProcessEvent(CFWL_Event* pEvent) override; 37 void OnDrawWidget(CFGAS_GEGraphics* pGraphics, 38 const CFX_Matrix& matrix) override; 39 FormFieldType GetFormFieldType() override; 40 41 void SetFWLCheckState(XFA_CheckState eCheckState); 42 43 private: 44 CXFA_FFCheckButton(CXFA_Node* pNode, CXFA_CheckButton* button); 45 46 bool CommitData() override; 47 bool IsDataChanged() override; 48 void CapLeftRightPlacement(const CXFA_Margin* captionMargin); 49 void AddUIMargin(XFA_AttributeValue iCapPlacement); 50 XFA_CheckState FWLState2XFAState(); 51 52 cppgc::Member<IFWL_WidgetDelegate> m_pOldDelegate; 53 cppgc::Member<CXFA_CheckButton> const button_; 54 CFX_RectF m_CheckBoxRect; 55 }; 56 57 #endif // XFA_FXFA_CXFA_FFCHECKBUTTON_H_ 58