2008-02-25 04:54:05 +03:00
|
|
|
/*
|
2010-09-22 03:31:50 +04:00
|
|
|
* Copyright 2006 - 2010, Haiku, Inc. All rights reserved.
|
2008-02-25 04:54:05 +03:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2008-02-06 13:51:44 +03:00
|
|
|
#ifndef AREA_H
|
|
|
|
#define AREA_H
|
|
|
|
|
2010-09-23 01:53:32 +04:00
|
|
|
|
2012-01-17 05:28:01 +04:00
|
|
|
#include <Referenceable.h>
|
2012-01-17 06:50:57 +04:00
|
|
|
#include <Rect.h>
|
2008-02-06 13:51:44 +03:00
|
|
|
#include <Size.h>
|
2012-01-17 05:28:01 +04:00
|
|
|
#include <String.h>
|
2008-02-06 13:51:44 +03:00
|
|
|
|
2010-09-20 10:09:19 +04:00
|
|
|
|
2012-01-17 05:28:01 +04:00
|
|
|
class BLayoutItem;
|
|
|
|
class BView;
|
2010-09-20 10:09:19 +04:00
|
|
|
|
2012-01-17 05:28:01 +04:00
|
|
|
|
|
|
|
namespace LinearProgramming {
|
|
|
|
class LinearSpec;
|
|
|
|
class Constraint;
|
|
|
|
};
|
2009-10-28 12:00:14 +03:00
|
|
|
|
2012-02-02 05:47:41 +04:00
|
|
|
namespace BPrivate {
|
|
|
|
class SharedSolver;
|
|
|
|
};
|
|
|
|
|
2008-02-06 13:51:44 +03:00
|
|
|
|
|
|
|
namespace BALM {
|
|
|
|
|
2010-09-20 10:09:19 +04:00
|
|
|
|
2012-01-17 05:28:01 +04:00
|
|
|
class Column;
|
|
|
|
class Row;
|
|
|
|
class XTab;
|
|
|
|
class YTab;
|
|
|
|
|
|
|
|
|
2010-10-04 00:05:52 +04:00
|
|
|
|
|
|
|
|
2011-03-14 03:24:12 +03:00
|
|
|
class RowColumnManager;
|
|
|
|
|
|
|
|
|
2008-02-06 13:51:44 +03:00
|
|
|
/**
|
|
|
|
* Rectangular area in the GUI, defined by a tab on each side.
|
|
|
|
*/
|
|
|
|
class Area {
|
|
|
|
public:
|
2010-09-20 10:26:32 +04:00
|
|
|
~Area();
|
|
|
|
|
2012-01-11 08:19:29 +04:00
|
|
|
int32 ID() const;
|
|
|
|
void SetID(int32 id);
|
|
|
|
|
2011-03-14 03:24:12 +03:00
|
|
|
BLayoutItem* Item();
|
2010-09-21 11:04:40 +04:00
|
|
|
|
2010-09-20 10:26:32 +04:00
|
|
|
XTab* Left() const;
|
|
|
|
XTab* Right() const;
|
|
|
|
YTab* Top() const;
|
|
|
|
YTab* Bottom() const;
|
2012-10-17 11:23:00 +04:00
|
|
|
void SetLeft(BReference<XTab> left);
|
|
|
|
void SetRight(BReference<XTab> right);
|
|
|
|
void SetTop(BReference<YTab> top);
|
|
|
|
void SetBottom(BReference<YTab> bottom);
|
2010-09-20 10:26:32 +04:00
|
|
|
|
|
|
|
Row* GetRow() const;
|
|
|
|
Column* GetColumn() const;
|
|
|
|
|
|
|
|
double ContentAspectRatio() const;
|
|
|
|
void SetContentAspectRatio(double ratio);
|
|
|
|
|
2010-09-21 11:04:40 +04:00
|
|
|
BSize ShrinkPenalties() const;
|
|
|
|
BSize GrowPenalties() const;
|
2010-09-22 09:50:51 +04:00
|
|
|
void SetShrinkPenalties(BSize shrink);
|
2010-09-21 11:04:40 +04:00
|
|
|
void SetGrowPenalties(BSize grow);
|
|
|
|
|
2012-01-17 02:41:57 +04:00
|
|
|
void GetInsets(float* left, float* top, float* right,
|
|
|
|
float* bottom) const;
|
2010-10-04 23:10:22 +04:00
|
|
|
float LeftInset() const;
|
|
|
|
float TopInset() const;
|
|
|
|
float RightInset() const;
|
|
|
|
float BottomInset() const;
|
2012-01-17 02:41:57 +04:00
|
|
|
|
|
|
|
void SetInsets(float insets);
|
|
|
|
void SetInsets(float horizontal, float vertical);
|
|
|
|
void SetInsets(float left, float top, float right,
|
|
|
|
float bottom);
|
2010-10-04 23:10:22 +04:00
|
|
|
void SetLeftInset(float left);
|
|
|
|
void SetTopInset(float top);
|
|
|
|
void SetRightInset(float right);
|
|
|
|
void SetBottomInset(float bottom);
|
2010-09-20 10:26:32 +04:00
|
|
|
|
2011-03-14 03:24:12 +03:00
|
|
|
BString ToString() const;
|
2010-09-20 10:26:32 +04:00
|
|
|
|
2012-01-17 05:28:01 +04:00
|
|
|
LinearProgramming::Constraint*
|
|
|
|
SetWidthAs(Area* area, float factor = 1.0f);
|
|
|
|
|
|
|
|
LinearProgramming::Constraint*
|
|
|
|
SetHeightAs(Area* area, float factor = 1.0f);
|
2009-12-06 16:14:45 +03:00
|
|
|
|
2010-09-22 03:18:43 +04:00
|
|
|
void InvalidateSizeConstraints();
|
|
|
|
|
2011-11-30 08:55:36 +04:00
|
|
|
BRect Frame() const;
|
2011-03-14 03:24:12 +03:00
|
|
|
|
2010-09-22 09:50:51 +04:00
|
|
|
private:
|
2010-09-22 08:51:09 +04:00
|
|
|
Area(BLayoutItem* item);
|
2010-09-21 11:04:40 +04:00
|
|
|
|
2012-01-17 05:28:01 +04:00
|
|
|
void _Init(LinearProgramming::LinearSpec* ls,
|
|
|
|
XTab* left, YTab* top, XTab* right,
|
|
|
|
YTab* bottom, RowColumnManager* manager);
|
|
|
|
void _Init(LinearProgramming::LinearSpec* ls,
|
|
|
|
Row* row, Column* column,
|
2011-03-14 03:24:12 +03:00
|
|
|
RowColumnManager* manager);
|
2010-09-21 11:04:40 +04:00
|
|
|
|
2012-01-20 02:02:54 +04:00
|
|
|
void _DoLayout(const BPoint& offset);
|
2009-12-06 16:14:45 +03:00
|
|
|
|
2010-09-22 03:18:43 +04:00
|
|
|
void _UpdateMinSizeConstraint(BSize min);
|
|
|
|
void _UpdateMaxSizeConstraint(BSize max);
|
2008-02-06 13:51:44 +03:00
|
|
|
private:
|
2012-01-17 07:21:32 +04:00
|
|
|
friend class BALMLayout;
|
|
|
|
friend class RowColumnManager;
|
2012-02-02 05:47:41 +04:00
|
|
|
friend class BPrivate::SharedSolver;
|
2012-01-17 07:21:32 +04:00
|
|
|
|
2010-09-21 11:04:40 +04:00
|
|
|
BLayoutItem* fLayoutItem;
|
2012-01-11 08:19:29 +04:00
|
|
|
int32 fID;
|
2010-09-23 04:53:33 +04:00
|
|
|
|
2012-01-17 05:28:01 +04:00
|
|
|
LinearProgramming::LinearSpec* fLS;
|
2010-09-22 08:51:09 +04:00
|
|
|
|
2011-11-30 08:55:36 +04:00
|
|
|
BReference<XTab> fLeft;
|
|
|
|
BReference<XTab> fRight;
|
|
|
|
BReference<YTab> fTop;
|
|
|
|
BReference<YTab> fBottom;
|
2010-09-22 08:51:09 +04:00
|
|
|
|
|
|
|
Row* fRow;
|
|
|
|
Column* fColumn;
|
|
|
|
|
|
|
|
BSize fShrinkPenalties;
|
|
|
|
BSize fGrowPenalties;
|
|
|
|
|
2012-01-18 00:08:53 +04:00
|
|
|
BSize fLeftTopInset;
|
2010-09-23 04:53:33 +04:00
|
|
|
BSize fRightBottomInset;
|
2009-12-06 16:14:45 +03:00
|
|
|
|
2010-09-22 09:55:15 +04:00
|
|
|
double fContentAspectRatio;
|
2011-03-14 03:24:12 +03:00
|
|
|
RowColumnManager* fRowColumnManager;
|
2012-01-17 05:28:01 +04:00
|
|
|
|
|
|
|
LinearProgramming::Constraint* fMinContentWidth;
|
|
|
|
LinearProgramming::Constraint* fMaxContentWidth;
|
|
|
|
LinearProgramming::Constraint* fMinContentHeight;
|
|
|
|
LinearProgramming::Constraint* fMaxContentHeight;
|
|
|
|
LinearProgramming::Constraint* fContentAspectRatioC;
|
|
|
|
|
2012-01-17 07:21:32 +04:00
|
|
|
uint32 _reserved[2];
|
2008-02-06 13:51:44 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace BALM
|
|
|
|
|
|
|
|
using BALM::Area;
|
|
|
|
|
|
|
|
#endif // AREA_H
|
2008-03-11 00:43:32 +03:00
|
|
|
|