#include <SliderTool.h>
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). |
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.
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.
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.
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.
ValueDelta | figure the Slidervalue should be changed with |
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
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.
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.
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.
widgetWidth | Width of the parents QGL widget | |
widgetHeight | Height of the parents QGL widget |
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.
QPoint SliderTool::btSliderDown_TopLeft [private] |
Topleft pixel position in the parent QGLWidget of the lower Button.
QPoint SliderTool::btSliderUp_TopLeft [private] |
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).
int SliderTool::lowerSliderBoundValue [private] |
lower bound for the value that is represented by the SliderTool
int SliderTool::max_Sliderbar_Lenght [private] |
Value to control the maximum length of the Sliderrail.
int SliderTool::parentHeight [private] |
Height of the parent QGLWidget (needed to draw Tool correctly).
int SliderTool::screen_Margin_button2Rail [private] |
Value to control the margin between buttons and the SliderRail.
int SliderTool::screen_Margin_right [private] |
Value to control the margin between right edge of the parent QGL widget and the Slider tool.
int SliderTool::screen_Margin_top [private] |
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.
bool SliderTool::sliderIsDragged [private] |
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).
QPoint SliderTool::sliderPos_TopLeft [private] |
Topleft pixel position in the parent QGLWidget of the Slider.
QPoint SliderTool::sliderRailPos_BottomDown [private] |
Bottomdown pixel position in the parent QGLWidget of the Slider Rail.
QPoint SliderTool::sliderRailPos_TopLeft [private] |
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).
int SliderTool::sliderToolHeight [private] |
Height of the whole Slidertool.
int SliderTool::sliderToolWidth [private] |
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).
int SliderTool::upperSliderBoundValue [private] |
upper bound for the value that is represented by the SliderTool