SliderTool Class Reference

#include <SliderTool.h>

List of all members.

Public Member Functions

 SliderTool (int max_Sliderbar_Lenght=300, int screen_Margin_top=10, int screen_Margin_right=10, int screen_Margin_button2Rail=5)
 constructor
 ~SliderTool ()
 destructor
void draw ()
 Draws the Slider directly into the FrameBuffer.
void initSliderToolSize (const int widgetWidth, const int widgetHeight)
 Calculates Positions and Size of the Slider Tool in the parent QGLWidget.
void initSliderBoundings (const int &minValue2Slide, const int &maxValue2Slide, const int startBound=0)
 Sets the Boundings and Value to start at for the Slider.
bool calcSliderPos (const float ValueDelta)
 Changes Slider value and position regarding the given Parameter.
int calcValue2SlideAt (float sliderPos)
 Calculates the Value that is taken on, if the Slider points on the Y-coord given as sliderPos.
bool IsSliderDragged ()
 returns if the Slider is dragged or not (Dragged Slider is thought as a slider that is clicked, hold and therefore dragged around).
void dragSlider ()
 Sets the Slider to be dragged (Dragged Slider is thought as a slider that is clicked, hold and therefore dragged around).
void releaseSlider ()
 releases Slider from being dragged (Dragged Slider is thought as a slider that is clicked, hold and therefore dragged around).
QPoint getBtSliderUp_TopLeft ()
 Getter for the topleft pixel position in the parent QGLWidget of the upper Button.
QPoint getBtSliderUp_BottomDown ()
 Getter for the bottomdown pixel position in the parent QGLWidget of the upper Button.
QPoint getBtSliderDown_TopLeft ()
 Getter for the topleft pixel position in the parent QGLWidget of the lower Button.
QPoint getBtSliderDown_BottomDown ()
 Getter for the bottomdown pixel position in the parent QGLWidget of the lower Button.
QPoint getSliderPos_TopLeft ()
 Getter for the current topleft pixel position in the parent QGLWidget of the slider.
QPoint getSliderPos_BottomDown ()
 Getter for the current bottomdown pixel position in the parent QGLWidget of the slider.
QPoint getSliderRailPos_TopLeft ()
 Getter for the topleft pixel position in the parent QGLWidget of the SliderRail.
QPoint getSliderRailPos_BottomDown ()
 Getter for the bottomdown pixel position in the parent QGLWidget of the SliderRail.
QPoint getSliderRailArea_TopLeft ()
 Getter for the topleft pixel position in the parent QGLWidget of the complete Area containing the rail.
QPoint getSliderRailArea_BottomDown ()
 Getter for the bottomdown pixel position in the parent QGLWidget of the complete Area containing the rail.
int getSliderHeight ()
 Getter for the height of the Slider.
int getCurrentValue ()
 Getter for the Value the Slider currently points on.
int getScreenMargin_Top ()
 Getter for the margin between top edge of the parent QGL widget and the Slider tool.
int getScreenMargin_Right ()
 Getter for the margin between right edge of the parent QGL widget and the Slider tool.
int getScreenMargin_Button2Rail ()
 Getter for the margin between buttons and the SliderRail.
void setScreenMargin_Top (int new_ScreenMargin)
 Setter for the margin between top edge of the parent QGL widget and the Slider tool.
void setScreenMargin_Right (int new_ScreenMargin)
 Setter for the margin between right edge of the parent QGL widget and the Slider tool.
void setScreenMargin_Button2Rail (int new_ScreenMargin)
 Setter for the margin between buttons and the SliderRail.
int getMaxSliderbarLenght ()
 Getter for the the maximum length of the Sliderrail.
void setMaxSliderbarLenght (int new_MaxSliderbarLenght)
 Setter for the the maximum length of the Sliderrail.

Private Attributes

int screen_Margin_top
 Value to control the margin between top edge of the parent QGL widget and the Slider tool.
int screen_Margin_right
 Value to control the margin between right edge of the parent QGL widget and the Slider tool.
int screen_Margin_button2Rail
 Value to control the margin between buttons and the SliderRail.
int max_Sliderbar_Lenght
 Value to control the maximum length of the Sliderrail.
GLubyte * sliderToolGLArray
 Array containing the Pixels for the SliderTool. Each Pixel is realized by four values in a row for Red Green Blue and Alpha (RGBA).
GLubyte * sliderGLArray
 Array containing the Pixels for the Slider. Each Pixel is realized by three values in a row for Red Green and Blue (RGB).
QPoint btSliderUp_TopLeft
 Topleft pixel position in the parent QGLWidget of the upper Button.
QPoint btSliderDown_TopLeft
 Topleft pixel position in the parent QGLWidget of the lower Button.
QPoint sliderRailPos_TopLeft
 Topleft pixel position in the parent QGLWidget of the Slider Rail.
QPoint sliderRailPos_BottomDown
 Bottomdown pixel position in the parent QGLWidget of the Slider Rail.
