OROCHI
 
Loading...
Searching...
No Matches
GxGuiPropertyParameter.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 GxGuiPropertyParameter : public GxGuiProperty
21{
22 //-----------------------------------------------------------
24 //-----------------------------------------------------------
26public:
27 GX_RTTI_CLASS(GxGuiPropertyParameter, GxGuiProperty)
28 // ClassBaseReference継承クラス用禁止宣言
29 GX_PROHIBIT_CLASS_BASE_REFERENCE(GxGuiPropertyParameter)
30
31
32 enum class PARAMETER_MODE
33 {
34 INT = 0,
35 FLOAT,
36 HEX,
37 BIT,
38 CSTR,
39 STRING
40 };
41
43 enum class SPACE_MODE
44 {
45 LINEAR = 0,
46 LOGARITHMIC,
47 LOGARITHMIC_REVERS,
48 RECIPROCAL,
49 MAX
50 };
51
53 enum class GUI_FLOAT_FORMAT
54 {
55 INT = 0,
56 _0_1,
57 _0_01,
58 _0_001,
59 _0_0001,
60 _0_00001,
61 _0_000001,
62 SYSTEM,
63 DEFAULT,
64 REAL,
65 MAX,
66 };
67#if GX_DEVELOP
69 GX_ENUM_TABLE_MAX(GUI_FLOAT_FORMAT)
70#endif //GX_DEVELOP
71
73 //-----------------------------------------------------------
75 //-----------------------------------------------------------
77public:
79 GxGuiPropertyParameter(void);
80
82 GxGuiPropertyParameter(const GxProperty& propertyData, GxTypedObject* pBase, const GxRtti& rtti, u32 index = 0, NAME_TYPE nameType = NAME_TYPE::LEFT, PARAMETER_MODE mode = PARAMETER_MODE::INT);
83
85 GxGuiPropertyParameter(const GxProperty& propertyData, GxTypedObject* pBase, const GxRtti& rtti, f64 min, f64 max, u32 index = 0, NAME_TYPE nameType = NAME_TYPE::LEFT, PARAMETER_MODE mode = PARAMETER_MODE::INT);
86
88 b32 initialize( void ) override;
89
91 //-----------------------------------------------------------
93 //-----------------------------------------------------------
95public:
97 void setMinMax( u64 min, u64 max );
99 void setMinMax( s64 min, s64 max );
101 void setMinMax( f64 min, f64 max );
103 GX_FORCE_INLINE void getMinMax( u64& min, u64& max ) const { min = _u64Min; max = _u64Max; }
105 GX_FORCE_INLINE void getMinMax( s64& min, s64& max ) const { min = _s64Min; max = _s64Max; }
107 GX_FORCE_INLINE void getMinMax( f64& min, f64& max ) const { min = _f64Min; max = _f64Max; }
108
110 void setMinMax( GxProperty::TYPE type );
111
113 void setStepS( f64 step );
115 void setStepF( f64 step );
118 constexpr f64 getStepS( void ) const { return _s64Step; }
121 constexpr f64 getStepF( void ) const { return _f64Step; }
122
124 constexpr void setSpaceMode(const SPACE_MODE spaceMode){ _spaceMode = spaceMode; }
126 constexpr SPACE_MODE getSpaceMode(void){ return _spaceMode; }
127
128protected:
130 void update(void) override;
132 void onDraw(void) override;
133
134public:
136 void onRemoveGui(GxGuiBase* pGui) override;
137
139 void onSize(const GxSize& size) override;
140
141protected:
143 void onKeyPress(GxKeyboard::KEY key) override;
144
146 void onActive(b32 active) override;
147
149 void onMouseDown(const GxPoint2& position, u32 button) override;
150
152 void onMouseMove(const GxPoint2& position) override;
153
155 void onDoubleClick(const GxPoint2& position, u32 button) override;
156
157private:
159 void eventEditString(void);
160
162 void createControlButton(void);
163
165 void deleteControlButton(void);
166
167#if defined( _WINDOWS )
169 static LRESULT CALLBACK MyDlgProc(HWND handleDialogWindow, UINT message, WPARAM wParam, LPARAM lParam);
170#endif //_WINDOWS
171
173 void controlParamUsedMouse(const GxPoint2& position);
174
176 //-----------------------------------------------------------
178 //-----------------------------------------------------------
180public:
182 GX_FORCE_INLINE const GxFlag32Bit& getLayout(void) const { return _layout; }
183
185 void setLayout( u32 flag, b32 on );
186
188 constexpr void setParameterMode( PARAMETER_MODE parameterMode ){ _parameterMode = parameterMode; }
189
191 constexpr PARAMETER_MODE getParameterMode( void ) const { return _parameterMode; }
192
194 GX_FORCE_INLINE void setFrameDrawn( b32 on ){ _isFrameDrawn = on; }
195
198 GX_FORCE_INLINE b32 isFrameDrawn( void ) const { return _isFrameDrawn; }
199
202 void setEnableButton( b32 on );
203
206 GX_FORCE_INLINE b32 isEnableButton( void ) const { return _enableButton; }
207
209 void getValueString( GxString& string, u32 size ) const;
210
212 GX_FORCE_INLINE GxString getValueString( u32 size ) const { GxString string; getValueString( string, size ); return string; }
213
215 void addValue( s64 add );
216
218 void addValue( f64 add );
219
221 f64 getValueRatio( void );
222
224 void setValueRatio( f64 ratio );
225
228 GX_FORCE_INLINE b32 isEditParam( void ) const { return _isEditParam; }
229
231 virtual b32 isControl( void ) const;
232
234 GX_FORCE_INLINE void setIsEditParam( b32 edit ){ _isEditParam = edit; getGxGuiSystem()->setEditMode( edit ); }
235
237 constexpr void setFloatFormat(GUI_FLOAT_FORMAT format) { _floatFormat = format; };
238
240 void setValue(u64 value);
242 void setValue(s64 value);
244 void setValue(f64 value);
245
247 u64 getValueU( void ) const;
249 s64 getValueS( void ) const;
251 f64 getValueF( void ) const;
252
254 void setValue(const GxString& string);
255
256protected:
258 b32 isDefaultValue( void ) override;
260 void setDefaultValue( void ) override;
261
263 //-----------------------------------------------------------
265 //-----------------------------------------------------------
267protected:
268 PARAMETER_MODE _parameterMode;
269 GUI_FLOAT_FORMAT _floatFormat;
270 b32 _isFrameDrawn;
271 b32 _enableButton;
272 b32 _usingButton;
273 b32 _isMouseDrag;
274
275 GxFlag32Bit _layout;
276
277 GxSize _displaySize;
278
279 GxString _displayString;
280 GxString _temporaryString;
281 GxString _clipDisplayString;
282 GxSize _clipDisplayStringSize;
283
284 // unsigned用
285 u64 _u64Min;
286 u64 _u64Max;
287
288 // signed用
289 s64 _s64Min;
290 s64 _s64Max;
291 f64 _s64Step;
292
293 // float用
294 f64 _f64Min;
295 f64 _f64Max;
296 f64 _f64Step;
297
298 // 値編集用
299 b32 _isEditParam;
300
301 GxGuiButton* _pGuiButton;
302
303 SPACE_MODE _spaceMode;
304
306};
307
308//---------------------------------------
310//---------------------------------------
311class GxGuiValueEdit : public GxGuiButton
312{
313 //-----------------------------------------------------------
315 //-----------------------------------------------------------
317public:
318 GX_RTTI_CLASS(GxGuiValueEdit, GxGuiButton)
319 // GxGuiButton継承クラス用禁止宣言
321
322
323 //-----------------------------------------------------------
325 //-----------------------------------------------------------
327public:
329 GxGuiValueEdit(void);
330
332 //-----------------------------------------------------------
334 //-----------------------------------------------------------
336public:
338 b32 initialize( void ) override;
339
343 void onMouseDown(const GxPoint2& position, u32 button) override;
344
347 void onNoClientMouseMove(const GxPoint2& position) override;
348
352 void onMouseUp(const GxPoint2& position, u32 button) override;
353
357 void onNoClientMouseUp(const GxPoint2& position, u32 button) override;
358
359protected:
361 void controlParamUsedMouse(const GxPoint2& position);
362
364 //-----------------------------------------------------------
366 //-----------------------------------------------------------
368public:
370 void update( void ) override;
371
374 GX_FORCE_INLINE b32 isControl( void ) const { return _isControlMouse; }
375
377 //-----------------------------------------------------------
379 //-----------------------------------------------------------
381protected:
382 b32 _isControlMouse;
383 s32 _mouseDowmY;
384 f64 _mouseDownValueF;
385 s64 _mouseDownValueS;
386 u64 _mouseDownValueU;
387 s32 _mouseMargin;
388
390};
391
392//===========================================================================
394//===========================================================================
395typedef void (*GX_GUI_PROPERTY_MODIFIER_FUNCTION)(GxGuiPropertyParameter& property, GxTypedObject* pOwner, u32 index);
396
397GX_CORE_NAMESPACE_END()
398
399#endif // GX_DEVELOP
#define GX_PROHIBIT_CLASS_BASE_REFERENCE(__CLASS__)
GxClassBaseReference継承の禁止宣言(new以外の生成禁止 + コピー禁止)
Definition GxBase.h:244
@ MAX
定義数
void GxTypedObject
その他
Definition GxDefine.h:213
@ LINEAR
線形補間
@ DEFAULT
ソートせずに名前順(デフォルト)
プロパティクラス
Definition GxProperty.h:48
TYPE
タイプ定義
Definition GxProperty.h:56
実行時型情報クラス
Definition GxRtti.h:154
ビット指定型フラグ
Definition GxStruct.h:1338
座標
Definition GxStruct.h:867
サイズ
Definition GxStruct.h:730
文字列型クラス
Definition GxString.h:18
32bitブーリアン
Definition GxDefine.h:173