예제 #1
0
파일: mbldc.cpp 프로젝트: bduck/livecode
void MCScreenDC::handle_touch(MCEventTouchPhase p_phase, void *p_touch, int32_t p_timestamp, int32_t p_x, int32_t p_y)
{
	switch(p_phase)
	{
		case kMCEventTouchPhaseBegan:
			if (m_mouse_touch == nil)
			{
				m_mouse_touch = p_touch;
				handle_mouse_press(p_timestamp, 0, p_x, p_y, 0, kMCMousePressStateDown);
			}
				
			process_touch(kMCEventTouchPhaseBegan, p_touch, p_timestamp, p_x, p_y);
			
			p_phase = kMCEventTouchPhaseMoved;
			break;
			
		case kMCEventTouchPhaseEnded:
			if (m_mouse_touch == p_touch)
			{
				handle_mouse_press(p_timestamp, 0, p_x, p_y, 0, kMCMousePressStateUp);
				m_mouse_touch = nil;
			}
			break;
	
		case kMCEventTouchPhaseMoved:
			if (m_mouse_touch == p_touch)
				handle_mouse_move(p_timestamp, 0, p_x, p_y);
			
			process_touch(kMCEventTouchPhaseMoved, p_touch, p_timestamp, p_x, p_y);
			break;
			
		case kMCEventTouchPhaseCancelled:
			if (m_mouse_touch == p_touch)
			{
				handle_mouse_press(p_timestamp, 0, p_x, p_y, 0, kMCMousePressStateRelease);
				m_mouse_touch = nil;
			}
			break;
			
		default:
			break;
	}
	
	process_touch(p_phase, p_touch, p_timestamp, p_x, p_y);
}
예제 #2
0
파일: exec.c 프로젝트: hanguangyi/egui
static void application_handle_message(union message* msg)
{
	/**
	 * 如果是桌面程序 那么首先将消息发给桌面的回调函数处理
	 **/
	if(global_application.application_type & APPLICATION_TYPE_DESKTOP)
	{
		if(global_application.desktop_msg_handler != NULL)
		{
			global_application.desktop_msg_handler(global_application.desktop_ptr, msg);
		}
	}

    switch(msg->base.type)
    {
    case MESSAGE_TYPE_KEYBD_PRESS:
        handle_keybd_press(msg);
        break;

    case MESSAGE_TYPE_KEYBD_RELEASE:
        handle_keybd_release(msg);
        break;

    case MESSAGE_TYPE_KEYBD_CLICK:
        handle_keybd_click(msg);
        break;

    case MESSAGE_TYPE_MOUSE_MOVE:
        handle_mouse_move(msg);
        break;

    case MESSAGE_TYPE_MOUSE_PRESS:
        handle_mouse_press(msg);
        break;

    case MESSAGE_TYPE_MOUSE_RELEASE:
        handle_mouse_release(msg);
        break;

    case MESSAGE_TYPE_MOUSE_SINGLE_CLICK:
        handle_mouse_single_click(msg);
        break;

    case MESSAGE_TYPE_MOUSE_DOUBLE_CLICK:
        handle_mouse_double_click(msg);
        break;

    case MESSAGE_TYPE_WIDGET_REPAINT:
        handle_widget_repaint(msg);
        break;

    case MESSAGE_TYPE_WIDGET_MOVE:
        handle_widget_move(msg);
        break;

    case MESSAGE_TYPE_WIDGET_RESIZE:
        handle_widget_resize(msg);
        break;

    case MESSAGE_TYPE_WINDOW_ACTIVATE:
        handle_window_activate(msg);
        break;

    case MESSAGE_TYPE_WINDOW_DEACTIVATE:
        handle_window_deactivate(msg);
        break;

    case MESSAGE_TYPE_WINDOW_MINIMIZE:
        handle_window_minimize(msg);
        break;

    case MESSAGE_TYPE_WINDOW_MAXIMIZE:
        handle_window_maximize(msg);
        break;

    case MESSAGE_TYPE_WINDOW_RESTORE:
        handle_window_restore(msg);
        break;

    case MESSAGE_TYPE_WINDOW_CANCEL:
        handle_window_cancel(msg);
        break;

    default:
        application_widgets_for_each_increament(do_find_window, msg);
        break;
    }
}