summaryrefslogtreecommitdiffstats
path: root/beos/liblayout/SpinButton.h
blob: 3bb00db6952b1d8aae280b39194cf95a6e30ada6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78

#ifndef _SPINBUTTON_H
#define _SPINBUTTON_H

#include <View.h>
#include "layout.h"
#include "HGroup.h"
#include "MTextControl.h"

enum spinmode
{
	SPIN_FLOAT,
	SPIN_INTEGER
};

class NumberTextView;
class TinyButton;
#if __POWERPC__
#pragma warn_hidevirtual off
#endif
class IMPEXPLIBLAYOUT SpinButton: public MView, public MDividable, public BControl
{
	public:
		SpinButton(const char *label,spinmode mode, BHandler *target=NULL);
		virtual ~SpinButton();

		virtual void reloadfont(BFont *font[]);
		virtual minimax layoutprefs();
		virtual BRect layout(BRect);
		
		virtual float LabelWidth();

		virtual void AllAttached();
		virtual void DetachedFromWindow();
		virtual void Draw(BRect);
		virtual void MessageReceived(BMessage *mes);
		virtual void SetEnabled(bool);

		double Increment();
		double Decrement();
		double StepSize();
		void SetStepSize(double step);

		virtual void SetValue(int32 v);
		virtual void SetValue(double v);
		double Value();
		double Maximum();
		void SetMaximum(double max);
		double Minimum();
		void SetMinimum(double min);
		const char * Format() const;
		void SetFormat(const char *f);

	private:
		spinmode mode;
		ulong height;
		TinyButton *tb1,*tb2;
		NumberTextView *tv;		
		long lx,ly;
		void NotifyWorld(BMessage *mes);
		BHandler *target;
		uint32 _expansiondata[4];
};

enum 
{
	M_SPIN_UP='!!up',
	M_SPIN_DOWN='!!dn',
	M_SPIN_TICK='!spn'
};

extern const IMPEXPLIBLAYOUT char M_RELEASE[];

#if __POWERPC__
#pragma warn_hidevirtual on
#endif

#endif