OpenMoHAA 0.82.0
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 { SLIDER_FLOAT, SLIDER_INTEGER } slidertype_t;
26
27class UISlider : public UIWidget {
28 bool m_initialized;
29 float m_minvalue;
30 float m_maxvalue;
31 int m_minx;
32 int m_maxx;
33 int m_arrow_width;
34 float m_value;
35 float m_oldvalue;
36 float m_sliderwidth; // Note: this is actually the width of only the thumb, not the whole slider
37 UIRect2D m_sliderregion;
38 UIRect2D m_prev_arrow_region;
39 UIRect2D m_next_arrow_region;
40 slidertype_t m_slidertype;
41 float m_stepsize;
42 bool m_prev_arrow_depressed;
43 bool m_next_arrow_depressed;
44 bool m_thumb_depressed;
45 UIReggedMaterial *m_bar_material;
46 UIReggedMaterial *m_prev_arrow_material;
47 UIReggedMaterial *m_next_arrow_material;
48 UIReggedMaterial *m_thumbmaterial;
49 UIReggedMaterial *m_prev_arrow_material_pressed;
50 UIReggedMaterial *m_next_arrow_material_pressed;
51 UIReggedMaterial *m_thumbmaterial_pressed;
52
53public:
54 CLASS_PROTOTYPE( UISlider );
55
56private:
57 void setThumb( void );
58 void Pressed( Event *ev );
59 void Released( Event *ev );
60 void Increment( void );
61 void Decrement( void );
62 void AutoIncrement( Event *ev );
63 void AutoDecrement( Event *ev );
64 void MouseExited( Event *ev );
65 void MouseEntered( Event *ev );
66 void MouseDragged( Event *ev );
67 void LayoutSetRange( Event *ev );
68 void LayoutSetType( Event *ev );
69 void LayoutSetStep( Event *ev );
70 void LayoutSliderBGShader( Event *ev );
71 void LayoutSliderThumbShader( Event *ev );
72 void LayoutSliderLeftShader( Event *ev );
73 void LayoutSliderRightShader( Event *ev );
74
75public:
76 UISlider();
77
78 void Draw( void ) override;
79 void FrameInitialized( void ) override;
80 qboolean KeyEvent( int key, unsigned int time ) override;
81 void UpdateData( void ) override;
82 void UpdateUIElement( void ) override;
83 void setType( slidertype_t type );
84 void setRange( float min, float max );
85 void setStep( float value );
86};
Definition listener.h:246
Definition uirect2d.h:28
Definition uiwidget.h:35