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 _FWL_SDAPATER_IMP_H
8 #define _FWL_SDAPATER_IMP_H
9 class IFWL_AdapterNative;
10 class IFWL_AdapterWidgetMgr;
11 class IFWL_AdapterThreadMgr;
12 class IFWL_AdapterTimerMgr;
13 class IFWL_WidgetMgrDelegate;
14 class CFWL_SDAdatperNative;
15 class CFWL_SDAdapterWidgetMgr;
16 class CFWL_SDAdapterTimerMgr;
17 class CFWL_SDAdapterWidgetMgr : public IFWL_AdapterWidgetMgr {
18  public:
19   CFWL_SDAdapterWidgetMgr();
20   ~CFWL_SDAdapterWidgetMgr();
21   virtual FWL_ERR CreateWidget(IFWL_Widget* pWidget,
22                                IFWL_Widget* pParent = NULL);
23   virtual FWL_ERR DestroyWidget(IFWL_Widget* pWidget);
24   virtual FWL_ERR SetWidgetRect(IFWL_Widget* pWidget, const CFX_RectF& rect);
25   virtual FWL_ERR SetWidgetPosition(IFWL_Widget* pWidget,
26                                     FX_FLOAT fx,
27                                     FX_FLOAT fy);
28   virtual FWL_ERR SetParentWidget(IFWL_Widget* pWidget, IFWL_Widget* pParent);
29   virtual FWL_ERR ShowWidget(IFWL_Widget* pWidget);
30   virtual FWL_ERR HideWidget(IFWL_Widget* pWidget);
31   virtual FWL_ERR SetNormal(IFWL_Widget* pWidget);
32   virtual FWL_ERR SetMaximize(IFWL_Widget* pWidget);
33   virtual FWL_ERR SetMinimize(IFWL_Widget* pWidget);
34   virtual FWL_ERR RunWidget(IFWL_Widget* pWidget);
35   virtual FWL_ERR RepaintWidget(IFWL_Widget* pWidget, const CFX_RectF* pRect);
36   virtual FWL_ERR Exit(int32_t iExitCode);
37   virtual FWL_ERR CreateWidgetWithNativeId(IFWL_Widget* pWidget, void* vp);
38   virtual FX_BOOL GetPopupPos(IFWL_Widget* pWidget,
39                               FX_FLOAT fMinHeight,
40                               FX_FLOAT fMaxHeight,
41                               const CFX_RectF& rtAnchor,
42                               CFX_RectF& rtPopup);
43 
44  public:
45   virtual FWL_ERR GetWidgetRect(IFWL_Widget* pWidget, CFX_RectF& rect);
46   virtual FWL_ERR SetWidgetIcon(IFWL_Widget* pWidget,
47                                 const CFX_DIBitmap* pIcon,
48                                 FX_BOOL bBig);
49   virtual FWL_ERR SetWidgetCaption(IFWL_Widget* pWidget,
50                                    const CFX_WideStringC& wsCaption);
51   virtual FWL_ERR SetBorderRegion(IFWL_Widget* pWidget, CFX_Path* pPath);
52   virtual FWL_ERR SetTransparent(IFWL_Widget* pWidget, FX_DWORD dwAlpha);
53   virtual FWL_ERR SetFullScreen(IFWL_Widget* pWidget, FX_BOOL bFullScreen);
54   virtual FX_BOOL CheckMessage();
55   virtual FX_BOOL IsIdleMessage();
56   virtual FWL_ERR DispatchMessage();
57   virtual FWL_ERR GetWidgetDC(IFWL_Widget* pWidget, void*& pDC);
58   virtual FWL_ERR ReleaseWidgetDC(IFWL_Widget* pWidget,
59                                   void* pDC,
60                                   CFX_RectF* pClip = 0);
61   virtual void* GetWindow(IFWL_Widget* pWidget);
62   virtual FX_DWORD GetKeyState(FX_DWORD dwVirtKey);
63   virtual FWL_ERR RunLoop(IFWL_Widget* widget);
64   virtual FWL_ERR EndLoop();
65   virtual FWL_ERR InitMenu(IFWL_Menu* pMenu, IFWL_MenuDP* pMenuData);
66   virtual FWL_ERR UpdateMenu(IFWL_Menu* pMenu,
67                              const void* hItem,
68                              int32_t iType);
69   virtual int32_t TrackPopupMenu(IFWL_Menu* pMenu, IFWL_MenuDP* pMenuData);
70   virtual FWL_ERR SetMessageHook(IFWL_AdapterMessageHook* hook);
71   virtual FWL_ERR GetSystemBorder(FX_FLOAT& l,
72                                   FX_FLOAT& t,
73                                   FX_FLOAT& r,
74                                   FX_FLOAT& b);
75 };
76 class CFWL_SDAdapterThreadMgr : public IFWL_AdapterThreadMgr {
77  public:
78   CFWL_SDAdapterThreadMgr();
79   ~CFWL_SDAdapterThreadMgr();
80 
81  public:
82   virtual FWL_ERR Start(IFWL_Thread* pThread,
83                         FWL_HTHREAD& hThread,
84                         FX_BOOL bSuspended = FALSE);
85   virtual FWL_ERR Resume(FWL_HTHREAD hThread);
86   virtual FWL_ERR Suspend(FWL_HTHREAD hThread);
87   virtual FWL_ERR Kill(FWL_HTHREAD hThread, int32_t iExitCode);
88   virtual FWL_ERR Stop(FWL_HTHREAD hThread, int32_t iExitCode);
89   virtual IFWL_Thread* GetCurrentThread();
90 };
91 #endif
92