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 Impala::Visualization::ImagesWindow. Definition at line 232 of file ImageStrip.h. References OglGui::ScrollBar::ChangePos(), OglGui::ImagesListener::ImageSelectionEvent(), mAllowDragging, mDragImId, mDragInitialized, mDragInsertId, mDragX, mFirstVis, Impala::Visualization::ImagesWindow::mImagesListener, Impala::Visualization::ImagesWindow::mImagesListenerData, mImSelected, mImSteps, mNrViews, OglGui::OglWindow::mOglWnd, OglGui::Window::MouseFunc(), Impala::Visualization::ImagesWindow::MoveImageTo(), mPropagateScrolling, mScrollBar, Impala::Visualization::ImagesWindow::mViewWidth, Redraw(), ReshapeFunc(), SetImageSelected(), OglGui::RepeatTimer::StartRepeatTime(), and Impala::Visualization::ImagesWindow::UpdateViewWithImage(). 00233 { 00234 Window::MouseFunc(msg, but, state, x, y); // skip ImagesWindow 00235 00236 if (msg == oglMouseWheelUp) 00237 mScrollBar->ChangePos( (state&oglShift) ? -5 : -1); 00238 if (msg == oglMouseWheelDown) 00239 mScrollBar->ChangePos( (state&oglShift) ? 5 : 1); 00240 00241 // todo : use ViewListener 00242 if (mImagesListener && (msg==oglMouseDown) && (but==oglLeftButton)) 00243 { 00244 View* view = FindView(x, y); 00245 if (view) 00246 { 00247 int imIdx = mFirstVis + GetViewIdx( view ); 00248 SetImageSelected(imIdx); 00249 mImagesListener->ImageSelectionEvent(this, imIdx, 00250 mImagesListenerData); 00251 } 00252 } 00253 00254 if (mAllowDragging && msg==oglMouseDown && but==oglRightButton) 00255 { 00256 View* dragView; 00257 if (dragView = FindView(x, y)) 00258 { 00259 mDragX = x; 00260 mDragImId = mFirstVis + GetViewIdx(dragView); 00261 if (!mDragInitialized) 00262 { 00263 mDragInitialized = true; 00264 ReshapeFunc(mOglWnd->width, mOglWnd->height); 00265 } 00266 UpdateViewWithImage(mNrViews - 1, mDragImId); 00267 StartRepeatTime(); 00268 oglSys.SetAlwaysDraw(mOglWnd, 1); 00269 } 00270 } 00271 if (mAllowDragging && msg==oglMouseMove && (state & oglRightButton)) 00272 { 00273 mDragX = x; 00274 if (mDragX >= mOglWnd->width - mViewWidth/4) 00275 { 00276 mDragX = mOglWnd->width - mViewWidth/4; 00277 mPropagateScrolling = x > mOglWnd->width ? mImSteps : 1; 00278 } 00279 else if (mDragX <= mViewWidth/4) 00280 { 00281 mDragX = mViewWidth/4; 00282 mPropagateScrolling = x < 0 ? -mImSteps : -1; 00283 } 00284 else 00285 mPropagateScrolling = 0; 00286 } 00287 if (msg==oglMouseUp && but==oglRightButton && mDragImId != -1) 00288 { 00289 MoveImageTo(mDragImId, mDragInsertId); 00290 if (mDragImId == mImSelected) 00291 mImSelected = mDragImId < mDragInsertId ? mDragInsertId-1 00292 : mDragInsertId; 00293 Redraw(); 00294 mDragImId = -1; 00295 oglSys.SetAlwaysDraw(mOglWnd, 0); 00296 } 00297 }
Here is the call graph for this function:
|