Ejemplo n.º 1
0
void UIString::update ()
{
	unsigned lines = 0;
	unsigned max_width = 0;
	unsigned cur_line_width = 0;
	const wchar_t *cls = get_text ().c_str (); // Current line starting point
	const wchar_t *s;
	for (s = cls; *s; ++s) {
		if (*s == L'\n') {
			++lines;
			max_width = maxU (max_width, cur_line_width);
			cur_line_width = 0;
			cls = s + 1;
		}
		else {
			cur_line_width += ucs_width (*s);
		}
	}
	if (s != cls) {
		++lines;
		max_width = maxU (max_width, cur_line_width);
	}

	this->lines = lines;
	this->max_width = max_width;

	split_cache_wid = 0;
	split_cache.clear ();
}
Ejemplo n.º 2
0
Scroll::Scroll(unsigned height, bool allow_focus_end, std::function<unsigned(unsigned)> get_item_screen_size)
	: get_item_screen_size_(std::move(get_item_screen_size))
	, accumulate_height_{0, 1}
	, height_(maxU(1, height))
	, allow_focus_end_(allow_focus_end)
{
	recalculate_len ();
}
Ejemplo n.º 3
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;


	}