GlistEngine
Loading...
Searching...
No Matches
gGUISlider.h
Go to the documentation of this file.
1/****************************************************************************
2 * Copyright (c) 2014 Nitra Games Ltd., Istanbul, Turkey *
3 * *
4 * Permission is hereby granted, free of charge, to any person obtaining a *
5 * copy of this software and associated documentation files (the *
6 * "Software"), to deal in the Software without restriction, including *
7 * without limitation the rights to use, copy, modify, merge, publish, *
8 * distribute, distribute with modifications, sublicense, and/or sell *
9 * copies of the Software, and to permit persons to whom the Software is *
10 * furnished to do so, subject to the following conditions: *
11 * *
12 * The above copyright notice and this permission notice should not be *
13 * deleted from the source form of the Software. *
14 * *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
22 * *
23 * Except as contained in this notice, the name(s) of the above copyright *
24 * holders shall not be used in advertising or otherwise to promote the *
25 * sale, use or other dealings in this Software without prior written *
26 * authorization. *
27 ****************************************************************************/
28
29/****************************************************************************
30 * Author: Yaren Cetinkaya, Murat Ergin, 2022 Aug 02 *
31 ****************************************************************************/
32/*
33 * gGUISlider.h
34 *
35 * Created on: 02 Aug 2022
36 * Author: Yaren Cetinkaya, Murat Ergin
37 */
38#ifndef UI_GGUISLIDER_H_
39#define UI_GGUISLIDER_H_
40
41#include "gGUIControl.h"
42
52class gGUISlider: public gGUIControl {
53public:
55 virtual ~gGUISlider();
56
57 void update();
58 void draw();
59 void mousePressed(int x, int y, int button);
60 void mouseReleased(int x, int y, int button);
61 void mouseDragged(int x, int y, int button);
62
69
76
82 void setTickVisibility(bool isVisible);
83
89 void setTextVisibility(bool isTextVisible);
90
92
98 float getMinValue();
99
105 void setMinValue(float minValue);
106
112 float getMaxValue();
113
119 void setMaxValue(float maxValue);
120
127
134 void setTicknum(float tickNum);
135
142
149
156
163
170
177
184
191
197 void setTickColor(gColor color);
198
205
206
209 bool isPressed();
211
212 virtual void set(gBaseApp* root, gBaseGUIObject* topParentGUIObject, gBaseGUIObject* parentGUIObject, int parentSlotLineNo, int parentSlotColumnNo, int x, int y, int w, int h);
213
214 friend class gGUIToolbar;
215
216private:
217 void drawSliderBar();
218 void drawSlider();
219 void drawTick();
220 void drawText();
221
222 float sliderbarh, sliderbarw;
223 float sliderh, sliderw;
224 float sliderx, slidery;
225 float sliderbarx, sliderbary;
226 float textx, texty;
227 float tickx, ticky;
228 float currentvaluex, currentvaluey;
229 float slidercenterx;
230 std::string ticknumbers;
231 std::string currentvaluetext;
232
233 bool isdisabled;
234 bool ispressedslider;
235 bool istickvisible;
236 bool ispressed;
237 bool istextvisible;
238
239 float ticknum;
240 float spacelength;
241 float minvalue;
242 float maxvalue;
243 float currentvalue;
244 float direction;
245 float counter, counterlimit;
246 float mousex;
247 float counterpressed, counterpressedlimit;
248
249 gColor slidercolor, pressedslidercolor, disabledcolor;
250 gColor sliderbarcolor;
251 gColor tickcolor;
252};
253
254#endif /* UI_GGUISLIDER_H_ */
Definition gBaseApp.h:16
Definition gBaseGUIObject.h:18
gBaseApp * root
Definition gBaseGUIObject.h:147
Definition gColor.h:17
Definition gGUIControl.h:29
Definition gGUISlider.h:52
void mouseReleased(int x, int y, int button)
void setTickVisibility(bool isVisible)
gColor * getSliderColor()
void mousePressed(int x, int y, int button)
void mouseDragged(int x, int y, int button)
void draw()
bool isDisabled()
void setMinValue(float minValue)
float getCurrentValue()
void setSliderbarColor(gColor color)
void setTickColor(gColor color)
void setTextVisibility(bool isTextVisible)
void setSliderColor(gColor color)
bool isSliderPressed()
gColor * getTickColor()
float getMinValue()
void update()
virtual void set(gBaseApp *root, gBaseGUIObject *topParentGUIObject, gBaseGUIObject *parentGUIObject, int parentSlotLineNo, int parentSlotColumnNo, int x, int y, int w, int h)
void setDisabledColor(gColor color)
void setMaxValue(float maxValue)
float getMaxValue()
gColor * getPressedSliderColor()
bool isTickVisible()
void setPressedSliderColor(gColor color)
gColor * getSliderbarColor()
virtual ~gGUISlider()
gColor * getDisabledColor()
float getSliderbarHeight()
void setTicknum(float tickNum)
float getSliderbarWidth()
void setDisabled(bool isDisabled)
bool isPressed()
Definition gGUIToolbar.h:27