xref: /haiku/headers/os/interface/GroupLayoutBuilder.h (revision 89208c77f10235d43fda0c7b3fd6751db02cc12c)
19ecf9d1cSIngo Weinhold /*
2*89208c77SStephan Aßmus  * Copyright 2006, Haiku, Inc. All rights reserved.
39ecf9d1cSIngo Weinhold  * Distributed under the terms of the MIT License.
49ecf9d1cSIngo Weinhold  */
59ecf9d1cSIngo Weinhold #ifndef	_GROUP_LAYOUT_BUILDER_H
69ecf9d1cSIngo Weinhold #define	_GROUP_LAYOUT_BUILDER_H
79ecf9d1cSIngo Weinhold 
89ecf9d1cSIngo Weinhold #include <GroupLayout.h>
99ecf9d1cSIngo Weinhold #include <GroupView.h>
109ecf9d1cSIngo Weinhold #include <List.h>
119ecf9d1cSIngo Weinhold 
129ecf9d1cSIngo Weinhold class BGroupLayoutBuilder {
139ecf9d1cSIngo Weinhold public:
149ecf9d1cSIngo Weinhold 								BGroupLayoutBuilder(
159ecf9d1cSIngo Weinhold 									enum orientation orientation = B_HORIZONTAL,
169ecf9d1cSIngo Weinhold 									float spacing = 0.0f);
179ecf9d1cSIngo Weinhold 								BGroupLayoutBuilder(BGroupLayout* layout);
189ecf9d1cSIngo Weinhold 								BGroupLayoutBuilder(BGroupView* view);
199ecf9d1cSIngo Weinhold 
209ecf9d1cSIngo Weinhold 			BGroupLayout*		RootLayout() const;
219ecf9d1cSIngo Weinhold 			BGroupLayout*		TopLayout() const;
229ecf9d1cSIngo Weinhold 			BGroupLayoutBuilder& GetTopLayout(BGroupLayout** _layout);
239ecf9d1cSIngo Weinhold 			BGroupLayoutBuilder& GetTopView(BView** _view);
249ecf9d1cSIngo Weinhold 
259ecf9d1cSIngo Weinhold 			BGroupLayoutBuilder& Add(BView* view);
269ecf9d1cSIngo Weinhold 			BGroupLayoutBuilder& Add(BView* view, float weight);
279ecf9d1cSIngo Weinhold 			BGroupLayoutBuilder& Add(BLayoutItem* item);
289ecf9d1cSIngo Weinhold 			BGroupLayoutBuilder& Add(BLayoutItem* item, float weight);
299ecf9d1cSIngo Weinhold 
309ecf9d1cSIngo Weinhold 			BGroupLayoutBuilder& AddGroup(enum orientation orientation,
319ecf9d1cSIngo Weinhold 									float spacing = 0.0f, float weight = 1.0f);
329ecf9d1cSIngo Weinhold 			BGroupLayoutBuilder& End();
339ecf9d1cSIngo Weinhold 
349ecf9d1cSIngo Weinhold 			BGroupLayoutBuilder& AddGlue(float weight = 1.0f);
359ecf9d1cSIngo Weinhold 			BGroupLayoutBuilder& AddStrut(float size);
369ecf9d1cSIngo Weinhold 
37e3e76a3aSRyan Leavengood 			BGroupLayoutBuilder& SetInsets(float left, float top, float right,
38e3e76a3aSRyan Leavengood 									float bottom);
39e3e76a3aSRyan Leavengood 
409ecf9d1cSIngo Weinhold 								operator BGroupLayout*();
419ecf9d1cSIngo Weinhold 								operator BView*();
429ecf9d1cSIngo Weinhold 
439ecf9d1cSIngo Weinhold private:
449ecf9d1cSIngo Weinhold 			bool				_PushLayout(BGroupLayout* layout);
459ecf9d1cSIngo Weinhold 			void				_PopLayout();
469ecf9d1cSIngo Weinhold 
479ecf9d1cSIngo Weinhold private:
489ecf9d1cSIngo Weinhold 			BGroupLayout*		fRootLayout;
499ecf9d1cSIngo Weinhold 			BList				fLayoutStack;
509ecf9d1cSIngo Weinhold };
519ecf9d1cSIngo Weinhold 
529ecf9d1cSIngo Weinhold #endif	// _GROUP_LAYOUT_BUILDER_H
53