Example #1
0
BOOL CMapToolView::PreTranslateMessage(MSG* pMsg)
{
	// TODO: 여기에 특수화된 코드를 추가 및/또는 기본 클래스를 호출합니다.

	switch (pMsg->message) 
	{
	case WM_KEYDOWN:
		if( LOWORD(pMsg->lParam) == 1 )
			OnKeyPress(LOWORD(pMsg->wParam));
		break;
	case WM_KEYUP:
		OnKeyRelease(LOWORD(pMsg->wParam));
		break;
	case WM_LBUTTONDOWN:
		OnMouseClick(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 0, LOWORD(pMsg->wParam));
		break;
	case WM_RBUTTONDOWN:
		OnMouseClick(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 1, LOWORD(pMsg->wParam));
		break;
	case WM_MBUTTONDOWN:
		OnMouseClick(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 2, LOWORD(pMsg->wParam));
		break;
	case WM_LBUTTONUP:
		OnMouseRelease(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 0, LOWORD(pMsg->wParam));
		break;
	case WM_RBUTTONUP:
		OnMouseRelease(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 1, LOWORD(pMsg->wParam));
		break;
	case WM_MBUTTONUP:
		OnMouseRelease(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 2, LOWORD(pMsg->wParam));
		break;
	case WM_LBUTTONDBLCLK:
		OnMouseDoubleClick(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 0, LOWORD(pMsg->wParam));
		break;
	case WM_RBUTTONDBLCLK:
		OnMouseDoubleClick(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 1, LOWORD(pMsg->wParam));
		break;
	case WM_MBUTTONDBLCLK:
		OnMouseDoubleClick(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 2, LOWORD(pMsg->wParam));
		break;
	case WM_MOUSEMOVE:
		OnMouseMove(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam));
		break;
	case WM_MOUSEWHEEL:
		OnMouseWheel((short)HIWORD(pMsg->wParam), LOWORD(pMsg->wParam));
		break;
	}
	return CView::PreTranslateMessage(pMsg);
}
Example #2
0
void
COpenGLDemo::HandleEvents()
{
  SDL_Event ev;
  while ( SDL_PollEvent( &ev ))
  {
    switch( ev.type )
    {
    case SDL_QUIT:
      OnQuit( ev.quit );
      break;
    case SDL_KEYDOWN:
      OnKeyDown( ev.key );
      break;
    case SDL_KEYUP:
      OnKeyUp( ev.key );
      break;
    case SDL_MOUSEMOTION:
      OnMouseMotion( ev.motion );
      break;
    case SDL_MOUSEBUTTONUP:
      OnMouseRelease( ev.button );
      break;
    case SDL_MOUSEBUTTONDOWN:
      OnMousePress( ev.button );
      break;
    }
  }
}
Example #3
0
STFSliders::STFSliders() : Control(),
channel( 0 ), rgb( true ), m( 0.5F ), c0( 0 ), c1( 1 ), v0( 0 ), v1( 1 ),
gradient( Bitmap::Null() ),
beingDragged( -1 ), scrolling( false ), scrollOrigin( 0 ),
onValueUpdated( 0 ), onValueUpdatedReceiver( 0 ),
onRangeUpdated( 0 ), onRangeUpdatedReceiver( 0 )
{
   OnPaint( (Control::paint_event_handler)&STFSliders::__Paint, *this );
   OnResize( (Control::resize_event_handler)&STFSliders::__Resize, *this );
   OnMousePress( (Control::mouse_button_event_handler)&STFSliders::__MousePress, *this );
   OnMouseMove( (Control::mouse_event_handler)&STFSliders::__MouseMove, *this );
   OnMouseRelease( (Control::mouse_button_event_handler)&STFSliders::__MouseRelease, *this );
   OnMouseWheel( (Control::mouse_wheel_event_handler)&STFSliders::__MouseWheel, *this );
}
Example #4
0
void UIBase::Input(){

    int key = InputManager::GetInstance().GetMouseMousePressKey();

    Point mpos = InputManager::GetInstance().GetMouse();
    if (IsInside(mpos.x,mpos.y)){

        if (key != 0 && OnMousePress){
            OnMousePress(this,key,mpos);
        }
        key = InputManager::GetInstance().GetMouseMouseReleaseKey();
        if (key != 0 && OnMouseRelease){
            OnMouseRelease(this,key,mpos);
        }
        if (!MouseInside){
            if (OnMouseEnter){
                OnMouseEnter(this,mpos);
            }
            MouseInside = true;
        }
    }else{
        if (MouseInside){
            if (OnMouseLeave){
                OnMouseLeave(this,mpos);
            }
            MouseInside = false;
        }
    }

    key = InputManager::GetInstance().IsAnyKeyPressed();
    if (key != -1 && OnKeyPress){
        OnKeyPress(this,key);
    }

    /*for (unsigned i = 0; i < Components.size(); ++i) {
        if (!Components[i]->IsDead()){
            Components[i]->Input();
        }
    }*/
}
void AbstractObj::mouseRelease()
{
    emit OnMouseRelease();
}