Beispiel #1
0
bool mxWindow::handleMessage(
		LRESULT *lRes,
		UINT uMsg,
		WPARAM wParam,
		LPARAM lParam
		)
{
	switch (uMsg) {
	case MM_MCINOTIFY:
		return onMciNotify(wParam, lParam);

	case WM_CLOSE:
		return onClose();

	case WM_COMMAND:
		return onCommand(
				LOWORD(wParam),
				reinterpret_cast<HWND>(lParam),
				HIWORD(wParam));

	case WM_CREATE:
		return onCreate(lRes, reinterpret_cast<CREATESTRUCT*>(lParam));

	case WM_DESTROY:
		return onDestroy();

	case WM_ERASEBKGND:
		return onEraseBkgnd(lRes, reinterpret_cast<HDC>(wParam));

	case WM_LBUTTONDBLCLK:
		return onLButtonDown(TRUE, mxPoint(lParam), wParam);

	case WM_LBUTTONDOWN:
		return onLButtonDown(FALSE, mxPoint(lParam), wParam);

	case WM_MOUSEMOVE:
		return onMouseMove(mxPoint(lParam), wParam);

	case WM_PAINT: {
		mxPaintDC dc(this);
		return onPaint(&dc); }

	case WM_SIZE:
		return onSize(wParam, mxSize(lParam));

	case WM_TIMER:
		return onTimer(wParam);

	}
	return false;
}
Beispiel #2
0
void OccView::mousePressEvent( QMouseEvent* theEvent )
{
    if (theEvent->button() == Qt::LeftButton)
    {
        onLButtonDown((theEvent->buttons() | theEvent->modifiers()), theEvent->pos());
    }
    else if (theEvent->button() == Qt::MidButton)
    {
        onMButtonDown((theEvent->buttons() | theEvent->modifiers()), theEvent->pos());
    }
    else if (theEvent->button() == Qt::RightButton)
    {
        onRButtonDown((theEvent->buttons() | theEvent->modifiers()), theEvent->pos());
    }
}
LRESULT WebPopupMenuProxyWin::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    LRESULT lResult = 0;
    bool handled = true;

    switch (message) {
        case WM_MOUSEACTIVATE:
            lResult = onMouseActivate(hWnd, message, wParam, lParam, handled);
            break;
        case WM_SIZE:
            lResult = onSize(hWnd, message, wParam, lParam, handled);
            break;
        case WM_KEYDOWN:
            lResult = onKeyDown(hWnd, message, wParam, lParam, handled);
            break;
        case WM_CHAR:
            lResult = onChar(hWnd, message, wParam, lParam, handled);
            break;
        case WM_MOUSEMOVE:
            lResult = onMouseMove(hWnd, message, wParam, lParam, handled);
            break;
        case WM_LBUTTONDOWN:
            lResult = onLButtonDown(hWnd, message, wParam, lParam, handled);
            break;
        case WM_LBUTTONUP:
            lResult = onLButtonUp(hWnd, message, wParam, lParam, handled);
            break;
        case WM_MOUSEWHEEL:
            lResult = onMouseWheel(hWnd, message, wParam, lParam, handled);
            break;
        case WM_PAINT:
            lResult = onPaint(hWnd, message, wParam, lParam, handled);
            break;
        case WM_PRINTCLIENT:
            lResult = onPrintClient(hWnd, message, wParam, lParam, handled);
            break;
        default:
            handled = false;
            break;
    }

    if (!handled)
        lResult = ::DefWindowProc(hWnd, message, wParam, lParam);

    return lResult;
}
Beispiel #4
0
//METHODS
void Event::onEvent(SDL_Event* event) {
    switch(event->type) {
        case SDL_ACTIVEEVENT: {
            switch (event->active.state) {
                case SDL_APPMOUSEFOCUS: {
                    if (event->active.gain) onMouseFocus();
                    else onMouseBlur();
                    break;
                }
                case SDL_APPINPUTFOCUS: {
                    if (event->active.gain) onInputFocus();
                    else onInputBlur();
                    break;
                }
                case SDL_APPACTIVE: {
                    if (event->active.gain) onRestore();
                    else onMinimize();
                    break;
                }
            }
            break;
        }
        case SDL_KEYDOWN: {
            onKeyDown(event->key.keysym.sym, event->key.keysym.mod,
                event->key.keysym.unicode);
            break;
        }
        case SDL_KEYUP: {
            onKeyUp(event->key.keysym.sym, event->key.keysym.mod,
                event->key.keysym.unicode);
            break;
        }
        case SDL_MOUSEMOTION: {
            onMouseMove(event->motion.x, event->motion.y,
                event->motion.xrel, event->motion.yrel,
                (event->motion.state & SDL_BUTTON(SDL_BUTTON_LEFT)) != 0,
                (event->motion.state & SDL_BUTTON(SDL_BUTTON_RIGHT)) != 0,
                (event->motion.state & SDL_BUTTON(SDL_BUTTON_MIDDLE)) != 0);
            break;
        }
        case SDL_MOUSEBUTTONDOWN: {
            switch(event->button.button) {
                case SDL_BUTTON_LEFT: {
                    onLButtonDown(event->button.x, event->button.y);
                    break;
                }
                case SDL_BUTTON_RIGHT: {
                    onRButtonDown(event->button.x, event->button.y);
                    break;
                }
                case SDL_BUTTON_MIDDLE: {
                    onMButtonDown(event->button.x, event->button.y);
                    break;
                }
            }
            break;
        }
        case SDL_MOUSEBUTTONUP: {
            switch(event->button.button) {
                case SDL_BUTTON_LEFT: {
                    onLButtonUp(event->button.x, event->button.y);
                    break;
                }
                case SDL_BUTTON_RIGHT: {
                    onRButtonUp(event->button.x, event->button.y);
                    break;
                }
                case SDL_BUTTON_MIDDLE: {
                    onMButtonUp(event->button.x, event->button.y);
                    break;
                }
            }
            break;
        }
        case SDL_JOYAXISMOTION: {
            onJoyAxis(event->jaxis.which, event->jaxis.axis,
                event->jaxis.value);
            break;
        }
        case SDL_JOYBALLMOTION: {
            onJoyBall(event->jball.which, event->jball.ball,
                event->jball.xrel, event->jball.yrel);
            break;
        }
        case SDL_JOYHATMOTION: {
            onJoyHat(event->jhat.which, event->jhat.hat,
                event->jhat.value);
            break;
        }
        case SDL_JOYBUTTONDOWN: {
            onJoyButtonDown(event->jbutton.which, event->jbutton.button);
            break;
        }
        case SDL_JOYBUTTONUP: {
            onJoyButtonUp(event->jbutton.which, event->jbutton.button);
            break;
        }
        case SDL_QUIT: {
            onExit();
            break;
        }
        case SDL_SYSWMEVENT: {
            //Ignore
            break;
        }
        case SDL_VIDEORESIZE: {
            onResize(event->resize.w, event->resize.h);
            break;
        }
        case SDL_VIDEOEXPOSE: {
            onExpose();
            break;
        }
        default: {
            onUser(event->user.type, event->user.code,
                event->user.data1, event->user.data2);
            break;
        }
    }
}
// ---------------------------------------------------------------------
LRESULT WinSkinWindow::wndProc(
	HWND hWnd,			// ウィンドウハンドル
	UINT uMsg,			// メッセージ
	WPARAM wParam,		// メッセージの WPARAM
	LPARAM lParam		// メッセージの LPARAM
)
{
	LRESULT ret = 0;
	bool isProcessed = false;
	if (uiManager != NULL)
	{
		WinCCSAppearance* appearance = static_cast<WinCCSAppearance*>(uiManager->GetSkinAppearance());
		if (appearance != NULL)
		{
			isProcessed = appearance->RelayWndProc(hWnd, uMsg, wParam, lParam, &ret);
		}
	}

	mousePositionAvailable = false;

	try
	{
		// ツールチップウィンドウへのリレー
		switch (uMsg)
		{
		case WM_LBUTTONDOWN:
		case WM_LBUTTONUP:
		case WM_MBUTTONDOWN:
		case WM_MBUTTONUP:
		case WM_MOUSEMOVE:
		case WM_RBUTTONDOWN:
		case WM_RBUTTONUP:
			{
				DWORD posVal;
				MSG msg;
				posVal = GetMessagePos();
				msg.hwnd = hWnd;
				msg.message = uMsg;
				msg.wParam = wParam;
				msg.lParam = lParam;
				msg.time = GetMessageTime();
				msg.pt.x = LOWORD(posVal);
				msg.pt.y = HIWORD(posVal);
				::SendMessage(hToolTipWnd, TTM_RELAYEVENT, 0, reinterpret_cast<LPARAM>(&msg));
			}
			break;
		}
	
		// 各メッセージのハンドリング
		switch (uMsg)
		{
		case WM_CREATE:
			return onCreate(hWnd, uMsg, wParam, lParam);
			break;
		case WM_DESTROY:
			return onDestroy(hWnd, uMsg, wParam, lParam);
			break;
		case WM_MOUSEMOVE:
			return onMouseMove(hWnd, uMsg, wParam, lParam);
			break;
		case WM_LBUTTONDOWN:
			return onLButtonDown(hWnd, uMsg, wParam, lParam);
			break;
		case WM_LBUTTONUP:
			return onLButtonUp(hWnd, uMsg, wParam, lParam);
			break;
		case WM_RBUTTONDOWN:
			return onRButtonDown(hWnd, uMsg, wParam, lParam);
			break;
		case WM_RBUTTONUP:
			return onRButtonUp(hWnd, uMsg, wParam, lParam);
			break;
		case WM_ACTIVATE:
			return onActivate(hWnd, uMsg, wParam, lParam);
			break;
		case UM_ACTIVATED:
			return onUMActivated(hWnd, uMsg, wParam, lParam);
			break;
		case WM_KEYUP:
		case WM_SYSKEYUP:
			return onKeyUp(hWnd, uMsg, wParam, lParam);
			break;
		case WM_TIMER:
			return onTimer(hWnd, uMsg, wParam, lParam);
			break;
		case UM_REREAD_SKIN:
			return onRereadSkin(hWnd, uMsg, wParam, lParam);
			break;
		case WM_COMMAND:
			return onCommand(hWnd, uMsg, wParam, lParam);
			break;

		default:
			if (isProcessed)
			{
				return ret;
			}
			else
			{
				return base::wndProc(hWnd, uMsg, wParam, lParam);
			}
		}
	}
	catch (Exception* ex)
	{
		ExceptionMessageUtils::DoExceptionMessageBox(CoveredCalcApp::GetInstance(), ex);
		ex->Delete();
	}
	
	return 0;
}
Beispiel #6
0
    /// event handlers
    void Module::onEvent(const SDL_Event& inEvent)
    {
        switch (inEvent.type)
        {
            case SDL_ACTIVEEVENT:
            {
                switch (inEvent.active.state)
                {
                    case SDL_APPMOUSEFOCUS:
                    {
                        if (inEvent.active.gain)
                            onMouseFocus();
                        else
                            onMouseBlur();

                        break;
                    }
                    case SDL_APPINPUTFOCUS:
                    {
                        if (inEvent.active.gain)
                            onInputFocus();
                        else
                            onInputBlur();

                        break;
                    }
                    case SDL_APPACTIVE:
                    {
                        if (inEvent.active.gain)
                            onRestore();
                        else
                            onMinimize();

                        break;
                    }
                }
                break;
            }

            case SDL_KEYDOWN:
            {
                onKeyDown(inEvent.key.keysym.sym, inEvent.key.keysym.mod,
                    inEvent.key.keysym.unicode);
                break;
            }

            case SDL_KEYUP:
            {
                onKeyUp(inEvent.key.keysym.sym, inEvent.key.keysym.mod,
                    inEvent.key.keysym.unicode);
                break;
            }

            case SDL_MOUSEMOTION:
            {
                onMouseMove(inEvent.motion.x, inEvent.motion.y,
                    inEvent.motion.xrel, inEvent.motion.yrel,
                    inEvent.motion.state & SDL_BUTTON(SDL_BUTTON_LEFT),
                    inEvent.motion.state & SDL_BUTTON(SDL_BUTTON_RIGHT),
                    inEvent.motion.state & SDL_BUTTON(SDL_BUTTON_MIDDLE));
                break;
            }

            case SDL_MOUSEBUTTONDOWN:
            {
                switch (inEvent.button.button)
                {
                    case SDL_BUTTON_LEFT:
                    {
                        onLButtonDown(inEvent.button.x, inEvent.button.y);
                        break;
                    }
                    case SDL_BUTTON_RIGHT:
                    {
                        onRButtonDown(inEvent.button.x, inEvent.button.y);
                        break;
                    }
                    case SDL_BUTTON_MIDDLE:
                    {
                        onMButtonDown(inEvent.button.x, inEvent.button.y);
                        break;
                    }
                }
                break;
            }

            case SDL_MOUSEBUTTONUP:
            {
                switch (inEvent.button.button)
                {
                    case SDL_BUTTON_LEFT:
                    {
                        onLButtonUp(inEvent.button.x, inEvent.button.y);
                        break;
                    }
                    case SDL_BUTTON_RIGHT:
                    {
                        onRButtonUp(inEvent.button.x, inEvent.button.y);
                        break;
                    }
                    case SDL_BUTTON_MIDDLE:
                    {
                        onMButtonUp(inEvent.button.x, inEvent.button.y);
                        break;
                    }
                    case SDL_BUTTON_WHEELUP:
                    {
                        onMouseWheel(true, false);
                        break;
                    }
                    case SDL_BUTTON_WHEELDOWN:
                    {
                        onMouseWheel(false, true);
                        break;
                    }
                }
                break;
            }

            case SDL_JOYAXISMOTION:
            {
                onJoyAxis(inEvent.jaxis.which, inEvent.jaxis.axis,
                          inEvent.jaxis.value);
                break;
            }

            case SDL_JOYBALLMOTION:
            {
                onJoyBall(inEvent.jball.which, inEvent.jball.ball,
                          inEvent.jball.xrel, inEvent.jball.yrel);
                break;
            }

            case SDL_JOYHATMOTION:
            {
                onJoyHat(inEvent.jhat.which, inEvent.jhat.hat,
                         inEvent.jhat.value);
                break;
            }
            case SDL_JOYBUTTONDOWN:
            {
                onJoyButtonDown(inEvent.jbutton.which,
                    inEvent.jbutton.button);
                break;
            }

            case SDL_JOYBUTTONUP:
            {
                onJoyButtonUp(inEvent.jbutton.which, inEvent.jbutton.button);
                break;
            }

            case SDL_QUIT:
            {
                onExit();
                break;
            }

            case SDL_SYSWMEVENT:
            {
                break;
            }

            case SDL_VIDEORESIZE:
            {
                onResize(inEvent.resize.w, inEvent.resize.h);
                break;
            }

            case SDL_VIDEOEXPOSE:
            {
                onExpose();
                break;
            }

            default:
            {
                onUser(inEvent.user.type, inEvent.user.code,
                    inEvent.user.data1, inEvent.user.data2);
                break;
            }
        }
    }
