BOOL LLMediaCtrl::handleHover( S32 x, S32 y, MASK mask ) { if (LLPanel::handleHover(x, y, mask)) return TRUE; convertInputCoords(x, y); if (mMediaSource) { mMediaSource->mouseMove(x, y, mask); gViewerWindow->setCursor(mMediaSource->getLastSetCursor()); } // TODO: Is this the right way to handle hover text changes driven by the plugin? if(mHoverTextChanged) { mHoverTextChanged = false; handleToolTip(x, y, mask); } return TRUE; }
/** Handles mouse events on the given item list * * This function is used in sorted or unsorted item list according to * the mCurrentSortPolicy value. * * \param px, py The mouse position * \param event The mouse event * \param vItemList The item list we handle events for * * \return \c true if the event is used * */ bool RainbruRPG::OgreGui::MultiColumnList:: injectMouse( unsigned int px, unsigned int py, const MouseEvent& event, tMultiColumnListItemList vItemList ){ // Compute the position of mouse for moved objects (items) int devMouseY = py + abs(mVScrollBar->getValue()); int devMouseX = px - mHScrollBar->getValue(); // Handle popupmenu if (mPopupMenu->isVisible()){ if (mPopupMenu->injectMouse(px, py, event)){ return true; } else if (event.isLeftMouseButtonPressed()|| event.isRightMouseButtonPressed()){ if (!mPopupMenu->in(px, py)){ mPopupMenu->hide(); return true; } } else{ if (mouseOveredItem ) mouseOveredItem->setMouseOver(false); return true; } } if (event.isRightMouseButtonPressed() == true){ LOGI(_("Showing PopupMenu")); mPopupMenu->move( px, py); mPopupMenu->show(); } // Disabling movingcolumn if no left button down if (!event.isLeftMouseButtonPressed()){ if (mMovingColumn != -1){ // TRANSLATORS: Do not translate mMovingColumn here, it is a // variable name. LOGI(_("mMovingColumn is now -1")); mMovingColumn = -1; } } // Move the ToolTip, even outside the Widget if it is in transition if ( mToolTip->inTransition() ) mToolTip->move( px + 25, py + 30 ); bool LMB=event.isLeftMouseButtonPressed(); // Resizing column if (mResizedColumnIndex!=-1){ if (event.isLeftMouseButtonPressed()){ mGui->setFocusedWidget(this); mColumnList[mResizedColumnIndex] ->resize((px - mResiedColumnRightPos) + mMouseXDev); computeLastColumnRight(); handleScrollBarsVisibility(); makeCorners(); // To recompute VScrollBar's height return true; } else{ mResizedColumnIndex=-1; mMouseXDev=0; mGui->disableFocusedWidget(); return true; } } // Handling column headers events tMultiColumnListColumnList::iterator colIter; int colLeft, colRight; unsigned int colIndex=0; if (devMouseX > corners.left && devMouseX < corners.right ){ if (py > corners.top && py < corners.top + mHeaderHeight ){ colLeft=corners.left; for (colIter=mColumnList.begin(); colIter!=mColumnList.end(); colIter++){ if ((*colIter)->isVisible()){ colRight=colLeft+(*colIter)->getWidth(); // Resizing column if ( (devMouseX > colRight - COLUMN_RESIZE_SENSITIVITY) && (devMouseX < colRight + COLUMN_RESIZE_SENSITIVITY)){ if (LMB){ if (mResizedColumnIndex==-1 && mMovingColumn==-1){ mGui->setFocusedWidget(this); mResizedColumnIndex=colIndex; mMouseXDev = colRight - px; mResiedColumnRightPos = colLeft; return true; } } else{ mResizedColumnIndex=-1; return false; } } else if ((devMouseX > colLeft + COLUMN_RESIZE_SENSITIVITY) && devMouseX < colRight - COLUMN_RESIZE_SENSITIVITY ){ // We are in column header, select it only if no column are moving if (mMovingColumn == -1){ (*colIter)->setSelected(true); } if (mouseOveredItem ) mouseOveredItem->setMouseOver(false); if (selectedColumn && selectedColumn!=(*colIter) ){ selectedColumn->setSelected(false); } selectedColumn=(*colIter); if (event.isLeftButtonClick()){ mToolTip->hide(); selectedColumn->toggleSort(); } else if (event.isLeftButtonLongClick()){ // Moving column mToolTip->hide(); // Moving column only if no column is moving if (mMovingColumn == -1){ mMovingColumn=colIndex; mGui->setFocusedWidget(this); } handleMovingColumn(devMouseX, py, colLeft, colRight, colIndex); } else if (!LMB){ handleToolTip(px, py); mMovingColumn=-1; mGui->disableFocusedWidget(); } return true; } colLeft=colRight; } // Is column visible? colIndex++; } } else{ mToolTip->hide(); // An item should be selected int a=devMouseY - (corners.top + mHeaderHeight); int itemIdx=(int)a/20; if ( itemIdx < vItemList.size() ){ if (event.isLeftButtonClick()){ // Select item if (selectedItem && selectedItem!=vItemList[itemIdx]){ selectedItem->setSelected(false); } selectedItem=vItemList[itemIdx]; selectedItem->toggleSelection(); // To get isOneItemSelected() return false if item is deselected if (!selectedItem->isSelected()) selectedItem = NULL; sigSelectionChanged.emit(); // de-mouseover item if (mouseOveredItem == selectedItem && selectedItem->isSelected()){ mouseOveredItem->setMouseOver(false); mouseOveredItem=NULL; } return true; } else{ // Mouse over item vItemList[itemIdx]->setMouseOver(true); if (selectedColumn) selectedColumn->setSelected(false); if (mouseOveredItem && mouseOveredItem!=vItemList[itemIdx]){ mouseOveredItem->setMouseOver(false); } mouseOveredItem=vItemList[itemIdx]; } return true; } } } if (selectedColumn) selectedColumn->setSelected(false); if (mouseOveredItem ) mouseOveredItem->setMouseOver(false); mToolTip->hide(); // mMovingColumn=-1; return false; }