Iridescence 1.00
Embedded Graphic Framework
Loading...
Searching...
No Matches
ds_value_base.h
1/* Copyright (C) 2017 - 2024, Thornwave Labs Inc - All Rights Reserved.
2 * Unauthorized copying of this file, via any medium is strictly prohibited.
3 * Proprietary and confidential.
4 * Written by Razvan Turiac <razvan.turiac@thornwave.com>
5*/
6
7#ifndef _DS_VALUE_BASE_H
8#define _DS_VALUE_BASE_H
9
10
11#include <ds_math.h>
12#include <ds_types_lambda.h>
13
14
19{
20public:
22
28 void setValueRange(float min, float max);
29
30
35 void setValue(float value);
36
37
42 float getValue(void) const;
43
44
54 void setOnChangeCallback(const lambda<void(float value, bool in_motion, bool user_input)> &cb);
55
56
57protected:
58 float mMinValue;
59 float mMaxValue;
60 float mValue;
61
62 float getNormalizedValue(float value);
63 void notifyValueChange(bool in_motion);
64
65 virtual float onValueChange(float value) = 0;
66
67private:
68 float mRecursionFlag;
69 lambda<void(float, bool, bool)> mOnChangeCallback;
70};
71
72
73#endif
DsValueBase is a base class that contains a float value.
Definition ds_value_base.h:19
void setValueRange(float min, float max)
Sets the value range.
void setValue(float value)
Sets the value.
float getValue(void) const
Returns the value.
void setOnChangeCallback(const lambda< void(float value, bool in_motion, bool user_input)> &cb)
Definition ds_types_lambda.h:24