1/*
2 * Copyright 2009-2015, Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef _CHANNEL_SLIDER_H
6#define _CHANNEL_SLIDER_H
7
8
9#include <ChannelControl.h>
10
11
12class BChannelSlider : public BChannelControl {
13public:
14								BChannelSlider(BRect area, const char* name,
15									const char* label, BMessage* message,
16									int32 channels = 1,
17									uint32 resizeMode = B_FOLLOW_LEFT_TOP,
18									uint32 flags = B_WILL_DRAW);
19								BChannelSlider(BRect area, const char* name,
20									const char* label, BMessage* message,
21									orientation orientation,
22									int32 channels = 1,
23									uint32 resizeMode = B_FOLLOW_LEFT_TOP,
24									uint32 flags = B_WILL_DRAW);
25								BChannelSlider(const char* name,
26									const char* label, BMessage* message,
27									orientation orientation,
28									int32 channels = 1,
29									uint32 flags = B_WILL_DRAW);
30								BChannelSlider(BMessage* archive);
31	virtual						~BChannelSlider();
32
33	static	BArchivable*		Instantiate(BMessage* from);
34	virtual	status_t			Archive(BMessage* into,
35									bool deep = true) const;
36
37	virtual	void				AttachedToWindow();
38	virtual	void				AllAttached();
39	virtual	void				DetachedFromWindow();
40	virtual	void				AllDetached();
41
42	virtual	void				MessageReceived(BMessage* message);
43
44	virtual	void				Draw(BRect updateRect);
45	virtual	void				MouseDown(BPoint where);
46	virtual	void				MouseUp(BPoint where);
47	virtual	void				MouseMoved(BPoint where, uint32 transit,
48									const BMessage* dragMessage);
49	virtual	void				WindowActivated(bool state);
50	virtual	void				KeyDown(const char* bytes, int32 numBytes);
51	virtual	void				KeyUp(const char* bytes, int32 numBytes);
52	virtual	void				FrameResized(float width, float height);
53
54	virtual	void				SetFont(const BFont* font,
55									uint32 mask = B_FONT_ALL);
56	virtual	void				MakeFocus(bool focusState = true);
57
58	virtual	void				GetPreferredSize(float* _width, float* _height);
59
60	virtual	BHandler*			ResolveSpecifier(BMessage* message,
61									int32 index, BMessage* specifier,
62									int32 form, const char* property);
63	virtual	status_t			GetSupportedSuites(BMessage* data);
64
65	virtual	void				SetEnabled(bool on);
66
67	virtual	orientation			Orientation() const;
68			void				SetOrientation(orientation orientation);
69
70	virtual	int32				MaxChannelCount() const;
71	virtual	bool				SupportsIndividualLimits() const;
72
73	virtual	void				DrawChannel(BView* into, int32 channel,
74									BRect area, bool pressed);
75
76	virtual	void				DrawGroove(BView* into, int32 channel,
77									BPoint leftTop, BPoint rightBottom);
78
79	virtual	void				DrawThumb(BView* into, int32 channel,
80									BPoint where, bool pressed);
81
82	virtual	const BBitmap*		ThumbFor(int32 channel, bool pressed);
83	virtual	BRect				ThumbFrameFor(int32 channel);
84	virtual	float				ThumbDeltaFor(int32 channel);
85	virtual	float				ThumbRangeFor(int32 channel);
86
87private:
88	// FBC padding
89								BChannelSlider(const BChannelSlider&);
90			BChannelSlider&		operator=(const BChannelSlider&);
91
92
93	virtual	void				_Reserved_BChannelSlider_0(void*, ...);
94	virtual	void				_Reserved_BChannelSlider_1(void*, ...);
95	virtual	void				_Reserved_BChannelSlider_2(void*, ...);
96	virtual	void				_Reserved_BChannelSlider_3(void*, ...);
97	virtual	void				_Reserved_BChannelSlider_4(void*, ...);
98	virtual	void				_Reserved_BChannelSlider_5(void*, ...);
99	virtual	void				_Reserved_BChannelSlider_6(void*, ...);
100	virtual	void				_Reserved_BChannelSlider_7(void*, ...);
101
102private:
103			void				_InitData();
104			void				_FinishChange(bool update = false);
105			void				_UpdateFontDimens();
106			void				_DrawThumbs();
107			void				_DrawGrooveFrame(BView* where,
108									const BRect& area);
109			void				_MouseMovedCommon(BPoint point, BPoint point2);
110
111private:
112			float				fBaseLine;
113			float				fLineFeed;
114			BBitmap*			fLeftKnob;
115			BBitmap*			fMidKnob;
116			BBitmap*			fRightKnob;
117			BBitmap*			fBacking;
118			BView*				fBackingView;
119			bool				fIsVertical;
120			bool				_padding_[3];
121			BPoint				fClickDelta;
122
123			int32				fCurrentChannel;
124			bool				fAllChannels;
125			int32*				fInitialValues;
126			float				fMinPoint;
127			int32				fFocusChannel;
128
129			uint32				_reserved_[12];
130};
131
132
133#endif // _CHANNEL_SLIDER_H
134