Esempio n. 1
0
//------------------------------------------
bool  ofCoreEvents::notifyMouseEvent(const ofMouseEventArgs & mouseEvent){
	switch(mouseEvent.type){
		case ofMouseEventArgs::Moved:
			return notifyMouseMoved(mouseEvent.x,mouseEvent.y);
		case ofMouseEventArgs::Dragged:
			return notifyMouseDragged(mouseEvent.x,mouseEvent.y,mouseEvent.button);
		case ofMouseEventArgs::Pressed:
			return notifyMousePressed(mouseEvent.x,mouseEvent.y,mouseEvent.button);
		case ofMouseEventArgs::Released:
			return notifyMouseReleased(mouseEvent.x,mouseEvent.y,mouseEvent.button);
		case ofMouseEventArgs::Scrolled:
			return notifyMouseScrolled(mouseEvent.x,mouseEvent.y,mouseEvent.scrollX,mouseEvent.scrollY);
		case ofMouseEventArgs::Entered:
			return notifyMouseEntered(mouseEvent.x,mouseEvent.y);
		case ofMouseEventArgs::Exited:
			return notifyMouseExited(mouseEvent.x,mouseEvent.y);
	}
	return false;
}
Esempio n. 2
0
	void Window::onMouseButtonReleased(int _left, int _top, MouseButton _id)
	{
		notifyMouseReleased(this, _left, _top, _id);

		Base::onMouseButtonReleased(_left, _top, _id);
	}
Esempio n. 3
0
LRESULT Window::messageHandler(UINT messageId, WPARAM wParameter, LPARAM lParameter)
{
    // TODO Break Down in smaller pieces like keyboardMessageHandler, mouseMessageHandler
    //      and then map key to functions
	switch(messageId)
	{
	  case WM_DESTROY:
      {
          notifyWindowClosed();
          return FALSE;
      }
      case WM_SYSKEYDOWN: // Fall through
      case WM_KEYDOWN:
      {
          notifyKeyPressed(wParameter, LOWORD(lParameter));
          return FALSE;
      }
      case WM_SYSKEYUP: // Fall through
      case WM_KEYUP:
      {
          notifyKeyReleased(wParameter);
          return FALSE;
      }
      case WM_LBUTTONDOWN:
      {
          notifyMousePressed(MOUSE_BUTTON_LEFT, LOWORD(lParameter), HIWORD(lParameter));
          return FALSE;
      }
      case WM_LBUTTONUP:
      {
          notifyMouseReleased(MOUSE_BUTTON_LEFT, LOWORD(lParameter), HIWORD(lParameter));
          return FALSE;
      }
      case WM_LBUTTONDBLCLK:
      {
          notifyMouseDoubleClicked(MOUSE_BUTTON_LEFT, LOWORD(lParameter), HIWORD(lParameter));
          return FALSE;
      }
      case WM_MBUTTONDOWN:
      {
          notifyMousePressed(MOUSE_BUTTON_MIDDLE, LOWORD(lParameter), HIWORD(lParameter));
          return FALSE;
      }
      case WM_MBUTTONUP:
      {
          notifyMouseReleased(MOUSE_BUTTON_MIDDLE, LOWORD(lParameter), HIWORD(lParameter));
          return FALSE;
      }
      case WM_MBUTTONDBLCLK:
      {
          notifyMouseDoubleClicked(MOUSE_BUTTON_MIDDLE, LOWORD(lParameter), HIWORD(lParameter));
          return FALSE;
      }
      case WM_RBUTTONDOWN:
      {
          notifyMousePressed(MOUSE_BUTTON_RIGHT, LOWORD(lParameter), HIWORD(lParameter));
          return FALSE;
      }
      case WM_RBUTTONUP:
      {
          notifyMouseReleased(MOUSE_BUTTON_RIGHT, LOWORD(lParameter), HIWORD(lParameter));
          return FALSE;
      }
      case WM_RBUTTONDBLCLK:
      {
          notifyMouseDoubleClicked(MOUSE_BUTTON_RIGHT, LOWORD(lParameter), HIWORD(lParameter));
          return FALSE;
      }
      case WM_MOUSEWHEEL:
      {
          notifyMouseWheel(LOWORD(lParameter), HIWORD(lParameter), GET_WHEEL_DELTA_WPARAM(wParameter));
          return FALSE;
      }
      case WM_MOUSEMOVE:
      {
          notifyMouseMoved(LOWORD(lParameter), HIWORD(lParameter));
          return FALSE;
      }
      case WM_SIZE:
      {
          mWidth = LOWORD(lParameter);
          mHeight = HIWORD(lParameter);
          notifyWindowResized();
          return FALSE;
      }
	}

    return DefWindowProc( mHandle, messageId, wParameter, lParameter );
}