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

virtual void OglGui::WindowView2DWithRect::MouseFunc ( INT  msg,
INT  but,
INT  state,
INT  x,
INT  y 
) [inline, virtual]

Reimplemented from OglGui::StaticText.

Definition at line 114 of file WindowView2DWithRect.h.

References mDragHX, mDragHY, mDragLX, mDragLY, mIsDragging, mListener, OglGui::OglWindow::mOglWnd, OglGui::Window::MouseFunc(), and OglGui::WindowView2DWithRectListener::OnRectangleSelect().

00115     {
00116         Window::MouseFunc(msg, but, state, x, y);
00117 
00118         int w = mOglWnd->width;
00119         int h = mOglWnd->height;
00120 
00121 
00122         if (msg == oglMouseDown && but == oglLeftButton) {
00123             if (mIsDragging) {
00124                 // execute if click within box, cancel if outside:
00125                 if (mDragLX <= x && x <= mDragHX && mDragLY <= y && y <= mDragHY) {
00126                     float sx, sy, sw, sh;
00127                     sx = mDragLX;
00128                     sy = mDragLY;
00129                     sw = mDragHX - mDragLX;
00130                     sh = mDragHY - mDragLY;
00131                     if (sw > 1 && sh > 1) {
00132                         // coordinates based on upper-left = 0,0 instead of lower-left = 0,0
00133 //                        ILOG_DEBUG(" SELECT: " << sx / w << ", " << 1.0 - (sy/h + sh/h) << ", " << sw/w << ", " <<sh/h);
00134                         if (mListener)
00135                         mListener->OnRectangleSelect(sx/w, 1.0 - (sy/h + sh/h), sw/w, sh/h);
00136                     }
00137                 }
00138                 mIsDragging = false;
00139                 return;
00140             } else {
00141                 mDragLX = mDragHX = x;
00142                 mDragLY = mDragHY = y;
00143                 mIsDragging = true;
00144             }
00145         }
00146 
00147         if (msg == oglMouseMove && mIsDragging) {
00148             if (x < mDragLX) mDragLX = x;
00149             if (x > mDragHX) mDragHX = x;
00150             if (y < mDragLY) mDragLY = y;
00151             if (y > mDragHY) mDragHY = y;
00152 
00153             if (mDragLX < 0) mDragLX = 0;
00154             if (mDragLY < 0) mDragLY = 0;
00155             if (mDragHX > w) mDragHX = w;
00156             if (mDragHY > h) mDragHY = h;
00157         }
00158     }

Here is the call graph for this function:


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