File: SMDoubleSlider.h

package info (click to toggle)
lynkeos.app 3.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,740 kB
  • sloc: objc: 40,528; ansic: 811; cpp: 150; sh: 68; makefile: 27
file content (207 lines) | stat: -rw-r--r-- 11,424 bytes parent folder | download | duplicates (5)
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
/*!	@header	SMDoubleSlider.h
    @discussion
    This is a NSSlider subclass that supports two knobs - a low value and a high value.  Almost all of
    the methods in this class are simply cover methods for the identically named SMDoubleSliderCell methods.

SMDoubleSlider Copyright (c) 2003-2008, Snowmint Creative Solutions LLC http://www.snowmintcs.com/
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
 Neither the name of Snowmint Creative Solutions LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#import <AppKit/AppKit.h>

/*!	@class	SMDoubleSlider
    @discussion	This subclass of NSSlider has two knobs - a low knob and a high knob.  The user
                can set either knob in the range of the slider, as long as the low knob is always lower
                in value than the high knob.
*/
@interface SMDoubleSlider : NSSlider
{
}

/*!	@method		trackingLoKnob
    @discussion	Are we tracking on the low knob or the high knob?  The end user can change this by clicking on
                one knob or the other, or by using the tab key to cycle through the knobs.

                The standard methods -doubleValue, -intValue, -setDoubleValue:, -setIntValue: etc. will
                all use either the low or the high knob depending on this setting.
    @result	YES if the double slider is tracking on the low knob.
*/
- (BOOL)trackingLoKnob;
/*!	@method		setTrackingLoKnob:
    @discussion	Are we tracking on the low knob or the high knob?  Note that the end user can change this by
                clicking on one knob or the other, or by using the tab key to cycle through the knobs.

                The standard methods -doubleValue, -intValue, -setDoubleValue:, -setIntValue: etc. will
                all use either the low or the high knob depending on this setting.
    @param	inValue		YES if you want to track on the low knob.
*/
- (void)setTrackingLoKnob:(BOOL)inValue;

/*!	@method		lockedSliders
    @discussion	Determine if the two sliders are locked together.  The low and high knobs will always have
                the same value if this is true.  The end user can not change this setting at run time.

                <b>NOTE: This value is currently saved, but the locking behavior is unimplemented.</b>
    @result	YES if the two knobs are locked together.
*/
- (BOOL)lockedSliders;
/*!	@method		setLockedSliders:
    @discussion	Lock the two sliders together, so it functions just like a normal NSSlider.  The low and high
                knobs will have the same value.  The end user can not change this setting at run time.

                The low knob value gets set to the high knob value immediately.

                <b>NOTE: This value is currently saved, but the locking behavior is unimplemented.</b>
    @param	inLocked	YES if you want to lock the two knobs together.
*/
- (void)setLockedSliders:(BOOL)inLocked;

/*!	@method	setObjectHiValue:
    @discussion	Sets the receiver's object value to object.
                The value is pinned between the low knob and maximum slider values.
    @param	obj		An object containing a numeric value.
*/
- (void)setObjectHiValue:(id)obj;
/*!	@method	setStringHiValue:
    @discussion Sets the high knob value of the receiver to aString. In its implementation, this method invokes
                setObjectValue:. If no formatter is assigned to the receiver, or if the formatter cannot
                "translate" aString to an underlying object, the receiver is flagged as having an invalid
                object.
                The value is pinned between the low knob and maximum slider values.
    @param	aString		Should be a string containing a number.
*/
- (void)setStringHiValue:(NSString *)aString;
/*!	@method	setIntHiValue:
    @discussion	Sets the high knob value of the receiver to an object anInt, representing an integer value.
                In its implementation, this method invokes setObjectValue:.
                The value is pinned between the low knob and maximum slider values.
    @param	anInt		An integer to set the high knob value to.
*/
- (void)setIntHiValue:(int)anInt;
/*!	@method	setFloatHiValue:
    @discussion	Sets the high knob value of the receiver to an object aFloat, representing a float value.
                In its implementation, this method invokes setObjectValue:.
                The value is pinned between the low knob and maximum slider values.
    @param	aFloat		An floating point number to set the high knob value to.
*/
- (void)setFloatHiValue:(float)aFloat;
/*!	@method	setDoubleHiValue:
    @discussion	Sets the high knob value of the receiver to an object aDouble, representing a double value.
                In its implementation, this method invokes setObjectValue:.
                The value is pinned between the low knob and maximum slider values.
    @param	aDouble		An double precision number to set the high knob value to.
*/
- (void)setDoubleHiValue:(double)aDouble;
/*!	@method	objectHiValue
    @discussion Returns the receiver's high knob value as an Objective-C object if a valid object has been
                associated with the receiver; otherwise, returns nil. To be valid, the receiver must
                have a formatter capable of converting the object to and from its textual representation.
    @result		The receiver's high knob value as an Objective-C object.
*/
- (id)objectHiValue;
/*!	@method	stringHiValue
    @discussion Returns the receiver's high knob value as an NSString as converted by the receiver's
                formatter, if one exists. If no formatter exists and the value is an NSString, returns the
                value as aa plain, attributed, or localized formatted string. If the value is not an NSString
                or can't be converted to one, returns an empty string.
    @result		The receiver's high knob value as an NSString object.
*/
- (NSString *)stringHiValue;
/*!	@method intHiValue
    @discussion	Returns the receiver's high knob value as an int.
    @result		The receiver's high knob value as an int.
*/
- (int)intHiValue;
/*!	@method floatHiValue
    @discussion	Returns the receiver's high knob value as a float.
    @result		The receiver's high knob value as a float.
*/
- (float)floatHiValue;
/*!	@method doubleHiValue
    @discussion	Returns the receiver's high knob value as a double.
    @result		The receiver's high knob value as a double.
*/
- (double)doubleHiValue;

