OpenGLCtrlSlider Class Reference

#include <TAPsOpenGLCtrlSlider.hpp>

Inheritance diagram for OpenGLCtrlSlider:

Inheritance graph
[legend]
Collaboration diagram for OpenGLCtrlSlider:

Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual void Default ()
virtual void Draw ()
 OpenGLCtrlSlider ()
virtual ~OpenGLCtrlSlider ()

Protected Member Functions

void DrawMarker ()


Detailed Description

Slider: Move left<->right or top<->bottom

Definition at line 21 of file TAPsOpenGLCtrlSlider.hpp.


Constructor & Destructor Documentation

BEGIN_NAMESPACE_TAPs__OpenGL OpenGLCtrlSlider::OpenGLCtrlSlider (  ) 

Definition at line 19 of file TAPsOpenGLCtrlSlider.cpp.

00020     : OpenGLCtrl()
00021 {
00022     Default();
00023 }

OpenGLCtrlSlider::~OpenGLCtrlSlider (  )  [virtual]

Definition at line 25 of file TAPsOpenGLCtrlSlider.cpp.

00026 {}


Member Function Documentation

void OpenGLCtrlSlider::Default (  )  [virtual]

Reimplemented from OpenGLCtrl.

Definition at line 33 of file TAPsOpenGLCtrlSlider.cpp.

00034 {
00035     SetSize( 100, 14 );
00036     SetText( "Slider" );
00037     m_BorderSize = 1;
00038     //
00039     m_ForegroundColor[0] = 1.0;
00040     m_ForegroundColor[1] = 1.0;
00041     m_ForegroundColor[2] = 1.0;
00042     m_ForegroundColor[3] = 0.90;
00043     //
00044     m_BackgroundColor[0] = 0.25;
00045     m_BackgroundColor[1] = 0.25;
00046     m_BackgroundColor[2] = 0.25;
00047     m_BackgroundColor[3] = 0.90;
00048 }

void OpenGLCtrlSlider::Draw (  )  [virtual]

The start (x,y) is the left-bottom point of a bounding box. A subclass that overrides this method should use start (x,y) as drawing w/o border. Another words, the border is extended from the start (x,y).

Hence, in order to use border as the starting point for drawing, the code below can be used.

SetStartPos( GetBorder() + x, GetBorder() + y );

Where (x,y) is the starting position.

Implements OpenGLCtrl.

Definition at line 55 of file TAPsOpenGLCtrlSlider.cpp.

00056 {
00057     //---------------------------------------------------------------
00058     // Draw Background with Border
00059     {
00060         int oneThirdHeight = m_DrawSizeXY[1] / 3;
00061         int mx = m_xyLowerLeftPt[0];
00062         int my = m_xyLowerLeftPt[1] + oneThirdHeight;
00063         int X = m_xyLowerLeftPt[0] + m_DrawSizeXY[0];
00064         int Y = my + oneThirdHeight;
00065         glBegin( GL_QUADS );
00066             // Draw Background
00067             glColor4fv( m_BackgroundColor );
00068             glVertex2f( mx, my );
00069             glVertex2f(  X, my );
00070             glVertex2f(  X,  Y );
00071             glVertex2f( mx,  Y );
00072             //
00073             /*
00074             glColor4fv( g_BorderColor );
00075             // Draw Left Border
00076             int LX = m_xyLowerLeftPt[0] - m_BorderSize;
00077             int BY = m_xyLowerLeftPt[1] - m_BorderSize;
00078             glVertex2f( LX,  m_xyLowerLeftPt[1] );
00079             glVertex2f( m_xyLowerLeftPt[0], m_xyLowerLeftPt[1] );
00080             glVertex2f( m_xyLowerLeftPt[0], Y );
00081             glVertex2f( LX,  Y );
00082             // Draw Right Border
00083             int RX = X + m_BorderSize;
00084             int TY = Y + m_BorderSize;
00085             glVertex2f(  X, m_xyLowerLeftPt[1] );
00086             glVertex2f( RX, m_xyLowerLeftPt[1] );
00087             glVertex2f( RX,  Y );
00088             glVertex2f(  X,  Y );
00089             // Draw Top Border
00090             glVertex2f( LX,  Y );
00091             glVertex2f( RX,  Y );
00092             glVertex2f( RX, TY );
00093             glVertex2f( LX, TY );
00094             // Draw Bottom Border
00095             glVertex2f( LX, BY );
00096             glVertex2f( RX, BY );
00097             glVertex2f( RX, m_xyLowerLeftPt[1] );
00098             glVertex2f( LX, m_xyLowerLeftPt[1] );
00099             //*/
00100         glEnd();
00101     }
00102 
00103     DrawText();
00104     DrawMarker();
00105 }

void OpenGLCtrlSlider::DrawMarker (  )  [protected]

Definition at line 106 of file TAPsOpenGLCtrlSlider.cpp.

00107 {
00108     //int X = m_xyLowerLeftPt[0] + m_DrawSizeXY[0];
00109     //int Y = m_xyLowerLeftPt[1] + m_DrawSizeXY[1];
00110     int X = m_DrawSizeXY[0] / 20;
00111     int halfX = X / 2;
00112     int Y = m_DrawSizeXY[1];
00113     int mx = m_xyLowerLeftPt[0];
00114     int my = m_xyLowerLeftPt[1];
00115     glPushMatrix();
00116     glTranslatef( 50+mx-halfX, my, 0 );
00117     glBegin( GL_QUADS );
00118         glColor4fv( m_BackgroundActColor );
00119         glVertex2f( 0, 0 );
00120         glVertex2f( X, 0 );
00121         glVertex2f( X, Y );
00122         glVertex2f( 0, Y );
00123     glEnd();
00124     glPopMatrix();
00125 }


The documentation for this class was generated from the following files:

Generated on Mon Oct 13 11:45:42 2008 for TAPs by  doxygen 1.5.6