1*9ecf9d1cSIngo Weinhold /* 2*9ecf9d1cSIngo Weinhold * Copyright 2006, Haiku Inc. 3*9ecf9d1cSIngo Weinhold * Distributed under the terms of the MIT License. 4*9ecf9d1cSIngo Weinhold */ 5*9ecf9d1cSIngo Weinhold #ifndef _GROUP_LAYOUT_BUILDER_H 6*9ecf9d1cSIngo Weinhold #define _GROUP_LAYOUT_BUILDER_H 7*9ecf9d1cSIngo Weinhold 8*9ecf9d1cSIngo Weinhold #include <GroupLayout.h> 9*9ecf9d1cSIngo Weinhold #include <GroupView.h> 10*9ecf9d1cSIngo Weinhold #include <List.h> 11*9ecf9d1cSIngo Weinhold 12*9ecf9d1cSIngo Weinhold class BGroupLayoutBuilder { 13*9ecf9d1cSIngo Weinhold public: 14*9ecf9d1cSIngo Weinhold BGroupLayoutBuilder( 15*9ecf9d1cSIngo Weinhold enum orientation orientation = B_HORIZONTAL, 16*9ecf9d1cSIngo Weinhold float spacing = 0.0f); 17*9ecf9d1cSIngo Weinhold BGroupLayoutBuilder(BGroupLayout* layout); 18*9ecf9d1cSIngo Weinhold BGroupLayoutBuilder(BGroupView* view); 19*9ecf9d1cSIngo Weinhold 20*9ecf9d1cSIngo Weinhold BGroupLayout* RootLayout() const; 21*9ecf9d1cSIngo Weinhold BGroupLayout* TopLayout() const; 22*9ecf9d1cSIngo Weinhold BGroupLayoutBuilder& GetTopLayout(BGroupLayout** _layout); 23*9ecf9d1cSIngo Weinhold BGroupLayoutBuilder& GetTopView(BView** _view); 24*9ecf9d1cSIngo Weinhold 25*9ecf9d1cSIngo Weinhold BGroupLayoutBuilder& Add(BView* view); 26*9ecf9d1cSIngo Weinhold BGroupLayoutBuilder& Add(BView* view, float weight); 27*9ecf9d1cSIngo Weinhold BGroupLayoutBuilder& Add(BLayoutItem* item); 28*9ecf9d1cSIngo Weinhold BGroupLayoutBuilder& Add(BLayoutItem* item, float weight); 29*9ecf9d1cSIngo Weinhold 30*9ecf9d1cSIngo Weinhold BGroupLayoutBuilder& AddGroup(enum orientation orientation, 31*9ecf9d1cSIngo Weinhold float spacing = 0.0f, float weight = 1.0f); 32*9ecf9d1cSIngo Weinhold BGroupLayoutBuilder& End(); 33*9ecf9d1cSIngo Weinhold 34*9ecf9d1cSIngo Weinhold BGroupLayoutBuilder& AddGlue(float weight = 1.0f); 35*9ecf9d1cSIngo Weinhold BGroupLayoutBuilder& AddStrut(float size); 36*9ecf9d1cSIngo Weinhold 37*9ecf9d1cSIngo Weinhold operator BGroupLayout*(); 38*9ecf9d1cSIngo Weinhold operator BView*(); 39*9ecf9d1cSIngo Weinhold 40*9ecf9d1cSIngo Weinhold private: 41*9ecf9d1cSIngo Weinhold bool _PushLayout(BGroupLayout* layout); 42*9ecf9d1cSIngo Weinhold void _PopLayout(); 43*9ecf9d1cSIngo Weinhold 44*9ecf9d1cSIngo Weinhold private: 45*9ecf9d1cSIngo Weinhold BGroupLayout* fRootLayout; 46*9ecf9d1cSIngo Weinhold BList fLayoutStack; 47*9ecf9d1cSIngo Weinhold }; 48*9ecf9d1cSIngo Weinhold 49*9ecf9d1cSIngo Weinhold #endif // _GROUP_LAYOUT_BUILDER_H 50