예제 #1
0
void MultiLineText::Layout()
{
	const Point newSize(m_layout->ComputeSize(GetSize()));
	if (m_preferredSize != newSize) GetContext()->RequestLayout();
	m_preferredSize = newSize;
	SetActiveArea(m_preferredSize);
}
예제 #2
0
void ModelSpinner::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);
}
예제 #3
0
파일: Label.cpp 프로젝트: Baph/pioneer
void Label::Layout()
{
	if (m_preferredSize == Point())
		PreferredSize();

	const Point &size = GetSize();
	SetActiveArea(Point(std::min(m_preferredSize.x,size.x), std::min(m_preferredSize.y,size.y)));
}
예제 #4
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));
}
예제 #5
0
파일: Button.cpp 프로젝트: AmesianX/pioneer
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));
}
예제 #6
0
파일: Face.cpp 프로젝트: Nikoraito/pioneer
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();
}
예제 #7
0
파일: Image.cpp 프로젝트: GizmoR13/pioneer
void Image::Layout()
{
	Point size = GetSize();

	Point activeArea;

	switch (m_stretchMode) {
		case STRETCH_MAX:
			activeArea = size;
			break;

		case STRETCH_PRESERVE_ASPECT: {

			float originalRatio = float(m_initialSize.x) / float(m_initialSize.y);
			float wantRatio = float(size.x) / float(size.y);

			// more room on X than Y, use full X, scale Y
			if (wantRatio < originalRatio) {
				activeArea.x = size.x;
				activeArea.y = float(size.x) / originalRatio;
			}

			// more room on Y than X, use full Y, scale X
			else {
				activeArea.x = float(size.y) * originalRatio;
				activeArea.y = size.y;
			}

			break;
		}

		default:
			assert(0);
	}

	Point activeOffset(std::max(0, (size.x-activeArea.x)/2), std::max(0, (size.y-activeArea.y)/2));

	SetActiveArea(activeArea, activeOffset);
}
예제 #8
0
void Widget::SetDimensions(const Point &position, const Point &size)
{
	m_position = position;
	SetSize(size);
	SetActiveArea(size);
}
예제 #9
0
void Gauge::Layout()
{
	SetActiveArea(Point(GetSize().x, GetContext()->GetSkin().GaugeBackground().size.y));
}
예제 #10
0
void SmallButton::Layout()
{
	SetActiveArea(PreferredSize());
}
예제 #11
0
void MultiLineText::Layout()
{
	m_preferredSize = m_layout->ComputeSize(GetSize());
	SetActiveArea(m_preferredSize);
}
예제 #12
0
void CheckBox::Layout()
{
	SetActiveArea(PreferredSize());
}