bool wxUIActionSimulator::MouseDblClick(int button) { MouseDown(button); MouseUp(button); MouseDown(button); MouseUp(button); return true; }
void TBarMenuBar::MouseMoved(BPoint where, uint32 code, const BMessage* message) { // the following code parallels that in ExpandoMenuBar for DnD tracking if (!message) { // force a cleanup fBarView->DragStop(true); BMenuBar::MouseMoved(where, code, message); return; } switch (code) { case B_ENTERED_VIEW: { BPoint loc; uint32 buttons; GetMouse(&loc, &buttons); // attempt to start DnD tracking if (message && buttons != 0) { fBarView->CacheDragData(const_cast<BMessage*>(message)); MouseDown(loc); } break; } } BMenuBar::MouseMoved(where, code, message); }
void MainWin::DispatchMessage(BMessage *msg, BHandler *handler) { if ((msg->what == B_MOUSE_DOWN) && (handler == fBackground || handler == fVideoView)) MouseDown(msg); if ((msg->what == B_MOUSE_MOVED) && (handler == fBackground || handler == fVideoView)) MouseMoved(msg); if ((msg->what == B_MOUSE_UP) && (handler == fBackground || handler == fVideoView)) MouseUp(msg); if ((msg->what == B_KEY_DOWN) && (handler == fBackground || handler == fVideoView)) { // special case for PrintScreen key if (msg->FindInt32("key") == B_PRINT_KEY) { fVideoView->OverlayScreenshotPrepare(); BWindow::DispatchMessage(msg, handler); fVideoView->OverlayScreenshotCleanup(); return; } // every other key gets dispatched to our KeyDown first if (KeyDown(msg) == B_OK) { // it got handled, don't pass it on return; } } BWindow::DispatchMessage(msg, handler); }
/* Main loop. 1) Stores key presses, and calls call-back functions for press/release if necessary. 2) Calls GameAction 3) Calls GameRender */ int BaseEngine::MainLoop(void) { SDL_Event event; int iKeyCode; // Main loop: loop until told not to while (m_iExitWithCode==-1) { // Render stuff m_iTick = SDL_GetTicks(); // Poll for events, and handle the ones we care about. while (SDL_PollEvent(&event)) { switch (event.type) { case SDL_KEYDOWN: //printf("Key down: %d, '%c'\n", SymbolToKeycode(event.key.keysym.sym), event.key.keysym.sym); m_pKeyStatus[SymbolToKeycode(event.key.keysym.sym)] = true; KeyDown(event.key.keysym.sym); break; case SDL_KEYUP: //printf("Key up: %d, '%c'\n", SymbolToKeycode(event.key.keysym.sym), event.key.keysym.sym); m_pKeyStatus[SymbolToKeycode(event.key.keysym.sym)] = false; KeyUp(event.key.keysym.sym); break; case SDL_MOUSEMOTION: m_iCurrentMouseX = event.motion.x; m_iCurrentMouseY = event.motion.y; MouseMoved( event.motion.x, event.motion.y ); break; case SDL_MOUSEBUTTONDOWN: m_iMouseXClickedDown = event.button.x; m_iMouseYClickedDown = event.button.y; MouseDown( event.button.button, event.button.x, event.button.y ); break; case SDL_MOUSEBUTTONUP: m_iMouseXClickedUp = event.button.x; m_iMouseYClickedUp = event.button.y; MouseUp( event.button.button, event.button.x, event.button.y ); break; case SDL_QUIT: return 0; } } // Do any updates for movements GameAction(); // Render the screen GameRender(); } return 0; }
void TExpandoMenuBar::MouseMoved(BPoint where, uint32 code, const BMessage *message) { if (!message) { // force a cleanup fBarView->DragStop(true); BMenuBar::MouseMoved(where, code, message); return; } BPoint loc; uint32 buttons; GetMouse(&loc, &buttons); switch (code) { case B_ENTERED_VIEW: if (message && buttons != 0) { fBarView->CacheDragData((BMessage *)message); MouseDown(loc); } break; case B_EXITED_VIEW: if (fBarView->Dragging() && buttons != 0) { if (!ItemAtPoint(where) && !InBeMenu(where) && (fSeparatorItem && !fSeparatorItem->Frame().Contains(where)) && !Frame().Contains(where)) fBarView->DragStop(); } break; } BMenuBar::MouseMoved(where, code, message); }
void MouseClick(TMouseButton button) { MouseDown(button); MouseUp(button); }
void HelloWorld::onTouchesEnded(const std::vector<Touch*>& pTouches, Event *pEvent){ // auto touchLocation = touch->getLocation(); // auto nodePosition = convertToNodeSpace( touchLocation ); // // log("Box2DView::onTouchEnded, pos: %f,%f -> %f,%f", touchLocation.x, touchLocation.y, nodePosition.x, nodePosition.y); // // MouseUp(b2Vec2(nodePosition.x*PTM_RATIO,nodePosition.y*PTM_RATIO)); if (m_enabelMove) { for (auto& touch : pTouches) { if(!touch) break; log("touch id: %d", touch->getID()); auto touchLocation = touch->getLocation(); auto nodePosition = convertToNodeSpace( touchLocation );//视图层不是当前场景大小, 所以需要转换视图 log("Box2DView::onTouchBegan, pos: %f,%f -> %f,%f", touchLocation.x, touchLocation.y, nodePosition.x * PTM_RATIO, nodePosition.y * PTM_RATIO); MouseDown(b2Vec2(nodePosition.x*PTM_RATIO,nodePosition.y*PTM_RATIO)); } } }
int WinTrackEventListener::ClickMouse() { if (state == OFF) return 0; MouseDown(); MouseUp(); return 1; }
bool HelloWorld::onTouchBegan(Touch* touch, Event* event){ auto touchLocation = touch->getLocation(); auto nodePosition = convertToNodeSpace( touchLocation );//视图层不是当前场景大小, 所以需要转换视图 log("Box2DView::onTouchBegan, pos: %f,%f -> %f,%f", touchLocation.x, touchLocation.y, nodePosition.x, nodePosition.y); return MouseDown(b2Vec2(nodePosition.x*PTM_RATIO,nodePosition.y*PTM_RATIO)); }
/* Main event handler function. This function gets raw SDL events from the GUI. */ GUI_status GUI_Widget:: HandleEvent(const SDL_Event *event) { switch (event->type) { case SDL_KEYDOWN: { return(KeyDown(event->key.keysym)); } break; case SDL_KEYUP: { return(KeyUp(event->key.keysym)); } break; case SDL_MOUSEBUTTONDOWN: { int x, y, button; x = event->button.x; y = event->button.y; if ( HitRect(x, y) ) { button = event->button.button; return(MouseDown(x, y, button)); } } break; case SDL_MOUSEBUTTONUP: { int x, y, button; x = event->button.x; y = event->button.y; button = event->button.button; if ( HitRect(x, y) ) { button = event->button.button; return(MouseUp(x, y, button)); } /* if widget was clicked before we must let it deactivate itself*/ else if (ClickState(1)) return(MouseUp(-1,-1,button)); } break; case SDL_MOUSEMOTION: { int x, y; Uint8 state; x = event->motion.x; y = event->motion.y; state = event->motion.state; if ( HitRect(x, y) ) { return(MouseMotion(x, y, state)); } /* if widget was clicked before we must let it react*/ else if (ClickState(1)) return(MouseMotion(-1,-1,state)); } break; default: { /* Pass it along.. */; } break; } return(GUI_PASS); }
//--------------------------- Mouse Button Checking PyObject* LMF_MouseDown (PyObject *self, PyObject *args){ int iMouseButton; if (!PyArg_ParseTuple(args, "i", &iMouseButton)) { ParsePyTupleError( __func__, __LINE__ ); return nullptr; } int iMouseState = MouseDown(iMouseButton); return Py_BuildValue("i", iMouseState); }
LRESULT Window::WindowMessage(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_SHOWWINDOW: Initialize(); break; case WM_SIZE: Resize(); break; case WM_PAINT: Render(); break; case WM_LBUTTONDOWN: MouseDown(); break; case WM_MOUSEMOVE: MouseMove(); break; case WM_LBUTTONUP: MouseUp(); break; case WM_KEYDOWN: switch (wParam) { case 0x50: //P _displayPointLight = !_displayPointLight; Render(); break; case 0x44: //D _displayDirectionalLight = !_displayDirectionalLight; Render(); break; } break; case WM_DESTROY: Destroy(); PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); break; } return 0; }
bool wxUIActionSimulator::MouseDragDrop(long x1, long y1, long x2, long y2, int button) { MouseMove(x1, y1); MouseDown(button); MouseMove(x2, y2); MouseUp(button); return true; }
void handleScreenEvent(bps_event_t *event) { screen_event_t screen_event = screen_event_get_event(event); mtouch_event_t mtouch_event; int screen_val; int position[2]; int rc; screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_TYPE, &screen_val); switch (screen_val) { case SCREEN_EVENT_MTOUCH_TOUCH: case SCREEN_EVENT_MTOUCH_MOVE: case SCREEN_EVENT_MTOUCH_RELEASE: rc = screen_get_mtouch_event(screen_event, &mtouch_event, 0); if (rc) fprintf(stderr, "Error: failed to get mtouch event\n"); rc = gestures_set_process_event(set, &mtouch_event, NULL); // No gesture detected, pass through if (!rc) { if (screen_val == SCREEN_EVENT_MTOUCH_TOUCH) MouseDown(mtouch_event.x, mtouch_event.y); else if (screen_val == SCREEN_EVENT_MTOUCH_MOVE) test->MouseMove(ConvertScreenToWorld(mtouch_event.x, mtouch_event.y)); else test->MouseUp(ConvertScreenToWorld(mtouch_event.x, mtouch_event.y)); } break; case SCREEN_EVENT_KEYBOARD: screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_KEY_FLAGS, &screen_val); if (screen_val & KEY_DOWN) { screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_KEY_SYM, &screen_val); if (screen_val >= ' ' && screen_val < '~') { Keyboard(screen_val, 0, 0); } else { screen_val = screen_val - 0xf000; Keyboard(screen_val, 0, 0); } } break; } }
/* Pointer event. */ int override DispatchPointer(const TASKMSG *msg) { RETURN_IF_NULL(msg); int cmd = msg->data1; switch (cmd) { case POINTER_UP: return MouseUp(msg->data2, msg->data3, msg->data4); case POINTER_DOWN: return MouseDown(msg->data2, msg->data3, msg->data4); case POINTER_MOVE: return MouseMove(msg->data2, msg->data3, msg->data4); case POINTER_WHEEL: return MouseWheel(msg->data2, msg->data3, msg->data4); } return 0; }
nsresult nsSplitterFrameInner::HandleEvent(nsIDOMEvent* aEvent) { nsAutoString eventType; aEvent->GetType(eventType); if (eventType.EqualsLiteral("mouseup")) return MouseUp(aEvent); if (eventType.EqualsLiteral("mousedown")) return MouseDown(aEvent); if (eventType.EqualsLiteral("mousemove") || eventType.EqualsLiteral("mouseout")) return MouseMove(aEvent); NS_ABORT(); return NS_OK; }
void Application::MouseGL(int button, int state, int x, int y) { IPoint mousePos( (x * 1.f) / screen.Width() * screen.GLWidth(), screen.GLHeight() - (y * 1.f) / screen.Height() * screen.GLHeight() ); if (button == GLUT_LEFT_BUTTON) { if (state == GLUT_DOWN) { MouseDown(mousePos); } else if (state == GLUT_UP) { MouseUp(mousePos); } } }
//! input callback. void GraphView::ViewInput(int pMouseX,int pMouseY,FBInputType pAction,int pButtonKey,int pModifier) { switch(pAction) { case kFBKeyPress: { UserInput(pMouseX, pMouseY, pButtonKey, pModifier); } break; case kFBButtonPress: { // register mouse down in viewport mDown = true; mLastX = pMouseX; mLastY = pMouseY; if (pModifier == kFBKeyAlt) if (pButtonKey == 2) // middle button click SetManipulator( MANIPULATOR_GRAPH_PAN ); else if (pButtonKey == 3) // right button click SetManipulator( MANIPULATOR_GRAPH_ZOOM ); // do some action below MouseDown(pMouseX, pMouseY, pModifier); } break; case kFBButtonRelease: // do some action below MouseUp(pMouseX, pMouseY, pModifier); // release button mDown = false; ClearManipulator(); break; case kFBMotionNotify: // do some action MouseMove(pMouseX, pMouseY, pModifier); // lastx, lasty mLastX = pMouseX; mLastY = pMouseY; break; } }
NS_IMETHODIMP nsWidgetUtils::HandleEvent(nsIDOMEvent* aDOMEvent) { nsAutoString eventType; aEvent->GetType(eventType); if (eventType.EqualsLiteral("mousedown")) { return MouseDown(aEvent); } if (eventType.EqualsLiteral("mouseup")) { return MouseUp(aEvent); } if (eventType.EqualsLiteral("mousemove")) { return MouseMove(aEvent); } return NS_OK; }
bool DesignerHook::OnMessage(TControl* Sender,Messages::TMessage &Message) { bool msg_handled=(IsMouseMsg(Message.Msg) || IsKeyMsg(Message.Msg)); TWMMouse& WMMouse=(TWMMouse&)Message; TWMKey& WMKey=(TWMKey&)Message; switch(Message.Msg){ case WM_LBUTTONDOWN: MouseDown( Sender, mbLeft, KeysToShiftState(WMMouse.Keys), WMMouse.XPos, WMMouse.YPos ); break; case WM_MOUSEMOVE: MouseMove( Sender, KeysToShiftState(WMMouse.Keys), WMMouse.XPos, WMMouse.YPos); break; case WM_LBUTTONUP: MouseUp( Sender, mbLeft, KeysToShiftState(WMMouse.Keys), WMMouse.XPos, WMMouse.YPos); break; case WM_KEYDOWN: KeyDown( Sender, WMKey.CharCode, KeyDataToShiftState(WMKey.KeyData) ); break; } if(Sender == Form_){ msg_handled=false ; } return msg_handled; }
void TExpandoMenuBar::MouseMoved(BPoint where, uint32 code, const BMessage *message) { if (!message) { // force a cleanup fBarView->DragStop(true); BMenuBar::MouseMoved(where, code, message); return; } uint32 buttons; if (!(Window()->CurrentMessage()) || Window()->CurrentMessage()->FindInt32("buttons", (int32*)&buttons) < B_OK) buttons = 0; switch (code) { case B_ENTERED_VIEW: if (message && buttons != 0) { fBarView->CacheDragData(message); MouseDown(where); } break; case B_EXITED_VIEW: if (fBarView->Dragging() && buttons != 0) { if (!TeamItemAtPoint(where) && !InBeMenu(where) && (fSeparatorItem && !fSeparatorItem->Frame().Contains(where)) && !Frame().Contains(where)) { fBarView->DragStop(); } } break; } BMenuBar::MouseMoved(where, code, message); }
/* Main loop. 1) Stores key presses, and calls call-back functions for press/release if necessary. 2) Calls GameAction 3) Calls GameRender */ int BaseEngine::MainLoop(void) { SDL_Event event; int iKeyCode; // Main loop: loop until told not to while (m_iExitWithCode==-1) { // Render stuff m_iTick = SDL_GetTicks(); // Poll for events, and handle the ones we care about. while (SDL_PollEvent(&event)) { switch (event.type) { case SDL_KEYDOWN: iKeyCode = event.key.keysym.sym; if ( (iKeyCode >= SDLK_FIRST) && (iKeyCode <= SDLK_LAST) ) m_pKeyStatus[iKeyCode-SDLK_FIRST] = 1; KeyDown(iKeyCode); break; case SDL_KEYUP: iKeyCode = event.key.keysym.sym; if ( (iKeyCode >= SDLK_FIRST) && (iKeyCode <= SDLK_LAST) ) { m_pKeyStatus[iKeyCode-SDLK_FIRST] = 0; } KeyUp(iKeyCode); break; case SDL_MOUSEMOTION: m_iCurrentMouseX = event.motion.x; m_iCurrentMouseY = event.motion.y; MouseMoved( event.motion.x, event.motion.y ); break; case SDL_MOUSEBUTTONDOWN: m_iMouseXClickedDown = event.button.x; m_iMouseYClickedDown = event.button.y; MouseDown( event.button.button, event.button.x, event.button.y ); break; case SDL_MOUSEBUTTONUP: m_iMouseXClickedUp = event.button.x; m_iMouseYClickedUp = event.button.y; MouseUp( event.button.button, event.button.x, event.button.y ); break; case SDL_QUIT: return 0; } } // Do any updates for movements GameAction(); // Render the screen GameRender(); } return 0; }
NS_IMETHODIMP nsFormFillController::HandleEvent(nsIDOMEvent* aEvent) { nsAutoString type; aEvent->GetType(type); if (type.EqualsLiteral("focus")) { return Focus(aEvent); } if (type.EqualsLiteral("mousedown")) { return MouseDown(aEvent); } if (type.EqualsLiteral("keypress")) { return KeyPress(aEvent); } if (type.EqualsLiteral("input")) { return (!mSuppressOnInput && mController && mFocusedInput) ? mController->HandleText() : NS_OK; } if (type.EqualsLiteral("blur")) { if (mFocusedInput) StopControllingInput(); return NS_OK; } if (type.EqualsLiteral("compositionstart")) { NS_ASSERTION(mController, "should have a controller!"); if (mController && mFocusedInput) mController->HandleStartComposition(); return NS_OK; } if (type.EqualsLiteral("compositionend")) { NS_ASSERTION(mController, "should have a controller!"); if (mController && mFocusedInput) mController->HandleEndComposition(); return NS_OK; } if (type.EqualsLiteral("contextmenu")) { if (mFocusedPopup) mFocusedPopup->ClosePopup(); return NS_OK; } if (type.EqualsLiteral("pagehide")) { nsCOMPtr<nsIDOMEventTarget> target; aEvent->GetTarget(getter_AddRefs(target)); nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(target); if (!domDoc) return NS_OK; if (mFocusedInput) { nsCOMPtr<nsIDOMDocument> inputDoc; mFocusedInput->GetOwnerDocument(getter_AddRefs(inputDoc)); if (domDoc == inputDoc) StopControllingInput(); } mPwmgrInputs.Enumerate(RemoveForDOMDocumentEnumerator, domDoc); } return NS_OK; }
NS_IMETHODIMP EditorEventListener::HandleEvent(nsIDOMEvent* aEvent) { NS_ENSURE_TRUE(mEditorBase, NS_ERROR_FAILURE); nsCOMPtr<nsIEditor> kungFuDeathGrip = mEditorBase; Unused << kungFuDeathGrip; // mEditorBase is not referred to in this function WidgetEvent* internalEvent = aEvent->WidgetEventPtr(); // Let's handle each event with the message of the internal event of the // coming event. If the DOM event was created with improper interface, // e.g., keydown event is created with |new MouseEvent("keydown", {});|, // its message is always 0. Therefore, we can ban such strange event easy. // However, we need to handle strange "focus" and "blur" event. See the // following code of this switch statement. // NOTE: Each event handler may require specific event interface. Before // calling it, this queries the specific interface. If it would fail, // each event handler would just ignore the event. So, in this method, // you don't need to check if the QI succeeded before each call. switch (internalEvent->mMessage) { // dragenter case eDragEnter: { nsCOMPtr<nsIDOMDragEvent> dragEvent = do_QueryInterface(aEvent); return DragEnter(dragEvent); } // dragover case eDragOver: { nsCOMPtr<nsIDOMDragEvent> dragEvent = do_QueryInterface(aEvent); return DragOver(dragEvent); } // dragexit case eDragExit: { nsCOMPtr<nsIDOMDragEvent> dragEvent = do_QueryInterface(aEvent); return DragExit(dragEvent); } // drop case eDrop: { nsCOMPtr<nsIDOMDragEvent> dragEvent = do_QueryInterface(aEvent); return Drop(dragEvent); } #ifdef HANDLE_NATIVE_TEXT_DIRECTION_SWITCH // keydown case eKeyDown: { nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aEvent); return KeyDown(keyEvent); } // keyup case eKeyUp: { nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aEvent); return KeyUp(keyEvent); } #endif // #ifdef HANDLE_NATIVE_TEXT_DIRECTION_SWITCH // keypress case eKeyPress: { nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aEvent); return KeyPress(keyEvent); } // mousedown case eMouseDown: { nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aEvent); NS_ENSURE_TRUE(mouseEvent, NS_OK); // EditorEventListener may receive (1) all mousedown, mouseup and click // events, (2) only mousedown event or (3) only mouseup event. // mMouseDownOrUpConsumedByIME is used only for ignoring click event if // preceding mousedown and/or mouseup event is consumed by IME. // Therefore, even if case #2 or case #3 occurs, // mMouseDownOrUpConsumedByIME is true here. Therefore, we should always // overwrite it here. mMouseDownOrUpConsumedByIME = NotifyIMEOfMouseButtonEvent(mouseEvent); return mMouseDownOrUpConsumedByIME ? NS_OK : MouseDown(mouseEvent); } // mouseup case eMouseUp: { nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aEvent); NS_ENSURE_TRUE(mouseEvent, NS_OK); // See above comment in the eMouseDown case, first. // This code assumes that case #1 is occuring. However, if case #3 may // occurs after case #2 and the mousedown is consumed, // mMouseDownOrUpConsumedByIME is true even though EditorEventListener // has not received the preceding mousedown event of this mouseup event. // So, mMouseDownOrUpConsumedByIME may be invalid here. However, // this is not a matter because mMouseDownOrUpConsumedByIME is referred // only by eMouseClick case but click event is fired only in case #1. // So, before a click event is fired, mMouseDownOrUpConsumedByIME is // always initialized in the eMouseDown case if it's referred. if (NotifyIMEOfMouseButtonEvent(mouseEvent)) { mMouseDownOrUpConsumedByIME = true; } return mMouseDownOrUpConsumedByIME ? NS_OK : MouseUp(mouseEvent); } // click case eMouseClick: { nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aEvent); NS_ENSURE_TRUE(mouseEvent, NS_OK); // If the preceding mousedown event or mouseup event was consumed, // editor shouldn't handle this click event. if (mMouseDownOrUpConsumedByIME) { mMouseDownOrUpConsumedByIME = false; mouseEvent->AsEvent()->PreventDefault(); return NS_OK; } return MouseClick(mouseEvent); } // focus case eFocus: return Focus(aEvent); // blur case eBlur: return Blur(aEvent); // text case eCompositionChange: return HandleText(aEvent); // compositionstart case eCompositionStart: return HandleStartComposition(aEvent); // compositionend case eCompositionEnd: HandleEndComposition(aEvent); return NS_OK; default: break; } nsAutoString eventType; aEvent->GetType(eventType); // We should accept "focus" and "blur" event even if it's synthesized with // wrong interface for compatibility with older Gecko. if (eventType.EqualsLiteral("focus")) { return Focus(aEvent); } if (eventType.EqualsLiteral("blur")) { return Blur(aEvent); } #ifdef DEBUG nsPrintfCString assertMessage("Editor doesn't handle \"%s\" event " "because its internal event doesn't have proper message", NS_ConvertUTF16toUTF8(eventType).get()); NS_ASSERTION(false, assertMessage.get()); #endif return NS_OK; }
void MouseMouse() { unsigned char byte1 = 0, byte2 = 0, byte3 = 0; int xChange, yChange, lButton, mButton, rButton; // Disable keyboard output here, because our data reads are not atomic MouseOut(MOUSE_CONTROL, CTRL_DEACTIVATE); byte1 = MouseIn(); if(byte1==-1) { MouseOut(MOUSE_CONTROL, CTRL_CMD); MouseOut(MOUSE_DATA, CMD_RESEND); MouseOut(MOUSE_CONTROL, CTRL_DEACTIVATE); return; } byte2 = MouseIn(); byte3 = MouseIn(); // Re-enable keyboard output MouseOut(MOUSE_CONTROL, CTRL_DEACTIVATE); lButton = ((byte1 & BYTE1_LEFT) == BYTE1_LEFT); mButton = ((byte1 & BYTE1_MIDDLE) == BYTE1_MIDDLE); rButton = ((byte1 & BYTE1_RIGHT) == BYTE1_RIGHT); if(byte1 & BYTE1_SIGNX) xChange = (int)(((unsigned int)~0xFF)|(byte2 & 0xFF)); else xChange = (int)byte2; if(byte1 & BYTE1_SIGNY) yChange = (int)(((unsigned int)~0xFF)|(byte3 & 0xFF)); else yChange = (int)byte3; MouseX += xChange; MouseY -= yChange; if(MouseX < 0) MouseX = 0; if(MouseY < 0) MouseY = 0; if(MouseX >= LoaderInfo->VideoMode.ModeWidth) MouseX = LoaderInfo->VideoMode.ModeWidth - 1; if(MouseY >= LoaderInfo->VideoMode.ModeHeight) MouseY = LoaderInfo->VideoMode.ModeHeight - 1; MouseMove(MouseX, MouseY); if(lButton ^ ButtonL) if(lButton) MouseDown(0); else MouseUp(0); if(mButton ^ ButtonM) if(mButton) MouseDown(1); else MouseUp(1); if(rButton ^ ButtonR) if(rButton) MouseDown(2); else MouseUp(2); ButtonL = lButton; ButtonM = mButton; ButtonR = rButton; }
HRESULT CWMPEventDispatch::Invoke( DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS FAR* pDispParams, VARIANT FAR* pVarResult, EXCEPINFO FAR* pExcepInfo, unsigned int FAR* puArgErr ) { if (!pDispParams) return E_POINTER; if (pDispParams->cNamedArgs != 0) return DISP_E_NONAMEDARGS; HRESULT hr = DISP_E_MEMBERNOTFOUND; switch (dispIdMember) { case DISPID_WMPCOREEVENT_OPENSTATECHANGE: OpenStateChange(pDispParams->rgvarg[0].lVal /* NewState */ ); break; case DISPID_WMPCOREEVENT_PLAYSTATECHANGE: PlayStateChange(pDispParams->rgvarg[0].lVal /* NewState */); break; case DISPID_WMPCOREEVENT_AUDIOLANGUAGECHANGE: AudioLanguageChange(pDispParams->rgvarg[0].lVal /* LangID */); break; case DISPID_WMPCOREEVENT_STATUSCHANGE: StatusChange(); break; case DISPID_WMPCOREEVENT_SCRIPTCOMMAND: ScriptCommand(pDispParams->rgvarg[1].bstrVal /* scType */, pDispParams->rgvarg[0].bstrVal /* Param */ ); break; case DISPID_WMPCOREEVENT_NEWSTREAM: NewStream(); break; case DISPID_WMPCOREEVENT_DISCONNECT: Disconnect(pDispParams->rgvarg[0].lVal /* Result */ ); break; case DISPID_WMPCOREEVENT_BUFFERING: Buffering(pDispParams->rgvarg[0].boolVal /* Start */); break; case DISPID_WMPCOREEVENT_ERROR: Error(); break; case DISPID_WMPCOREEVENT_WARNING: Warning(pDispParams->rgvarg[1].lVal /* WarningType */, pDispParams->rgvarg[0].lVal /* Param */, pDispParams->rgvarg[2].bstrVal /* Description */); break; case DISPID_WMPCOREEVENT_ENDOFSTREAM: EndOfStream(pDispParams->rgvarg[0].lVal /* Result */ ); break; case DISPID_WMPCOREEVENT_POSITIONCHANGE: PositionChange(pDispParams->rgvarg[1].dblVal /* oldPosition */, pDispParams->rgvarg[0].dblVal /* newPosition */); break; case DISPID_WMPCOREEVENT_MARKERHIT: MarkerHit(pDispParams->rgvarg[0].lVal /* MarkerNum */); break; case DISPID_WMPCOREEVENT_DURATIONUNITCHANGE: DurationUnitChange(pDispParams->rgvarg[0].lVal /* NewDurationUnit */); break; case DISPID_WMPCOREEVENT_CDROMMEDIACHANGE: CdromMediaChange(pDispParams->rgvarg[0].lVal /* CdromNum */); break; case DISPID_WMPCOREEVENT_PLAYLISTCHANGE: PlaylistChange(pDispParams->rgvarg[1].pdispVal /* Playlist */, (WMPPlaylistChangeEventType) pDispParams->rgvarg[0].lVal /* change */); break; case DISPID_WMPCOREEVENT_CURRENTPLAYLISTCHANGE: CurrentPlaylistChange((WMPPlaylistChangeEventType) pDispParams->rgvarg[0].lVal /* change */); break; case DISPID_WMPCOREEVENT_CURRENTPLAYLISTITEMAVAILABLE: CurrentPlaylistItemAvailable(pDispParams->rgvarg[0].bstrVal /* bstrItemName */); break; case DISPID_WMPCOREEVENT_MEDIACHANGE: MediaChange(pDispParams->rgvarg[0].pdispVal /* Item */); break; case DISPID_WMPCOREEVENT_CURRENTMEDIAITEMAVAILABLE: CurrentMediaItemAvailable(pDispParams->rgvarg[0].bstrVal /* bstrItemName */); break; case DISPID_WMPCOREEVENT_CURRENTITEMCHANGE: CurrentItemChange(pDispParams->rgvarg[0].pdispVal /* pdispMedia */); break; case DISPID_WMPCOREEVENT_MEDIACOLLECTIONCHANGE: MediaCollectionChange(); break; case DISPID_WMPCOREEVENT_MEDIACOLLECTIONATTRIBUTESTRINGADDED: MediaCollectionAttributeStringAdded(pDispParams->rgvarg[1].bstrVal /* bstrAttribName */, pDispParams->rgvarg[0].bstrVal /* bstrAttribVal */ ); break; case DISPID_WMPCOREEVENT_MEDIACOLLECTIONATTRIBUTESTRINGREMOVED: MediaCollectionAttributeStringRemoved(pDispParams->rgvarg[1].bstrVal /* bstrAttribName */, pDispParams->rgvarg[0].bstrVal /* bstrAttribVal */ ); break; case DISPID_WMPCOREEVENT_MEDIACOLLECTIONATTRIBUTESTRINGCHANGED: MediaCollectionAttributeStringChanged(pDispParams->rgvarg[2].bstrVal /* bstrAttribName */, pDispParams->rgvarg[1].bstrVal /* bstrOldAttribVal */, pDispParams->rgvarg[0].bstrVal /* bstrNewAttribVal */); break; case DISPID_WMPCOREEVENT_PLAYLISTCOLLECTIONCHANGE: PlaylistCollectionChange(); break; case DISPID_WMPCOREEVENT_PLAYLISTCOLLECTIONPLAYLISTADDED: PlaylistCollectionPlaylistAdded(pDispParams->rgvarg[0].bstrVal /* bstrPlaylistName */ ); break; case DISPID_WMPCOREEVENT_PLAYLISTCOLLECTIONPLAYLISTREMOVED: PlaylistCollectionPlaylistRemoved(pDispParams->rgvarg[0].bstrVal /* bstrPlaylistName */ ); break; case DISPID_WMPCOREEVENT_PLAYLISTCOLLECTIONPLAYLISTSETASDELETED: PlaylistCollectionPlaylistSetAsDeleted(pDispParams->rgvarg[1].bstrVal /* bstrPlaylistName */, pDispParams->rgvarg[0].boolVal /* varfIsDeleted */); break; case DISPID_WMPCOREEVENT_MODECHANGE: ModeChange(pDispParams->rgvarg[1].bstrVal /* ModeName */, pDispParams->rgvarg[0].boolVal /* NewValue */); break; case DISPID_WMPCOREEVENT_MEDIAERROR: MediaError(pDispParams->rgvarg[0].pdispVal /* pMediaObject */); break; case DISPID_WMPCOREEVENT_OPENPLAYLISTSWITCH: OpenPlaylistSwitch(pDispParams->rgvarg[0].pdispVal /* pItem */); break; case DISPID_WMPCOREEVENT_DOMAINCHANGE: DomainChange(pDispParams->rgvarg[0].bstrVal /* strDomain */); break; case DISPID_WMPOCXEVENT_SWITCHEDTOPLAYERAPPLICATION: SwitchedToPlayerApplication(); break; case DISPID_WMPOCXEVENT_SWITCHEDTOCONTROL: SwitchedToControl(); break; case DISPID_WMPOCXEVENT_PLAYERDOCKEDSTATECHANGE: PlayerDockedStateChange(); break; case DISPID_WMPOCXEVENT_PLAYERRECONNECT: PlayerReconnect(); break; case DISPID_WMPOCXEVENT_CLICK: Click(pDispParams->rgvarg[3].iVal /* nButton */, pDispParams->rgvarg[2].iVal /* nShiftState */, pDispParams->rgvarg[1].lVal /* fX */, pDispParams->rgvarg[0].lVal /* fY */); break; case DISPID_WMPOCXEVENT_DOUBLECLICK: DoubleClick(pDispParams->rgvarg[3].iVal /* nButton */, pDispParams->rgvarg[2].iVal /* nShiftState */, pDispParams->rgvarg[1].lVal /* fX */, pDispParams->rgvarg[0].lVal /* fY */); break; case DISPID_WMPOCXEVENT_KEYDOWN: KeyDown(pDispParams->rgvarg[1].iVal /* nKeyCode */, pDispParams->rgvarg[0].iVal /* nShiftState */); break; case DISPID_WMPOCXEVENT_KEYPRESS: KeyPress(pDispParams->rgvarg[0].iVal /* nKeyAscii */); break; case DISPID_WMPOCXEVENT_KEYUP: KeyUp(pDispParams->rgvarg[1].iVal /* nKeyCode */, pDispParams->rgvarg[0].iVal /* nShiftState */); break; case DISPID_WMPOCXEVENT_MOUSEDOWN: MouseDown(pDispParams->rgvarg[3].iVal /* nButton */, pDispParams->rgvarg[2].iVal /* nShiftState */, pDispParams->rgvarg[1].lVal /* fX */, pDispParams->rgvarg[0].lVal /* fY */); break; case DISPID_WMPOCXEVENT_MOUSEMOVE: MouseMove(pDispParams->rgvarg[3].iVal /* nButton */, pDispParams->rgvarg[2].iVal /* nShiftState */, pDispParams->rgvarg[1].lVal /* fX */, pDispParams->rgvarg[0].lVal /* fY */); break; case DISPID_WMPOCXEVENT_MOUSEUP: MouseUp(pDispParams->rgvarg[3].iVal /* nButton */, pDispParams->rgvarg[2].iVal /* nShiftState */, pDispParams->rgvarg[1].lVal /* fX */, pDispParams->rgvarg[0].lVal /* fY */); break; } return( hr ); }
LRESULT WINAPI LoopFafaCheck( HWND w, UINT msg, WPARAM mw, LPARAM ml ) { HDC h ; switch( msg ) { case WM_SYSCOLORCHANGE: CreatePensBrushes() ; break ; case WM_CREATE : InitButtonWords( w ) ; if ( TstF( GetStyle(), FC_PRESELECT ) ) SetState( (WORD)FB_SELECTED ) ; break ; case WM_SETFONT: { HFONT f = (HFONT)mw ; SetFont(f) ; h = GetDC( w ) ; if ( TstF( GetStyle(), FC_BUTTONDRAW ) ) DrawFafaButton( w ,h ) ; else DrawFafaCheck( w ,h ) ; ReleaseDC( w, h ) ; break ; } case WM_CHANGEBITMAP: { HBITMAP f = (HBITMAP)ml ; WORD width = LOBYTE(mw) ; WORD height = HIBYTE(mw) ; LONG style = GetStyle() ; if (width == 255) { SIZE s; GetBitmapDimensionEx(f, &s); width = s.cx; height = s.cy; } SetBitmap(f) ; SetBitmapW(width) ; SetBitmapH(height) ; if (f) { /* Switch to Bitmap button */ style &= 0xffffff70 ; style |= (FC_BUTTONDRAW|FB_BITMAP) ; } else { /* Switch to Text button */ style &= 0xffffff70 ; /* default text style for check items */ if (style&FC_RADIO) style |= FC_CIR_DWN ; else style |= FC_REC_DWN ; } SetStyle(style) ; h = GetDC( w ) ; if ( TstF( GetStyle(), FC_BUTTONDRAW ) ) DrawFafaButton( w ,h) ; else DrawFafaCheck( w ,h) ; ReleaseDC( w, h ) ; break ; } case WM_GETFONT: return (LRESULT)GetFont() ; case WM_PAINT : if ( TstF( GetStyle(), FC_BUTTONDRAW ) ) RedrawFafaButton( w ) ; else RedrawFafaCheck( w ) ; break ; case WM_SETFOCUS: ChangeCheckFocus( w, 1 ) ; if ( GetAcc() && KeyIsDown( GetAcc() ) ) CheckKeyDown( w, 1 ) ; break ; case WM_KILLFOCUS: ChangeCheckFocus( w, 0 ) ; break ; case WM_ENABLE: if ( ( mw != 0 ) ^ IsDisabled() ) InvalidateRect( w, 0, 0 ) ; break ; case WM_RBUTTONDOWN: if ( ! TstF( GetStyle(), FC_RIGHTBUT ) ) break ; case WM_LBUTTONDOWN: SetFocus( w ) ; MouseDown( w ) ; break ; case WM_MOUSEMOVE: MouseMove( w, ml ) ; break ; case WM_RBUTTONUP: if ( ! TstF( GetStyle(), FC_RIGHTBUT ) ) break ; case WM_LBUTTONUP: MouseUp( w, ml ) ; break ; case FAFA_GETCHECK : #ifdef DEBUG_FAFA MyDebugMsg("State of check %x is %d\n",w,TstState(FB_SELECTED)); #endif return ( LONG ) TstState( FB_SELECTED ) ; case FAFA_SETCHECK : #ifdef DEBUG_FAFA MyDebugMsg("Setting Check %x to %d\n",w,mw) ; #endif if ( ChangeCheckSelect( w, ( mw != 0 ) ) && mw ) MakeRadioIteration( w ) ; break ; case WM_KEYDOWN: case WM_SYSKEYDOWN: case WM_KEYUP: case WM_SYSKEYUP: if ( mw == ' ' || KeyIsAcc( w, mw ) ) CheckKeyDown( w, IsMessDown( msg ) ) ; else return DefWindowProc( w, msg, mw, ml ) ; break; case WM_WHOAREYOU : return ( LONG ) FB_CHECK ; case WM_SETTEXT : InvalidateRect( w, 0, 0 ) ; default: return DefWindowProc( w, msg, mw, ml ) ; } return 0l ; }
bool NewProjectDialog::MessageReceived(EMListenerRepository* p_opSender, uint32 p_vMessage) { float vX; float vY; bool vButtonOne; bool vButtonTwo; bool vButtonThree; switch(p_vMessage) { case EM_DRAW: Draw(m_opView -> GetClippingRect()); return true; case EM_MOUSE_DOWN: m_opView -> GetMouse(vX, vY, vButtonOne, vButtonTwo, vButtonThree); MouseDown(vX, vY, vButtonOne, vButtonTwo, vButtonThree); return true; case EM_MOUSE_MOVED: m_opView -> GetMouse(vX, vY, vButtonOne, vButtonTwo, vButtonThree); MouseMoved(vX, vY, vButtonOne, vButtonTwo, vButtonThree); return true; case EM_MOUSE_UP: m_opView -> GetMouse(vX, vY, vButtonOne, vButtonTwo, vButtonThree); MouseUp(vX, vY); return true; case EM_QUIT_REQUESTED: case MESSAGE_BUTTON_CANCEL: if(m_opWindow -> Lock()) { m_opWindow -> Hide(); m_opWindow -> Unlock(); } case MESSAGE_VIDEO_FORMAT_CHANGED: { //;//cout_commented_out_4_release << "MESSAGE_VIDEO_FORMAT_CHANGED" << endl; if(m_opWindow -> Lock()) { int32 vIndex = m_oValueBoxVideoFormat.GetValueIndex(); // This is a hack, well live with it switch(vIndex) { case 0: m_opTextControlWidth -> SetText("320"); m_opTextControlHeight -> SetText("240"); m_opTextControlFps -> SetText("15"); break; case 1: m_opTextControlWidth -> SetText("720"); m_opTextControlHeight -> SetText("480"); m_opTextControlFps -> SetText("29.97"); break; case 2: m_opTextControlWidth -> SetText("720"); m_opTextControlHeight -> SetText("486"); m_opTextControlFps -> SetText("29.97"); break; case 3: m_opTextControlWidth -> SetText("640"); m_opTextControlHeight -> SetText("480"); m_opTextControlFps -> SetText("29.97"); break; case 4: m_opTextControlWidth -> SetText("352"); m_opTextControlHeight -> SetText("240"); m_opTextControlFps -> SetText("29.97"); break; case 5: m_opTextControlWidth -> SetText("720"); m_opTextControlHeight -> SetText("576"); m_opTextControlFps -> SetText("25"); break; case 6: m_opTextControlWidth -> SetText("768"); m_opTextControlHeight -> SetText("576"); m_opTextControlFps -> SetText("25"); break; case 7: m_opTextControlWidth -> SetText("352"); m_opTextControlHeight -> SetText("288"); m_opTextControlFps -> SetText("25"); break; } m_opWindow -> Unlock(); } return true; } case MESSAGE_BUTTON_OK: if(AllValuesOk()) { EMCommandRepository::Instance() -> ExecuteCommand(COMMAND_CREATE_PROJECT, this, NULL); if(m_opWindow -> Lock()) { m_opWindow -> Hide(); m_opWindow -> Unlock(); } } return true; // case EM_CREATE_PROJECT_REQUESTED: default: return false; } }
void View::MouseEvent( int what, int x, int y, unsigned int buttons ) { // Backwards, as added. lock(); for ( int i = CountChildren() - 1; i >= 0; i-- ) { View *view = ChildAt(i); if ( view->Frame().Contains( x,y ) ) { int nx = x - view->Frame().left; int ny = y - view->Frame().top; if ( GetWindow() != NULL ) GetWindow()->SetActiveView( view ); view->MouseEvent( what, nx, ny, buttons ); unlock(); return; } } unlock(); // Otherwise... switch( what ) { case MOUSE_DOWN: MouseDown( x, y, buttons ); break; case MOUSE_UP: if ( hasFlag( HAS_POPUPMENU ) == false ) { MouseUp( x, y, buttons ); break; } // Only the right mouse button. if ( m_buttons != RIGHT_MOUSE_BUTTON ) { MouseUp( x, y, buttons ); break; } if ( m_popupMenu == NULL ) m_popupMenu = Popup(); if ( m_popupMenu == NULL ) return; m_popupMenu->MoveTo( x - m_popupMenu->Frame().Width() / 2, y - m_popupMenu->Frame().Height() / 2 ); m_popupMenu->Show(); break; case MOUSE_MOVED: MouseMoved( x, y, buttons ); break; } m_buttons = buttons; }
void ChipSelecter::MouseDoubleClick(const IPoint &mouse_pos) { MouseDown(mouse_pos); }