Ejemplo n.º 1
0
void Menu::Refresh(Control *refresh)
{
	int width = m_destination->Width();
	int maximum = m_destination->Height();
	m_destination->Begin();
	if (refresh == NULL)
		m_destination->FillRect(0, 0, width, maximum, false);
	Control *item = m_topView;
	for (int current = 0; (item != NULL) && (current < maximum); item = item->m_next)
	{
		if (!item->Visible())
			continue;
		int height = item->Height();
		if ((current + height) >= maximum)
			break;
		if (refresh == item)
		{
			m_destination->FillRect(0, current, width, current + height, false);
			item->Paint(m_destination, 0, current, width, item == m_focus);
			break;	// Only need to draw one
		}
		if (refresh == NULL)	// I hate code duplication
			item->Paint(m_destination, 0, current, width, item == m_focus);
		current += height;
	}
	m_destination->End();
}
Ejemplo n.º 2
0
Control*
Window::_GetControl(IE::point point)
{
	std::vector<Control*>::const_iterator i;
	for (i = fControls.begin(); i != fControls.end(); i++) {
		Control* control = (*i);
		const IE::point pt = control->Position();
		if (point.x >= pt.x && point.x <= pt.x + control->Width()
				&& point.y >= pt.y && point.y <= pt.y + control->Height()) {
			return (*i);
		}
	}
	return NULL;
}
Ejemplo n.º 3
0
bool Menu::IsOnScreen(Control *item)
{
	int current, maximum;
	Control *display;

	maximum = m_destination->Height();
	current = 0;
	for (display = m_topView; display != NULL; display = display->m_next)
	{
		if (!display->Visible())
			continue;
		current += display->Height();
		if (current >= maximum)	// Off the bottom of the screen (even partially)
			break;
		if (item == display)
			return true;
	}
	return false;
}