void CL_ListViewHeader_Impl::on_mouse_move(CL_GUIMessage_Input &input, CL_InputEvent &input_event)
{
	CL_Point pos = input_event.mouse_pos;
	bool current_rect_set = false;

	if (!current_mouse_in_rect.contains(pos))
	{
		CL_ListViewColumnHeader col = first_column;
		while (!col.is_null())
		{
			bool inside = col.impl->rect.contains(pos);
			col.impl->part.set_state(CssStr::hot, inside);
			col.impl->part.set_state(CssStr::normal, !inside);
			if (inside)
			{
				current_rect_set = true;
				current_mouse_in_rect = col.impl->rect;
			}
			col = col.get_next_sibling();
		}
	}

	if (!current_rect_set)
	{
		current_mouse_in_rect = CL_Rect(0,0,0,0);
	}

	listview_header->request_repaint();
}
bool CL_MenuModalLoop::is_above_menubar(const CL_Point &mouse_screen_pos)
{
	if (menubar)
	{
		CL_Point menu_pos  = menubar->screen_to_component_coords(mouse_screen_pos);
		CL_Rect r = menubar->get_geometry().get_size();
		if (r.contains(menu_pos))
			return true;
	}

	return false;
}
CL_PopupMenuWindow *CL_MenuModalLoop::find_popup_at(const CL_Point &mouse_screen_pos)
{
	std::vector<CL_PopupMenuWindow*>::size_type i;
	for (i=0; i<popup_windows.size(); i++)
	{
		CL_Point pos = popup_windows[i]->screen_to_component_coords(mouse_screen_pos);
		CL_Rect r = popup_windows[i]->get_size();
		if (r.contains(pos))
		{
			return popup_windows[i];
		}
	}

	return 0;
}
Example #4
0
void CL_MenuBar_Impl::select_item_at(const CL_Point &mouse_pos)
{
	std::vector<CL_TopMenu>::size_type index;
	for (index = 0; index < menus.size(); index++)
	{
		CL_Rect r = get_menu_item_rect(index);
		r.top = 0;
		r.bottom = menubar->get_geometry().bottom;
		if (r.contains(mouse_pos))
		{
			selected_index = index;
			menubar->request_repaint();
			return;
		}
	}

	// Selection isn't changed if the mouse is on the menubar but not on an item.
}
Example #5
0
	void EditorPoint::findPointAt(const CL_Pointf &p_pos, int &p_index)
	{
		if (getKeys().size() == 0)
		{
			p_index = -1;
			m_impl->m_state = EditorPointImpl::None;

			CL_Rect rect = getPointRect(p_pos);

			for (int i = 0; i < m_track.getPointCount(); ++i)
			{
				if (rect.contains(m_track.getPoint(i).getPosition()))
				{
					m_impl->m_state = EditorPointImpl::Point;
					p_index = i;

					return;
				}
			}
		}
	}