2008-02-25 01:54:05 +00:00
|
|
|
/*
|
2010-09-21 23:31:50 +00:00
|
|
|
* Copyright 2006 - 2010, Haiku, Inc. All rights reserved.
|
2008-02-25 01:54:05 +00:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2010-09-21 23:31:50 +00:00
|
|
|
#ifndef ALM_LAYOUT_H
|
|
|
|
#define ALM_LAYOUT_H
|
2008-02-06 10:51:44 +00:00
|
|
|
|
2010-08-17 18:43:41 +00:00
|
|
|
#include <AbstractLayout.h>
|
2008-02-06 10:51:44 +00:00
|
|
|
#include <File.h>
|
|
|
|
#include <List.h>
|
|
|
|
#include <Size.h>
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
#include <View.h>
|
|
|
|
|
2009-10-28 09:00:14 +00:00
|
|
|
#include "Area.h"
|
|
|
|
#include "Column.h"
|
2008-02-06 10:51:44 +00:00
|
|
|
#include "LinearSpec.h"
|
2010-09-20 06:26:32 +00:00
|
|
|
#include "Row.h"
|
|
|
|
#include "XTab.h"
|
|
|
|
#include "YTab.h"
|
2008-02-06 10:51:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace BALM {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A GUI layout engine using the ALM.
|
|
|
|
*/
|
2010-09-20 22:47:13 +00:00
|
|
|
class BALMLayout : public BAbstractLayout {
|
2008-02-06 10:51:44 +00:00
|
|
|
public:
|
2010-09-20 06:26:32 +00:00
|
|
|
BALMLayout();
|
2010-09-21 07:04:40 +00:00
|
|
|
virtual ~BALMLayout();
|
|
|
|
|
2010-09-20 06:26:32 +00:00
|
|
|
XTab* AddXTab();
|
|
|
|
YTab* AddYTab();
|
|
|
|
Row* AddRow();
|
|
|
|
Row* AddRow(YTab* top, YTab* bottom);
|
|
|
|
Column* AddColumn();
|
|
|
|
Column* AddColumn(XTab* left, XTab* right);
|
|
|
|
|
2010-09-21 07:04:40 +00:00
|
|
|
Area* AddArea(XTab* left, YTab* top, XTab* right,
|
|
|
|
YTab* bottom, BView* content, BSize minContentSize);
|
|
|
|
Area* AddArea(Row* row, Column* column,
|
|
|
|
BView* content, BSize minContentSize);
|
|
|
|
Area* AddArea(XTab* left, YTab* top, XTab* right,
|
|
|
|
YTab* bottom, BView* content);
|
|
|
|
Area* AddArea(Row* row, Column* column,
|
|
|
|
BView* content);
|
2010-09-20 06:26:32 +00:00
|
|
|
Area* AreaOf(BView* control);
|
2008-03-10 21:43:32 +00:00
|
|
|
|
2010-09-20 06:26:32 +00:00
|
|
|
XTab* Left() const;
|
|
|
|
XTab* Right() const;
|
|
|
|
YTab* Top() const;
|
|
|
|
YTab* Bottom() const;
|
2008-02-06 10:51:44 +00:00
|
|
|
|
2010-09-22 04:51:09 +00:00
|
|
|
virtual BSize BaseMinSize();
|
|
|
|
virtual BSize BaseMaxSize();
|
|
|
|
virtual BSize BasePreferredSize();
|
|
|
|
virtual BAlignment BaseAlignment();
|
2010-09-21 07:04:40 +00:00
|
|
|
|
|
|
|
virtual void InvalidateLayout(bool children = false);
|
|
|
|
|
|
|
|
virtual bool ItemAdded(BLayoutItem* item, int32 atIndex);
|
|
|
|
virtual void ItemRemoved(BLayoutItem* item, int32 fromIndex);
|
|
|
|
virtual void DerivedLayoutItems();
|
2010-09-20 06:26:32 +00:00
|
|
|
|
|
|
|
char* PerformancePath() const;
|
|
|
|
void SetPerformancePath(char* path);
|
2008-02-06 10:51:44 +00:00
|
|
|
|
2010-09-20 22:47:13 +00:00
|
|
|
LinearSpec* Solver();
|
|
|
|
|
2008-02-06 10:51:44 +00:00
|
|
|
private:
|
2010-09-22 05:29:50 +00:00
|
|
|
void _SolveLayout();
|
|
|
|
|
2010-09-21 07:04:40 +00:00
|
|
|
Area* _AreaForItem(BLayoutItem* item) const;
|
2010-09-21 23:18:43 +00:00
|
|
|
void _UpdateAreaConstraints();
|
2010-09-21 07:04:40 +00:00
|
|
|
|
2010-09-22 05:29:50 +00:00
|
|
|
BSize _CalculateMinSize();
|
|
|
|
BSize _CalculateMaxSize();
|
|
|
|
BSize _CalculatePreferredSize();
|
2008-02-06 10:51:44 +00:00
|
|
|
|
|
|
|
|
2010-09-20 22:47:13 +00:00
|
|
|
LinearSpec fSolver;
|
|
|
|
|
2010-09-20 06:26:32 +00:00
|
|
|
XTab* fLeft;
|
|
|
|
XTab* fRight;
|
|
|
|
YTab* fTop;
|
|
|
|
YTab* fBottom;
|
|
|
|
BSize fMinSize;
|
|
|
|
BSize fMaxSize;
|
|
|
|
BSize fPreferredSize;
|
|
|
|
char* fPerformancePath;
|
2008-02-06 10:51:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace BALM
|
|
|
|
|
|
|
|
using BALM::BALMLayout;
|
|
|
|
|
2010-09-21 23:31:50 +00:00
|
|
|
#endif // ALM_LAYOUT_H
|