- Rework the ALM layout api. The AddItemTo* function are now related to the current Area. On default the current Area is the last added Area.

- Add some more const where appreciated.
- Fix some style issues and a leak in Row and Column.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38842 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Clemens Zeidler
2010-09-29 03:30:47 +00:00
parent e65a6eb2e0
commit 5b6fca0639
7 changed files with 148 additions and 158 deletions
+27 -24
View File
@@ -46,29 +46,33 @@ public:
char* PerformancePath() const;
void SetPerformancePath(char* path);
LinearSpec* Solver();
LinearSpec* Solver() const;
void SetInset(float inset);
float Inset();
float Inset() const;
void SetSpacing(float spacing);
float Spacing();
float Spacing() const;
Area* AreaFor(const BView* control) const;
Area* AreaFor(const BLayoutItem* item) const;
Area* CurrentArea() const;
void SetCurrentArea(const Area* area);
void SetCurrentArea(const BView* control);
void SetCurrentArea(const BLayoutItem* item);
virtual BLayoutItem* AddView(BView* child);
virtual BLayoutItem* AddView(int32 index, BView* child);
virtual Area* AddView(BView* view, XTab* left, YTab* top,
XTab* right, YTab* bottom);
virtual Area* AddView(BView* view, Row* row, Column* column);
virtual Area* AddViewToRight(BView* view, Area* leftArea,
XTab* right = NULL, YTab* top = NULL,
YTab* bottom = NULL);
virtual Area* AddViewToLeft(BView* view, Area* rightArea,
XTab* left = NULL, YTab* top = NULL,
YTab* bottom = NULL);
virtual Area* AddViewToTop(BView* view, Area* bottomArea,
YTab* top = NULL, XTab* left = NULL,
XTab* right = NULL);
virtual Area* AddViewToBottom(BView* view, Area* topArea,
virtual Area* AddViewToRight(BView* view, XTab* right = NULL,
YTab* top = NULL, YTab* bottom = NULL);
virtual Area* AddViewToLeft(BView* view, XTab* left = NULL,
YTab* top = NULL, YTab* bottom = NULL);
virtual Area* AddViewToTop(BView* view, YTab* top = NULL,
XTab* left = NULL, XTab* right = NULL);
virtual Area* AddViewToBottom(BView* view,
YTab* bottom = NULL, XTab* left = NULL,
XTab* right = NULL);
@@ -79,19 +83,17 @@ public:
virtual Area* AddItem(BLayoutItem* item, Row* row,
Column* column);
virtual Area* AddItemToRight(BLayoutItem* item,
Area* leftArea, XTab* right = NULL,
YTab* top = NULL, YTab* bottom = NULL);
XTab* right = NULL, YTab* top = NULL,
YTab* bottom = NULL);
virtual Area* AddItemToLeft(BLayoutItem* item,
Area* rightArea, XTab* left = NULL,
YTab* top = NULL, YTab* bottom = NULL);
XTab* left = NULL, YTab* top = NULL,
YTab* bottom = NULL);
virtual Area* AddItemToTop(BLayoutItem* item,
Area* bottomArea, YTab* top = NULL,
XTab* left = NULL, XTab* right = NULL);
YTab* top = NULL, XTab* left = NULL,
XTab* right = NULL);
virtual Area* AddItemToBottom(BLayoutItem* item,
Area* topArea, YTab* bottom = NULL,
XTab* left = NULL, XTab* right = NULL);
virtual Area* AreaOf(BView* control);
YTab* bottom = NULL, XTab* left = NULL,
XTab* right = NULL);
virtual BSize BaseMinSize();
virtual BSize BaseMaxSize();
@@ -110,7 +112,6 @@ private:
void _SolveLayout();
Area* _AreaForItem(BLayoutItem* item) const;
void _UpdateAreaConstraints();
BSize _CalculateMinSize();
@@ -131,6 +132,8 @@ private:
float fInset;
float fSpacing;
Area* fCurrentArea;
};
} // namespace BALM
+10 -11
View File
@@ -6,8 +6,6 @@
#define COLUMN_H
#include <List.h>
#include "Constraint.h"
#include "LinearSpec.h"
@@ -22,19 +20,20 @@ class XTab;
*/
class Column {
public:
~Column();
XTab* Left() const;
XTab* Right() const;
Column* Previous() const;
void SetPrevious(Column* value);
void SetPrevious(Column* value);
Column* Next() const;
void SetNext(Column* value);
//~ string ToString();
void InsertBefore(Column* column);
void InsertAfter(Column* column);
void SetNext(Column* value);
void InsertBefore(Column* column);
void InsertAfter(Column* column);
Constraint* HasSameWidthAs(Column* column);
BList* Constraints() const;
void SetConstraints(BList* constraints);
~Column();
ConstraintList* Constraints() const;
protected:
Column(LinearSpec* ls);
@@ -49,7 +48,7 @@ private:
Column* fNext;
Constraint* fPreviousGlue;
Constraint* fNextGlue;
BList* fConstraints;
ConstraintList fConstraints;
public:
friend class BALMLayout;
+8 -11
View File
@@ -6,8 +6,6 @@
#define ROW_H
#include <List.h>
#include "Constraint.h"
#include "LinearSpec.h"
@@ -22,19 +20,18 @@ class YTab;
*/
class Row {
public:
~Row();
YTab* Top() const;
YTab* Bottom() const;
Row* Previous() const;
void SetPrevious(Row* value);
void SetPrevious(Row* value);
Row* Next() const;
void SetNext(Row* value);
//~ string ToString();
void InsertBefore(Row* row);
void InsertAfter(Row* row);
void SetNext(Row* value);
void InsertBefore(Row* row);
void InsertAfter(Row* row);
Constraint* HasSameHeightAs(Row* row);
BList* Constraints() const;
void SetConstraints(BList* constraints);
~Row();
ConstraintList* Constraints() const;
protected:
Row(LinearSpec* ls);
@@ -49,7 +46,7 @@ private:
Row* fNext;
Constraint* fPreviousGlue;
Constraint* fNextGlue;
BList* fConstraints;
ConstraintList fConstraints;
public:
friend class BALMLayout;