Ejemplo n.º 1
0
void Background::MouseLDoubleClickInside(aui_MouseEvent *data)
{
	if (IsDisabled()) return;

	if (GetWhichSeesMouse() && GetWhichSeesMouse() != this) return;
	SetWhichSeesMouse(this);

	Assert(g_tiledMap != NULL);
	if (g_tiledMap == NULL) return;

	data->position.x -= X();
	data->position.y -= Y();

	if (s_savedEvents.GetCount() > 0) {
		SavedMouseEvent *ev = s_savedEvents.GetTail();
		if(ev->type == SEV_LGRAB) {
			ev->type = SEV_LDOUBLE;
			memcpy(&ev->event, data, sizeof(aui_MouseEvent));
		} else {
			ev = new SavedMouseEvent;
			memcpy(&ev->event, data, sizeof(aui_MouseEvent));
			ev->type = SEV_LDOUBLE;
			s_savedEvents.AddTail(ev);
		}
	} else {
		g_tiledMap->Click(data, TRUE);
	}

    m_lbutton_isdown = TRUE;

}
Ejemplo n.º 2
0
AUI_ERRCODE Background::Idle(void)
{
	if(g_tiledMap) {
		g_tiledMap->Idle();
	}

	while(s_savedEvents.GetCount() > 0) {
		SavedMouseEvent *ev = s_savedEvents.GetHead();
		switch(ev->type) {
			case SEV_LGRAB:
			{
				uint32 curTicks = GetTickCount();
				if (curTicks > (ev->event.time + doubleClickTimeout)) {
					g_tiledMap->Click(&ev->event, FALSE);
				} else {
					return AUI_ERRCODE_OK;
				}
				break;
			}
			case SEV_RGRAB:
				g_tiledMap->Click(&ev->event, FALSE);
				break;
			case SEV_LDROP:
				g_tiledMap->Drop(&ev->event);
				break;
			case SEV_LDRAG:
				g_tiledMap->MouseDrag(&ev->event);
				break;
			case SEV_LDOUBLE:
				g_tiledMap->Click(&ev->event, TRUE);
				break;
		}
		delete s_savedEvents.RemoveHead();
	}

#if 0
	if (hasSavedEvent) {
		uint32 curTicks = GetTickCount();
		if (curTicks > (savedEvent.time + doubleClickTimeout)) {
			g_tiledMap->Click(&savedEvent, FALSE);
			hasSavedEvent = FALSE;
		}
	}
#endif
	return AUI_ERRCODE_OK;
}