void CL_TreeView_Silver::on_paint_node(CL_TreeNode *node, CL_Point &point)
{
	CL_Component *component = node->get_component();
	CL_Component *client_area = treeview->get_client_area();

	int height = component->get_height();
	int mid = (height) / 2;

	// Should we draw decoration ?
	bool draw_decoration = true;
	if(node->is_root())
		draw_decoration = node->get_treeview()->is_root_decoration_visible();

	// Find what y offset we're drawing at
	point.y -= scrollbar->get_value();

	// Find what x offset we're drawing at
	int x_offset = 0;
	if(draw_decoration)
		x_offset = 12;

	int screen_x = client_area->get_screen_x();
	int screen_y = client_area->get_screen_y();
	
	// Is the node visible?
	if (point.y + height >= 0 && point.y <= client_area->get_height())
	{
		if(draw_decoration)
		{
			// Draw collapse box
			if(node->has_children())
			{
				CL_Display::draw_rect(
					CL_Rect(
						screen_x + point.x,
						screen_y + point.y + mid - 5,
						screen_x + point.x + 9,
						screen_y + point.y + mid + 4),
					CL_Color(128, 142, 159));

				CL_Display::fill_rect(
					CL_Rect(
						screen_x + point.x + 1,
						screen_y + point.y + mid - 4,
						screen_x + point.x + 8,
						screen_y + point.y + mid + 3),
					CL_Gradient(
						CL_Color::white,
						CL_Color::white,
						CL_Color(230, 235, 240),
						CL_Color(230, 235, 240)));

				CL_Display::fill_rect(
					CL_Rect(
						screen_x + point.x + 2,
						screen_y + point.y + mid - 3,
						screen_x + point.x + 7,
						screen_y + point.y + mid + 2),
					CL_Gradient(
						CL_Color(217, 222, 227),
						CL_Color(217, 222, 227),
						CL_Color::white,
						CL_Color::white));

				// Horizontal line
				CL_Display::draw_line(
					screen_x + point.x + 2.0f,
					screen_y + point.y + mid - 1.0f,
					screen_x + point.x + 7.0f,
					screen_y + point.y + mid - 1,
					CL_Color::black);

				// Vertical line
				if(node->is_collapsed())
					CL_Display::draw_line(
						screen_x + point.x + 4.0f,
						screen_y + point.y + mid - 3.0f,
						screen_x + point.x + 4.0f,
						screen_y + point.y + mid + 2.0f,
						CL_Color::black);
			}
		}

		// Size and place child component
		component->set_position(point.x + x_offset, point.y);
		node->set_placement_offset(point.x + x_offset);

		// Draw component
		component->show(true);
		component->sig_begin_paint();
		component->sig_paint()();
		component->sig_end_paint();
	}
	else
	{
		component->show(false);
	}

	// Move down for next component
	point.y += scrollbar->get_value();
	point.y += height;

	// If it has any children, adjust the x-position for the children
	if(node->is_collapsed() == false)
		point.x += 3 + x_offset;
}
void
WindowImpl::do_close()
{
  parent->show(false);
}