Make tabs BReferenceable. Maintain a list of tabs.

This commit is contained in:
czeidler
2011-11-30 17:55:36 +13:00
parent b394b1d2bb
commit 57014d1ff7
10 changed files with 181 additions and 82 deletions
+18 -8
View File
@@ -35,12 +35,16 @@ public:
BALMLayout* friendLayout = NULL);
virtual ~BALMLayout();
XTab* AddXTab();
YTab* AddYTab();
BReference<XTab> AddXTab();
BReference<YTab> AddYTab();
int32 CountXTabs() const;
int32 CountYTabs() const;
XTab* XTabAt(int32 index) const;
YTab* YTabAt(int32 index) const;
/*! Order the tab list and return a reference to the list. */
const XTabList& OrderedXTabs();
const YTabList& OrderedYTabs();
Row* AddRow(YTab* top, YTab* bottom);
Column* AddColumn(XTab* left, XTab* right);
@@ -104,6 +108,7 @@ public:
YTab* bottom = NULL);
virtual Area* AddItem(BLayoutItem* item, Row* row,
Column* column);
virtual Area* AddItemToRight(BLayoutItem* item,
XTab* right = NULL, YTab* top = NULL,
YTab* bottom = NULL);
@@ -129,6 +134,9 @@ public:
virtual void DerivedLayoutItems();
private:
friend class XTab;
friend class YTab;
/*! Add a view without initialize the Area. */
BLayoutItem* _CreateLayoutItem(BView* view);
@@ -138,16 +146,18 @@ private:
BSize _CalculateMaxSize();
BSize _CalculatePreferredSize();
void _ParseGroupItem(GroupItem& item, XTab* left,
YTab* top, XTab* right, YTab* bottom);
void _ParseGroupItem(GroupItem& item,
BReference<XTab> left, BReference<YTab> top,
BReference<XTab> right,
BReference<YTab> bottom);
LinearSpec* fSolver;
LinearSpec fOwnSolver;
XTab* fLeft;
XTab* fRight;
YTab* fTop;
YTab* fBottom;
BReference<XTab> fLeft;
BReference<XTab> fRight;
BReference<YTab> fTop;
BReference<YTab> fBottom;
BSize fMinSize;
BSize fMaxSize;
BSize fPreferredSize;
+6 -6
View File
@@ -103,8 +103,8 @@ public:
void InvalidateSizeConstraints();
BRect Frame();
BRect ItemFrame();
BRect Frame() const;
BRect ItemFrame() const;
private:
Area(BLayoutItem* item);
@@ -124,10 +124,10 @@ private:
LinearSpec* fLS;
XTab* fLeft;
XTab* fRight;
YTab* fTop;
YTab* fBottom;
BReference<XTab> fLeft;
BReference<XTab> fRight;
BReference<YTab> fTop;
BReference<YTab> fBottom;
Row* fRow;
Column* fColumn;
+2 -2
View File
@@ -33,8 +33,8 @@ private:
Column(LinearSpec* ls, XTab* left, XTab* right);
LinearSpec* fLS;
XTab* fLeft;
XTab* fRight;
BReference<XTab> fLeft;
BReference<XTab> fRight;
//! managed by RowColumnManager
Constraint* fPrefSizeConstraint;
+2 -2
View File
@@ -33,8 +33,8 @@ private:
Row(LinearSpec* ls, YTab* top, YTab* bottom);
LinearSpec* fLS;
YTab* fTop;
YTab* fBottom;
BReference<YTab> fTop;
BReference<YTab> fBottom;
//! managed by RowColumnManager
Constraint* fPrefSizeConstraint;
+22 -18
View File
@@ -6,6 +6,7 @@
#define X_TAB_H
#include <Referenceable.h>
#include "LinearSpec.h"
#include "Variable.h"
@@ -13,34 +14,37 @@
namespace BALM {
class BALMLayout;
/**
* Vertical grid line (x-tab).
*/
class XTab : public Variable {
protected:
XTab(LinearSpec* ls)
:
Variable(ls)
{
}
class XTab : public Variable, public BReferenceable {
public:
virtual ~XTab();
friend class BALMLayout;
protected:
XTab(BALMLayout* layout);
private:
BALMLayout* fALMLayout;
};
class YTab : public Variable {
protected:
YTab(LinearSpec* ls)
:
Variable(ls)
{
}
class YTab : public Variable, public BReferenceable {
public:
virtual ~YTab();
friend class BALMLayout;
protected:
YTab(BALMLayout* layout);
private:
BALMLayout* fALMLayout;
};