void Journal::use() { BobSlot *joe = _vm->graphics()->bob(0); _prevJoeX = joe->x; _prevJoeY = joe->y; _panelMode = PM_NORMAL; _system = g_system; _panelTextCount = 0; memset(_panelTextY, 0, sizeof(_panelTextY)); memset(&_textField, 0, sizeof(_textField)); memset(_saveDescriptions, 0, sizeof(_saveDescriptions)); _vm->findGameStateDescriptions(_saveDescriptions); setup(); redraw(); update(); _vm->display()->palFadeIn(ROOM_JOURNAL); _quitMode = QM_LOOP; while (_quitMode == QM_LOOP) { Common::Event event; Common::EventManager *eventMan = _system->getEventManager(); while (eventMan->pollEvent(event)) { switch (event.type) { case Common::EVENT_KEYDOWN: handleKeyDown(event.kbd.ascii, event.kbd.keycode); break; case Common::EVENT_LBUTTONDOWN: handleMouseDown(event.mouse.x, event.mouse.y); break; case Common::EVENT_WHEELUP: handleMouseWheel(-1); break; case Common::EVENT_WHEELDOWN: handleMouseWheel(1); break; case Common::EVENT_RTL: case Common::EVENT_QUIT: return; default: break; } } _system->delayMillis(20); _system->updateScreen(); } _vm->writeOptionSettings(); _vm->display()->clearTexts(0, GAME_SCREEN_HEIGHT - 1); _vm->graphics()->putCameraOnBob(0); if (_quitMode == QM_CONTINUE) { continueGame(); } }
bool System::handle_event(event e) { static EventArgs::MouseButtons mouse_button_maping[] = { EventArgs::Left, EventArgs::Middle, EventArgs::Right }; int event_type = e.type & event_type_filter; int mouse_event = e.mouse.type & mouse_event_filter; switch(event_type) { case event_mouse: { switch(mouse_event) { case mouse_move: return handleMouseMove(e.mouse.x, e.mouse.y); break; case mouse_wheel: return handleMouseWheel(e.mouse.delta); break; case mouse_button: return handleMouseButton(mouse_button_maping[e.mouse.button], e.mouse.type & event_key_down ? EventArgs::Down : EventArgs::Up); break; case mouse_dbclick: return handleMouseDouble(mouse_button_maping[e.mouse.button]); break; } } break; case event_keyboard: return handleKeyboard(e.keyboard.key, e.keyboard.type & event_key_down ? EventArgs::Down : EventArgs::Up); break; case event_char: return handleChar(e.text.code); break; case event_focus: handleFocusLost(); break; case event_viewport_resize: handleViewportChange(); break; } return false; }
bool WebPopupMenuImpl::handleInputEvent(const WebInputEvent& inputEvent) { if (!m_widget) return false; // FIXME: WebKit seems to always return false on mouse events methods. For // now we'll assume it has processed them (as we are only interested in // whether keyboard events are processed). switch (inputEvent.type) { case WebInputEvent::MouseMove: handleMouseMove(static_cast<const WebMouseEvent&>(inputEvent)); return true; case WebInputEvent::MouseLeave: handleMouseLeave(static_cast<const WebMouseEvent&>(inputEvent)); return true; case WebInputEvent::MouseWheel: handleMouseWheel(static_cast<const WebMouseWheelEvent&>(inputEvent)); return true; case WebInputEvent::MouseDown: handleMouseDown(static_cast<const WebMouseEvent&>(inputEvent)); return true; case WebInputEvent::MouseUp: handleMouseUp(static_cast<const WebMouseEvent&>(inputEvent)); return true; // In Windows, RawKeyDown only has information about the physical key, but // for "selection", we need the information about the character the key // translated into. For English, the physical key value and the character // value are the same, hence, "selection" works for English. But for other // languages, such as Hebrew, the character value is different from the // physical key value. Thus, without accepting Char event type which // contains the key's character value, the "selection" won't work for // non-English languages, such as Hebrew. case WebInputEvent::RawKeyDown: case WebInputEvent::KeyDown: case WebInputEvent::KeyUp: case WebInputEvent::Char: return handleKeyEvent(static_cast<const WebKeyboardEvent&>(inputEvent)); case WebInputEvent::TouchStart: case WebInputEvent::TouchMove: case WebInputEvent::TouchEnd: case WebInputEvent::TouchCancel: return handleTouchEvent(static_cast<const WebTouchEvent&>(inputEvent)); case WebInputEvent::GestureScrollBegin: case WebInputEvent::GestureScrollEnd: case WebInputEvent::GestureScrollUpdate: case WebInputEvent::GestureFlingStart: case WebInputEvent::GestureFlingCancel: case WebInputEvent::GestureTap: case WebInputEvent::GestureTapUnconfirmed: case WebInputEvent::GestureTapDown: case WebInputEvent::GestureShowPress: case WebInputEvent::GestureTapCancel: case WebInputEvent::GestureDoubleTap: case WebInputEvent::GestureTwoFingerTap: case WebInputEvent::GestureLongPress: case WebInputEvent::GestureLongTap: case WebInputEvent::GesturePinchBegin: case WebInputEvent::GesturePinchEnd: case WebInputEvent::GesturePinchUpdate: return handleGestureEvent(static_cast<const WebGestureEvent&>(inputEvent)); case WebInputEvent::Undefined: case WebInputEvent::MouseEnter: case WebInputEvent::ContextMenu: return false; } return false; }
/** Handles events. Returns true if handled, false otherwise.*/ bool OrbitCameraManipulator::handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa ) { switch( ea.getEventType() ) { case osgGA::GUIEventAdapter::FRAME: return handleFrame( ea, aa ); case osgGA::GUIEventAdapter::RESIZE: return handleResize( ea, aa ); default: break; } if( ea.getHandled() ) { return false; } computeRayPointer( ea, aa ); bool handled = false; switch( ea.getEventType() ) { case osgGA::GUIEventAdapter::MOVE: handled = handleMouseMove( ea, aa ); break; case osgGA::GUIEventAdapter::DRAG: handled = handleMouseDrag( ea, aa ); break; case osgGA::GUIEventAdapter::PUSH: handled = handleMousePush( ea, aa ); break; case osgGA::GUIEventAdapter::RELEASE: handled = handleMouseRelease( ea, aa ); break; case osgGA::GUIEventAdapter::KEYDOWN: handled = handleKeyDown( ea, aa ); break; case osgGA::GUIEventAdapter::KEYUP: m_control_key_down = false; handled = handleKeyUp( ea, aa ); break; case osgGA::GUIEventAdapter::SCROLL: if( _flags & PROCESS_MOUSE_WHEEL ) handled = handleMouseWheel( ea, aa ); else handled = false; break; default: handled = false; } return handled; }