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_INCLUDE_FWL_CORE_FWL_WIDGET_H_ | 7 #ifndef XFA_FWL_CORE_IFWL_WIDGET_H_ |
8 #define XFA_INCLUDE_FWL_CORE_FWL_WIDGET_H_ | 8 #define XFA_FWL_CORE_IFWL_WIDGET_H_ |
9 | 9 |
10 #include "xfa/include/fwl/core/fwl_note.h" | 10 #include "xfa/fwl/core/fwl_error.h" |
11 #include "xfa/include/fwl/core/fwl_target.h" | 11 #include "core/fxcrt/include/fx_coordinates.h" |
12 #include "xfa/include/fwl/core/fwl_widgetdef.h" | 12 #include "core/fxcrt/include/fx_system.h" |
| 13 #include "core/fxcrt/include/fx_basic.h" |
| 14 #include "xfa/fwl/core/ifwl_target.h" |
13 | 15 |
| 16 class CFX_Graphics; |
| 17 class IFWL_DataProvider; |
| 18 class IFWL_Form; |
| 19 class IFWL_NoteThread; |
14 class IFWL_ThemeProvider; | 20 class IFWL_ThemeProvider; |
15 class CFWL_WidgetImpProperties; | |
16 class IFWL_DataProvider; | |
17 class IFWL_Widget; | |
18 class IFWL_WidgetDelegate; | 21 class IFWL_WidgetDelegate; |
19 class IFWL_Custom; | |
20 class IFWL_Proxy; | |
21 class IFWL_Form; | |
22 | 22 |
23 class IFWL_DataProvider { | |
24 public: | |
25 virtual ~IFWL_DataProvider() {} | |
26 virtual FWL_ERR GetCaption(IFWL_Widget* pWidget, | |
27 CFX_WideString& wsCaption) = 0; | |
28 }; | |
29 class IFWL_Widget : public IFWL_Target { | 23 class IFWL_Widget : public IFWL_Target { |
30 public: | 24 public: |
31 FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); | 25 FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); |
32 FWL_ERR GetGlobalRect(CFX_RectF& rect); | 26 FWL_ERR GetGlobalRect(CFX_RectF& rect); |
33 FWL_ERR SetWidgetRect(const CFX_RectF& rect); | 27 FWL_ERR SetWidgetRect(const CFX_RectF& rect); |
34 FWL_ERR GetClientRect(CFX_RectF& rect); | 28 FWL_ERR GetClientRect(CFX_RectF& rect); |
35 IFWL_Widget* GetParent(); | 29 IFWL_Widget* GetParent(); |
36 FWL_ERR SetParent(IFWL_Widget* pParent); | 30 FWL_ERR SetParent(IFWL_Widget* pParent); |
37 IFWL_Widget* GetOwner(); | 31 IFWL_Widget* GetOwner(); |
38 FWL_ERR SetOwner(IFWL_Widget* pOwner); | 32 FWL_ERR SetOwner(IFWL_Widget* pOwner); |
(...skipping 17 matching lines...) Expand all Loading... |
56 FWL_ERR GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); | 50 FWL_ERR GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); |
57 FWL_ERR SetMatrix(const CFX_Matrix& matrix); | 51 FWL_ERR SetMatrix(const CFX_Matrix& matrix); |
58 FWL_ERR DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = NULL); | 52 FWL_ERR DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = NULL); |
59 IFWL_ThemeProvider* GetThemeProvider(); | 53 IFWL_ThemeProvider* GetThemeProvider(); |
60 FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); | 54 FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); |
61 FWL_ERR SetDataProvider(IFWL_DataProvider* pDataProvider); | 55 FWL_ERR SetDataProvider(IFWL_DataProvider* pDataProvider); |
62 IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate); | 56 IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate); |
63 IFWL_NoteThread* GetOwnerThread() const; | 57 IFWL_NoteThread* GetOwnerThread() const; |
64 CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent); | 58 CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent); |
65 }; | 59 }; |
66 class IFWL_WidgetDelegate { | |
67 public: | |
68 virtual ~IFWL_WidgetDelegate() {} | |
69 virtual int32_t OnProcessMessage(CFWL_Message* pMessage) = 0; | |
70 virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent) = 0; | |
71 virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, | |
72 const CFX_Matrix* pMatrix = NULL) = 0; | |
73 }; | |
74 class CFWL_WidgetImpProperties { | |
75 public: | |
76 CFWL_WidgetImpProperties() { | |
77 m_ctmOnParent.SetIdentity(); | |
78 m_rtWidget.Set(0, 0, 0, 0); | |
79 m_dwStyles = FWL_WGTSTYLE_Child; | |
80 m_dwStyleExes = 0; | |
81 m_dwStates = 0; | |
82 m_pThemeProvider = NULL; | |
83 m_pDataProvider = NULL; | |
84 m_pParent = NULL; | |
85 m_pOwner = NULL; | |
86 } | |
87 CFX_Matrix m_ctmOnParent; | |
88 CFX_RectF m_rtWidget; | |
89 FX_DWORD m_dwStyles; | |
90 FX_DWORD m_dwStyleExes; | |
91 FX_DWORD m_dwStates; | |
92 IFWL_ThemeProvider* m_pThemeProvider; | |
93 IFWL_DataProvider* m_pDataProvider; | |
94 IFWL_Widget* m_pParent; | |
95 IFWL_Widget* m_pOwner; | |
96 }; | |
97 class IFWL_Custom : public IFWL_Widget { | |
98 public: | |
99 static IFWL_Custom* Create(const CFWL_WidgetImpProperties& properties, | |
100 IFWL_Widget* pOuter); | |
101 | 60 |
102 FWL_ERR SetProxy(IFWL_Proxy* pProxy); | 61 typedef CFX_MapPtrTemplate<FX_DWORD, FX_DWORD> CFX_MapAccelerators; |
103 | 62 |
104 protected: | |
105 IFWL_Custom(); | |
106 }; | |
107 class IFWL_Proxy { | |
108 public: | |
109 virtual ~IFWL_Proxy() {} | |
110 virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) = 0; | |
111 virtual FWL_ERR Update() = 0; | |
112 }; | |
113 typedef CFX_MapPtrTemplate<FX_DWORD, FX_DWORD> CFX_MapAccelerators; | |
114 FWL_ERR FWL_Accelerator_SetApp(CFX_MapAccelerators* pMapAccel); | 63 FWL_ERR FWL_Accelerator_SetApp(CFX_MapAccelerators* pMapAccel); |
115 FWL_ERR FWL_Accelerator_SetThread(CFX_MapAccelerators* pMapAccel); | 64 FWL_ERR FWL_Accelerator_SetThread(CFX_MapAccelerators* pMapAccel); |
116 FWL_ERR FWL_Accelerator_SetForm(IFWL_Form* pFrom, | 65 FWL_ERR FWL_Accelerator_SetForm(IFWL_Form* pFrom, |
117 CFX_MapAccelerators* pMapAccel); | 66 CFX_MapAccelerators* pMapAccel); |
118 FWL_ERR FWL_EnabelWidget(IFWL_Widget* widget, FX_BOOL bEnable); | 67 FWL_ERR FWL_EnabelWidget(IFWL_Widget* widget, FX_BOOL bEnable); |
119 | 68 |
120 #endif // XFA_INCLUDE_FWL_CORE_FWL_WIDGET_H_ | 69 #endif // XFA_FWL_CORE_IFWL_WIDGET_H_ |
OLD | NEW |