void InputContext::TriggerMouseEvent(MouseEvent &mouse) { emit MouseEventReceived(&mouse); switch(mouse.eventType) { case MouseEvent::MouseMove: emit MouseMove(&mouse); break; case MouseEvent::MouseScroll: emit MouseScroll(&mouse); break; case MouseEvent::MousePressed: switch(mouse.button) { case MouseEvent::LeftButton: emit MouseLeftPressed(&mouse); break; case MouseEvent::RightButton: emit MouseRightPressed(&mouse); break; case MouseEvent::MiddleButton: emit MouseMiddlePressed(&mouse); break; ///\todo XButton1 and XButton2 support? } break; case MouseEvent::MouseReleased: switch(mouse.button) { case MouseEvent::LeftButton: emit MouseLeftReleased(&mouse); break; case MouseEvent::RightButton: emit MouseRightReleased(&mouse); break; case MouseEvent::MiddleButton: emit MouseMiddleReleased(&mouse); break; ///\todo XButton1 and XButton2 support? } break; case MouseEvent::MouseDoubleClicked: emit MouseDoubleClicked(&mouse); break; default: assert(false); break; } }
LRESULT CALLBACK EditorWindow::WindowsProcedure(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { int xPos, yPos; static HINSTANCE hInst = GetModuleHandle(NULL); HWND hBufferHwnd; char s[100]; IDevice* device; int cxClient, cyClient; EditorScene* scene = EditorScene::getInstance(); switch (msg) { case WM_CREATE: OnCreate(hInst, hwnd); break; case WM_SIZE: cxClient = LOWORD(lParam); cyClient = HIWORD(lParam); OnSize(cxClient, cyClient); break; case WM_LBUTTONDOWN: xPos = LOWORD(lParam); yPos = HIWORD(lParam); MouseLeftButtonDown(xPos, yPos); break; case WM_RBUTTONDOWN: xPos = LOWORD(lParam); yPos = HIWORD(lParam); MouseRightButtonDown(xPos, yPos); break; case WM_RBUTTONUP: xPos = LOWORD(lParam); yPos = HIWORD(lParam); MouseRightButtonUp(xPos, yPos); break; case WM_MOUSEMOVE: xPos = LOWORD(lParam); yPos = HIWORD(lParam); MouseMove(xPos, yPos); break; case WM_LBUTTONDBLCLK: xPos = LOWORD(lParam); yPos = HIWORD(lParam); MouseDoubleClicked(xPos, yPos); break; case WM_COMMAND: OnCommand(LOWORD(wParam), HIWORD(wParam), wParam, lParam); break; case WM_CTLCOLORSTATIC: SetTextColor((HDC)wParam, RGB(230,0,0)); // iTextColor is the RGB() color you want for the text SetBkColor((HDC)wParam, RGB(230, 0, 0)); // iBkColor is the color you want for the text background return (LRESULT)CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); } return 0; }
//------------------------------------------------------------------------------ // TimelineScene // TimelineScene::TimelineScene(QObject* parent) : QGraphicsScene(parent), m_border(BORDER_MARGIN), m_currentIdx(0), m_isRunning(false), m_parentWidget(0), //m_timelineClockForm(0), //m_timeMax(TIME_MAX), //m_timeMin(0), m_timeSpan(60000), // 1 minute m_timeStampLastProcessed(0), m_timeStampPause(0), m_xScaleConst(1.0) { setSceneRect(1, 1, 1, 1); // arbitrary value just to init will be changed when view is resized connect(this, SIGNAL(sceneRectChanged(const QRectF&)), this, SLOT(OnCalcSceneConst(const QRectF&))); // Timeline TimelineItem* item = new TimelineItem(); connect(this, SIGNAL(sceneRectChanged(const QRectF&)), item, SLOT(OnSceneRectChanged(const QRectF&))); connect(item, SIGNAL(MouseDoubleClicked()), this, SLOT(OnSceneScaleChangeRequest())); addItem(item); //// PlayPause Btn //m_playPauseBtn->setObjectName(QStringLiteral("PlayPauseBtn")); //m_playPauseBtn->setIcon(QIcon(QStringLiteral(":/MultiSpeaker/Resources/media-play-32.png"))); //m_playPauseBtn->setPopupMode(QToolButton::DelayedPopup); //m_playPauseBtn->setAutoRaise(true); ////m_playPauseBtn->setStyleSheet("background-color: transparent; border-color: black"); //connect(m_playPauseBtn, SIGNAL(clicked()), this, SLOT(OnPlayPauseClicked())); //// Reset Btn //m_resetBtn->setObjectName(QStringLiteral("ResetBtn")); //m_resetBtn->setIcon(QIcon(QStringLiteral(":/MultiSpeaker/Resources/undo.png"))); //m_resetBtn->setPopupMode(QToolButton::DelayedPopup); //m_resetBtn->setAutoRaise(true); ////m_resetBtn->setStyleSheet("background-color: transparent"); ////m_resetBtn->setStyleSheet("border-color: black"); //m_resetBtn->hide(); //connect(m_resetBtn, SIGNAL(clicked()), this, SLOT(OnResetClicked())); //QGraphicsProxyWidget* clockProxy = addWidget(m_clock); //QGraphicsProxyWidget* playPauseProxy = addWidget(m_playPauseBtn); //QGraphicsProxyWidget* resetProxy = addWidget(m_resetBtn); //QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(); //layout->addItem(playPauseProxy); //layout->addItem(clockProxy); //layout->addItem(resetProxy); //m_timelineClockForm = new QGraphicsWidget; //m_timelineClockForm->setLayout(layout); //addItem(m_timelineClockForm); }
bool nuiMatrixView::MouseClicked(nuiSize X, nuiSize Y, nglMouseInfo::Flags Button) { //*********************************************************** // // LEFT BUTTON // //*********************************************************** if (Button & nglMouseInfo::ButtonLeft) { uint col,row; // you did'nt clicked in a cell if (!GetCellCoord(X, Y, col, row)) { // it may be a "deselect all" action if (!IsKeyDown (mGrabMouseKey)) { DeselectAll(); Invalidate(); } return false; } // retrieve the targeted cell nuiWidget* pWidget = nuiGrid::GetCell(col, row); // if the cell is disabled, don't do anything if (!pWidget || !pWidget->IsEnabled()) { // it may be a "deselect all" action if (!IsKeyDown (mGrabMouseKey)) { DeselectAll(); Invalidate(); } return false; } // if the cell is not a matrixview item, don't do anything nuiMatrixViewItem* item = dynamic_cast<nuiMatrixViewItem*>(pWidget); if (!item) { // it may be a "deselect all" action if (!IsKeyDown (mGrabMouseKey)) { DeselectAll(); Invalidate(); } return false; } mClickedItem = item; // if the item is supposed to be hidden, make it silent if (!mClickedItem->IsVisible()) { // it may be a "deselect all" action if (!IsKeyDown (mGrabMouseKey)) { DeselectAll(); Invalidate(); } } // double click <=> rename the targeted cell (or the selected cells) if (Button & nglMouseInfo::ButtonDoubleClick) { bool res = MouseDoubleClicked(col, row); return res; } mClicked=true; Grab (); mClickPos[0] = X; mClickPos[1] = Y; // selection key is pressed if (IsKeyDown (mGrabMouseKey)) { bool res = Selected(col, row); Invalidate(); return res; } // is the targeted cell selected already? std::map<nuiMatrixViewItem*, bool>::iterator it = mSelectedItems.find(mClickedItem); // no ==> deselect all, select this single cell and prepare it to be modified if (it == mSelectedItems.end()) { DeselectAll(); Selected(col, row); mCanChange = true; } // yes => do nothing but preparing the cell to be modified else mCanChange = true; } //*********************************************************** // // WHEEL UP AND DOWN // //*********************************************************** if ((Button & nglMouseInfo::ButtonWheelUp) || (Button & nglMouseInfo::ButtonWheelDown)) { uint col,row; if (!GetCellCoord(X, Y, col, row)) return false; // retrieve the targeted cell nuiWidget* pWidget = nuiGrid::GetCell(col, row); // if the cell is disabled, don't do anything if (!pWidget || !pWidget->IsEnabled()) return false; // if the cell is not a matrixview item, don't do anything nuiMatrixViewItem* item = dynamic_cast<nuiMatrixViewItem*>(pWidget); if (!item) return false; // one single selected cell or more? uint nbSelectedCells = mSelectedItems.size(); if (nbSelectedCells <= 1) { DeselectAll(); Selected(col, row); } int32 delta; if (IsKeyDown(mFineSensitivityKey)) { if (Button & nglMouseInfo::ButtonWheelUp) delta = 1; else delta = -1; } else { if (Button & nglMouseInfo::ButtonWheelUp) delta = 5; else delta = -5; } double valueOfReference = item->GetValue(); valueOfReference += delta; // apply value modification on all selected items if (IsKeyDown(mRelativeKey)) { std::map<nuiMatrixViewItem*, bool>::iterator it; for (it = mSelectedItems.begin(); it != mSelectedItems.end(); ++it) { nuiMatrixViewItem* item = it->first; item->SetRelativeValue(delta); } } else { std::map<nuiMatrixViewItem*, bool>::iterator it; for (it = mSelectedItems.begin(); it != mSelectedItems.end(); ++it) { nuiMatrixViewItem* item = it->first; item->SetValue(valueOfReference); } } InteractiveValueChanged(); nglTimer::Start(false, true); } Invalidate(); return true; }
void SplitterHandle::mouseDoubleClickEvent( QMouseEvent *event ) { if (event->button() == Qt::LeftButton) emit MouseDoubleClicked(); QSplitterHandle::mouseDoubleClickEvent(event); }
QSplitterHandle* Splitter::createHandle() { SplitterHandle *splitterHandle = new SplitterHandle(orientation(), this); connect(splitterHandle, SIGNAL(MouseDoubleClicked()), SLOT(MouseDoubleClicked())); return splitterHandle; }