xref: /haiku/headers/os/interface/ChannelSlider.h (revision 2f86ba45579bdc9648b232175f87edc62ab71b54)
1d734a8ceSbeveloper /*******************************************************************************
2d734a8ceSbeveloper /
3d734a8ceSbeveloper /	File:			ChannelSlider.h
4d734a8ceSbeveloper /
5d734a8ceSbeveloper /   Description:    BChannelSlider implements a slider which can have a number
6d734a8ceSbeveloper /					of (on-screen) related values. A typical use is for a stereo
7d734a8ceSbeveloper /					volume control.
8d734a8ceSbeveloper /
9d734a8ceSbeveloper /	Copyright 1998-99, Be Incorporated, All Rights Reserved
10d734a8ceSbeveloper /
11d734a8ceSbeveloper *******************************************************************************/
12d734a8ceSbeveloper 
13e6753e37SKarsten Heimrich #ifndef _CHANNEL_SLIDER_H
14d734a8ceSbeveloper #define _CHANNEL_SLIDER_H
15d734a8ceSbeveloper 
16e6753e37SKarsten Heimrich 
17d734a8ceSbeveloper #include <ChannelControl.h>
18d734a8ceSbeveloper 
19e6753e37SKarsten Heimrich 
20*2f86ba45SStephan Aßmus class BChannelSlider : public BChannelControl {
21d734a8ceSbeveloper public:
22e6753e37SKarsten Heimrich 								BChannelSlider(BRect area, const char* name,
23e6753e37SKarsten Heimrich 									const char* label, BMessage* message,
24d734a8ceSbeveloper 									int32 channels = 1,
25*2f86ba45SStephan Aßmus 									uint32 resizeMode
26*2f86ba45SStephan Aßmus 										= B_FOLLOW_LEFT | B_FOLLOW_TOP,
27d734a8ceSbeveloper 									uint32 flags = B_WILL_DRAW);
28e6753e37SKarsten Heimrich 								BChannelSlider(BRect area, const char* name,
29e6753e37SKarsten Heimrich 									const char* label, BMessage* message,
30*2f86ba45SStephan Aßmus 									enum orientation orientation,
31*2f86ba45SStephan Aßmus 									int32 channels = 1,
32*2f86ba45SStephan Aßmus 									uint32 resizeMode
33*2f86ba45SStephan Aßmus 										= B_FOLLOW_LEFT | B_FOLLOW_TOP,
34*2f86ba45SStephan Aßmus 									uint32 flags = B_WILL_DRAW);
35*2f86ba45SStephan Aßmus 								BChannelSlider(const char* name,
36*2f86ba45SStephan Aßmus 									const char* label, BMessage* message,
37*2f86ba45SStephan Aßmus 									enum orientation orientation,
38*2f86ba45SStephan Aßmus 									int32 channels = 1,
39d734a8ceSbeveloper 									uint32 flags = B_WILL_DRAW);
40e6753e37SKarsten Heimrich 								BChannelSlider(BMessage* archive);
41d734a8ceSbeveloper 	virtual						~BChannelSlider();
42d734a8ceSbeveloper 
43d734a8ceSbeveloper 	static	BArchivable*		Instantiate(BMessage* from);
44d734a8ceSbeveloper 	virtual	status_t			Archive(BMessage* into, bool deep = true) const;
45d734a8ceSbeveloper 
46d734a8ceSbeveloper 	virtual	orientation			Orientation() const;
47*2f86ba45SStephan Aßmus 			void				SetOrientation(enum orientation orientation);
48d734a8ceSbeveloper 
49d734a8ceSbeveloper 	virtual	int32				MaxChannelCount() const;
50d734a8ceSbeveloper 	virtual	bool				SupportsIndividualLimits() const;
51d734a8ceSbeveloper 
52d734a8ceSbeveloper 	virtual	void				AttachedToWindow();
53d734a8ceSbeveloper 	virtual	void				AllAttached();
54d734a8ceSbeveloper 	virtual	void				DetachedFromWindow();
55d734a8ceSbeveloper 	virtual	void				AllDetached();
56d734a8ceSbeveloper 
57*2f86ba45SStephan Aßmus 	virtual	void				MessageReceived(BMessage* message);
58d734a8ceSbeveloper 
59d734a8ceSbeveloper 	virtual	void				Draw(BRect area);
60d734a8ceSbeveloper 	virtual	void				MouseDown(BPoint where);
61*2f86ba45SStephan Aßmus 	virtual	void				MouseUp(BPoint where);
62*2f86ba45SStephan Aßmus 	virtual	void				MouseMoved(BPoint where, uint32 transit,
63*2f86ba45SStephan Aßmus 									const BMessage* dragMessage);
64d734a8ceSbeveloper 	virtual	void				WindowActivated(bool state);
65d734a8ceSbeveloper 	virtual	void				KeyDown(const char* bytes, int32 numBytes);
66d734a8ceSbeveloper 	virtual	void				KeyUp(const char* bytes, int32 numBytes);
67d734a8ceSbeveloper 	virtual	void				FrameResized(float width, float height);
68d734a8ceSbeveloper 
69*2f86ba45SStephan Aßmus 	virtual	void				SetFont(const BFont* font,
70*2f86ba45SStephan Aßmus 									uint32 mask = B_FONT_ALL);
71d734a8ceSbeveloper 	virtual	void				MakeFocus(bool focusState = true);
72d734a8ceSbeveloper 
73d734a8ceSbeveloper 	virtual	void				SetEnabled(bool on);
74d734a8ceSbeveloper 
75*2f86ba45SStephan Aßmus 	virtual	void				GetPreferredSize(float* _width, float* _height);
76d734a8ceSbeveloper 
77*2f86ba45SStephan Aßmus 	virtual	BHandler*			ResolveSpecifier(BMessage* message, int32 index,
78*2f86ba45SStephan Aßmus 									BMessage* specifier, int32 form,
79*2f86ba45SStephan Aßmus 									const char* p);
80d734a8ceSbeveloper 	virtual	status_t			GetSupportedSuites(BMessage* data);
81d734a8ceSbeveloper 
82d734a8ceSbeveloper 							// Perform rendering for an entire slider channel.
83e6753e37SKarsten Heimrich virtual	void				DrawChannel(BView* into, int32 channel, BRect area,
84d734a8ceSbeveloper 								bool pressed);
85d734a8ceSbeveloper 
86e6753e37SKarsten Heimrich 							// Draw groove that appears behind a channel's thumb.
87e6753e37SKarsten Heimrich virtual	void				DrawGroove(BView* into, int32 channel, BPoint lt,
88d734a8ceSbeveloper 								BPoint br);
89d734a8ceSbeveloper 
90d734a8ceSbeveloper 							// Draw the thumb for a single channel.
91e6753e37SKarsten Heimrich virtual	void				DrawThumb(BView* into, int32 channel, BPoint where,
92d734a8ceSbeveloper 								bool pressed);
93d734a8ceSbeveloper 
94d734a8ceSbeveloper virtual	const BBitmap*		ThumbFor(int32 channel, bool pressed);
95d734a8ceSbeveloper virtual	BRect				ThumbFrameFor(int32 channel);
96d734a8ceSbeveloper virtual	float				ThumbDeltaFor(int32 channel);
97d734a8ceSbeveloper virtual	float				ThumbRangeFor(int32 channel);
98d734a8ceSbeveloper 
99d734a8ceSbeveloper private:
100e6753e37SKarsten Heimrich 							BChannelSlider(const BChannelSlider &);
101e6753e37SKarsten Heimrich 							BChannelSlider& operator=(const BChannelSlider &);
102d734a8ceSbeveloper 
103d734a8ceSbeveloper 
1047f347940SAxel Dörfler virtual	void				_Reserved_BChannelSlider_0(void* , ...);
1057f347940SAxel Dörfler virtual	void				_Reserved_BChannelSlider_1(void* , ...);
1067f347940SAxel Dörfler virtual	void				_Reserved_BChannelSlider_2(void* , ...);
1077f347940SAxel Dörfler virtual	void				_Reserved_BChannelSlider_3(void* , ...);
1087f347940SAxel Dörfler virtual	void				_Reserved_BChannelSlider_4(void* , ...);
1097f347940SAxel Dörfler virtual	void				_Reserved_BChannelSlider_5(void* , ...);
1107f347940SAxel Dörfler virtual	void				_Reserved_BChannelSlider_6(void* , ...);
1117f347940SAxel Dörfler virtual	void				_Reserved_BChannelSlider_7(void* , ...);
112d734a8ceSbeveloper 
113422c0791SStefano Ceccherini 		float				fBaseLine;
114422c0791SStefano Ceccherini 		float				fLineFeed;
115422c0791SStefano Ceccherini 		BBitmap*			fLeftKnob;
116422c0791SStefano Ceccherini 		BBitmap*			fMidKnob;
117422c0791SStefano Ceccherini 		BBitmap*			fRightKnob;
118422c0791SStefano Ceccherini 		BBitmap*			fBacking;
119422c0791SStefano Ceccherini 		BView*				fBackingView;
120422c0791SStefano Ceccherini 		bool				fVertical;
121422c0791SStefano Ceccherini 		bool				fPadding[3];
122422c0791SStefano Ceccherini 		BPoint				fClickDelta;
123d734a8ceSbeveloper 
124d734a8ceSbeveloper 		int32				fCurrentChannel;
125d734a8ceSbeveloper 		bool				fAllChannels;
126d734a8ceSbeveloper 		int32*				fInitialValues;
127d734a8ceSbeveloper 		float				fMinpoint;
128d734a8ceSbeveloper 		int32				fFocusChannel;
129d734a8ceSbeveloper 
130d734a8ceSbeveloper 		uint32				_reserved_[12];
131d734a8ceSbeveloper 
132e6753e37SKarsten Heimrich 		void				_InitData();
133310177b4SRene Gollent 		void				_FinishChange(bool update = false);
134e6753e37SKarsten Heimrich 		void				_UpdateFontDimens();
135e6753e37SKarsten Heimrich 		void				_DrawThumbs();
136e6753e37SKarsten Heimrich 		void				_DrawGrooveFrame(BView* where, const BRect& area);
137e6753e37SKarsten Heimrich 		bool				_Vertical() const;
138e6753e37SKarsten Heimrich 		void				_Redraw();
139e6753e37SKarsten Heimrich 		void				_MouseMovedCommon(BPoint point, BPoint point2);
140d734a8ceSbeveloper };
141d734a8ceSbeveloper 
142d734a8ceSbeveloper 
143d734a8ceSbeveloper #endif /* _CHANNEL_SLIDER_H */
144