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

virtual void OglGui::TextField::DrawTextWithCursor (  )  [inline, virtual]

Definition at line 79 of file TextField.h.

References GetSelectionLeftRight(), OglGui::OglWindow::mOglWnd, and OglGui::StaticText::mText.

Referenced by DisplayFunc().

00080     {
00081         glColor3d(0,0,0);
00082  
00083         // draw the string content while storing rasterpos of the selection
00084         int left,right;
00085         GetSelectionLeftRight(left, right);
00086         double posstart[4];
00087         double pos[4];
00088         glRasterPos2d(0, 0);
00089         double xLeft,xRight;
00090         glGetDoublev(GL_CURRENT_RASTER_POSITION, posstart);
00091 
00092         glRasterPos2d(4, 6);
00093         // before selection
00094         oglSys.PrintFont(1, (char*)mText.substr(0,left).c_str());
00095         glGetDoublev(GL_CURRENT_RASTER_POSITION, pos);
00096         xLeft = pos[0] - posstart[0]; // left position of selection / caret
00097          // in selection
00098         oglSys.PrintFont(1, (char*)mText.substr(left,right-left).c_str());
00099         glGetDoublev(GL_CURRENT_RASTER_POSITION, pos);
00100         xRight = pos[0] - posstart[0]; // right position of selection / caret
00101          // after selection
00102         oglSys.PrintFont(1, (char*) mText.substr(right).c_str());
00103 
00104         // draw the caret / the selection
00105         if (xLeft==xRight)
00106         {
00107             xLeft--;
00108             xRight++;
00109         }
00110         glColor3d(1,1,1);
00111         glEnable(GL_BLEND);
00112         glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);
00113         glBegin(GL_QUADS);
00114         glVertex2d(xLeft, 1);
00115         glVertex2d(xLeft, mOglWnd->height - 1);
00116         glVertex2d(xRight, mOglWnd->height - 1);
00117         glVertex2d(xRight, 1);
00118         glEnd();
00119         glDisable(GL_BLEND);
00120     }

Here is the call graph for this function:


Generated on Thu Jan 13 09:27:07 2011 for ImpalaSrc by  doxygen 1.5.1