QPoint sliderPos_TopLeft
 Topleft pixel position in the parent QGLWidget of the Slider.
int buttonSize
 Lenght/Height of the Button-pictures.
int parentHeight
 Height of the parent QGLWidget (needed to draw Tool correctly).
int sliderwidth
 Lenght of the Slider-picture.
int sliderheight
 Height of the Slider-picture.
int sliderToolWidth
 Length of the whole Slidertool.
int sliderToolHeight
 Height of the whole Slidertool.
bool sliderIsDragged
 Flag to follow whether the Slider is dragged or not (Dragged Slider is thought as a slider that is clicked, hold and therefore dragged around).
float sliderValue
 current value that is represented by the SliderTool
int upperSliderBoundValue
 upper bound for the value that is represented by the SliderTool
int lowerSliderBoundValue
 lower bound for the value that is represented by the SliderTool

Static Private Attributes

static const QString UPPER_BT_PIC = "./images/ZoomIn.png"
 Path to the picture for the upper Button (Picture have to be square).
static const QString LOWER_BT_PIC = "./images/ZoomOut.png"
 Path to the picture for the lower Button (Picture have to be square).
static const QString SLIDER = "./images/Slider.png"
 Path to the picture for the Slider (Transparency is currently not supported for Slider).

Detailed Description

SliderTool Class provides a vertical Slider, placed with margin at the top right corner of a parent QGL widget. It is directly painted with OpenGl methods into the FrameBuffer to avoid side effects on the OpenGl scene.


Constructor & Destructor Documentation

SliderTool::SliderTool ( int  max_Sliderbar_Lenght = 300,
int  screen_Margin_top = 10,
int  screen_Margin_right = 10,
int  screen_Margin_button2Rail = 5 
)

constructor

SliderTool is constructed, with the given parameter values or standart values. Images for the buttons and the slider are initialised and array with the Slider pixels (sliderGLArray) is generated.

Parameters:
max_Sliderbar_Lenght the maximum length of the Sliderrail
screen_Margin_from_topedge Value to control the margin between top edge of the parent QGL widget and the Slider tool
screen_Margin_from_rightedge Value to control the margin between right edge of the parent QGL widget and the Slider tool
screen_Margin_button2Rail Value to control the margin between buttons and the SliderRail
SliderTool::~SliderTool (  ) 

destructor

SliderTool is destructed: image-arrays for the framebuffer are deleted.


Member Function Documentation

bool SliderTool::calcSliderPos ( const float  ValueDelta  ) 

Changes Slider value and position regarding the given Parameter.

The represented value is changed by Parameter ValueDelta, and thereby the position of the Slider is adapted.

Parameters:
ValueDelta figure the Slidervalue should be changed with
Returns:
False - If the new value is out of bounce
True - If value was changes succesfully
int SliderTool::calcValue2SlideAt ( float  sliderPos  ) 

Calculates the Value that is taken on, if the Slider points on the Y-coord given as sliderPos.

out of bounce +return

Parameters:
sliderPos Y-coord in the range of the parent QGLWidget
void SliderTool::dragSlider (  ) 

Sets the Slider to be dragged (Dragged Slider is thought as a slider that is clicked, hold and therefore dragged around).

void SliderTool::draw (  ) 

Draws the Slider directly into the FrameBuffer.

Draws the SliderTool by drawing the Pixels from the image-arrays (sliderToolGLArray, sliderGLArray) into the framebuffer.

See also:
openGL functions glBitmap(), glDrawPixels
QPoint SliderTool::getBtSliderDown_BottomDown (  ) 

Getter for the bottomdown pixel position in the parent QGLWidget of the lower Button.

QPoint SliderTool::getBtSliderDown_TopLeft (  ) 

Getter for the topleft pixel position in the parent QGLWidget of the lower Button.

QPoint SliderTool::getBtSliderUp_BottomDown (  ) 

Getter for the bottomdown pixel position in the parent QGLWidget of the upper Button.

QPoint SliderTool::getBtSliderUp_TopLeft (  ) 

Getter for the topleft pixel position in the parent QGLWidget of the upper Button.

int SliderTool::getCurrentValue (  ) 

Getter for the Value the Slider currently points on.

int SliderTool::getMaxSliderbarLenght (  ) 

Getter for the the maximum length of the Sliderrail.

int SliderTool::getScreenMargin_Button2Rail (  ) 

Getter for the margin between buttons and the SliderRail.

int SliderTool::getScreenMargin_Right (  ) 

Getter for the margin between right edge of the parent QGL widget and the Slider tool.

int SliderTool::getScreenMargin_Top (  ) 

Getter for the margin between top edge of the parent QGL widget and the Slider tool.

int SliderTool::getSliderHeight (  ) 

Getter for the height of the Slider.

QPoint SliderTool::getSliderPos_BottomDown (  ) 

Getter for the current bottomdown pixel position in the parent QGLWidget of the slider.

