summaryrefslogtreecommitdiffstats
path: root/beos/liblayout/PropGadget.h
blob: 81a3f1f9bd32496339d5ae587efd58fe673c716e (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

#ifndef _PROPGADGET
#define _PROPGADGET
#include "layout.h"
#include <Control.h>
#include <Bitmap.h>

class IMPEXPLIBLAYOUT PropGadget;

typedef void (*propgadget_hook)(PropGadget*, void*, double, double);

#if __POWERPC__
#pragma simple_class_byval off
#endif

class PropGadget : public MView, public BControl
{
	public:		PropGadget(double xprop, double xval, double yprop, double yval,
					BBitmap *knobimage=NULL,
					 propgadget_hook=NULL,
					 void *callbackarg=NULL,
					 long extraspacing=0);
				PropGadget(BMessage*);
				virtual ~PropGadget();
				virtual long Archive(BMessage *archive, bool deep=true) const;
				static BArchivable *Instantiate(BMessage *archive);

				BBitmap*	Pknob;

				virtual	void	Draw(BRect);
				virtual void	AttachedToWindow();
				virtual void	DetachedFromWindow();
				virtual void	MouseDown(BPoint);

				void			SetProportion(double, double);
				void			SetProportionNoDraw(double,double);
				virtual void	SetValues(double,double);
				void			SetValuesNoDraw(double,double);
				virtual void	FrameResized(float,float);
				void			ReDraw();
				inline double	Hval() {return hval;}
				inline double	Vval() {return 1.0-vval;}

				virtual	minimax	layoutprefs();
				virtual BRect	layout(BRect rect);
				virtual void	setcolor(rgb_color col, bool deep=false);
				virtual void	DrawContainer(BRect);
				virtual void	DrawKnob(BRect);
				virtual void	KeyDown(const char *bytes, int32 numbytes);
						bool	IsBusy();

	private:	virtual void _expansionpropgadget1(); 
				virtual void _expansionpropgadget2(); 

				thread_id mousethread;
				BPoint	clickpoint;
				BRect	lastknobrect;
				bool	_isbusy;
				bool	vertical;
				bool	horizontal;

				double	hprop;
				double	hval;
				double	vprop;
				double	vval;
				void	(*callback)(PropGadget*,void*,double,double);
				void	*callbackarg;
				long	borderspacing;

				static	long	_mousetracker(void *arg);
						void	_MouseTracker();

				uint32  _expansiondata[2];
};
#endif