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

virtual void OglGui::TextEdit::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 1024 of file TextEdit.h.

References ClampDocY(), ComputeCaretPosition(), FindInsertionIndexAtWidth(), FindLineAtY(), GetLineAtIndex(), OglGui::OglWindow::H(), mCaret, mCaretY, OglGui::DocDimensions::mDocX, OglGui::DocDimensions::mDocY, mHorizontalScrollBar, mLastMouseX, mLastMouseY, mLineH, mMark, OglGui::OglWindow::mOglWnd, OglGui::Window::MouseFunc(), mPropagateScrollingX, mPropagateScrollingY, mUpDownPos, mVerticalScrollBar, OglGui::RepeatTimer::StartRepeatTime(), and OglGui::OglWindow::W().

Referenced by HandleScrollBarsOnDisplay().

01025     {
01026         if (msg == oglMouseDown && btn == oglLeftButton && !(state&oglControl))
01027         {
01028             string  str;
01029             int     lineInd = FindLineAtY(y, mCaretY);
01030 
01031             GetLineAtIndex(&str, lineInd);
01032             mCaret = lineInd + FindInsertionIndexAtWidth(&str, -mDocX+x);
01033             if (!(state & oglShift))
01034                 mMark = mCaret;
01035 
01036             StartRepeatTime();
01037             oglSys.SetAlwaysDraw(mOglWnd, 1);
01038             mLastMouseX = x;
01039             mLastMouseY = y;
01040             mUpDownPos = mCaret - lineInd;
01041         }
01042         if (msg == oglMouseMove && (state & oglLeftButton))
01043         {
01044             string  str;
01045             int     lineInd = FindLineAtY(y, mCaretY);
01046 
01047             GetLineAtIndex(&str, lineInd);
01048             mCaret = lineInd + FindInsertionIndexAtWidth(&str, -mDocX+x);
01049 
01050             mPropagateScrollingX = mPropagateScrollingY = 0;
01051 
01052             int minY = mHorizontalScrollBar ? mHorizontalScrollBar->H() : 0;
01053             if (y < minY)
01054                 mPropagateScrollingY = 4 - (y-minY)/2;
01055             else if(y > H())
01056                 mPropagateScrollingY = -4 - (y - H())/2;
01057 
01058             int maxW = W() - (mVerticalScrollBar ? mVerticalScrollBar->W() : 0); 
01059             if (x < 0)
01060                 mPropagateScrollingX = 4 - x/2;
01061             else if(x > maxW)
01062                 mPropagateScrollingX = -4 - (x - maxW)/2;
01063 
01064             mLastMouseX = x;
01065             mLastMouseY = y;
01066             mUpDownPos = mCaret - lineInd;
01067         }
01068 
01069         if (msg == oglMouseUp && btn == oglLeftButton)
01070         {
01071             mPropagateScrollingY = mPropagateScrollingX = 0;
01072             oglSys.SetAlwaysDraw(mOglWnd, 0);
01073         }
01074 
01075         if (msg == oglMouseWheelUp || msg == oglMouseWheelDown)
01076         {
01077             mDocY += (msg == oglMouseWheelUp ? -mLineH : mLineH);
01078             ClampDocY();
01079         }
01080 
01081         ComputeCaretPosition();
01082         Window::MouseFunc(msg, btn, state, x, y);
01083     }

Here is the call graph for this function:


Generated on Fri Mar 19 12:08:15 2010 for ImpalaSrc by  doxygen 1.5.1