haiku/headers/os/interface/GroupLayoutBuilder.h
Ryan Leavengood e3e76a3af9 Added convenience methods to allow a group or grid layout's insets to be set
while it is being built.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20026 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-01-31 20:30:20 +00:00

53 lines
1.4 KiB
C++

/*
* Copyright 2006, Haiku Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _GROUP_LAYOUT_BUILDER_H
#define _GROUP_LAYOUT_BUILDER_H
#include <GroupLayout.h>
#include <GroupView.h>
#include <List.h>
class BGroupLayoutBuilder {
public:
BGroupLayoutBuilder(
enum orientation orientation = B_HORIZONTAL,
float spacing = 0.0f);
BGroupLayoutBuilder(BGroupLayout* layout);
BGroupLayoutBuilder(BGroupView* view);
BGroupLayout* RootLayout() const;
BGroupLayout* TopLayout() const;
BGroupLayoutBuilder& GetTopLayout(BGroupLayout** _layout);
BGroupLayoutBuilder& GetTopView(BView** _view);
BGroupLayoutBuilder& Add(BView* view);
BGroupLayoutBuilder& Add(BView* view, float weight);
BGroupLayoutBuilder& Add(BLayoutItem* item);
BGroupLayoutBuilder& Add(BLayoutItem* item, float weight);
BGroupLayoutBuilder& AddGroup(enum orientation orientation,
float spacing = 0.0f, float weight = 1.0f);
BGroupLayoutBuilder& End();
BGroupLayoutBuilder& AddGlue(float weight = 1.0f);
BGroupLayoutBuilder& AddStrut(float size);
BGroupLayoutBuilder& SetInsets(float left, float top, float right,
float bottom);
operator BGroupLayout*();
operator BView*();
private:
bool _PushLayout(BGroupLayout* layout);
void _PopLayout();
private:
BGroupLayout* fRootLayout;
BList fLayoutStack;
};
#endif // _GROUP_LAYOUT_BUILDER_H