You.i Engine
YiGridLayout.h
Go to the documentation of this file.
1 // © You i Labs Inc. All rights reserved.
2 #ifndef _YI_GRID_LAYOUT_H_
3 #define _YI_GRID_LAYOUT_H_
4 
6 
7 namespace youi_private
8 {
9 class MeasurementData;
10 }
11 
177 {
178 public:
183  enum class FillOrder
184  {
185  Automatic = 0,
186  TopLeftToRight,
187  LeftTopToBottom,
188  TopRightToLeft,
189  RightTopToBottom,
190  BottomLeftToRight,
191  LeftBottomToTop,
192  BottomRightToLeft,
193  RightBottomToTop
194  };
195 
201  enum class PackMode
202  {
203  Wrap,
204  Tetris,
205  First
206  };
207 
208  CYIGridLayout();
209  virtual ~CYIGridLayout();
210 
220  void SetSpacing(float spacing);
221 
229  void SetHorizontalSpacing(float spacing);
230 
238  void SetVerticalSpacing(float spacing);
239 
240  float GetHorizontalSpacing() const;
241  float GetVerticalSpacing() const;
242 
246  void SetRowsCount(size_t rows);
247  size_t GetRowsCount() const;
248 
252  void SetColumnsCount(size_t columns);
253  size_t GetColumnsCount() const;
254 
258  void SetUseUniformRows(bool useUniformRows);
259  bool IsUsingUniformRows() const;
260 
264  void SetUseUniformColumns(bool useUniformColumns);
265  bool IsUsingUniformColumns() const;
266 
270  void SetUseTableCells(bool useTableCells);
271  bool IsUsingTableCells() const;
272 
277  void SetFillOrder(FillOrder order);
278  FillOrder GetFillOrder() const;
279 
283  void SetPackMode(PackMode mode);
284  PackMode GetPackMode() const;
285 
286 protected:
287  virtual void Configure() override;
288 
289  virtual void OnMeasure(const CYISceneNode::MeasureSpec &widthSpec, const CYISceneNode::MeasureSpec &heightSpec, const CYISceneNode::MeasureSpec &depthSpec) override;
290 
291  virtual void OnApplyMeasurements() override;
292 
293  virtual const CYIRuntimeTypeInfo &GetLayoutConfigType() const override;
294 
297  size_t m_rows;
298  size_t m_columns;
304 
305 private:
306  std::unique_ptr<youi_private::MeasurementData> m_pMeasurementData;
307 
309 };
310 
317 {
318 public:
320  virtual ~CYIGridLayoutConfig();
321  virtual std::unique_ptr<CYILayoutConfig> Clone() const override;
322 
323  virtual void ConfigureFrom(const IYIPropertiesSource *pSource) override;
324 
330  void SetCellWidth(uint32_t width);
331  uint32_t GetCellWidth() const;
332 
338  void SetCellHeight(uint32_t height);
339  uint32_t GetCellHeight() const;
340 
341 protected:
342  uint32_t m_cellWidth;
343  uint32_t m_cellHeight;
344 
346 };
347 
350 #endif // _YI_GRID_LAYOUT_H_
A class used to hold per-child layout configuration for CYIAnimatingLayout layouts.
Definition: YiAnimatingLayout.h:155
bool m_uniformColumns
Definition: YiGridLayout.h:300
float m_horizontalSpacing
Definition: YiGridLayout.h:295
FillOrder
Definition: YiGridLayout.h:183
A layout that positions items in a grid.
Definition: YiGridLayout.h:176
uint32_t m_cellHeight
Definition: YiGridLayout.h:343
uint32_t m_cellWidth
Definition: YiGridLayout.h:342
size_t m_rows
Definition: YiGridLayout.h:297
Definition: YiSceneNode.h:374
A class used to hold per-child layout configuration for CYIGridLayout layouts.
Definition: YiGridLayout.h:316
The abstract runtime representation of a C++ type.
Definition: YiRtti.h:58
FillOrder m_fillOrder
Definition: YiGridLayout.h:302
A layout that can animate its children&#39;s position and size.
Definition: YiAnimatingLayout.h:67
An interface to a class that provides key-value properties.
Definition: YiPropertiesSource.h:21
size_t m_columns
Definition: YiGridLayout.h:298
Definition: YiGridLayout.h:7
#define YI_TYPE_BASES(CLASS, BASES...)
Definition: YiRtti.h:259
float m_verticalSpacing
Definition: YiGridLayout.h:296
bool m_tableCells
Definition: YiGridLayout.h:301
PackMode m_packMode
Definition: YiGridLayout.h:303
bool m_uniformRows
Definition: YiGridLayout.h:299
PackMode
Definition: YiGridLayout.h:201