xref: /haiku/headers/os/interface/GroupLayoutBuilder.h (revision c14bca2958fb7b0c34d5464ccfdd87038f909a0c)
19ecf9d1cSIngo Weinhold /*
21d6c7b6cSAlex 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(
15*e724b26fSJohn Scipione 									orientation orientation = B_HORIZONTAL,
1682ab3167SAlex Wilson 									float spacing = B_USE_DEFAULT_SPACING);
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 
31*e724b26fSJohn Scipione 			BGroupLayoutBuilder& AddGroup(orientation orientation,
3282ab3167SAlex Wilson 									float spacing = B_USE_DEFAULT_SPACING,
3382ab3167SAlex Wilson 									float weight = 1.0f);
349ecf9d1cSIngo Weinhold 			BGroupLayoutBuilder& End();
359ecf9d1cSIngo Weinhold 
369ecf9d1cSIngo Weinhold 			BGroupLayoutBuilder& AddGlue(float weight = 1.0f);
379ecf9d1cSIngo Weinhold 			BGroupLayoutBuilder& AddStrut(float size);
389ecf9d1cSIngo Weinhold 
39e3e76a3aSRyan Leavengood 			BGroupLayoutBuilder& SetInsets(float left, float top, float right,
40e3e76a3aSRyan Leavengood 									float bottom);
41e3e76a3aSRyan Leavengood 
429ecf9d1cSIngo Weinhold 								operator BGroupLayout*();
439ecf9d1cSIngo Weinhold 
449ecf9d1cSIngo Weinhold private:
459ecf9d1cSIngo Weinhold 			bool				_PushLayout(BGroupLayout* layout);
469ecf9d1cSIngo Weinhold 			void				_PopLayout();
479ecf9d1cSIngo Weinhold 
489ecf9d1cSIngo Weinhold private:
499ecf9d1cSIngo Weinhold 			BGroupLayout*		fRootLayout;
509ecf9d1cSIngo Weinhold 			BList				fLayoutStack;
519ecf9d1cSIngo Weinhold };
529ecf9d1cSIngo Weinhold 
539ecf9d1cSIngo Weinhold #endif	// _GROUP_LAYOUT_BUILDER_H
54