示例#1
0
文件: Area.cpp 项目: mariuz/haiku
/**
 * Perform layout on the area.
 */
void Area::DoLayout()
{
	if (Content() == NULL)
		return; // empty areas need no layout

	// if there is a childArea, then it is the childArea that actually contains the content
	Area* area = (fChildArea != NULL) ? fChildArea : this;

	// set content location and size
	area->Content()->MoveTo(floor(area->Left()->Value() + 0.5),
			floor(area->Top()->Value() + 0.5));
	int32 width = (int32)floor(area->Right()->Value() - area->Left()->Value() + 0.5);
	int32 height = (int32)floor(area->Bottom()->Value() - area->Top()->Value() + 0.5);
	area->Content()->ResizeTo(width, height);
}
示例#2
0
BALMLayoutBuilder&
BALMLayoutBuilder::AddToLeft(BView* view, XTab* _left, YTab* top, YTab* bottom)
{
	Area* currentArea = _CurrentArea();
	BReference<XTab> left = _left;
	if (_left == NULL)
		left = fLayout->AddXTab();
	XTab* right = currentArea->Left();
	if (!top)
		top = currentArea->Top();
	if (!bottom)
		bottom = currentArea->Bottom();

	return Add(view, left, top, right, bottom);
}
示例#3
0
BALMLayoutBuilder&
BALMLayoutBuilder::AddAbove(BLayoutItem* item, YTab* _top, XTab* left,
	XTab* right)
{
	Area* currentArea = _CurrentArea();
	if (!left)
		left = currentArea->Left();
	if (!right)
		right = currentArea->Right();
	BReference<YTab> top = _top;
	if (_top == NULL)
		top = fLayout->AddYTab();
	YTab* bottom = currentArea->Top();

	return Add(item, left, top, right, bottom);
}
示例#4
0
BALMLayoutBuilder&
BALMLayoutBuilder::AddToRight(BLayoutItem* item, XTab* _right, YTab* top,
	YTab* bottom)
{
	Area* currentArea = _CurrentArea();
	XTab* left = currentArea->Right();
	BReference<XTab> right = _right;
	if (_right == NULL)
		right = fLayout->AddXTab();
	if (!top)
		top = currentArea->Top();
	if (!bottom)
		bottom = currentArea->Bottom();

	return Add(item, left, top, right, bottom);
}