haiku/headers/libs/alm/ALMLayoutBuilder.h

103 lines
2.8 KiB
C
Raw Normal View History

2012-01-17 01:38:20 +04:00
/*
* Copyright 2012, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef ALM_LAYOUT_BUILDER_H
#define ALM_LAYOUT_BUILDER_H
#include "ALMLayout.h"
#include <ObjectList.h>
2012-01-17 01:38:20 +04:00
class BLayoutItem;
class BView;
2012-01-17 01:38:20 +04:00
class BWindow;
namespace BALM {
class BALMLayoutBuilder {
public:
BALMLayoutBuilder(BView* view, float hSpacing,
float vSpacing,
BALMLayout* friendLayout = NULL);
BALMLayoutBuilder(BView* view,
BALMLayout* layout);
BALMLayoutBuilder(BWindow* window,
float hSpacing, float vSpacing,
BALMLayout* friendLayout = NULL);
BALMLayoutBuilder(BWindow* window,
BALMLayout* layout);
BALMLayoutBuilder(BALMLayout* layout);
BALMLayoutBuilder& Add(BView* view, XTab* left, YTab* top,
XTab* right = NULL, YTab* bottom = NULL);
BALMLayoutBuilder& Add(BView* view, Row* row, Column* column);
BALMLayoutBuilder& Add(BLayoutItem* item, XTab* left,
YTab* top, XTab* right = NULL,
YTab* bottom = NULL);
BALMLayoutBuilder& Add(BLayoutItem* item, Row* row,
Column* column);
BALMLayoutBuilder& SetInsets(float insets);
BALMLayoutBuilder& SetInsets(float horizontal, float vertical);
BALMLayoutBuilder& SetInsets(float left, float top, float right,
float bottom);
BALMLayoutBuilder& SetSpacing(float horizontal, float vertical);
BALMLayoutBuilder& AddToLeft(BView* view,
2012-01-17 01:38:20 +04:00
XTab* left = NULL, YTab* top = NULL,
YTab* bottom = NULL);
BALMLayoutBuilder& AddToRight(BView* view,
2012-01-17 01:38:20 +04:00
XTab* right = NULL, YTab* top = NULL,
YTab* bottom = NULL);
BALMLayoutBuilder& AddAbove(BView* view,
2012-01-17 01:38:20 +04:00
YTab* top = NULL, XTab* left = NULL,
XTab* right = NULL);
BALMLayoutBuilder& AddBelow(BView* view, YTab* bottom = NULL,
2012-01-17 01:38:20 +04:00
XTab* left = NULL, XTab* right = NULL);
BALMLayoutBuilder& AddToLeft(BLayoutItem* item,
2012-01-17 01:38:20 +04:00
XTab* left = NULL, YTab* top = NULL,
YTab* bottom = NULL);
BALMLayoutBuilder& AddToRight(BLayoutItem* item,
2012-01-17 01:38:20 +04:00
XTab* right = NULL, YTab* top = NULL,
YTab* bottom = NULL);
BALMLayoutBuilder& AddAbove(BLayoutItem* item,
2012-01-17 01:38:20 +04:00
YTab* top = NULL, XTab* left = NULL,
XTab* right = NULL);
BALMLayoutBuilder& AddBelow(BLayoutItem* item,
2012-01-17 01:38:20 +04:00
YTab* bottom = NULL, XTab* left = NULL,
XTab* right = NULL);
BALMLayoutBuilder& Push();
BALMLayoutBuilder& Pop();
2012-01-17 01:38:20 +04:00
// these methods throw away the stack
BALMLayoutBuilder& StartingAt(BView* view);
BALMLayoutBuilder& StartingAt(BLayoutItem* item);
2012-01-17 01:38:20 +04:00
private:
typedef BObjectList<Area> AreaStack;
2012-01-17 01:38:20 +04:00
BALMLayout* fLayout;
AreaStack fAreaStack;
Area* _CurrentArea() const;
void _SetCurrentArea(Area*);
2012-01-17 01:38:20 +04:00
};
};
#endif