- Add helper functions to get the tabs of a view or a layout item.

- AddView only require the top, left tabs now.
- Remove the TwoViews test and replace it with a slightly more complex test.
- Merge XTab and YTab files into one header file.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38860 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Clemens Zeidler
2010-09-30 01:32:48 +00:00
parent 7c8978a92c
commit 70e2076135
13 changed files with 220 additions and 189 deletions
+15 -6
View File
@@ -17,8 +17,7 @@
#include "Column.h"
#include "LinearSpec.h"
#include "Row.h"
#include "XTab.h"
#include "YTab.h"
#include "Tab.h"
namespace BALM {
@@ -54,17 +53,26 @@ public:
void SetSpacing(float spacing);
float Spacing() const;
Area* AreaFor(const BView* control) const;
Area* AreaFor(const BView* view) const;
Area* AreaFor(const BLayoutItem* item) const;
Area* CurrentArea() const;
void SetCurrentArea(const Area* area);
void SetCurrentArea(const BView* control);
void SetCurrentArea(const BView* view);
void SetCurrentArea(const BLayoutItem* item);
XTab* LeftOf(const BView* view) const;
XTab* LeftOf(const BLayoutItem* item) const;
XTab* RightOf(const BView* view) const;
XTab* RightOf(const BLayoutItem* item) const;
YTab* TopOf(const BView* view) const;
YTab* TopOf(const BLayoutItem* item) const;
YTab* BottomOf(const BView* view) const;
YTab* BottomOf(const BLayoutItem* item) const;
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);
XTab* right = NULL, YTab* bottom = NULL);
virtual Area* AddView(BView* view, Row* row, Column* column);
virtual Area* AddViewToRight(BView* view, XTab* right = NULL,
YTab* top = NULL, YTab* bottom = NULL);
@@ -79,7 +87,8 @@ public:
virtual bool AddItem(BLayoutItem* item);
virtual bool AddItem(int32 index, BLayoutItem* item);
virtual Area* AddItem(BLayoutItem* item, XTab* left,
YTab* top, XTab* right, YTab* bottom);
YTab* top, XTab* right = NULL,
YTab* bottom = NULL);
virtual Area* AddItem(BLayoutItem* item, Row* row,
Column* column);
virtual Area* AddItemToRight(BLayoutItem* item,
+1 -2
View File
@@ -15,8 +15,7 @@
#include "Column.h"
#include "LinearSpec.h"
#include "Row.h"
#include "XTab.h"
#include "YTab.h"
#include "Tab.h"
class Constraint;
@@ -18,25 +18,37 @@ namespace BALM {
*/
class XTab : public Variable {
protected:
XTab(LinearSpec* ls);
protected:
/**
* Property signifying if there is a constraint which relates
* this tab to a different tab that is further to the left.
* Only used for reverse engineering.
*/
bool fLeftLink;
XTab(LinearSpec* ls)
:
Variable(ls)
{
}
public:
friend class Area;
friend class Column;
friend class BALMLayout;
friend class BALMLayout;
friend class Column;
};
class YTab : public Variable {
protected:
YTab(LinearSpec* ls)
:
Variable(ls)
{
}
public:
friend class BALMLayout;
friend class Row;
};
} // namespace BALM
using BALM::XTab;
using BALM::YTab;
#endif // X_TAB_H
-42
View File
@@ -1,42 +0,0 @@
/*
* Copyright 2006 - 2010, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef Y_TAB_H
#define Y_TAB_H
#include "LinearSpec.h"
#include "Variable.h"
namespace BALM {
/**
* Horizontal grid line (y-tab).
*/
class YTab : public Variable {
protected:
YTab(LinearSpec* ls);
protected:
/**
* Property signifying if there is a constraint which relates
* this tab to a different tab that is further to the top.
* Only used for reverse engineering.
*/
bool fTopLink;
public:
friend class Area;
friend class Row;
friend class BALMLayout;
};
} // namespace BALM
using BALM::YTab;
#endif // Y_TAB_H