Exemplo n.º 1
0
void MenuBar::redraw ()
{
	choose_palette (PALETTE_ID_MENUBAR);
	clear ();
	for (ItemList::iterator it=item_list.begin(); it!=item_list.end(); ++it) {
		it->text.output(*this, {it->w, 0}, it->text.get_width ());
	}
	unsigned x = 0;
	if (!item_list.empty ()) {
		x = item_list.back ().w + item_list.back ().text.get_width () + 2;
	}
	if (x < get_size ().x) {
		// Align to the right
		unsigned w = minU (get_size ().x - x, text.get_width ());
		x = get_size ().x - w;
		text.output(*this, {x, 0}, w);
	}
}
Exemplo n.º 2
0
	bool BoundingCircle::isInside2D(const BoundingObject2D& bounding_obj) const {

		switch (bounding_obj.getObjectType()) {
			case BOX:
				return (
					bounding_obj.minU() <= minU() && bounding_obj.maxU() >= maxU() &&
					bounding_obj.minV() <= minV() && bounding_obj.maxV() >= maxV()
					);

			case CIRCLE:
				return (
					(position.distance(bounding_obj.centroid())+
					((const BoundingCircle&)bounding_obj).getRadius()) <= radius
					);

			default:
				break;
		}

		return false;


	}
Exemplo n.º 3
0
void UIString::output (Control &ctrl, Size pos, Size size) const
{
	unsigned wid = size.x;
	unsigned height = size.y;
	const SplitStringLineList &lst = split_line (wid);
	const SplitStringLine *ptr = &lst[0];

	for (unsigned n=minU(height,lst.size()); n; --n) {
		if (get_hotkey_pos () - ptr->begin < ptr->len) {
			ctrl << pos
				<< str (get_text().data()+ptr->begin, get_hotkey_pos() - ptr->begin)
				<< toggle (UNDERLINE)
				<< get_text().data()[get_hotkey_pos ()]
				<< toggle (UNDERLINE)
				<< str (get_text().data()+get_hotkey_pos()+1, ptr->len - (get_hotkey_pos () - ptr->begin + 1));
		}
		else {
			ctrl << pos
				<< str (get_text().data()+ptr->begin, ptr->len);
		}
		pos.y++;
		++ptr;
	}
}