19ecf9d1cSIngo Weinhold /* 29ecf9d1cSIngo Weinhold * Copyright 2006, Haiku Inc. 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 37*e3e76a3aSRyan Leavengood BGroupLayoutBuilder& SetInsets(float left, float top, float right, 38*e3e76a3aSRyan Leavengood float bottom); 39*e3e76a3aSRyan 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