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_APP_H_ 8 #define XFA_FWL_CFWL_APP_H_ 9 10 #include <memory> 11 12 #include "core/fxcrt/fx_string.h" 13 #include "core/fxcrt/timerhandler_iface.h" 14 #include "xfa/fwl/cfwl_widgetmgr.h" 15 16 class CFWL_NoteDriver; 17 class CFWL_WidgetMgr; 18 19 enum FWL_KeyFlag { 20 FWL_KEYFLAG_Ctrl = 1 << 0, 21 FWL_KEYFLAG_Alt = 1 << 1, 22 FWL_KEYFLAG_Shift = 1 << 2, 23 FWL_KEYFLAG_Command = 1 << 3, 24 FWL_KEYFLAG_LButton = 1 << 4, 25 FWL_KEYFLAG_RButton = 1 << 5, 26 FWL_KEYFLAG_MButton = 1 << 6 27 }; 28 29 class CFWL_App { 30 public: 31 class AdapterIface { 32 public: 33 virtual ~AdapterIface() = default; 34 virtual CFWL_WidgetMgr::AdapterIface* GetWidgetMgrAdapter() = 0; 35 virtual TimerHandlerIface* GetTimerHandler() = 0; 36 }; 37 38 explicit CFWL_App(AdapterIface* pAdapter); 39 ~CFWL_App(); 40 GetAdapterNative()41 AdapterIface* GetAdapterNative() const { return m_pAdapterNative.Get(); } GetWidgetMgr()42 CFWL_WidgetMgr* GetWidgetMgr() const { return m_pWidgetMgr.get(); } GetNoteDriver()43 CFWL_NoteDriver* GetNoteDriver() const { return m_pNoteDriver.get(); } 44 45 private: 46 UnownedPtr<AdapterIface> const m_pAdapterNative; 47 std::unique_ptr<CFWL_WidgetMgr> m_pWidgetMgr; 48 std::unique_ptr<CFWL_NoteDriver> m_pNoteDriver; 49 }; 50 51 #endif // XFA_FWL_CFWL_APP_H_ 52