• 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_FWL_CFWL_FORM_H_
8 #define XFA_FWL_CFWL_FORM_H_
9 
10 #include <memory>
11 
12 #include "core/fxcrt/fx_system.h"
13 #include "xfa/fwl/cfwl_widget.h"
14 #include "xfa/fwl/cfwl_widgetproperties.h"
15 
16 #define FWL_CLASS_Form L"FWL_FORM"
17 #define FWL_CLASS_FormProxy L"FWL_FORMPROXY"
18 
19 class CFWL_MessageMouse;
20 class CFWL_NoteLoop;
21 class CFWL_Widget;
22 class IFWL_ThemeProvider;
23 
24 class CFWL_Form : public CFWL_Widget {
25  public:
26   CFWL_Form(const CFWL_App* app,
27             std::unique_ptr<CFWL_WidgetProperties> properties,
28             CFWL_Widget* pOuter);
29   ~CFWL_Form() override;
30 
31   // CFWL_Widget
32   FWL_Type GetClassID() const override;
33   bool IsInstance(const WideStringView& wsClass) const override;
34   CFX_RectF GetClientRect() override;
35   void Update() override;
36   FWL_WidgetHit HitTest(const CFX_PointF& point) override;
37   void DrawWidget(CXFA_Graphics* pGraphics, const CFX_Matrix& matrix) override;
38   void OnProcessMessage(CFWL_Message* pMessage) override;
39   void OnDrawWidget(CXFA_Graphics* pGraphics,
40                     const CFX_Matrix& matrix) override;
41 
42   CFWL_Widget* DoModal();
43   void EndDoModal();
44 
GetSubFocus()45   CFWL_Widget* GetSubFocus() const { return m_pSubFocus; }
SetSubFocus(CFWL_Widget * pWidget)46   void SetSubFocus(CFWL_Widget* pWidget) { m_pSubFocus = pWidget; }
47 
48  private:
49   void DrawBackground(CXFA_Graphics* pGraphics, IFWL_ThemeProvider* pTheme);
50   CFX_RectF GetEdgeRect();
51   void SetWorkAreaRect();
52   void Layout();
53   void RegisterForm();
54   void UnRegisterForm();
55   void OnLButtonDown(CFWL_MessageMouse* pMsg);
56   void OnLButtonUp(CFWL_MessageMouse* pMsg);
57 
58   CFX_RectF m_rtRestore;
59   CFX_RectF m_rtRelative;
60   std::unique_ptr<CFWL_NoteLoop> m_pNoteLoop;
61   CFWL_Widget* m_pSubFocus;
62   float m_fCXBorder;
63   float m_fCYBorder;
64 };
65 
66 #endif  // XFA_FWL_CFWL_FORM_H_
67