This function is called by the event handling system everytime the user has moved or clicked the mouse. So if you want a window which reacts to the mouse in a specific way, you can inherit a class from Window. Another method to implement mouse behaviour is to use a window listener (in this case you have to inherit a class from WindowListener and attach it to this window, see WindowListener for more details) Reimplemented from OglGui::Window. Reimplemented in Impala::Visualization::SimilarityTimeLine. Definition at line 256 of file ZoomShiftRuler.h. References CheckPropagateScrolling(), Current(), mClickedUnit, mClickedX, OglGui::DocDimensions::mDocW, OglGui::DocDimensions::mDocX, mDragging, mLastX, mMaxDocWidth, mMinDocWidth, mMouseState, OglGui::OglWindow::mOglWnd, OglGui::Window::MouseFunc(), mPropagateScrolling, mScaling, Pixel2Unit(), SetDocXClamped(), OglGui::RepeatTimer::StartRepeatTime(), and Unit2Pixel(). Referenced by DisplayFunc(), and Impala::Visualization::SimilarityTimeLine::MouseFunc(). 00257 { 00258 Window::MouseFunc(msg,btn,state,x,y); 00259 00260 if (state & oglAlt) return; 00261 00262 bool shift = (state & oglShift) != 0; 00263 bool control = (state & oglControl) != 0; 00264 00265 mMouseState = state; 00266 00267 if ((msg==oglMouseDown && btn==oglLeftButton) || (!mScaling && control)) 00268 { 00269 StartRepeatTime(); 00270 CheckPropagateScrolling(x); 00271 mClickedUnit = Pixel2Unit(x); 00272 if (!(shift||control)) 00273 Current(mClickedUnit); 00274 mLastX = mClickedX = x; 00275 mDragging = true; 00276 if (control) 00277 mScaling = true; 00278 } 00279 00280 if (mScaling && !control) 00281 mScaling = false; 00282 00283 if (msg == oglMouseUp) 00284 { 00285 mPropagateScrolling = mDragging = mScaling = false; 00286 oglSys.SetAlwaysDraw(mOglWnd, 0); 00287 } 00288 00289 if (msg == oglMouseMove && mDragging) 00290 { 00291 CheckPropagateScrolling(x); 00292 int dx = x - mLastX; 00293 if (mScaling) 00294 { 00295 int oldDocW = mDocW; 00296 mDocW *= (1 + .02*dx); 00297 if (oldDocW > 0 && mDocW<0) // Overflow 00298 mDocW = oldDocW; 00299 00300 if (mDocW < mMinDocWidth) 00301 mDocW = mMinDocWidth; 00302 if (mDocW > mMaxDocWidth) 00303 mDocW = mMaxDocWidth; 00304 00305 long clickedPixelNow = Unit2Pixel(mClickedUnit); 00306 mDocX += mLastX - clickedPixelNow; 00307 mDocX -= mLastX - mClickedX; 00308 } 00309 else if (shift) 00310 SetDocXClamped(mDocX+dx); 00311 else 00312 Current(Pixel2Unit(x)); 00313 00314 mLastX = x; 00315 } 00316 }
Here is the call graph for this function:
|