OpenMoHAA 0.82.1
Loading...
Searching...
No Matches
uislider.h
1/*
2===========================================================================
3Copyright (C) 2024 the OpenMoHAA team
4
5This file is part of OpenMoHAA source code.
6
7OpenMoHAA source code is free software; you can redistribute it
8and/or modify it under the terms of the GNU General Public License as
9published by the Free Software Foundation; either version 2 of the License,
10or (at your option) any later version.
11
12OpenMoHAA source code is distributed in the hope that it will be
13useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with OpenMoHAA source code; if not, write to the Free Software
19Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20===========================================================================
21*/
22
23#pragma once
24
25typedef enum {
26 SLIDER_FLOAT,
27 SLIDER_INTEGER
28} slidertype_t;
29
30class UISlider : public UIWidget
31{
32 bool m_initialized;
33 float m_minvalue;
34 float m_maxvalue;
35 int m_minx;
36 int m_maxx;
37 int m_arrow_width;
38 float m_value;
39 float m_oldvalue;
40 float m_sliderwidth; // Note: this is actually the width of only the thumb, not the whole slider
41 UIRect2D m_sliderregion;
42 UIRect2D m_prev_arrow_region;
43 UIRect2D m_next_arrow_region;
44 slidertype_t m_slidertype;
45 float m_stepsize;
46 bool m_prev_arrow_depressed;
47 bool m_next_arrow_depressed;
48 bool m_thumb_depressed;
49 UIReggedMaterial *m_bar_material;
50 UIReggedMaterial *m_prev_arrow_material;
51 UIReggedMaterial *m_next_arrow_material;
52 UIReggedMaterial *m_thumbmaterial;
53 UIReggedMaterial *m_prev_arrow_material_pressed;
54 UIReggedMaterial *m_next_arrow_material_pressed;
55 UIReggedMaterial *m_thumbmaterial_pressed;
56
57public:
58 CLASS_PROTOTYPE(UISlider);
59
60private:
61 void setThumb(void);
62 void Pressed(Event *ev);
63 void Released(Event *ev);
64 void Increment(void);
65 void Decrement(void);
66 void AutoIncrement(Event *ev);
67 void AutoDecrement(Event *ev);
68 void MouseExited(Event *ev);
69 void MouseEntered(Event *ev);
70 void MouseDragged(Event *ev);
71 void LayoutSetRange(Event *ev);
72 void LayoutSetType(Event *ev);
73 void LayoutSetStep(Event *ev);
74 void LayoutSliderBGShader(Event *ev);
75 void LayoutSliderThumbShader(Event *ev);
76 void LayoutSliderLeftShader(Event *ev);
77 void LayoutSliderRightShader(Event *ev);
78
79public:
80 UISlider();
81
82 void Draw(void) override;
83 void FrameInitialized(void) override;
84 qboolean KeyEvent(int key, unsigned int time) override;
85 void UpdateData(void) override;
86 void UpdateUIElement(void) override;
87 void setType(slidertype_t type);
88 void setRange(float min, float max);
89 void setStep(float value);
90};
Definition listener.h:246
Definition uirect2d.h:29
Definition uiwidget.h:36