diff options
author | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
---|---|---|
committer | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
commit | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Wasabi/api/config/items/attrfloat.h | |
parent | 537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff) | |
download | winamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz |
Initial community commit
Diffstat (limited to 'Src/Wasabi/api/config/items/attrfloat.h')
-rw-r--r-- | Src/Wasabi/api/config/items/attrfloat.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/Src/Wasabi/api/config/items/attrfloat.h b/Src/Wasabi/api/config/items/attrfloat.h new file mode 100644 index 00000000..056f0c46 --- /dev/null +++ b/Src/Wasabi/api/config/items/attrfloat.h @@ -0,0 +1,52 @@ +#ifndef _ATTRFLOAT_H +#define _ATTRFLOAT_H + +#include "attribute.h" + +// actually it's a double :) + +class _float : public Attribute { +public: + /** + Optionally set the name and default value of + your configuration attribute during construction. + + @param name Name of the configuration attribute. + @param default_val Default value. + */ + _float(const wchar_t *name=NULL, double default_val=0.f) : Attribute(name) { + setValueAsDouble(default_val, true); + } + + /** + Get the attribute type. This will return + a constant representing the attribute type. + + These constants can be: BOOL, FLOAT, STRING and INT. + + @see AttributeType + @ret The attribute type. + */ + virtual int getAttributeType() { return AttributeType::FLOAT; } + + /** + Get the configuration group to be used to represent + this attribute in the registry. + + @ret Config group to be used. + */ + virtual const wchar_t *getConfigGroup() { return L"studio.configgroup.float"; } + + // convenience operators + /** + Get the value of the attribute. + */ + operator double() { return getValueAsDouble(); } + + /** + Set the value of the attribute. + */ + double operator =(double newval) { return setValueAsDouble(newval) ? newval : getValueAsDouble(); } +}; + +#endif |