Esempio n. 1
0
void Tooltip::redoLayout() {
	checkEmpty();
	if (_empty)
		return;

	if (_font.empty())
		_font = getFontName();

	Graphics::Aurora::FontHandle font = FontMan.get(_font);

	_lineHeight  = font.getFont().getHeight();
	_lineSpacing = font.getFont().getLineSpacing();

	for (std::vector<Line>::iterator l = _lines.begin(); l != _lines.end(); ++l) {
		if (l->text)
			continue;

		l->text = new Graphics::Aurora::Text(font, l->line, l->r, l->g, l->b, l->a);
		l->text->setTag("Tooltip#Text");
	}

	float width, height;
	getSize(width, height);

	if ((_width != width) || (_height != height)) {
		_width  = width;
		_height = height;

		redoBubble();
	}

	updatePosition();
}
Esempio n. 2
0
void Tooltip::redoLayout() {
	checkEmpty();
	if (_empty)
		return;

	if (_font.empty())
		_font = getFontName();

	Graphics::Aurora::FontHandle font = FontMan.get(_font);

	_lineHeight  = font.getFont().getHeight();
	_lineSpacing = font.getFont().getLineSpacing();

	float width, height;
	getSize(width, height);

	if ((_width != width) || (_height != height)) {
		_width  = width;
		_height = height;

		redoBubble();
	}

	updatePosition();
}
Esempio n. 3
0
void Tooltip::redoLines() {
	bool needRedo = false;

	Common::UString fontName = getFontName();
	if (fontName != _font) {
		needRedo = true;

		for (std::vector<Line>::iterator l = _lines.begin(); l != _lines.end(); ++l) {
			delete l->text;
			l->text = 0;
		}

		_font = fontName;

		Graphics::Aurora::FontHandle font = FontMan.get(_font);

		_lineHeight  = font.getFont().getHeight();
		_lineSpacing = font.getFont().getLineSpacing();

		_width  = 0.0;
		_height = 0.0;
	}

	bool showBubble, showText, showPortrait;
	getFeedbackMode(showBubble, showText, showPortrait);

	if ((showBubble   != _showBubble  ) ||
		  (showText     != _showText    ) ||
			(showPortrait != _showPortrait)) {

		needRedo = true;

		_width  = 0.0;
		_height = 0.0;

		_showBubble   = showBubble;
		_showText     = showText;
		_showPortrait = showPortrait;
	}

	if (needRedo)
		redoLayout();
}
Esempio n. 4
0
void Tooltip::redoLines(bool force) {
	bool needRedo = force;

	bool showBubble, showText, showPortrait;
	getFeedbackMode(showBubble, showText, showPortrait);

	const Common::UString fontName = getFontName();

	if ((fontName     != _font        ) ||
	    (showBubble   != _showBubble  ) ||
		  (showText     != _showText    ) ||
			(showPortrait != _showPortrait)) {

		_font         = fontName;
		_showBubble   = showBubble;
		_showText     = showText;
		_showPortrait = showPortrait;

		needRedo = true;
	}

	if (!needRedo)
		return;

	Graphics::Aurora::FontHandle font = FontMan.get(_font);

	_lineHeight  = font.getFont().getHeight();
	_lineSpacing = font.getFont().getLineSpacing();

	_width  = 0.0f;
	_height = 0.0f;

	if (!createTexts(100.0f, 3))
		if (!createTexts(150.f, 3))
			createTexts(300.0f);

	redoLayout();
}
Esempio n. 5
0
WidgetListItemTextLine::WidgetListItemTextLine(::Engines::GUI &gui,
    const Common::UString &font, const Common::UString &text, float spacing) :
	WidgetListItem(gui),
	_uR(1.0f), _uG(1.0f), _uB(1.0f), _uA(1.0f),
	_sR(1.0f), _sG(1.0f), _sB(0.0f), _sA(1.0f), _spacing(spacing) {

	Graphics::Aurora::FontHandle f = FontMan.get(font);

	_fontHeight = f.getFont().getHeight();

	_text = new Graphics::Aurora::Text(f, text, _uR, _uG, _uB, _uA, 0.0f);

	_text->setClickable(true);
}
Esempio n. 6
0
void WidgetListBox::setText(const Common::UString &font,
                            const Common::UString &text, float spacing) {

	lock();
	clear();

	Graphics::Aurora::FontHandle f = FontMan.get(font);
	std::vector<Common::UString> lines;
	f.getFont().split(text, lines, getContentWidth());

	for (std::vector<Common::UString>::iterator l = lines.begin(); l != lines.end(); ++l)
		add(new WidgetListItemTextLine(*_gui, font, *l, spacing));

	unlock();
}
Esempio n. 7
0
bool Tooltip::createTexts(float width, size_t maxLines) {
	deleteTexts();

	Graphics::Aurora::FontHandle font = FontMan.get(_font);

	const float maxWidth = _showBubble ? (width - (_showPortrait ? 18.0f : 0.0f)) : 0.0f;

	for (std::vector<Line>::const_iterator l = _lines.begin(); l != _lines.end(); l++) {
		std::vector<Common::UString> lineLines;

		font.getFont().split(l->line, lineLines, maxWidth);

		for (std::vector<Common::UString>::const_iterator i = lineLines.begin(); i != lineLines.end(); ++i) {
			_texts.push_back(new Graphics::Aurora::Text(font, *i, l->r, l->g, l->b, l->a));
			_texts.back()->setTag("Tooltip#Text");
		}
	}

	return !_showBubble || !maxLines || (_texts.size() <= maxLines);
}