Ejemplo n.º 1
0
void StatusBar_Impl::position_parts()
{
	Rect rect(Point(0,0), statusbar->get_geometry().get_size());
	Rect content = statusbar->get_content_box();

	int xpos = content.right;
	if (show_size_grip)
	{
		int preferred_width = part_size_grip.get_css_width();
		Rect rect_sizegrip(content.right - preferred_width, content.top, content.right, content.bottom);
		xpos = rect_sizegrip.left;
	}

	for (unsigned int index = statusbar_parts.size(); index > 0; index--)
	{
		StatusBar_Part &statusbar_part = statusbar_parts[index-1];
		int left = xpos - statusbar_part.width;
		int right = xpos;
		Rect new_position(left, content.top, right, content.bottom);
		if (statusbar_part.component && statusbar_part.position != new_position)
			statusbar_part.component->set_geometry(part_status_part.get_content_box(new_position));

		statusbar_part.position = new_position;
		xpos = left;
	}
}
Ejemplo n.º 2
0
void CL_StatusBar_Impl::on_render(CL_GraphicContext &gc, const CL_Rect &update_rect)
{
	CL_Rect rect(CL_Point(0,0), statusbar->get_geometry().get_size());
	part_component.render_box(gc, rect, update_rect);
	CL_Rect content = part_component.get_content_box(rect);

	CL_Rect rect_status_text = content;

	if (show_size_grip)
	{
		int preferred_width = part_size_grip.get_preferred_width();
		CL_Rect rect_sizegrip(content.right - preferred_width, content.top, content.right, content.bottom);
		part_size_grip.render_box(gc, rect_sizegrip, update_rect);
		rect_status_text.right = rect_sizegrip.left;
	}

	if (!statusbar_parts.empty())
		rect_status_text.right = statusbar_parts[0].position.left;

	part_status_text.render_box(gc, rect_status_text, update_rect);
	CL_Rect status_text_content = part_status_text.get_content_box(rect_status_text);

	font.draw_text(gc, status_text_content.left + 4, content.bottom - 6, status_text, text_color);

	for (unsigned int index = 0; index < statusbar_parts.size(); index++)
	{
		CL_StatusBar_Part &statusbar_part = statusbar_parts[index];
		part_status_part.render_box(gc, statusbar_part.position, update_rect);
		CL_Rect part_content = part_status_part.get_content_box(statusbar_part.position);
		int icon_width = 0;
		if (!statusbar_part.icon.is_null())
		{
			statusbar_part.icon.draw(gc, (float)part_content.left + 4, (float)part_content.bottom - 6 - statusbar_part.icon.get_height());
			icon_width = statusbar_part.icon.get_width() + 4;
		}
		if (!statusbar_part.text.empty())
		{
			font.draw_text(gc, part_content.left + 4 + icon_width, part_content.bottom - 6, statusbar_part.text, text_color);
		}
	}
}
Ejemplo n.º 3
0
void StatusBar_Impl::on_render(Canvas &canvas, const Rect &update_rect)
{
	Rect rect(Point(0,0), statusbar->get_geometry().get_size());
	Rect content = statusbar->get_content_box();

	Rect rect_status_text = content;

	if (show_size_grip)
	{
		int preferred_width = part_size_grip.get_css_width();
		Rect rect_sizegrip(content.right - preferred_width, content.top, content.right, content.bottom);
		part_size_grip.render_box(canvas, rect_sizegrip);
		rect_status_text.right = rect_sizegrip.left;
	}

	if (!statusbar_parts.empty())
		rect_status_text.right = statusbar_parts[0].position.left;

	part_status_text.render_box(canvas, rect_status_text);
	Rect status_text_content = part_status_text.get_content_box(rect_status_text);

	statusbar->render_text(canvas, status_text, status_text_content.left + 4, content.bottom - 6);

	for (unsigned int index = 0; index < statusbar_parts.size(); index++)
	{
		StatusBar_Part &statusbar_part = statusbar_parts[index];
		part_status_part.render_box(canvas, statusbar_part.position);
		Rect part_content = part_status_part.get_content_box(statusbar_part.position);
		int icon_width = 0;
		if (!statusbar_part.icon.is_null())
		{
			statusbar_part.icon.draw(canvas, (float)part_content.left + 4, (float)part_content.bottom - 6 - statusbar_part.icon.get_height());
			icon_width = statusbar_part.icon.get_width() + 4;
		}
		if (!statusbar_part.text.empty())
		{
			statusbar->render_text(canvas, statusbar_part.text, part_content.left + 4 + icon_width, part_content.bottom - 6);
		}
	}
}