Beispiel #7
0
//==============================================================================
void CEvent::onEvent(SDL_Event *anEvent) {
    switch(anEvent->type) {

        case SDL_WINDOWEVENT: {

            switch(anEvent->window.event) {

                case SDL_WINDOWEVENT_ENTER:{
                    onMouseFocus();
                    break;
                }

                case SDL_WINDOWEVENT_LEAVE:{
                    onMouseBlur();
                    break;
                }

                case SDL_WINDOWEVENT_FOCUS_GAINED: {
                    onInputFocus();                   
                    break;
                }

                case SDL_WINDOWEVENT_FOCUS_LOST: {
                    onInputBlur();
                    break;
                }

                case SDL_WINDOWEVENT_RESTORED: {
                    onRestore();
                    break;
                }

                case SDL_WINDOWEVENT_MINIMIZED: {
                    onMinimize();
                    break;
                }

            }

            break;

        }

        case SDL_KEYDOWN: {
            onKeyPress(anEvent->key.keysym.sym, anEvent->key.keysym.mod);
            break;
        }

        case SDL_KEYUP: {
            onKeyRelease(anEvent->key.keysym.sym,anEvent->key.keysym.mod);
            break;
        }

        case SDL_MOUSEMOTION: {
            onMouseMove(anEvent->motion.x, anEvent->motion.y, anEvent->motion.xrel, anEvent->motion.yrel,(anEvent->motion.state&SDL_BUTTON(SDL_BUTTON_LEFT))!=0,(anEvent->motion.state&SDL_BUTTON(SDL_BUTTON_RIGHT))!=0,(anEvent->motion.state&SDL_BUTTON(SDL_BUTTON_MIDDLE))!=0);
            break;
        }

        case SDL_MOUSEBUTTONDOWN: {
            switch(anEvent->button.button) {
                case SDL_BUTTON_LEFT: {
                    onLButtonDown(anEvent->button.x,anEvent->button.y);
                    break;
                 }

                case SDL_BUTTON_RIGHT: {
                    onRButtonDown(anEvent->button.x,anEvent->button.y);
                    break;
                 }

                case SDL_BUTTON_MIDDLE: {
                    onMButtonDown(anEvent->button.x,anEvent->button.y);
                    break;
                 }
            }
            break;
       }
     
        case SDL_MOUSEBUTTONUP: {
            switch(anEvent->button.button) {
                case SDL_BUTTON_LEFT: {
                    onLButtonUp(anEvent->button.x,anEvent->button.y);
                    break;
                }
                case SDL_BUTTON_RIGHT: {
                    onRButtonUp(anEvent->button.x,anEvent->button.y);
                    break;
                }
                case SDL_BUTTON_MIDDLE: {
                    onMButtonUp(anEvent->button.x,anEvent->button.y);
                    break;
                }
            }
            break;
        }

        case SDL_QUIT: {
            onExit();
            break;
        }

        case SDL_SYSWMEVENT: {
            //Ignore
            break;
        }

        case SDL_WINDOWEVENT_RESIZED: {
            onResize(anEvent->window.data1,anEvent->window.data2);
            break;
        }

        case SDL_WINDOWEVENT_EXPOSED: {
            onExpose();
            break;
        }

        default: {
            onUser(anEvent->user.type,anEvent->user.code,anEvent->user.data1,anEvent->user.data2);
            break;
        }
    }
}