/*!	@method	setObjectLoValue:
    @discussion	Sets the receiver's object value to object.
                The value is pinned between the low knob and maximum slider values.
    @param	obj		An object containing a numeric value.
*/
- (void)setObjectLoValue:(id)obj;
/*!	@method	setStringLoValue:
    @discussion Sets the low knob value of the receiver to aString. In its implementation, this method invokes
                setObjectValue:. If no formatter is assigned to the receiver, or if the formatter cannot
                "translate" aString to an underlying object, the receiver is flagged as having an invalid
                object.
                The value is pinned between the minimum and high knob slider values.
    @param	aString		Should be a string containing a number.
*/
- (void)setStringLoValue:(NSString *)aString;
/*!	@method	setIntLoValue:
    @discussion	Sets the low knob value of the receiver to an object anInt, representing an integer value.
                In its implementation, this method invokes setObjectValue:.
                The value is pinned between the minimum and high knob slider values.
    @param	anInt		An integer to set the low knob value to.
*/
- (void)setIntLoValue:(int)anInt;
/*!	@method	setFloatLoValue:
    @discussion	Sets the low knob value of the receiver to an object aFloat, representing a float value.
                In its implementation, this method invokes setObjectValue:.
                The value is pinned between the minimum and high knob slider values.
    @param	aFloat		An floating point number to set the low knob value to.
*/
- (void)setFloatLoValue:(float)aFloat;
/*!	@method	setDoubleLoValue:
    @discussion	Sets the low knob value of the receiver to an object aDouble, representing a double value.
                In its implementation, this method invokes setObjectValue:.
                The value is pinned between the minimum and high knob slider values.
    @param	aDouble		An double precision number to set the low knob value to.
*/
- (void)setDoubleLoValue:(double)aDouble;
/*!	@method	objectLoValue
    @discussion Returns the receiver's low knob value as an Objective-C object if a valid object has been
                associated with the receiver; otherwise, returns nil. To be valid, the receiver must
                have a formatter capable of converting the object to and from its textual representation.
    @result		The receiver's low knob value as an Objective-C object.
*/
- (id)objectLoValue;
/*!	@method	stringLoValue
    @discussion Returns the receiver's low knob value as an NSString as converted by the receiver's
                formatter, if one exists. If no formatter exists and the value is an NSString, returns the
                value as aa plain, attributed, or localized formatted string. If the value is not an NSString
                or can't be converted to one, returns an empty string.
    @result		The receiver's low knob value as an NSString object.
*/
- (NSString *)stringLoValue;
/*!	@method intLoValue
    @discussion	Returns the receiver's low knob value as an int.
    @result		The receiver's low knob value as an int.
*/
- (int)intLoValue;
/*!	@method floatLoValue
    @discussion	Returns the receiver's low knob value as a float.
    @result		The receiver's low knob value as a float.
*/
- (float)floatLoValue;
/*!	@method doubleLoValue
    @discussion	Returns the receiver's low knob value as a double.
    @result		The receiver's low knob value as a double.
*/
- (double)doubleLoValue;

@end

// These are private API to be used only by NSDoubleSliderCell
@interface SMDoubleSlider(Private)
- (void)updateBoundControllerHiValue:(double)val;
- (void)updateBoundControllerLoValue:(double)val;
@end