GridLayout.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------------------+
2 |
3 | Supplied under applicable software license agreement.
4 |
5 | Copyright (c) 2018 Bentley Systems, Incorporated. All rights reserved.
6 |
7 +---------------------------------------------------------------------------------------*/
8 #pragma once
9 
10 #include <UI/UIFramework.h>
12 #include <Bentley\WString.h>
13 
15 
16 //=======================================================================================
69 //=======================================================================================
70 class GridLayout : public LayoutManager
71  {
72 public:
76  DLLEXPORT static GridLayout* Create (LayoutControl *parent = NULL);
77 
80  DLLEXPORT void SetHorizontalSpacing (int spacing);
81 
83  DLLEXPORT int GetHorizontalSpacing () const;
84 
87  DLLEXPORT void SetVerticalSpacing (int spacing);
88 
90  DLLEXPORT int GetVerticalSpacing () const;
91 
94  DLLEXPORT void SetSpacing (int spacing);
95 
98  DLLEXPORT int GetSpacing() const;
99 
102  DLLEXPORT int GetRowStretch (int row) const;
103 
107  DLLEXPORT void SetRowStretch (int row, int stretch);
108 
111  DLLEXPORT int GetColumnStretch (int column) const;
112 
116  DLLEXPORT void SetColumnStretch (int column, int stretch);
117 
120  DLLEXPORT int GetRowMinimumHeight (int row) const;
121 
125  DLLEXPORT void SetRowMinimumHeight (int row, int minHeight);
126 
129  DLLEXPORT int GetColumnMinimumWidth (int column) const;
130 
134  DLLEXPORT void SetColumnMinimumWidth (int column, int minWidth);
135 
145  DLLEXPORT StatusInt SetColumnSharedSizeGroup (int column, WCharCP groupName);
146 
148  DLLEXPORT int GetColumnCount () const;
149 
151  DLLEXPORT int GetRowCount () const;
152 
156  DLLEXPORT BRect GetCellRect (int row, int column) const;
157 
163  DLLEXPORT void AddControl (LayoutControl *ctl, int row, int column, LayoutAlignment alignment = Align_None);
164 
172  DLLEXPORT void AddControl (LayoutControl *ctl, int row, int column, int rowSpan, int columnSpan, LayoutAlignment alignment = Align_None);
173 
179  DLLEXPORT void AddLayout (LayoutManager *layout, int row, int column, LayoutAlignment alignment = Align_None);
180 
188  DLLEXPORT void AddLayout (LayoutManager *layout, int row, int column, int rowSpan, int columnSpan, LayoutAlignment alignment = Align_None);
189 
191 
198  DLLEXPORT void GetItemPosition (int index, int *row, int *column, int *rowSpan, int *columnSpan);
199 
203  DLLEXPORT LayoutItem *ItemAtPosition (int row, int column) const;
204 
206  DLLEXPORT virtual void Invalidate () override;
207 
209  DLLEXPORT virtual void SetDirty () override;
210 
212  DLLEXPORT virtual BSize GetDesiredSize() const override;
213 
215  DLLEXPORT virtual BSize GetMinimumSize() const override;
216 
218  DLLEXPORT virtual BSize GetMaximumSize() const override;
219 
222  DLLEXPORT virtual bool HasHeightForWidth () const override;
223 
226  DLLEXPORT virtual int GetHeightForWidth (int width) const override;
227 
230  DLLEXPORT virtual int GetMinimumHeightForWidth (int width) const override;
231 
234  DLLEXPORT virtual void SetGeometry (const BRect& rect) override;
235 
239 
241  DLLEXPORT virtual size_t Count() const override;
242 
246  DLLEXPORT virtual LayoutItem *ItemAt (int index) const override;
247 
251  DLLEXPORT virtual LayoutItem *TakeAt (int index) override;
252 
253  };
254 
virtual void Invalidate() override
Resets the layout's rectangle then calls Update()
LayoutOrientation
This type is used to signify an object's orientation.
Definition: LayoutEnums.h:94
void SetRowStretch(int row, int stretch)
Sets the stretch factor for the given row.
The LayoutControl class is the abstract base class of all user interface elements for layout manager ...
Definition: LayoutControl.h:54
int GetRowStretch(int row) const
Returns the stretch factor for the given row.
int GetSpacing() const
Gets the spacing between items in the layout.
virtual LayoutOrientations GetExpandingOrientations() const
Returns whether this layout item can make use of more space than GetDesiredSize().
Definition: LayoutEnums.h:53
void GetItemPosition(int index, int *row, int *column, int *rowSpan, int *columnSpan)
Returns information about the item at a given index.
void SetColumnStretch(int column, int stretch)
Sets the stretch factor for the given column.
int GetRowCount() const
Returns the number of rows.
virtual void SetDirty() override
Resets the layout's rectangle then calls Update()
void SetVerticalSpacing(int spacing)
Sets the vertical spacing between rows in the layout.
int GetColumnMinimumWidth(int column) const
Returns the minimum width for the given column.
void AddLayout(LayoutManager *layout, int row, int column, LayoutAlignment alignment=Align_None)
Adds a child LayoutManager to the GridLayout Layout Manager.
The LayoutItem class provides an abstract item that a LayoutManager manipulates.
Definition: LayoutItem.h:52
LayoutFlags - Creates a "Flags" class out of an enum with constructors and operator overloading...
Definition: LayoutFlags.h:43
int GetColumnStretch(int column) const
Returns the stretch factor for the given column.
virtual int GetMinimumHeightForWidth(int width) const override
Returns the minimum height for this layout item, given the width.
The BRect class defines a rectangle using integer precision.
Definition: BRect.h:71
BRect GetCellRect(int row, int column) const
Retrieves the bounding rectangle of the cell specified by the given row index and column index...
int GetRowMinimumHeight(int row) const
Returns the minimum height for the given row.
virtual BSize GetDesiredSize() const override
Returns the desired size for this layout item.
wchar_t const * WCharCP
Definition: Bentley.h:224
The BSize class defines the size of a two - dimensional object using integer point precision...
Definition: BSize.h:38
#define NULL
Definition: Bentley.h:157
virtual LayoutItem * ItemAt(int index) const override
Retrieves the item at index in the layout and returns the item.
#define BEGIN_BENTLEY_UIFRAMEWORK_NAMESPACE
Definition: UIFramework.h:14
int GetVerticalSpacing() const
Returns the vertical spacing between rows in the layout.
LayoutItem * ItemAtPosition(int row, int column) const
Returns the LayoutItem associated with a given row and column.
virtual BSize GetMaximumSize() const override
Returns the maximum size for this layout item.
#define DLLEXPORT
Definition: basedefs.h:137
void SetColumnMinimumWidth(int column, int minWidth)
Sets the minimum width for the given column.
virtual size_t Count() const override
Returns the number of items in this layout.
virtual BSize GetMinimumSize() const override
Returns the minimum size for this layout item.
virtual void SetGeometry(const BRect &rect) override
Sets the geometry for this layout item to the given rectangle.
int GetHorizontalSpacing() const
Returns the horizontal spacing between items in the layout.
void SetRowMinimumHeight(int row, int minHeight)
Sets the minimum height for the given row.
virtual bool HasHeightForWidth() const override
Returns whether this layout's preferred height depends on its width.
void SetSpacing(int spacing)
Sets the horizontal and vertical spacing between items in the layout.
#define END_BENTLEY_UIFRAMEWORK_NAMESPACE
Definition: UIFramework.h:15
static GridLayout * Create(LayoutControl *parent=0)
Creates a GridLayout Layout Manager.
void SetDefaultPositioning(int n, LayoutOrientation orient)
void AddControl(LayoutControl *ctl, int row, int column, LayoutAlignment alignment=Align_None)
Adds a control to the GridLayout Layout Manager.
The LayoutManager class is the base class of the layout managers.
Definition: LayoutManager.h:46
int StatusInt
Definition: Bentley.h:222
StatusInt SetColumnSharedSizeGroup(int column, WCharCP groupName)
Sets the SharedSizeGroup name for the given column.
The GridLayout class lays out controls in a table or grid.
Definition: GridLayout.h:70
void SetHorizontalSpacing(int spacing)
Sets the horizontal spacing between items in the layout.
virtual LayoutItem * TakeAt(int index) override
Removes the item at index from the layout, and returns the item.
int GetColumnCount() const
Returns the number of columns.
virtual int GetHeightForWidth(int width) const override
Returns the preferred height for this layout item, given the width.

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.