CL_Rect CL_GUIWindowManagerProvider_System::get_geometry(CL_GUITopLevelWindow *handle, bool client_area) const
{
	std::map<CL_GUITopLevelWindow *, CL_GUITopLevelWindowSystem *>::const_iterator it = window_map.find(handle);
	if (it != window_map.end())
	{
		if (client_area)
		{
			CL_Rect r = it->second->window.get_viewport();
			CL_Point tl = it->second->window.client_to_screen(r.get_top_left());
			r.left += tl.x;
			r.right += tl.x;
			r.top += tl.y;
			r.bottom += tl.y;
			return r;
		}
		else
			return it->second->window.get_geometry();
	}
	else
	{
		return CL_Rect();
	}
}
CL_Rect CL_GUIComponent::component_to_window_coords(const CL_Rect &rect) const
{
	CL_Point tl = component_to_window_coords(rect.get_top_left());
	CL_Point br = component_to_window_coords(rect.get_bottom_right());
	return CL_Rect(tl.x, tl.y, br.x, br.y);
}