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 253 of file ImageSet.h. References OglGui::ScrollBar::ChangePos(), OglGui::ImagesListener::ImageSelectionEvent(), mAllowDragging, mDragImId, mDragInsertId, mDragViewNr, mDragX, mDragY, mFirstVisY, Impala::Visualization::ImagesWindow::mImages, Impala::Visualization::ImagesWindow::mImagesListener, Impala::Visualization::ImagesWindow::mImagesListenerData, mImSelected, mImSteps, mNrVisibleX, mNrVisibleY, OglGui::OglWindow::mOglWnd, OglGui::Window::MouseFunc(), Impala::Visualization::ImagesWindow::MoveImageTo(), mPropagateScrolling, mScrollBar, Impala::Visualization::ImagesWindow::mViewHeight, Redraw(), SetImageSelected(), OglGui::RepeatTimer::StartRepeatTime(), and Impala::Visualization::ImagesWindow::UpdateViewWithImage(). 00254 { 00255 Window::MouseFunc(msg, but, state, x, y); // skip ImagesWindow 00256 00257 if (msg == oglMouseWheelUp) 00258 mScrollBar->ChangePos((state&oglShift) ? -5 : -1); 00259 if (msg == oglMouseWheelDown) 00260 mScrollBar->ChangePos((state&oglShift) ? 5 : 1); 00261 00262 // todo : use ViewListener 00263 if (mImagesListener && (msg==oglMouseDown) && (but==oglLeftButton)) 00264 { 00265 View* view = FindView(x, y); 00266 if (view) 00267 { 00268 int imIdx = mFirstVisY * mNrVisibleX + GetViewIdx(view); 00269 SetImageSelected(imIdx); 00270 int orgIdx = mImages[imIdx]->Idx(); 00271 mImagesListener->ImageSelectionEvent(this, orgIdx, 00272 mImagesListenerData); 00273 } 00274 } 00275 00276 if (mAllowDragging && msg==oglMouseDown && but==oglRightButton) 00277 { 00278 View* dragView = FindView(x, y); 00279 if (dragView) 00280 { 00281 mDragX = x; 00282 mDragY = y; 00283 mDragImId = mFirstVisY * mNrVisibleX + GetViewIdx(dragView); 00284 mDragViewNr = NrViewers(); 00285 if (mDragViewNr > mNrVisibleX * mNrVisibleY) 00286 mDragViewNr = mNrVisibleX * mNrVisibleY; 00287 UpdateViewWithImage(mDragViewNr, mDragImId); 00288 StartRepeatTime(); 00289 oglSys.SetAlwaysDraw(mOglWnd, 1); 00290 } 00291 } 00292 if (mAllowDragging && msg==oglMouseMove && (state & oglRightButton)) 00293 { 00294 mDragX = x; 00295 mDragY = y; 00296 00297 if (mDragY >= mOglWnd->height - mViewHeight/4) 00298 { 00299 mDragY = mOglWnd->height - mViewHeight/4; 00300 mPropagateScrolling = y > mOglWnd->height ? -mImSteps : -1; 00301 } 00302 else if (mDragY <= mViewHeight/4) 00303 { 00304 mDragY = mViewHeight/4; 00305 mPropagateScrolling = y < 0 ? mImSteps : 1; 00306 } 00307 else 00308 mPropagateScrolling = 0; 00309 00310 } 00311 if (msg==oglMouseUp && but==oglRightButton && mDragImId != -1) 00312 { 00313 if (mDragInsertId != -1) 00314 { 00315 MoveImageTo(mDragImId, mDragInsertId); 00316 if (mDragImId == mImSelected) 00317 mImSelected = mDragImId < mDragInsertId ? mDragInsertId-1 00318 : mDragInsertId; 00319 } 00320 mDragImId = -1; 00321 SetViewVisible(mDragViewNr, false); 00322 mDragViewNr = -1; 00323 Redraw(); 00324 oglSys.SetAlwaysDraw(mOglWnd, 0); 00325 } 00326 00327 }
Here is the call graph for this function:
|