In BALMLayout, allow for more flexibility in spacing and insets.

* allow for independent left, top, right and bottom insets
* allow for independent vertical and horizontal spacing between tabs
* allow for the usage of Haiku's spacing constants such as B_USE_WINDOW_INSETS
This commit is contained in:
Alex Wilson
2012-05-03 08:44:17 +12:00
parent 1be46cf584
commit 75e2dcf8fe
3 changed files with 112 additions and 36 deletions
+22 -7
View File
@@ -31,7 +31,8 @@ class RowColumnManager;
*/
class BALMLayout : public BAbstractLayout {
public:
BALMLayout(float spacing = 0.0f,
BALMLayout(float hSpacing = 0.0f,
float vSpacing = 0.0f,
BALMLayout* friendLayout = NULL);
virtual ~BALMLayout();
@@ -56,11 +57,16 @@ public:
LinearSpec* Solver() const;
void SetInset(float inset);
float Inset() const;
void SetInsets(float insets);
void SetInsets(float x, float y);
void SetInsets(float left, float top, float right,
float bottom);
void GetInsets(float* left, float* top, float* right,
float* bottom) const;
void SetSpacing(float spacing);
float Spacing() const;
void SetSpacing(float hSpacing, float vSpacing);
void GetSpacing(float* _hSpacing,
float* _vSpacing) const;
Area* AreaFor(int32 id) const;
Area* AreaFor(const BView* view) const;
@@ -139,6 +145,10 @@ protected:
private:
friend class XTab;
friend class YTab;
friend class Area;
float InsetForTab(XTab* tab);
float InsetForTab(YTab* tab);
/*! Add a view without initialize the Area. */
BLayoutItem* _CreateLayoutItem(BView* view);
@@ -165,8 +175,13 @@ private:
BSize fMaxSize;
BSize fPreferredSize;
float fInset;
float fSpacing;
float fLeftInset;
float fRightInset;
float fTopInset;
float fBottomInset;
float fHSpacing;
float fVSpacing;
Area* fCurrentArea;