2008-02-25 04:54:05 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2007-2008, Christof Lutteroth, lutteroth@cs.auckland.ac.nz
|
|
|
|
* Copyright 2007-2008, James Kim, jkim202@ec.auckland.ac.nz
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
|
2008-02-06 13:51:44 +03:00
|
|
|
#ifndef BALM_LAYOUT_H
|
|
|
|
#define BALM_LAYOUT_H
|
|
|
|
|
|
|
|
#include <File.h>
|
|
|
|
#include <Layout.h>
|
|
|
|
#include <List.h>
|
|
|
|
#include <Size.h>
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
#include <View.h>
|
|
|
|
|
|
|
|
#include "LayoutStyleType.h"
|
|
|
|
#include "LinearSpec.h"
|
|
|
|
|
|
|
|
|
|
|
|
namespace BALM {
|
|
|
|
|
|
|
|
class Area;
|
|
|
|
class Column;
|
|
|
|
class Row;
|
|
|
|
class XTab;
|
|
|
|
class YTab;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A GUI layout engine using the ALM.
|
|
|
|
*/
|
|
|
|
class BALMLayout : public BLayout, public LinearSpec {
|
|
|
|
|
|
|
|
public:
|
|
|
|
BALMLayout();
|
2008-03-11 00:43:32 +03:00
|
|
|
void SolveLayout();
|
2008-02-06 13:51:44 +03:00
|
|
|
|
|
|
|
XTab* AddXTab();
|
|
|
|
YTab* AddYTab();
|
|
|
|
Row* AddRow();
|
|
|
|
Row* AddRow(YTab* top, YTab* bottom);
|
|
|
|
Column* AddColumn();
|
|
|
|
Column* AddColumn(XTab* left, XTab* right);
|
2008-03-11 00:43:32 +03:00
|
|
|
|
2008-02-06 13:51:44 +03: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);
|
|
|
|
Area* AreaOf(BView* control);
|
|
|
|
BList* Areas() const;
|
2008-03-11 00:43:32 +03:00
|
|
|
|
2008-02-06 13:51:44 +03:00
|
|
|
XTab* Left() const;
|
|
|
|
XTab* Right() const;
|
|
|
|
YTab* Top() const;
|
|
|
|
YTab* Bottom() const;
|
|
|
|
|
2008-03-11 00:43:32 +03:00
|
|
|
void RecoverLayout(BView* parent);
|
|
|
|
|
2008-02-06 13:51:44 +03:00
|
|
|
LayoutStyleType LayoutStyle() const;
|
2008-03-11 00:43:32 +03:00
|
|
|
void SetLayoutStyle(LayoutStyleType style);
|
2008-02-06 13:51:44 +03:00
|
|
|
|
2008-03-11 00:43:32 +03:00
|
|
|
BLayoutItem* AddView(BView* child);
|
|
|
|
BLayoutItem* AddView(int32 index, BView* child);
|
2008-02-06 13:51:44 +03:00
|
|
|
bool AddItem(BLayoutItem* item);
|
|
|
|
bool AddItem(int32 index, BLayoutItem* item);
|
|
|
|
bool RemoveView(BView* child);
|
|
|
|
bool RemoveItem(BLayoutItem* item);
|
2008-03-11 00:43:32 +03:00
|
|
|
BLayoutItem* RemoveItem(int32 index);
|
2008-02-06 13:51:44 +03:00
|
|
|
|
|
|
|
BSize MinSize();
|
|
|
|
BSize MaxSize();
|
|
|
|
BSize PreferredSize();
|
|
|
|
BAlignment Alignment();
|
|
|
|
bool HasHeightForWidth();
|
2008-03-11 00:43:32 +03:00
|
|
|
void GetHeightForWidth(float width, float* min,
|
2008-02-06 13:51:44 +03:00
|
|
|
float* max, float* preferred);
|
2008-03-11 00:43:32 +03:00
|
|
|
void InvalidateLayout();
|
|
|
|
void LayoutView();
|
2008-02-06 13:51:44 +03:00
|
|
|
|
|
|
|
char* PerformancePath() const;
|
2008-03-11 00:43:32 +03:00
|
|
|
void SetPerformancePath(char* path);
|
2008-02-06 13:51:44 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
BSize CalculateMinSize();
|
|
|
|
BSize CalculateMaxSize();
|
|
|
|
BSize CalculatePreferredSize();
|
|
|
|
|
|
|
|
private:
|
|
|
|
LayoutStyleType fLayoutStyle;
|
|
|
|
bool fActivated;
|
|
|
|
|
|
|
|
BList* fAreas;
|
|
|
|
XTab* fLeft;
|
|
|
|
XTab* fRight;
|
|
|
|
YTab* fTop;
|
|
|
|
YTab* fBottom;
|
|
|
|
BSize fMinSize;
|
|
|
|
BSize fMaxSize;
|
|
|
|
BSize fPreferredSize;
|
|
|
|
char* fPerformancePath;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace BALM
|
|
|
|
|
|
|
|
using BALM::BALMLayout;
|
|
|
|
|
|
|
|
#endif // BALM_LAYOUT_H
|