Home || Visual Search || Applications || Architecture || Important Messages || OGL || Src

virtual void OglGui::Carousel3D::MouseFunc ( int  msg,
int  btn,
int  state,
int  x,
int  y 
) [inline, virtual]

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.

Definition at line 266 of file Carousel3D.h.

References IndexOf(), mCenterRotY, mDragged, mDragPixThreshold, mDragStarted, mFlowDragDiff, mFlowDragLastX, mFlowDragStartTime, mFlowDragStartX, mFlowing, mFlowSpeed, mFlowStartRotY, mIsRotatingTo, mListener, mListenerData, OglGui::OglWindow::mOglWnd, OglGui::Window::MouseFunc(), OglGui::Carousel3DListener::OnCarousel3D(), and OglGui::OglWindow::SetAlwaysDraw().

00267     {
00268         Window::MouseFunc(msg, btn, state, x, y);
00269 
00270         if (msg == oglMouseDown && btn == oglLeftButton)
00271         {
00272             if (mDragged = ((mFlowing||mIsRotatingTo) ? true : false))
00273                 SetAlwaysDraw(mFlowing = mIsRotatingTo = false);
00274             //mFlowDragStartTime  = clock();
00275             mFlowDragStartTime  = OglClock();
00276             mDragStarted        = true;
00277             mFlowDragDiff       = 0;
00278             mFlowDragStartX     = x;
00279             mFlowDragLastX      = x;
00280             mFlowStartRotY      = mCenterRotY;
00281         }
00282         if (msg == oglMouseMove && mDragStarted)
00283         {
00284             mFlowDragDiff  = mFlowDragLastX - x;
00285             mCenterRotY   -= mFlowDragDiff / 10.f;
00286             mFlowDragLastX = x;
00287             if (fabs(mFlowStartRotY - mCenterRotY) > mDragPixThreshold)
00288                 mDragged = true;
00289         }
00290         if (msg == oglMouseUp && btn == oglLeftButton)
00291         {
00292             OGLVIEW3D*    v;
00293             if (!mDragged && mListener && (v = view3DSys.FindView(mOglWnd,x,y)))
00294                 mListener->OnCarousel3D(this, IndexOf(v), mListenerData);
00295             if (mDragged)
00296             {
00297                 //double t = (clock() - mFlowDragStartTime) / (CLOCKS_PER_SEC*1.);
00298                 double t = (OglClock() - mFlowDragStartTime);
00299                 if (t<0.1) t = 0.1;
00300                 mFlowSpeed = ((x-mFlowDragStartX)/10.f) / t;
00301                 if (abs(mFlowDragDiff) < 5)
00302                     mFlowSpeed = 0;
00303                 SetAlwaysDraw(mFlowing = (fabs(mFlowSpeed) > 30));
00304                 mFlowStartRotY     = mCenterRotY;
00305                 //mFlowDragStartTime = clock();
00306                 mFlowDragStartTime = OglClock();
00307             }
00308             mDragStarted = mDragged = false;
00309         }
00310     }

Here is the call graph for this function:


Generated on Thu Jan 13 09:26:12 2011 for ImpalaSrc by  doxygen 1.5.1