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

Side by Side Diff: xfa/src/fwl/core/fwl_gridimp.h

Issue 1803723002: Move xfa/src up to xfa/. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 9 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/src/fwl/core/fwl_formimp.cpp ('k') | xfa/src/fwl/core/fwl_gridimp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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_SRC_FWL_CORE_FWL_GRIDIMP_H_
8 #define XFA_SRC_FWL_CORE_FWL_GRIDIMP_H_
9
10 #include "xfa/include/fwl/core/fwl_app.h"
11 #include "xfa/include/fwl/core/fwl_content.h"
12 #include "xfa/include/fwl/core/fwl_grid.h"
13 #include "xfa/src/fwl/core/fwl_contentimp.h"
14
15 class CFWL_GridLength {
16 public:
17 CFWL_GridLength() : fLength(0), eUnit(FWL_GRIDUNIT_Fixed) {}
18 CFWL_GridLength(FX_FLOAT fValue, FWL_GRIDUNIT e)
19 : fLength(fValue), eUnit(e) {}
20 FX_FLOAT fLength;
21 FWL_GRIDUNIT eUnit;
22 };
23
24 class CFWL_GridColRow {
25 public:
26 CFWL_GridColRow()
27 : m_Size(1, FWL_GRIDUNIT_Scaled),
28 m_MinSize(0, FWL_GRIDUNIT_Fixed),
29 m_MaxSize(0, FWL_GRIDUNIT_Infinity),
30 m_fActualSize(0),
31 m_fActualPos(0) {}
32 CFWL_GridLength m_Size;
33 CFWL_GridLength m_MinSize;
34 CFWL_GridLength m_MaxSize;
35 FX_FLOAT m_fActualSize;
36 FX_FLOAT m_fActualPos;
37 };
38
39 class CFWL_GridWidgetInfo {
40 public:
41 CFWL_GridWidgetInfo()
42 : m_iColumn(0),
43 m_iColumnSpan(1),
44 m_iRow(0),
45 m_iRowSpan(1),
46 m_dwMarginFlag(0),
47 m_fActualWidth(0),
48 m_fActualHeight(0) {
49 m_Size[FWL_GRIDSIZE_Width].eUnit = FWL_GRIDUNIT_Auto;
50 m_Size[FWL_GRIDSIZE_Width].fLength = 0;
51 m_Size[FWL_GRIDSIZE_Height].eUnit = FWL_GRIDUNIT_Auto;
52 m_Size[FWL_GRIDSIZE_Height].fLength = 0;
53 m_Size[FWL_GRIDSIZE_MinWidth].eUnit = FWL_GRIDUNIT_Fixed;
54 m_Size[FWL_GRIDSIZE_MinWidth].fLength = 0;
55 m_Size[FWL_GRIDSIZE_MaxWidth].eUnit = FWL_GRIDUNIT_Infinity;
56 m_Size[FWL_GRIDSIZE_MaxWidth].fLength = 0;
57 m_Size[FWL_GRIDSIZE_MinHeight].eUnit = FWL_GRIDUNIT_Fixed;
58 m_Size[FWL_GRIDSIZE_MinHeight].fLength = 0;
59 m_Size[FWL_GRIDSIZE_MaxHeight].eUnit = FWL_GRIDUNIT_Infinity;
60 m_Size[FWL_GRIDSIZE_MaxHeight].fLength = 0;
61 m_Margin[0] = m_Margin[1] = m_Margin[2] = m_Margin[3] = 0;
62 }
63 int32_t m_iColumn;
64 int32_t m_iColumnSpan;
65 int32_t m_iRow;
66 int32_t m_iRowSpan;
67 CFWL_GridLength m_Size[6];
68 FX_DWORD m_dwMarginFlag;
69 FX_FLOAT m_Margin[4];
70 FX_FLOAT m_fActualWidth;
71 FX_FLOAT m_fActualHeight;
72 };
73
74 class CFWL_GridImp : public CFWL_ContentImp {
75 public:
76 CFWL_GridImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter);
77 virtual ~CFWL_GridImp();
78 virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const;
79 virtual FX_DWORD GetClassID() const;
80 virtual FWL_ERR Initialize();
81 virtual FWL_ERR Finalize();
82 virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE);
83 virtual FWL_ERR SetWidgetRect(const CFX_RectF& rect);
84 virtual FWL_ERR Update();
85 virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics,
86 const CFX_Matrix* pMatrix = NULL);
87
88 virtual FWL_ERR InsertWidget(IFWL_Widget* pChild, int32_t nIndex = -1);
89 virtual FWL_ERR RemoveWidget(IFWL_Widget* pWidget);
90 virtual FWL_HGRIDCOLROW InsertColRow(FX_BOOL bColumn, int32_t nIndex = -1);
91 virtual int32_t CountColRows(FX_BOOL bColumn);
92 virtual FWL_HGRIDCOLROW GetColRow(FX_BOOL bColumn, int32_t nIndex);
93 virtual int32_t GetIndex(FWL_HGRIDCOLROW hColRow);
94 virtual FX_FLOAT GetSize(FWL_HGRIDCOLROW hColRow, FWL_GRIDUNIT& eUnit);
95 virtual FWL_ERR SetSize(FWL_HGRIDCOLROW hColRow,
96 FX_FLOAT fSize,
97 FWL_GRIDUNIT eUnit);
98 FX_FLOAT GetMinSize(FWL_HGRIDCOLROW hColRow, FWL_GRIDUNIT& eUnit);
99 FWL_ERR SetMinSize(FWL_HGRIDCOLROW hColRow,
100 FX_FLOAT fSize,
101 FWL_GRIDUNIT eUnit);
102 FX_FLOAT GetMaxSize(FWL_HGRIDCOLROW hColRow, FWL_GRIDUNIT& eUnit);
103 FWL_ERR SetMaxSize(FWL_HGRIDCOLROW hColRow,
104 FX_FLOAT fSize,
105 FWL_GRIDUNIT eUnit);
106 virtual FX_BOOL DeleteColRow(FWL_HGRIDCOLROW hColRow);
107 virtual FX_BOOL IsColumn(FWL_HGRIDCOLROW hColRow);
108 virtual int32_t GetWidgetPos(IFWL_Widget* pWidget, FX_BOOL bColumn);
109 virtual FWL_ERR SetWidgetPos(IFWL_Widget* pWidget,
110 int32_t iPos,
111 FX_BOOL bColumn);
112 virtual int32_t GetWidgetSpan(IFWL_Widget* pWidget, FX_BOOL bColumn);
113 virtual FWL_ERR SetWidgetSpan(IFWL_Widget* pWidget,
114 int32_t iSpan,
115 FX_BOOL bColumn);
116 virtual FX_FLOAT GetWidgetSize(IFWL_Widget* pWidget,
117 FWL_GRIDSIZE eSize,
118 FWL_GRIDUNIT& eUnit);
119 virtual FWL_ERR SetWidgetSize(IFWL_Widget* pWidget,
120 FWL_GRIDSIZE eSize,
121 FX_FLOAT fSize,
122 FWL_GRIDUNIT eUit);
123 virtual FX_BOOL GetWidgetMargin(IFWL_Widget* pWidget,
124 FWL_GRIDMARGIN eMargin,
125 FX_FLOAT& fMargin);
126 virtual FWL_ERR SetWidgetMargin(IFWL_Widget* pWidget,
127 FWL_GRIDMARGIN eMargin,
128 FX_FLOAT fMargin);
129 virtual FWL_ERR RemoveWidgetMargin(IFWL_Widget* pWidget,
130 FWL_GRIDMARGIN eMargin);
131 virtual FX_FLOAT GetGridSize(FWL_GRIDSIZE eSize, FWL_GRIDUNIT& eUnit);
132 virtual FWL_ERR SetGridSize(FWL_GRIDSIZE eSize,
133 FX_FLOAT fSize,
134 FWL_GRIDUNIT eUit);
135
136 protected:
137 CFWL_GridWidgetInfo* GetWidgetInfo(IFWL_Widget* pWidget);
138 void ProcFixedColRow(CFWL_GridColRow* pColRow,
139 int32_t nIndex,
140 FX_FLOAT fColRowSize,
141 FX_BOOL bColumn);
142 void ProcAutoColRow(CFWL_GridColRow* pColRow,
143 int32_t nIndex,
144 FX_BOOL bColumn);
145 void ProcScaledColRow(CFWL_GridColRow* pColRow,
146 int32_t nIndex,
147 FX_FLOAT fColRowSize,
148 FX_BOOL bColumn);
149 void CalcWidgetWidth(IFWL_Widget* pWidget,
150 CFWL_GridWidgetInfo* pInfo,
151 FX_FLOAT fColunmWidth);
152 void CalcWidgetHeigt(IFWL_Widget* pWidget,
153 CFWL_GridWidgetInfo* pInfo,
154 FX_FLOAT fRowHeigt);
155 FX_FLOAT CalcAutoColumnWidgetWidth(IFWL_Widget* pWidget,
156 CFWL_GridWidgetInfo* pInfo);
157 FX_FLOAT CalcAutoColumnWidgetHeight(IFWL_Widget* pWidget,
158 CFWL_GridWidgetInfo* pInfo);
159 FX_FLOAT ProcessColumns(FX_FLOAT fWidth);
160 FX_FLOAT ProcessRows(FX_FLOAT fHeight);
161 FX_FLOAT ProcessUnCertainColumns();
162 FX_FLOAT ProcessUnCertainRows();
163 FX_BOOL SetColRowActualSize(CFWL_GridColRow* pColRow,
164 FX_FLOAT fSize,
165 FX_BOOL bSetBeyond = FALSE);
166 FX_FLOAT SetWidgetActualWidth(CFWL_GridWidgetInfo* pInfo, FX_FLOAT fWidth);
167 FX_FLOAT SetWidgetActualHeight(CFWL_GridWidgetInfo* pInfo, FX_FLOAT fHeight);
168 void SetAllWidgetsRect();
169 FX_BOOL IsGrid(IFWL_Widget* pWidget);
170 void SetSpanAutoColRowSize(const CFX_PtrArray& spanAutos,
171 FX_FLOAT fTotalSize);
172 void SetSpanScaledColRowSize(const CFX_PtrArray& spanScaleds,
173 FX_FLOAT fTotalSize,
174 FX_FLOAT fTotalScaledNum);
175 void SetScaledColRowsSize(const CFX_PtrArray& spanScaleds,
176 FX_FLOAT fTotalSize,
177 FX_FLOAT fTotalScaledNum);
178 CFX_PtrArray m_Rows;
179 CFX_PtrArray m_Columns;
180 CFX_PtrArray m_Widgets;
181 CFX_MapPtrToPtr m_mapWidgetInfo;
182 CFWL_GridLength m_Size[6];
183 friend class CFWL_GridImpDelegate;
184 };
185
186 class CFWL_GridImpDelegate : public CFWL_WidgetImpDelegate {
187 public:
188 CFWL_GridImpDelegate(CFWL_GridImp* pOwner);
189 int32_t OnProcessMessage(CFWL_Message* pMessage) override;
190 FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics,
191 const CFX_Matrix* pMatrix = NULL) override;
192
193 protected:
194 CFWL_GridImp* m_pOwner;
195 };
196
197 #endif // XFA_SRC_FWL_CORE_FWL_GRIDIMP_H_
OLDNEW
« no previous file with comments | « xfa/src/fwl/core/fwl_formimp.cpp ('k') | xfa/src/fwl/core/fwl_gridimp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698