OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef XFA_FWL_CFWL_FORM_H_ | 7 #ifndef XFA_FWL_CFWL_FORM_H_ |
8 #define XFA_FWL_CFWL_FORM_H_ | 8 #define XFA_FWL_CFWL_FORM_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "core/fxcrt/fx_system.h" | 12 #include "core/fxcrt/fx_system.h" |
13 #include "xfa/fwl/cfwl_widget.h" | 13 #include "xfa/fwl/cfwl_widget.h" |
14 #include "xfa/fwl/cfwl_widgetproperties.h" | 14 #include "xfa/fwl/cfwl_widgetproperties.h" |
15 | 15 |
16 #define FWL_CLASS_Form L"FWL_FORM" | 16 #define FWL_CLASS_Form L"FWL_FORM" |
17 #define FWL_CLASS_FormProxy L"FWL_FORMPROXY" | 17 #define FWL_CLASS_FormProxy L"FWL_FORMPROXY" |
18 | 18 |
19 #if (_FX_OS_ == _FX_MACOSX_) | 19 #if (_FX_OS_ == _FX_MACOSX_) |
20 #define FWL_UseMacSystemBorder | 20 #define FWL_UseMacSystemBorder |
21 #endif | 21 #endif |
22 | 22 |
23 class CFWL_MessageMouse; | 23 class CFWL_MessageMouse; |
24 class CFWL_NoteLoop; | 24 class CFWL_NoteLoop; |
25 class CFWL_Widget; | 25 class CFWL_Widget; |
26 class IFWL_ThemeProvider; | 26 class IFWL_ThemeProvider; |
27 class CFWL_SysBtn; | |
28 | 27 |
29 class CFWL_Form : public CFWL_Widget { | 28 class CFWL_Form : public CFWL_Widget { |
30 public: | 29 public: |
31 CFWL_Form(const CFWL_App* app, | 30 CFWL_Form(const CFWL_App* app, |
32 std::unique_ptr<CFWL_WidgetProperties> properties, | 31 std::unique_ptr<CFWL_WidgetProperties> properties, |
33 CFWL_Widget* pOuter); | 32 CFWL_Widget* pOuter); |
34 ~CFWL_Form() override; | 33 ~CFWL_Form() override; |
35 | 34 |
36 // CFWL_Widget | 35 // CFWL_Widget |
37 FWL_Type GetClassID() const override; | 36 FWL_Type GetClassID() const override; |
38 bool IsInstance(const CFX_WideStringC& wsClass) const override; | 37 bool IsInstance(const CFX_WideStringC& wsClass) const override; |
39 CFX_RectF GetClientRect() override; | 38 CFX_RectF GetClientRect() override; |
40 void Update() override; | 39 void Update() override; |
41 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; | 40 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; |
42 void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; | 41 void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; |
43 void OnProcessMessage(CFWL_Message* pMessage) override; | 42 void OnProcessMessage(CFWL_Message* pMessage) override; |
44 void OnDrawWidget(CFX_Graphics* pGraphics, | 43 void OnDrawWidget(CFX_Graphics* pGraphics, |
45 const CFX_Matrix* pMatrix) override; | 44 const CFX_Matrix* pMatrix) override; |
46 | 45 |
47 CFWL_Widget* DoModal(); | 46 CFWL_Widget* DoModal(); |
48 void EndDoModal(); | 47 void EndDoModal(); |
49 | 48 |
50 CFWL_Widget* GetSubFocus() const { return m_pSubFocus; } | 49 CFWL_Widget* GetSubFocus() const { return m_pSubFocus; } |
51 void SetSubFocus(CFWL_Widget* pWidget) { m_pSubFocus = pWidget; } | 50 void SetSubFocus(CFWL_Widget* pWidget) { m_pSubFocus = pWidget; } |
52 | 51 |
53 private: | 52 private: |
54 void DrawBackground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme); | 53 void DrawBackground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme); |
55 void RemoveSysButtons(); | |
56 CFWL_SysBtn* GetSysBtnAtPoint(FX_FLOAT fx, FX_FLOAT fy); | |
57 CFWL_SysBtn* GetSysBtnByState(uint32_t dwState); | |
58 CFWL_SysBtn* GetSysBtnByIndex(int32_t nIndex); | |
59 int32_t GetSysBtnIndex(CFWL_SysBtn* pBtn); | |
60 CFX_RectF GetEdgeRect(); | 54 CFX_RectF GetEdgeRect(); |
61 void SetWorkAreaRect(); | 55 void SetWorkAreaRect(); |
62 void Layout(); | 56 void Layout(); |
63 void ResetSysBtn(); | |
64 void RegisterForm(); | 57 void RegisterForm(); |
65 void UnRegisterForm(); | 58 void UnRegisterForm(); |
66 void OnLButtonDown(CFWL_MessageMouse* pMsg); | 59 void OnLButtonDown(CFWL_MessageMouse* pMsg); |
67 void OnLButtonUp(CFWL_MessageMouse* pMsg); | 60 void OnLButtonUp(CFWL_MessageMouse* pMsg); |
68 void OnMouseMove(CFWL_MessageMouse* pMsg); | |
69 void OnMouseLeave(CFWL_MessageMouse* pMsg); | |
70 | 61 |
71 #if (_FX_OS_ == _FX_MACOSX_) | |
72 bool m_bMouseIn; | |
73 #endif | |
74 CFX_RectF m_rtRestore; | 62 CFX_RectF m_rtRestore; |
75 CFX_RectF m_rtRelative; | 63 CFX_RectF m_rtRelative; |
76 CFWL_SysBtn* m_pCloseBox; | |
77 CFWL_SysBtn* m_pMinBox; | |
78 CFWL_SysBtn* m_pMaxBox; | |
79 std::unique_ptr<CFWL_NoteLoop> m_pNoteLoop; | 64 std::unique_ptr<CFWL_NoteLoop> m_pNoteLoop; |
80 CFWL_Widget* m_pSubFocus; | 65 CFWL_Widget* m_pSubFocus; |
81 FX_FLOAT m_fCXBorder; | 66 FX_FLOAT m_fCXBorder; |
82 FX_FLOAT m_fCYBorder; | 67 FX_FLOAT m_fCYBorder; |
83 int32_t m_iCaptureBtn; | |
84 int32_t m_iSysBox; | |
85 bool m_bLButtonDown; | |
86 bool m_bMaximized; | |
87 bool m_bSetMaximize; | |
88 bool m_bDoModalFlag; | |
89 }; | 68 }; |
90 | 69 |
91 #endif // XFA_FWL_CFWL_FORM_H_ | 70 #endif // XFA_FWL_CFWL_FORM_H_ |
OLD | NEW |