You.i Engine
YiGridLayout.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2020. 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 
218  void SetSpacing(float spacing);
219  float GetSpacing() const;
220 
224  void SetRowsCount(size_t rows);
225  size_t GetRowsCount() const;
226 
230  void SetColumnsCount(size_t columns);
231  size_t GetColumnsCount() const;
232 
236  void SetUseUniformRows(bool useUniformRows);
237  bool IsUsingUniformRows() const;
238 
242  void SetUseUniformColumns(bool useUniformColumns);
243  bool IsUsingUniformColumns() const;
244 
248  void SetUseTableCells(bool useTableCells);
249  bool IsUsingTableCells() const;
250 
255  void SetFillOrder(FillOrder order);
256  FillOrder GetFillOrder() const;
257 
261  void SetPackMode(PackMode mode);
262  PackMode GetPackMode() const;
263 
264 protected:
265  virtual void Configure() override;
266 
267  virtual void OnMeasure(const CYISceneNode::MeasureSpec &widthSpec, const CYISceneNode::MeasureSpec &heightSpec, const CYISceneNode::MeasureSpec &depthSpec) override;
268 
269  virtual void OnApplyMeasurements() override;
270 
271  virtual const CYIRuntimeTypeInfo &GetLayoutConfigType() const override;
272 
273  float m_spacing;
274  size_t m_rows;
275  size_t m_columns;
281 
282 private:
283  std::unique_ptr<youi_private::MeasurementData> m_pMeasurementData;
284 
286 };
287 
294 {
295 public:
297  virtual ~CYIGridLayoutConfig();
298  virtual std::unique_ptr<CYILayoutConfig> Clone() const override;
299 
300  virtual void ConfigureFrom(const IYIPropertiesSource *pSource) override;
301 
307  void SetCellWidth(uint32_t width);
308  uint32_t GetCellWidth() const;
309 
315  void SetCellHeight(uint32_t height);
316  uint32_t GetCellHeight() const;
317 
318 protected:
319  uint32_t m_cellWidth;
320  uint32_t m_cellHeight;
321 
323 };
324 
327 #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:277
FillOrder
Definition: YiGridLayout.h:183
A layout that positions items in a grid.
Definition: YiGridLayout.h:176
uint32_t m_cellHeight
Definition: YiGridLayout.h:320
uint32_t m_cellWidth
Definition: YiGridLayout.h:319
size_t m_rows
Definition: YiGridLayout.h:274
Definition: YiSceneNode.h:373
A class used to hold per-child layout configuration for CYIGridLayout layouts.
Definition: YiGridLayout.h:293
The abstract runtime representation of a C++ type.
Definition: YiRtti.h:56
FillOrder m_fillOrder
Definition: YiGridLayout.h:279
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:275
Definition: YiKeyEventUtilities.h:7
#define YI_TYPE_BASES(CLASS, BASES...)
Definition: YiRtti.h:257
bool m_tableCells
Definition: YiGridLayout.h:278
PackMode m_packMode
Definition: YiGridLayout.h:280
float m_spacing
Definition: YiGridLayout.h:273
bool m_uniformRows
Definition: YiGridLayout.h:276
PackMode
Definition: YiGridLayout.h:201