| OLD | NEW |
| (Empty) |
| 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_CORE_CFWL_FORM_H_ | |
| 8 #define XFA_FWL_CORE_CFWL_FORM_H_ | |
| 9 | |
| 10 #include <memory> | |
| 11 | |
| 12 #include "core/fxcrt/fx_system.h" | |
| 13 #include "xfa/fwl/core/cfwl_widget.h" | |
| 14 #include "xfa/fwl/core/cfwl_widgetproperties.h" | |
| 15 | |
| 16 #define FWL_CLASS_Form L"FWL_FORM" | |
| 17 #define FWL_CLASS_FormProxy L"FWL_FORMPROXY" | |
| 18 #define FWL_STYLEEXT_FRM_Resize (1L << 0) | |
| 19 #define FWL_STYLEEXT_FRM_NativeBorder (1L << 1) | |
| 20 #define FWL_STYLEEXT_FRM_RoundCorner (2L << 1) | |
| 21 #define FWL_STYLEEXT_FRM_RoundCorner4 (3L << 1) | |
| 22 #define FWL_STYLEEXT_FRM_NoDrawClient (1L << 3) | |
| 23 #define FWL_STYLEEXT_FRM_BorderCornerMask (3L << 1) | |
| 24 #define FWL_STYLEEXT_FRM_Max (3) | |
| 25 | |
| 26 #if (_FX_OS_ == _FX_MACOSX_) | |
| 27 #define FWL_UseMacSystemBorder | |
| 28 #endif | |
| 29 | |
| 30 class CFWL_MsgMouse; | |
| 31 class CFWL_NoteLoop; | |
| 32 class CFWL_Widget; | |
| 33 class IFWL_ThemeProvider; | |
| 34 class CFWL_SysBtn; | |
| 35 | |
| 36 class CFWL_Form : public CFWL_Widget { | |
| 37 public: | |
| 38 CFWL_Form(const CFWL_App* app, | |
| 39 std::unique_ptr<CFWL_WidgetProperties> properties, | |
| 40 CFWL_Widget* pOuter); | |
| 41 ~CFWL_Form() override; | |
| 42 | |
| 43 // CFWL_Widget | |
| 44 FWL_Type GetClassID() const override; | |
| 45 bool IsInstance(const CFX_WideStringC& wsClass) const override; | |
| 46 void GetClientRect(CFX_RectF& rect) override; | |
| 47 void Update() override; | |
| 48 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; | |
| 49 void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; | |
| 50 void OnProcessMessage(CFWL_Message* pMessage) override; | |
| 51 void OnDrawWidget(CFX_Graphics* pGraphics, | |
| 52 const CFX_Matrix* pMatrix) override; | |
| 53 | |
| 54 CFWL_Widget* DoModal(); | |
| 55 void EndDoModal(); | |
| 56 | |
| 57 CFWL_Widget* GetSubFocus() const { return m_pSubFocus; } | |
| 58 void SetSubFocus(CFWL_Widget* pWidget) { m_pSubFocus = pWidget; } | |
| 59 | |
| 60 private: | |
| 61 void DrawBackground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme); | |
| 62 void RemoveSysButtons(); | |
| 63 CFWL_SysBtn* GetSysBtnAtPoint(FX_FLOAT fx, FX_FLOAT fy); | |
| 64 CFWL_SysBtn* GetSysBtnByState(uint32_t dwState); | |
| 65 CFWL_SysBtn* GetSysBtnByIndex(int32_t nIndex); | |
| 66 int32_t GetSysBtnIndex(CFWL_SysBtn* pBtn); | |
| 67 void GetEdgeRect(CFX_RectF& rtEdge); | |
| 68 void SetWorkAreaRect(); | |
| 69 void Layout(); | |
| 70 void ResetSysBtn(); | |
| 71 void RegisterForm(); | |
| 72 void UnRegisterForm(); | |
| 73 void OnLButtonDown(CFWL_MsgMouse* pMsg); | |
| 74 void OnLButtonUp(CFWL_MsgMouse* pMsg); | |
| 75 void OnMouseMove(CFWL_MsgMouse* pMsg); | |
| 76 void OnMouseLeave(CFWL_MsgMouse* pMsg); | |
| 77 void OnLButtonDblClk(CFWL_MsgMouse* pMsg); | |
| 78 | |
| 79 #if (_FX_OS_ == _FX_MACOSX_) | |
| 80 bool m_bMouseIn; | |
| 81 #endif | |
| 82 CFX_RectF m_rtRestore; | |
| 83 CFX_RectF m_rtRelative; | |
| 84 CFWL_SysBtn* m_pCloseBox; | |
| 85 CFWL_SysBtn* m_pMinBox; | |
| 86 CFWL_SysBtn* m_pMaxBox; | |
| 87 std::unique_ptr<CFWL_NoteLoop> m_pNoteLoop; | |
| 88 CFWL_Widget* m_pSubFocus; | |
| 89 FX_FLOAT m_fCXBorder; | |
| 90 FX_FLOAT m_fCYBorder; | |
| 91 int32_t m_iCaptureBtn; | |
| 92 int32_t m_iSysBox; | |
| 93 bool m_bLButtonDown; | |
| 94 bool m_bMaximized; | |
| 95 bool m_bSetMaximize; | |
| 96 bool m_bDoModalFlag; | |
| 97 }; | |
| 98 | |
| 99 #endif // XFA_FWL_CORE_CFWL_FORM_H_ | |
| OLD | NEW |