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