1a0ba79fbSJohn Scipione /* 2a0ba79fbSJohn Scipione * Copyright 2015 Haiku, Inc. All rights reserved. 3a0ba79fbSJohn Scipione * Distributed under the terms of the MIT license. 4a0ba79fbSJohn Scipione * 5a0ba79fbSJohn Scipione * Authors: 6a0ba79fbSJohn Scipione * John Scipione, jscipione@gmail.com 7a0ba79fbSJohn Scipione */ 8a0ba79fbSJohn Scipione #ifndef _DECIMAL_SPINNER_H 9a0ba79fbSJohn Scipione #define _DECIMAL_SPINNER_H 10a0ba79fbSJohn Scipione 11a0ba79fbSJohn Scipione 12a0ba79fbSJohn Scipione #include <Spinner.h> 13a0ba79fbSJohn Scipione 14a0ba79fbSJohn Scipione 15a0ba79fbSJohn Scipione class BDecimalSpinner : public BAbstractSpinner { 16a0ba79fbSJohn Scipione public: 17a0ba79fbSJohn Scipione BDecimalSpinner(BRect frame, const char* name, 18a0ba79fbSJohn Scipione const char* label, BMessage* message, 197f9368caSlooncraz uint32 resizingMode = B_FOLLOW_LEFT_TOP, 20a0ba79fbSJohn Scipione uint32 flags = B_WILL_DRAW | B_NAVIGABLE); 21a0ba79fbSJohn Scipione BDecimalSpinner(const char* name, const char* label, 22a0ba79fbSJohn Scipione BMessage* message, 23a0ba79fbSJohn Scipione uint32 flags = B_WILL_DRAW | B_NAVIGABLE); 24a0ba79fbSJohn Scipione BDecimalSpinner(BMessage* data); 25a0ba79fbSJohn Scipione virtual ~BDecimalSpinner(); 26a0ba79fbSJohn Scipione 27a0ba79fbSJohn Scipione static BArchivable* Instantiate(BMessage* data); 28a0ba79fbSJohn Scipione virtual status_t Archive(BMessage* data, bool deep = true) const; 29a0ba79fbSJohn Scipione 30a0ba79fbSJohn Scipione virtual status_t GetSupportedSuites(BMessage* message); 31a0ba79fbSJohn Scipione 32a0ba79fbSJohn Scipione virtual void AttachedToWindow(); 33a0ba79fbSJohn Scipione 34a0ba79fbSJohn Scipione virtual void Increment(); 35a0ba79fbSJohn Scipione virtual void Decrement(); 36a0ba79fbSJohn Scipione 37a0ba79fbSJohn Scipione virtual void SetEnabled(bool enable); 38a0ba79fbSJohn Scipione Precision()39a0ba79fbSJohn Scipione uint32 Precision() const { return fPrecision; }; SetPrecision(uint32 precision)40a0ba79fbSJohn Scipione virtual void SetPrecision(uint32 precision) { fPrecision = precision; }; 41a0ba79fbSJohn Scipione MinValue()42a0ba79fbSJohn Scipione double MinValue() const { return fMinValue; } 43a0ba79fbSJohn Scipione virtual void SetMinValue(double min); 44a0ba79fbSJohn Scipione MaxValue()45*3705d40cSJohn Scipione double MaxValue() const { return fMaxValue; } 46*3705d40cSJohn Scipione virtual void SetMaxValue(double max); 47*3705d40cSJohn Scipione 48a0ba79fbSJohn Scipione void Range(double* min, double* max); 49a0ba79fbSJohn Scipione virtual void SetRange(double min, double max); 50a0ba79fbSJohn Scipione Step()51a0ba79fbSJohn Scipione double Step() const { return fStep; } SetStep(double step)52a0ba79fbSJohn Scipione virtual void SetStep(double step) { fStep = step; }; 53a0ba79fbSJohn Scipione Value()54a0ba79fbSJohn Scipione double Value() const { return fValue; }; 55a0ba79fbSJohn Scipione virtual void SetValue(int32 value); 56a0ba79fbSJohn Scipione virtual void SetValue(double value); 57a0ba79fbSJohn Scipione virtual void SetValueFromText(); 58a0ba79fbSJohn Scipione 59a0ba79fbSJohn Scipione private: 60a0ba79fbSJohn Scipione // FBC padding 61a0ba79fbSJohn Scipione virtual void _ReservedDecimalSpinner20(); 62a0ba79fbSJohn Scipione virtual void _ReservedDecimalSpinner19(); 63a0ba79fbSJohn Scipione virtual void _ReservedDecimalSpinner18(); 64a0ba79fbSJohn Scipione virtual void _ReservedDecimalSpinner17(); 65a0ba79fbSJohn Scipione virtual void _ReservedDecimalSpinner16(); 66a0ba79fbSJohn Scipione virtual void _ReservedDecimalSpinner15(); 67a0ba79fbSJohn Scipione virtual void _ReservedDecimalSpinner14(); 68a0ba79fbSJohn Scipione virtual void _ReservedDecimalSpinner13(); 69a0ba79fbSJohn Scipione virtual void _ReservedDecimalSpinner12(); 70a0ba79fbSJohn Scipione virtual void _ReservedDecimalSpinner11(); 71a0ba79fbSJohn Scipione virtual void _ReservedDecimalSpinner10(); 72a0ba79fbSJohn Scipione virtual void _ReservedDecimalSpinner9(); 73a0ba79fbSJohn Scipione virtual void _ReservedDecimalSpinner8(); 74a0ba79fbSJohn Scipione virtual void _ReservedDecimalSpinner7(); 75a0ba79fbSJohn Scipione virtual void _ReservedDecimalSpinner6(); 76a0ba79fbSJohn Scipione virtual void _ReservedDecimalSpinner5(); 77a0ba79fbSJohn Scipione virtual void _ReservedDecimalSpinner4(); 78a0ba79fbSJohn Scipione virtual void _ReservedDecimalSpinner3(); 79a0ba79fbSJohn Scipione virtual void _ReservedDecimalSpinner2(); 80a0ba79fbSJohn Scipione virtual void _ReservedDecimalSpinner1(); 81a0ba79fbSJohn Scipione 82a0ba79fbSJohn Scipione private: 83a0ba79fbSJohn Scipione void _InitObject(); 84a0ba79fbSJohn Scipione 85a0ba79fbSJohn Scipione double fMinValue; 86a0ba79fbSJohn Scipione double fMaxValue; 87a0ba79fbSJohn Scipione double fStep; 88a0ba79fbSJohn Scipione double fValue; 89a0ba79fbSJohn Scipione uint32 fPrecision; 90a0ba79fbSJohn Scipione 91a0ba79fbSJohn Scipione // FBC padding 92a0ba79fbSJohn Scipione uint32 _reserved[20]; 93a0ba79fbSJohn Scipione }; 94a0ba79fbSJohn Scipione 95a0ba79fbSJohn Scipione 96a0ba79fbSJohn Scipione #endif // _DECIMAL_SPINNER_H 97