xref: /haiku/headers/os/interface/GridLayoutBuilder.h (revision 93a78ecaa45114d68952d08c4778f073515102f2)
1 /*
2  * Copyright 2006, Haiku Inc.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef	_GRID_LAYOUT_BUILDER_H
6 #define	_GRID_LAYOUT_BUILDER_H
7 
8 #include <GridView.h>
9 
10 class BGridLayoutBuilder {
11 public:
12 								BGridLayoutBuilder(
13 									float horizontalSpacing = 0.0f,
14 									float verticalSpacing = 0.0f);
15 								BGridLayoutBuilder(BGridLayout* layout);
16 								BGridLayoutBuilder(BGridView* view);
17 
18 			BGridLayout*		GridLayout() const;
19 			BView*				View() const;
20 			BGridLayoutBuilder& GetGridLayout(BGridLayout** _layout);
21 			BGridLayoutBuilder& GetView(BView** _view);
22 
23 			BGridLayoutBuilder& Add(BView* view, int32 column, int32 row,
24 									int32 columnCount = 1, int32 rowCount = 1);
25 			BGridLayoutBuilder& Add(BLayoutItem* item, int32 column, int32 row,
26 									int32 columnCount = 1, int32 rowCount = 1);
27 
28 			BGridLayoutBuilder& SetColumnWeight(int32 column, float weight);
29 			BGridLayoutBuilder& SetRowWeight(int32 row, float weight);
30 
31 			BGridLayoutBuilder& SetInsets(float left, float top, float right,
32 									float bottom);
33 
34 								operator BGridLayout*();
35 								operator BView*();
36 
37 private:
38 			BGridLayout*		fLayout;
39 };
40 
41 #endif	// _GRID_LAYOUT_BUILDER_H
42