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"
|
|
|
|
|
2012-04-30 05:58:31 +04:00
|
|
|
#include <ObjectList.h>
|
|
|
|
|
2012-01-17 01:38:20 +04:00
|
|
|
|
2012-01-17 05:28:01 +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);
|
|
|
|
|
2012-04-30 05:58:31 +04:00
|
|
|
BALMLayoutBuilder& AddToLeft(BView* view,
|
2012-01-17 01:38:20 +04:00
|
|
|
XTab* left = NULL, YTab* top = NULL,
|
|
|
|
YTab* bottom = NULL);
|
2012-04-30 05:58:31 +04:00
|
|
|
BALMLayoutBuilder& AddToRight(BView* view,
|
2012-01-17 01:38:20 +04:00
|
|
|
XTab* right = NULL, YTab* top = NULL,
|
|
|
|
YTab* bottom = NULL);
|
2012-04-30 05:58:31 +04:00
|
|
|
BALMLayoutBuilder& AddAbove(BView* view,
|
2012-01-17 01:38:20 +04:00
|
|
|
YTab* top = NULL, XTab* left = NULL,
|
|
|
|
XTab* right = NULL);
|
2012-04-30 05:58:31 +04:00
|
|
|
BALMLayoutBuilder& AddBelow(BView* view, YTab* bottom = NULL,
|
2012-01-17 01:38:20 +04:00
|
|
|
XTab* left = NULL, XTab* right = NULL);
|
|
|
|
|
2012-04-30 05:58:31 +04:00
|
|
|
BALMLayoutBuilder& AddToLeft(BLayoutItem* item,
|
2012-01-17 01:38:20 +04:00
|
|
|
XTab* left = NULL, YTab* top = NULL,
|
|
|
|
YTab* bottom = NULL);
|
2012-04-30 05:58:31 +04:00
|
|
|
BALMLayoutBuilder& AddToRight(BLayoutItem* item,
|
2012-01-17 01:38:20 +04:00
|
|
|
XTab* right = NULL, YTab* top = NULL,
|
|
|
|
YTab* bottom = NULL);
|
2012-04-30 05:58:31 +04:00
|
|
|
BALMLayoutBuilder& AddAbove(BLayoutItem* item,
|
2012-01-17 01:38:20 +04:00
|
|
|
YTab* top = NULL, XTab* left = NULL,
|
|
|
|
XTab* right = NULL);
|
2012-04-30 05:58:31 +04:00
|
|
|
BALMLayoutBuilder& AddBelow(BLayoutItem* item,
|
2012-01-17 01:38:20 +04:00
|
|
|
YTab* bottom = NULL, XTab* left = NULL,
|
|
|
|
XTab* right = NULL);
|
|
|
|
|
|
|
|
|
2012-04-30 05:58:31 +04:00
|
|
|
BALMLayoutBuilder& Push();
|
|
|
|
BALMLayoutBuilder& Pop();
|
2012-01-17 01:38:20 +04:00
|
|
|
|
|
|
|
|
2012-04-30 05:58:31 +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:
|
2012-04-30 05:58:31 +04:00
|
|
|
typedef BObjectList<Area> AreaStack;
|
2012-01-17 01:38:20 +04:00
|
|
|
|
|
|
|
BALMLayout* fLayout;
|
2012-04-30 05:58:31 +04:00
|
|
|
AreaStack fAreaStack;
|
|
|
|
|
|
|
|
Area* _CurrentArea() const;
|
|
|
|
void _SetCurrentArea(Area*);
|
2012-01-17 01:38:20 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|