xref: /aosp_15_r20/external/pdfium/xfa/fxfa/cxfa_ffpushbutton.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
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_FFPUSHBUTTON_H_
8 #define XFA_FXFA_CXFA_FFPUSHBUTTON_H_
9 
10 #include "v8/include/cppgc/member.h"
11 #include "xfa/fxfa/cxfa_fffield.h"
12 
13 #define XFA_FWL_PSBSTYLEEXT_HiliteInverted (1L << 0)
14 #define XFA_FWL_PSBSTYLEEXT_HilitePush (1L << 1)
15 #define XFA_FWL_PSBSTYLEEXT_HiliteOutLine (1L << 2)
16 
17 class CXFA_Button;
18 class CXFA_TextLayout;
19 class CXFA_TextProvider;
20 
21 class CXFA_FFPushButton final : public CXFA_FFField {
22  public:
23   CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED;
24   ~CXFA_FFPushButton() override;
25 
26   void Trace(cppgc::Visitor* visitor) const override;
27 
28   // CXFA_FFField
29   void RenderWidget(CFGAS_GEGraphics* pGS,
30                     const CFX_Matrix& matrix,
31                     HighlightOption highlight) override;
32   bool LoadWidget() override;
33   bool PerformLayout() override;
34   void UpdateWidgetProperty() 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  private:
42   CXFA_FFPushButton(CXFA_Node* pNode, CXFA_Button* button);
43 
44   void LoadHighlightCaption();
45   void LayoutHighlightCaption();
46   void RenderHighlightCaption(CFGAS_GEGraphics* pGS, CFX_Matrix* pMatrix);
47   float GetLineWidth();
48   FX_ARGB GetLineColor();
49   FX_ARGB GetFillColor();
50 
51   cppgc::Member<CXFA_TextLayout> m_pRolloverTextLayout;
52   cppgc::Member<CXFA_TextLayout> m_pDownTextLayout;
53   cppgc::Member<CXFA_TextProvider> m_pRollProvider;
54   cppgc::Member<CXFA_TextProvider> m_pDownProvider;
55   cppgc::Member<IFWL_WidgetDelegate> m_pOldDelegate;
56   cppgc::Member<CXFA_Button> const button_;
57 };
58 
59 #endif  // XFA_FXFA_CXFA_FFPUSHBUTTON_H_
60