DecimalSpinner.h revision a0ba79fb
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
15class BDecimalSpinner : public BAbstractSpinner {
16public:
17								BDecimalSpinner(BRect frame, const char* name,
18									const char* label, BMessage* message,
19									uint32 resizingMode = B_FOLLOW_LEFT | B_FOLLOW_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
39			uint32				Precision() const { return fPrecision; };
40	virtual	void				SetPrecision(uint32 precision) { fPrecision = precision; };
41
42			double				MaxValue() const { return fMaxValue; }
43	virtual	void				SetMaxValue(double max);
44
45			double				MinValue() const { return fMinValue; }
46	virtual	void				SetMinValue(double min);
47
48			void				Range(double* min, double* max);
49	virtual	void				SetRange(double min, double max);
50
51			double				Step() const { return fStep; }
52	virtual	void				SetStep(double step) { fStep = step; };
53
54			double				Value() const { return fValue; };
55	virtual	void				SetValue(int32 value);
56	virtual	void				SetValue(double value);
57	virtual	void				SetValueFromText();
58
59private:
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
82private:
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