Exemple #1
0
void Face::Layout()
{
	Point size(GetSize());
	Point activeArea(std::min(size.x, size.y));
	Point activeOffset(std::max(0, (size.x-activeArea.x)/2), std::max(0, (size.y-activeArea.y)/2));
	SetActiveArea(activeArea, activeOffset);

	Widget *innerWidget = GetInnerWidget();
	if (!innerWidget) return;
	SetWidgetDimensions(innerWidget, activeOffset, activeArea);
	innerWidget->Layout();
}
Exemple #2
0
void Button::Layout()
{
	Widget *innerWidget = GetInnerWidget();

	if (!innerWidget) {
		SetActiveArea(Point(GetContext()->GetSkin().ButtonMinInnerSize()) + Point(GetContext()->GetSkin().ButtonNormal().borderWidth*2));
		return;
	}

	const Point innerSize = GetSize() - Point(GetContext()->GetSkin().ButtonNormal().borderWidth*2);
	SetWidgetDimensions(innerWidget, Point(GetContext()->GetSkin().ButtonNormal().borderWidth), CalcSize(innerWidget, innerSize));
	innerWidget->Layout();

	Point innerActiveArea(innerWidget->GetActiveArea());
	growToMinimum(innerActiveArea, GetContext()->GetSkin().ButtonMinInnerSize());

	SetActiveArea(innerActiveArea + Point(GetContext()->GetSkin().ButtonNormal().borderWidth*2));
}
Exemple #3
0
void Button::Layout()
{
	Widget *innerWidget = GetInnerWidget();

	const Skin::BorderedRectElement &elem(GetContext()->GetSkin().ButtonNormal());

	if (!innerWidget) {
		SetActiveArea(PreferredSize());
		return;
	}

	const Point innerSize = GetSize() - Point(elem.paddingX*2, elem.paddingY*2);
	SetWidgetDimensions(innerWidget, Point(elem.paddingX, elem.paddingY), innerWidget->CalcSize(innerSize));
	innerWidget->Layout();

	Point innerActiveArea(innerWidget->GetActiveArea());
	growToMinimum(innerActiveArea, GetContext()->GetSkin().ButtonMinInnerSize());

	SetActiveArea(innerActiveArea + Point(elem.paddingX*2, elem.paddingY*2));
}