• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_FFPUSHBUTTON_H_
8 #define XFA_FXFA_CXFA_FFPUSHBUTTON_H_
9 
10 #include <memory>
11 
12 #include "xfa/fxfa/cxfa_fffield.h"
13 
14 #define XFA_FWL_PSBSTYLEEXT_HiliteInverted (1L << 0)
15 #define XFA_FWL_PSBSTYLEEXT_HilitePush (1L << 1)
16 #define XFA_FWL_PSBSTYLEEXT_HiliteOutLine (1L << 2)
17 
18 class CXFA_TextProvider;
19 
20 class CXFA_FFPushButton : public CXFA_FFField {
21  public:
22   explicit CXFA_FFPushButton(CXFA_Node* pNode);
23   ~CXFA_FFPushButton() override;
24 
25   // CXFA_FFField
26   void RenderWidget(CXFA_Graphics* pGS,
27                     const CFX_Matrix& matrix,
28                     uint32_t dwStatus) override;
29   bool LoadWidget() override;
30   void UnloadWidget() override;
31   bool PerformLayout() override;
32   void UpdateWidgetProperty() override;
33   void OnProcessMessage(CFWL_Message* pMessage) override;
34   void OnProcessEvent(CFWL_Event* pEvent) override;
35   void OnDrawWidget(CXFA_Graphics* pGraphics,
36                     const CFX_Matrix& matrix) override;
37   FormFieldType GetFormFieldType() override;
38 
39  private:
40   void LoadHighlightCaption();
41   void LayoutHighlightCaption();
42   void RenderHighlightCaption(CXFA_Graphics* pGS, CFX_Matrix* pMatrix);
43   float GetLineWidth();
44   FX_ARGB GetLineColor();
45   FX_ARGB GetFillColor();
46 
47   std::unique_ptr<CXFA_TextLayout> m_pRolloverTextLayout;
48   std::unique_ptr<CXFA_TextLayout> m_pDownTextLayout;
49   std::unique_ptr<CXFA_TextProvider> m_pRollProvider;
50   std::unique_ptr<CXFA_TextProvider> m_pDownProvider;
51   IFWL_WidgetDelegate* m_pOldDelegate;
52 };
53 
54 #endif  // XFA_FXFA_CXFA_FFPUSHBUTTON_H_
55