Exemple #1
0
void WidgetCheckBox::load(const Aurora::GFF3Struct &gff) {
	KotORWidget::load(gff);

	Border border = createBorder(gff);
	Graphics::Aurora::TextureHandle texture = TextureMan.get(border.fill);

	float squareLength = _quad->getHeight();
	float _quadPosCorrect = (squareLength - (texture.getTexture().getHeight() * 0.625f)) / 2;
	float x, y, z;
	if (_quad) {
		_quad->getPosition(x, y, z);
		_quad->setPosition(x + _quadPosCorrect, y + _quadPosCorrect, z);
		_quad->setHeight(texture.getTexture().getHeight() * 0.625f);
		_quad->setWidth(texture.getTexture().getWidth() * 0.625f);
	}
	if (_text) {
		_text->getPosition(x, y, z);
		_text->setPosition(x + squareLength, y, z);
		_text->setSize(_text->getWidth() - squareLength, _text->getHeight());
	}

	if (getTextHighlightableComponent() != 0) {
		setTextHighlighting(getTextHighlightableComponent());
	}
	if (getQuadHighlightableComponent() != 0) {
		setQuadHighlighting(getQuadHighlightableComponent());
	}
}
Exemple #2
0
void WidgetButton::setIcon(const Common::UString &icon) {
	if (_icon == icon)
		return;

	_icon = icon;

	if (icon.empty()) {
		if (_iconQuad) {
			_iconQuad->hide();
			_iconQuad.reset();
		}
		return;
	}

	Graphics::Aurora::TextureHandle textureHandle = TextureMan.get(icon);
	Graphics::Aurora::Texture &texture = textureHandle.getTexture();

	_iconQuad.reset(new Graphics::Aurora::GUIQuad(
			textureHandle,
			0.0f, 0.0f, texture.getWidth(), texture.getHeight()));

	float x, y, z;
	getPosition(x, y, z);

	_iconQuad->setPosition(
		x + getWidth() / 2.0f - texture.getWidth() / 2.0f,
		y + getHeight() / 2.0f - texture.getHeight() / 2.0f,
		z - 1.0f
	);

	if (isVisible())
		_iconQuad->show();
}