/** * 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); }
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); }
BALMLayoutBuilder& BALMLayoutBuilder::AddBelow(BLayoutItem* item, YTab* _bottom, XTab* left, XTab* right) { Area* currentArea = _CurrentArea(); if (!left) left = currentArea->Left(); if (!right) right = currentArea->Right(); YTab* top = currentArea->Bottom(); BReference<YTab> bottom = _bottom; if (_bottom == NULL) bottom = fLayout->AddYTab(); return Add(item, left, top, right, bottom); }
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); }