xref: /haiku/headers/os/interface/GroupLayoutBuilder.h (revision 1d6c7b6cb6f46c2672074ff137a18833d4dd3041)
19ecf9d1cSIngo Weinhold /*
2*1d6c7b6cSAlex Wilson  * Copyright 2006-2010, 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);
23e70fa080SAlex Wilson 			BView*				TopView() const;
249ecf9d1cSIngo Weinhold 			BGroupLayoutBuilder& GetTopView(BView** _view);
259ecf9d1cSIngo Weinhold 
269ecf9d1cSIngo Weinhold 			BGroupLayoutBuilder& Add(BView* view);
279ecf9d1cSIngo Weinhold 			BGroupLayoutBuilder& Add(BView* view, float weight);
289ecf9d1cSIngo Weinhold 			BGroupLayoutBuilder& Add(BLayoutItem* item);
299ecf9d1cSIngo Weinhold 			BGroupLayoutBuilder& Add(BLayoutItem* item, float weight);
309ecf9d1cSIngo Weinhold 
319ecf9d1cSIngo Weinhold 			BGroupLayoutBuilder& AddGroup(enum orientation orientation,
329ecf9d1cSIngo Weinhold 									float spacing = 0.0f, float weight = 1.0f);
339ecf9d1cSIngo Weinhold 			BGroupLayoutBuilder& End();
349ecf9d1cSIngo Weinhold 
359ecf9d1cSIngo Weinhold 			BGroupLayoutBuilder& AddGlue(float weight = 1.0f);
369ecf9d1cSIngo Weinhold 			BGroupLayoutBuilder& AddStrut(float size);
379ecf9d1cSIngo Weinhold 
38e3e76a3aSRyan Leavengood 			BGroupLayoutBuilder& SetInsets(float left, float top, float right,
39e3e76a3aSRyan Leavengood 									float bottom);
40e3e76a3aSRyan Leavengood 
419ecf9d1cSIngo Weinhold 								operator BGroupLayout*();
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