xref: /haiku/headers/os/interface/ChannelControl.h (revision 2f470aec1c92ce6917b8a903e343795dc77af41f)
1 /*******************************************************************************
2 /
3 /	File:			ChannelControl.h
4 /
5 /   Description:    BChannelControl is the base class for controls that
6 /					have several independent values, with minima and maxima.
7 /
8 /	Copyright 1998-99, Be Incorporated, All Rights Reserved
9 /
10 *******************************************************************************/
11 
12 #if !defined(_CHANNEL_CONTROL_H)
13 #define _CHANNEL_CONTROL_H
14 
15 #include <Control.h>
16 #include <String.h>
17 
18 class BChannelControl :
19 	public BControl
20 {
21 public:
22 							BChannelControl(
23 									BRect frame,
24 									const char * name,
25 									const char * label,
26 									BMessage * model,
27 									int32 channel_count = 1,
28 									uint32 resize = B_FOLLOW_LEFT | B_FOLLOW_TOP,
29 									uint32 flags = B_WILL_DRAW);
30 							BChannelControl(
31 									BMessage * from);
32 virtual						~BChannelControl();
33 virtual	status_t			Archive(
34 									BMessage * into,
35 									bool deep = true) const;
36 
37 virtual	void				Draw(
38 									BRect area) = 0;
39 virtual	void				MouseDown(
40 									BPoint where) = 0;
41 virtual	void				KeyDown(
42 									const char * bytes,
43 									int32 size) = 0;
44 
45 virtual	void				FrameResized(
46 									float width,
47 									float height);
48 virtual	void				SetFont(
49 									const BFont * font,
50 									uint32 mask = B_FONT_ALL);
51 
52 virtual	void				AttachedToWindow();
53 virtual	void				DetachedFromWindow();
54 virtual	void				ResizeToPreferred();
55 virtual	void				GetPreferredSize(
56 									float * width,
57 									float * height) = 0;
58 virtual	void				MessageReceived(
59 									BMessage * message);
60 
61 virtual BHandler			*ResolveSpecifier(BMessage *msg,
62 									int32 index,
63 									BMessage *specifier,
64 									int32 form,
65 									const char *property);
66 virtual status_t			GetSupportedSuites(BMessage *data);
67 
68 virtual	void				SetModificationMessage(
69 									BMessage *message);
70 		BMessage			*ModificationMessage() const;
71 
72 virtual	status_t			Invoke(BMessage *msg = NULL);
73 
74 // Perform a full-fledged channel invocation.  These methods are
75 // just like Invoke() and InvokeNotify(), but include information
76 // about all of the channels in the control.
77 virtual	status_t			InvokeChannel(BMessage *msg = NULL,
78 										  int32 from_channel = 0,
79 										  int32 channel_count = -1,
80 										  const bool* in_mask = NULL);
81 		status_t			InvokeNotifyChannel(BMessage *msg = NULL,
82 												uint32 kind = B_CONTROL_INVOKED,
83 												int32 from_channel = 0,
84 												int32 channel_count = -1,
85 												const bool* in_mask = NULL);
86 
87 virtual	void				SetValue(		/* SetCurrentChannel() determines which channel */
88 									int32 value);
89 virtual	status_t			SetCurrentChannel(
90 									int32 channel);
91 		int32				CurrentChannel() const;
92 
93 virtual	int32				CountChannels() const;
94 virtual	int32				MaxChannelCount() const = 0;
95 virtual	status_t			SetChannelCount(
96 									int32 channel_count);
97 		int32				ValueFor(
98 									int32 channel) const;
99 virtual	int32				GetValue(
100 									int32 * out_values,
101 									int32 from_channel,
102 									int32 channel_count) const;
103 		status_t			SetValueFor(
104 									int32 channel,
105 									int32 value);
106 virtual	status_t			SetValue(
107 									int32 from_channel,
108 									int32 channel_count,
109 									const int32 * in_values);
110 		status_t			SetAllValue(
111 									int32 values);
112 		status_t			SetLimitsFor(
113 									int32 channel,
114 									int32 minimum,
115 									int32 maximum);
116 		status_t			GetLimitsFor(
117 									int32 channel,
118 									int32 * minimum,
119 									int32 * maximum)	const ;
120 virtual	status_t			SetLimitsFor(
121 									int32 from_channel,
122 									int32 channel_count,
123 									const int32 * minimum,
124 									const int32 * maximum);
125 virtual	status_t			GetLimitsFor(
126 									int32 from_channel,
127 									int32 channel_count,
128 									int32 * minimum,
129 									int32 * maximum) const;
130 		status_t			SetLimits(
131 									int32 minimum,
132 									int32 maximum);
133 		status_t			GetLimits(
134 									int32 * outMinimum,
135 									int32 * outMaximum) const;
136 
137 virtual	bool				SupportsIndividualLimits() const = 0;
138 virtual	status_t			SetLimitLabels(
139 									const char * min_label,
140 									const char * max_label);
141 		const char * 		MinLimitLabel() const;
142 		const char * 		MaxLimitLabel() const;
143 virtual	status_t			SetLimitLabelsFor(
144 									int32 channel,
145 									const char * minLabel,
146 									const char * maxLabel);
147 virtual	status_t			SetLimitLabelsFor(
148 									int32 from_channel,
149 									int32 channel_count,
150 									const char * minLabel,
151 									const char * maxLabel);
152 		const char *		MinLimitLabelFor(
153 									int32 channel) const;
154 		const char *		MaxLimitLabelFor(
155 									int32 channel) const;
156 private:
157 
158 		BChannelControl( /* unimplemented */
159 				const BChannelControl &);
160 		BChannelControl & operator=( /* unimplemented */
161 				const BChannelControl &);
162 virtual	void _Reserverd_ChannelControl_0(void *, ...);
163 virtual	void _Reserverd_ChannelControl_1(void *, ...);
164 virtual	void _Reserverd_ChannelControl_2(void *, ...);
165 virtual	void _Reserverd_ChannelControl_3(void *, ...);
166 virtual	void _Reserverd_ChannelControl_4(void *, ...);
167 virtual	void _Reserverd_ChannelControl_5(void *, ...);
168 virtual	void _Reserverd_ChannelControl_6(void *, ...);
169 virtual	void _Reserverd_ChannelControl_7(void *, ...);
170 virtual	void _Reserverd_ChannelControl_8(void *, ...);
171 virtual	void _Reserverd_ChannelControl_9(void *, ...);
172 virtual	void _Reserverd_ChannelControl_10(void *, ...);
173 virtual	void _Reserverd_ChannelControl_11(void *, ...);
174 
175 protected:
176 
177 		inline int32 * const & MinLimitList() const;
178 		inline int32 * const & MaxLimitList() const;
179 		inline int32 * const & ValueList() const;
180 
181 private:
182 
183 		int32 fChannelCount;
184 		int32 fCurrentChannel;
185 		int32 * fChannelMin;
186 		int32 * fChannelMax;
187 		int32 * fChannelValues;
188 
189 		BString fMinLabel;
190 		BString fMaxLabel;
191 
192 		void * fMultiLabels;
193 
194 		BMessage * fModificationMsg;
195 
196 		uint32 _reserved_[15];
197 
198 		status_t			StuffValues(
199 									int32 from_channel,
200 									int32 channel_count,
201 									const int32 * in_values);
202 };
203 
204 inline int32 * const & BChannelControl::MinLimitList() const
205 {
206 	return fChannelMin;
207 }
208 
209 inline int32 * const & BChannelControl::MaxLimitList() const
210 {
211 	return fChannelMax;
212 }
213 
214 inline int32 * const & BChannelControl::ValueList() const
215 {
216 	return fChannelValues;
217 }
218 
219 
220 #endif /* _CHANNEL_CONTROL_H */
221 
222