Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: xfa/fwl/core/ifwl_form.h

Issue 2432423002: Merge the CFWL_*Imp classes into the IFWL_* classes. (Closed)
Patch Set: Review feedback Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fwl/core/ifwl_edit.cpp ('k') | xfa/fwl/core/ifwl_form.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_FORM_H_ 7 #ifndef XFA_FWL_CORE_IFWL_FORM_H_
8 #define XFA_FWL_CORE_IFWL_FORM_H_ 8 #define XFA_FWL_CORE_IFWL_FORM_H_
9 9
10 #include <memory>
11
10 #include "core/fxcrt/fx_system.h" 12 #include "core/fxcrt/fx_system.h"
11 #include "xfa/fwl/core/cfwl_widgetimpproperties.h" 13 #include "xfa/fwl/core/cfwl_widgetimpproperties.h"
12 #include "xfa/fwl/core/ifwl_dataprovider.h" 14 #include "xfa/fwl/core/ifwl_dataprovider.h"
13 #include "xfa/fwl/core/ifwl_widget.h" 15 #include "xfa/fwl/core/ifwl_widget.h"
14 16
15 #define FWL_CLASS_Form L"FWL_FORM" 17 #define FWL_CLASS_Form L"FWL_FORM"
16 #define FWL_CLASS_FormProxy L"FWL_FORMPROXY" 18 #define FWL_CLASS_FormProxy L"FWL_FORMPROXY"
17 #define FWL_STYLEEXT_FRM_Resize (1L << 0) 19 #define FWL_STYLEEXT_FRM_Resize (1L << 0)
18 #define FWL_STYLEEXT_FRM_NativeBorder (1L << 1) 20 #define FWL_STYLEEXT_FRM_NativeBorder (1L << 1)
19 #define FWL_STYLEEXT_FRM_RoundCorner (2L << 1) 21 #define FWL_STYLEEXT_FRM_RoundCorner (2L << 1)
20 #define FWL_STYLEEXT_FRM_RoundCorner4 (3L << 1) 22 #define FWL_STYLEEXT_FRM_RoundCorner4 (3L << 1)
21 #define FWL_STYLEEXT_FRM_NoDrawClient (1L << 3) 23 #define FWL_STYLEEXT_FRM_NoDrawClient (1L << 3)
22 #define FWL_STYLEEXT_FRM_BorderCornerMask (3L << 1) 24 #define FWL_STYLEEXT_FRM_BorderCornerMask (3L << 1)
23 #define FWL_STYLEEXT_FRM_Max (3) 25 #define FWL_STYLEEXT_FRM_Max (3)
24 26
25 #if (_FX_OS_ == _FX_MACOSX_) 27 #if (_FX_OS_ == _FX_MACOSX_)
26 #define FWL_UseMacSystemBorder 28 #define FWL_UseMacSystemBorder
27 #endif 29 #endif
28 30
31 #define FWL_SYSBUTTONSTATE_Hover 0x0001
32 #define FWL_SYSBUTTONSTATE_Pressed 0x0002
33 #define FWL_SYSBUTTONSTATE_Disabled 0x0010
34
29 enum FWL_FORMSIZE { 35 enum FWL_FORMSIZE {
30 FWL_FORMSIZE_Manual = 0, 36 FWL_FORMSIZE_Manual = 0,
31 FWL_FORMSIZE_Width, 37 FWL_FORMSIZE_Width,
32 FWL_FORMSIZE_Height, 38 FWL_FORMSIZE_Height,
33 FWL_FORMSIZE_All, 39 FWL_FORMSIZE_All,
34 }; 40 };
35 41
36 class CFX_DIBitmap; 42 class CFWL_SysBtn {
37 class CFX_WideString; 43 public:
38 class CFX_Path; 44 CFWL_SysBtn();
45
46 bool IsDisabled() const;
47 uint32_t GetPartState() const;
48
49 void SetNormal();
50 void SetPressed();
51 void SetHover();
52 void SetDisabled(FX_BOOL bDisabled);
53
54 CFX_RectF m_rtBtn;
55 uint32_t m_dwState;
56 };
57
58 enum FORM_RESIZETYPE {
59 FORM_RESIZETYPE_None = 0,
60 FORM_RESIZETYPE_Cap,
61 };
62
63 struct RestoreInfo {
64 RestoreInfo();
65 ~RestoreInfo();
66
67 CFX_PointF m_ptStart;
68 CFX_SizeF m_szStart;
69 };
70
71 class CFWL_MsgMouse;
72 class CFWL_MsgClose;
73 class CFWL_MsgWindowMove;
74 class CFWL_NoteLoop;
75 class CFWL_WidgetImpProperties;
39 class IFWL_Widget; 76 class IFWL_Widget;
40 class IFWL_Form; 77 class IFWL_ThemeProvider;
78 class CFWL_SysBtn;
79 class CFWL_FormImpDelegate;
41 80
42 class IFWL_FormDP : public IFWL_DataProvider { 81 class IFWL_FormDP : public IFWL_DataProvider {
43 public: 82 public:
44 virtual CFX_DIBitmap* GetIcon(IFWL_Widget* pWidget, FX_BOOL bBig) = 0; 83 virtual CFX_DIBitmap* GetIcon(IFWL_Widget* pWidget, FX_BOOL bBig) = 0;
45 }; 84 };
46 85
47 class IFWL_Form : public IFWL_Widget { 86 class IFWL_Form : public IFWL_Widget {
48 public: 87 public:
49 static IFWL_Form* CreateFormProxy(CFWL_WidgetImpProperties& properties, 88 IFWL_Form(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter);
50 CFX_WideString* classname, 89 ~IFWL_Form() override;
51 IFWL_Widget* pOuter); 90
91 // IFWL_Widget
92 FWL_Error GetClassName(CFX_WideString& wsClass) const override;
93 FWL_Type GetClassID() const override;
94 FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const override;
95 FWL_Error Initialize() override;
96 FWL_Error Finalize() override;
97
98 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override;
99 FWL_Error GetClientRect(CFX_RectF& rect) override;
100 FWL_Error Update() override;
101 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
102 FWL_Error DrawWidget(CFX_Graphics* pGraphics,
103 const CFX_Matrix* pMatrix = nullptr) override;
52 104
53 FWL_FORMSIZE GetFormSize(); 105 FWL_FORMSIZE GetFormSize();
54 FWL_Error SetFormSize(FWL_FORMSIZE eFormSize); 106 FWL_Error SetFormSize(FWL_FORMSIZE eFormSize);
55 IFWL_Widget* DoModal(); 107 IFWL_Widget* DoModal();
56 IFWL_Widget* DoModal(uint32_t& dwCommandID); 108 IFWL_Widget* DoModal(uint32_t& dwCommandID);
57 FWL_Error EndDoModal(); 109 FWL_Error EndDoModal();
58 FWL_Error SetBorderRegion(CFX_Path* pPath); 110 FWL_Error SetBorderRegion(CFX_Path* pPath);
111 void DrawBackground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme);
112 IFWL_Widget* GetSubFocus();
113 void SetSubFocus(IFWL_Widget* pWidget);
59 114
60 protected: 115 protected:
61 IFWL_Form(); 116 friend class CFWL_FormImpDelegate;
117
118 void ShowChildWidget(IFWL_Widget* pParent);
119 void RemoveSysButtons();
120 void CalcContentRect(CFX_RectF& rtContent);
121 CFWL_SysBtn* GetSysBtnAtPoint(FX_FLOAT fx, FX_FLOAT fy);
122 CFWL_SysBtn* GetSysBtnByState(uint32_t dwState);
123 CFWL_SysBtn* GetSysBtnByIndex(int32_t nIndex);
124 int32_t GetSysBtnIndex(CFWL_SysBtn* pBtn);
125 FX_FLOAT GetCaptionHeight();
126 void DrawCaptionText(CFX_Graphics* pGs,
127 IFWL_ThemeProvider* pTheme,
128 const CFX_Matrix* pMatrix = nullptr);
129 void DrawIconImage(CFX_Graphics* pGs,
130 IFWL_ThemeProvider* pTheme,
131 const CFX_Matrix* pMatrix = nullptr);
132 void GetEdgeRect(CFX_RectF& rtEdge);
133 void SetWorkAreaRect();
134 void SetCursor(FX_FLOAT fx, FX_FLOAT fy);
135 void Layout();
136 void ReSetSysBtn();
137 void RegisterForm();
138 void UnRegisterForm();
139 FX_BOOL IsDoModal();
140 void SetThemeData();
141 FX_BOOL HasIcon();
142 void UpdateIcon();
143 void UpdateCaption();
144 void DoWidthLimit(FX_FLOAT& fLeft,
145 FX_FLOAT& fWidth,
146 FX_FLOAT fCurX,
147 FX_FLOAT fSpace,
148 FX_FLOAT fLimitMin,
149 FX_FLOAT fLimitMax,
150 FX_BOOL bLeft);
151 void DoHeightLimit(FX_FLOAT& fTop,
152 FX_FLOAT& fHeight,
153 FX_FLOAT fCurY,
154 FX_FLOAT fSpace,
155 FX_FLOAT fLimitMin,
156 FX_FLOAT fLimitMax,
157 FX_BOOL bTop);
158
159 CFX_RectF m_rtRestore;
160 CFX_RectF m_rtCaptionText;
161 CFX_RectF m_rtRelative;
162 CFX_RectF m_rtCaption;
163 CFX_RectF m_rtIcon;
164 CFWL_SysBtn* m_pCloseBox;
165 CFWL_SysBtn* m_pMinBox;
166 CFWL_SysBtn* m_pMaxBox;
167 CFWL_SysBtn* m_pCaptionBox;
168 std::unique_ptr<CFWL_NoteLoop> m_pNoteLoop;
169 IFWL_Widget* m_pSubFocus;
170 RestoreInfo m_InfoStart;
171 FX_FLOAT m_fCXBorder;
172 FX_FLOAT m_fCYBorder;
173 int32_t m_iCaptureBtn;
174 int32_t m_iSysBox;
175 int32_t m_eResizeType;
176 FX_BOOL m_bLButtonDown;
177 bool m_bMaximized;
178 FX_BOOL m_bSetMaximize;
179 FX_BOOL m_bCustomizeLayout;
180 FWL_FORMSIZE m_eFormSize;
181 FX_BOOL m_bDoModalFlag;
182 FX_FLOAT m_fSmallIconSz;
183 FX_FLOAT m_fBigIconSz;
184 CFX_DIBitmap* m_pBigIcon;
185 CFX_DIBitmap* m_pSmallIcon;
186 FX_BOOL m_bMouseIn;
187 };
188
189 class CFWL_FormImpDelegate : public CFWL_WidgetImpDelegate {
190 public:
191 CFWL_FormImpDelegate(IFWL_Form* pOwner);
192 void OnProcessMessage(CFWL_Message* pMessage) override;
193 void OnProcessEvent(CFWL_Event* pEvent) override;
194 void OnDrawWidget(CFX_Graphics* pGraphics,
195 const CFX_Matrix* pMatrix = nullptr) override;
196
197 protected:
198 void OnLButtonDown(CFWL_MsgMouse* pMsg);
199 void OnLButtonUp(CFWL_MsgMouse* pMsg);
200 void OnMouseMove(CFWL_MsgMouse* pMsg);
201 void OnMouseHover(CFWL_MsgMouse* pMsg);
202 void OnMouseLeave(CFWL_MsgMouse* pMsg);
203 void OnLButtonDblClk(CFWL_MsgMouse* pMsg);
204 void OnWindowMove(CFWL_MsgWindowMove* pMsg);
205 void OnClose(CFWL_MsgClose* pMsg);
206 IFWL_Form* m_pOwner;
62 }; 207 };
63 208
64 #endif // XFA_FWL_CORE_IFWL_FORM_H_ 209 #endif // XFA_FWL_CORE_IFWL_FORM_H_
OLDNEW
« no previous file with comments | « xfa/fwl/core/ifwl_edit.cpp ('k') | xfa/fwl/core/ifwl_form.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698