QPoint SliderTool::getSliderPos_TopLeft (  ) 

Getter for the current topleft pixel position in the parent QGLWidget of the slider.

QPoint SliderTool::getSliderRailArea_BottomDown (  ) 

Getter for the bottomdown pixel position in the parent QGLWidget of the complete Area containing the rail.

QPoint SliderTool::getSliderRailArea_TopLeft (  ) 

Getter for the topleft pixel position in the parent QGLWidget of the complete Area containing the rail.

QPoint SliderTool::getSliderRailPos_BottomDown (  ) 

Getter for the bottomdown pixel position in the parent QGLWidget of the SliderRail.

QPoint SliderTool::getSliderRailPos_TopLeft (  ) 

Getter for the topleft pixel position in the parent QGLWidget of the SliderRail.

void SliderTool::initSliderBoundings ( const int &  minValue2Slide,
const int &  maxValue2Slide,
const int  startBound = 0 
)

Sets the Boundings and Value to start at for the Slider.

Values to be represented by the SliderTool are initalised.

Parameters:
minValue2Slide value the Slider have to present at least
maxValue2Slide value the Slider have to present at most
startBound current value the Slider have to point on yet
void SliderTool::initSliderToolSize ( const int  widgetWidth,
const int  widgetHeight 
)

Calculates Positions and Size of the Slider Tool in the parent QGLWidget.

SliderTool-size and Position is initalized in the top-right corner of the parent QGLWidget. Image-arrays for the whole tool (except the Slider) is created and filled with the rail and button pixels. This function should be called in the parents resize event, so that The SliderTool is always displayed correctly.

Parameters:
widgetWidth Width of the parents QGL widget
widgetHeight Height of the parents QGL widget
See also:
Value Picture (main)
bool SliderTool::IsSliderDragged (  ) 

returns if the Slider is dragged or not (Dragged Slider is thought as a slider that is clicked, hold and therefore dragged around).

void SliderTool::releaseSlider (  ) 

releases Slider from being dragged (Dragged Slider is thought as a slider that is clicked, hold and therefore dragged around).

void SliderTool::setMaxSliderbarLenght ( int  new_MaxSliderbarLenght  ) 

Setter for the the maximum length of the Sliderrail.

void SliderTool::setScreenMargin_Button2Rail ( int  new_ScreenMargin  ) 

Setter for the margin between buttons and the SliderRail.

void SliderTool::setScreenMargin_Right ( int  new_ScreenMargin  ) 

Setter for the margin between right edge of the parent QGL widget and the Slider tool.

void SliderTool::setScreenMargin_Top ( int  new_ScreenMargin  ) 

Setter for the margin between top edge of the parent QGL widget and the Slider tool.


Member Data Documentation

Topleft pixel position in the parent QGLWidget of the lower Button.

Topleft pixel position in the parent QGLWidget of the upper Button.

int SliderTool::buttonSize [private]

Lenght/Height of the Button-pictures.

const QString SliderTool::LOWER_BT_PIC = "./images/ZoomOut.png" [static, private]

Path to the picture for the lower Button (Picture have to be square).

lower bound for the value that is represented by the SliderTool

Value to control the maximum length of the Sliderrail.

int SliderTool::parentHeight [private]

Height of the parent QGLWidget (needed to draw Tool correctly).

Value to control the margin between buttons and the SliderRail.

Value to control the margin between right edge of the parent QGL widget and the Slider tool.

Value to control the margin between top edge of the parent QGL widget and the Slider tool.

const QString SliderTool::SLIDER = "./images/Slider.png" [static, private]

Path to the picture for the Slider (Transparency is currently not supported for Slider).

Both buttons must have the same size!

GLubyte* SliderTool::sliderGLArray [private]

Array containing the Pixels for the Slider. Each Pixel is realized by three values in a row for Red Green and Blue (RGB).

int SliderTool::sliderheight [private]

Height of the Slider-picture.

Flag to follow whether the Slider is dragged or not (Dragged Slider is thought as a slider that is clicked, hold and therefore dragged around).

Topleft pixel position in the parent QGLWidget of the Slider.

Bottomdown pixel position in the parent QGLWidget of the Slider Rail.

Topleft pixel position in the parent QGLWidget of the Slider Rail.

GLubyte* SliderTool::sliderToolGLArray [private]

Array containing the Pixels for the SliderTool. Each Pixel is realized by four values in a row for Red Green Blue and Alpha (RGBA).

Height of the whole Slidertool.

Length of the whole Slidertool.

float SliderTool::sliderValue [private]

current value that is represented by the SliderTool

int SliderTool::sliderwidth [private]

Lenght of the Slider-picture.

const QString SliderTool::UPPER_BT_PIC = "./images/ZoomIn.png" [static, private]

Path to the picture for the upper Button (Picture have to be square).

upper bound for the value that is represented by the SliderTool


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables
Generated on Sun May 29 19:36:43 2011 for GM_sliderTool by  doxygen 1.6.3