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_CORE_IFWL_WIDGET_H_ | 7 #ifndef XFA_FWL_CORE_IFWL_WIDGET_H_ |
8 #define XFA_FWL_CORE_IFWL_WIDGET_H_ | 8 #define XFA_FWL_CORE_IFWL_WIDGET_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "core/fxcrt/include/fx_basic.h" | 12 #include "core/fxcrt/include/fx_basic.h" |
13 #include "core/fxcrt/include/fx_coordinates.h" | 13 #include "core/fxcrt/include/fx_coordinates.h" |
14 #include "core/fxcrt/include/fx_system.h" | 14 #include "core/fxcrt/include/fx_system.h" |
15 #include "xfa/fwl/core/fwl_error.h" | 15 #include "xfa/fwl/core/fwl_error.h" |
16 #include "xfa/fwl/core/fwl_widgetimp.h" | 16 #include "xfa/fwl/core/fwl_widgetimp.h" |
17 | 17 |
18 // FWL contains three parallel inheritance hierarchies, which reference each | 18 // FWL contains three parallel inheritance hierarchies, which reference each |
19 // other via pointers as follows: | 19 // other via pointers as follows: |
20 // | 20 // |
21 // m_pIface m_pImpl | 21 // m_pIface m_pImpl |
22 // CFWL_Widget ----------> IFWL_Widget ----------> CFWL_WidgetImp | 22 // CFWL_Widget ----------> IFWL_Widget ----------> CFWL_WidgetImp |
23 // | | | | 23 // | | | |
24 // A A A | 24 // A A A |
25 // | | | | 25 // | | | |
26 // CFWL_... IFWL_... CFWL_...Imp | 26 // CFWL_... IFWL_... CFWL_...Imp |
27 // | 27 // |
28 | 28 |
| 29 enum class FWL_Type { |
| 30 Unknown = 0, |
| 31 |
| 32 Barcode, |
| 33 Caret, |
| 34 CheckBox, |
| 35 ComboBox, |
| 36 DateTimePicker, |
| 37 Edit, |
| 38 Form, |
| 39 FormProxy, |
| 40 ListBox, |
| 41 MonthCalendar, |
| 42 PictureBox, |
| 43 PushButton, |
| 44 ScrollBar, |
| 45 SpinButton, |
| 46 ToolTip |
| 47 }; |
| 48 |
29 class CFWL_WidgetImp; | 49 class CFWL_WidgetImp; |
30 class CFX_Graphics; | 50 class CFX_Graphics; |
31 class IFWL_App; | 51 class IFWL_App; |
32 class IFWL_DataProvider; | 52 class IFWL_DataProvider; |
33 class IFWL_Form; | 53 class IFWL_Form; |
34 class IFWL_ThemeProvider; | 54 class IFWL_ThemeProvider; |
35 class IFWL_WidgetDelegate; | 55 class IFWL_WidgetDelegate; |
36 | 56 |
37 class IFWL_Widget { | 57 class IFWL_Widget { |
38 public: | 58 public: |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 IFWL_ThemeProvider* GetThemeProvider(); | 92 IFWL_ThemeProvider* GetThemeProvider(); |
73 FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); | 93 FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); |
74 FWL_Error SetDataProvider(IFWL_DataProvider* pDataProvider); | 94 FWL_Error SetDataProvider(IFWL_DataProvider* pDataProvider); |
75 IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate); | 95 IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate); |
76 IFWL_App* GetOwnerApp() const; | 96 IFWL_App* GetOwnerApp() const; |
77 CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent); | 97 CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent); |
78 | 98 |
79 // These call into equivalent polymorphic methods of m_pImpl. There | 99 // These call into equivalent polymorphic methods of m_pImpl. There |
80 // should be no need to override these in subclasses. | 100 // should be no need to override these in subclasses. |
81 FWL_Error GetClassName(CFX_WideString& wsClass) const; | 101 FWL_Error GetClassName(CFX_WideString& wsClass) const; |
82 uint32_t GetClassID() const; | 102 FWL_Type GetClassID() const; |
83 FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; | 103 FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; |
84 FWL_Error Initialize(); | 104 FWL_Error Initialize(); |
85 FWL_Error Finalize(); | 105 FWL_Error Finalize(); |
86 | 106 |
87 CFWL_WidgetImp* GetImpl() const { return m_pImpl.get(); } | 107 CFWL_WidgetImp* GetImpl() const { return m_pImpl.get(); } |
88 | 108 |
89 protected: | 109 protected: |
90 // Takes ownership of |pImpl|. | 110 // Takes ownership of |pImpl|. |
91 void SetImpl(CFWL_WidgetImp* pImpl) { m_pImpl.reset(pImpl); } | 111 void SetImpl(CFWL_WidgetImp* pImpl) { m_pImpl.reset(pImpl); } |
92 | 112 |
93 private: | 113 private: |
94 std::unique_ptr<CFWL_WidgetImp> m_pImpl; | 114 std::unique_ptr<CFWL_WidgetImp> m_pImpl; |
95 }; | 115 }; |
96 | 116 |
97 #endif // XFA_FWL_CORE_IFWL_WIDGET_H_ | 117 #endif // XFA_FWL_CORE_IFWL_WIDGET_H_ |
OLD | NEW |