OROCHI
 
Loading...
Searching...
No Matches
GxGuiPropertySlider.h
Go to the documentation of this file.
1//===========================================================================
10//===========================================================================
11#pragma once
12
13#if GX_DEVELOP
14
15GX_CORE_NAMESPACE_BEGIN()
16
17//===========================================================================
19//===========================================================================
20class GxGuiPropertySlider : public GxGuiPropertyParameter
21{
22 //-----------------------------------------------------------
24 //-----------------------------------------------------------
26public:
27 GX_RTTI_CLASS(GxGuiPropertySlider, GxGuiPropertyParameter)
28 // ClassBaseReference継承クラス用禁止宣言
29 GX_PROHIBIT_CLASS_BASE_REFERENCE(GxGuiPropertySlider)
30
31
32 enum class PLAY_TIME
33 {
34 RATIO = 0,
35 REAL,
36 FRAME,
37 };
38
39private:
41 static constexpr u32 MARGIN_LEFT = 8;
43 static constexpr u32 MARGIN_RIGHT = 8;
44
46 //-----------------------------------------------------------
48 //-----------------------------------------------------------
50public:
52 GxGuiPropertySlider(void);
54 GxGuiPropertySlider(const GxProperty& property, GxTypedObject* pOwner, const GxRtti& rtti, u32 index = 0, b32 useButtonPlay = false );
55
57 //-----------------------------------------------------------
59 //-----------------------------------------------------------
61public:
63 b32 initialize( void ) override;
64
66 void update( void ) override;
67
69 void onNoClientDraw( void ) override;
70
72 GX_FORCE_INLINE virtual void setPlayButtonOn(b32 state) { if (_pGuiButton) { _isPlay = state; _pGuiButton->setOn(state); } }
73
75 GxSize getUseRegionSize(void) const override;
76
77protected:
79 GxRect calculateClientRect(const GxRect& clientRect) const override;
80
82 void onSize(const GxSize& size) override;
83
85 void onNoClientMouseDown(const GxPoint2& position, u32 button) override;
86
88 void onKeyDown(GxKeyboard::KEY key) override;
89
91 void onKeyPress(GxKeyboard::KEY key) override;
92
94 GX_FORCE_INLINE void eventPlay(void) { _isPlay = true; }
95
97 GX_FORCE_INLINE void eventPause(void) { _isPlay = false; }
98
100 GxRect getSliderRect(void);
101
103 GxRect getSliderHandleRect(void);
104
106 //-----------------------------------------------------------
108 //-----------------------------------------------------------
110public:
113 constexpr void setSliderWidthRatio( f32 ratio ){ _sliderWidthRatio = ratio; }
114
117 GX_FORCE_INLINE b32 isControl( void ) const override { return _controlBar || Super::isControl(); }
118
119 GX_FORCE_INLINE virtual b32 isValueChanged( void ) const { return _valueChanged; }
120
122 GX_FORCE_INLINE void setMultiRow( b32 on ){ _isMultiRow = on; }
123
126 GX_FORCE_INLINE b32 isMultiRow( void ) const { return _isMultiRow; }
127
129 GX_FORCE_INLINE void setLoop( b32 state ){ _isLoop = state; }
131 GX_FORCE_INLINE b32 isLoop( void ) const { return _isLoop; }
132
134 constexpr void setPlayTimeMode( PLAY_TIME mode ){ _playTimeMode = mode; }
136 constexpr PLAY_TIME getPlayTimeMode( void ) const { return _playTimeMode; }
137
139 // デフォルトは 0 でステップ無し動作。
140 GX_FORCE_INLINE void setSliderStep(f64 step) { _sliderStep = GxMath::getAbs(step); }
141
143 //-----------------------------------------------------------
145 //-----------------------------------------------------------
147protected:
148 b32 _controlBar;
149 b32 _valueChanged;
150
151 f32 _sliderWidthRatio;
152 b32 _isMultiRow;
153
154 b32 _useButtonPlay;
155 b32 _isPlay;
156 b32 _isLoop;
157 PLAY_TIME _playTimeMode;
158
159 f64 _previousVal;
160 f64 _sliderStep;
161
163};
164
165//===========================================================================
167//===========================================================================
168class GxGuiPropertySliderColor : public GxGuiPropertySlider
169{
170 //-----------------------------------------------------------
172 //-----------------------------------------------------------
174public:
175 GX_RTTI_CLASS(GxGuiPropertySliderColor, GxGuiPropertySlider)
176 // ClassBaseReference継承クラス用禁止宣言
177 GX_PROHIBIT_CLASS_BASE_REFERENCE(GxGuiPropertySliderColor)
178
179
180 //-----------------------------------------------------------
182 //-----------------------------------------------------------
184public:
186 GxGuiPropertySliderColor(void);
188 GxGuiPropertySliderColor(const GxProperty& property, GxTypedObject* pClassOwner, const GxRtti& rtti, u32 index = 0);
189
191 //-----------------------------------------------------------
193 //-----------------------------------------------------------
195public:
197 void cleanup( void ) override;
198
200 b32 initialize( void ) override;
201
203 void onNoClientDraw( void ) override;
204
206 //-----------------------------------------------------------
208 //-----------------------------------------------------------
210public:
212 void setSliderColor( u32 index, const GxColor& color );
213
215 void createSliderColor( u32 count );
216
218 GxColor* getSliderColor( u32 count );
219
221 void clearSliderColor( void );
222
224 //-----------------------------------------------------------
226 //-----------------------------------------------------------
228protected:
229 GxArray* _pListColor;
230
232};
233
234GX_CORE_NAMESPACE_END()
235
236#endif // GX_DEVELOP
#define GX_PROHIBIT_CLASS_BASE_REFERENCE(__CLASS__)
GxClassBaseReference継承の禁止宣言(new以外の生成禁止 + コピー禁止)
Definition GxBase.h:244
void GxTypedObject
その他
Definition GxDefine.h:213
配列クラス
Definition GxArray.h:18
static GX_FORCE_INLINE T getAbs(const T value)
絶対値
Definition GxMath.h:168
プロパティクラス
Definition GxProperty.h:48
実行時型情報クラス
Definition GxRtti.h:154
Definition GxColor.h:21
座標
Definition GxStruct.h:867
矩形
Definition GxStruct.h:951
サイズ
Definition GxStruct.h:730
32bitブーリアン
Definition GxDefine.h:173