-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathSSYWrappingCheckbox.h
executable file
·77 lines (60 loc) · 2.27 KB
/
SSYWrappingCheckbox.h
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
#import <Cocoa/Cocoa.h>
/*!
@brief This class provides a checkbox for which text wrapping actually works.
@details Under the hood, uses an NSTextField to replace the title of the checkbox.
*/
@interface SSYWrappingCheckbox : NSControl {
NSTextField* m_textField ;
NSButton* m_checkbox ;
CGFloat m_maxWidth ;
}
/*!
@brief The text-wrapping label field to the right of the checkbox,
which replaces its title.
@details Since self retains this as a subview, we only need a weak,
i.e. (assign) reference
*/
@property (assign) NSTextField* textField ;
/*!
@brief The NSButton which does the work, except that its title
is not used.
@details Since self retains this as a subview, we only need a weak,
i.e. (assign) reference
*/
@property (assign) NSButton* checkbox ;
/*!
@brief The maximum width allowed for the receiver, which is
enforced by text-wrapping the title.
@details
*/
@property (assign) CGFloat maxWidth ;
/*!
@brief The state of the receiver's checkbox
*/
@property (assign) NSCellStateValue state ;
/*!
@brief Designated initializer for SSYWrappingCheckbox.
@param title The text value of the <i>label</i> which will appear to the
right of the checkbox in the returned instance, where its title would normally be.
@param maxWidth The maximum width that the returned view will be.
*/
- (id)initWithTitle:(NSString*)title
maxWidth:(CGFloat)maxWidth ;
/*!
@brief Convenience method for getting an autoreleased instance of this class.
@param title The text value of the <i>label</i> which will appear to the
right of the checkbox in the returned instance, where its title would normally be.
@param maxWidth The maximum width that the returned view will be.
@result The instance, autoreleased
*/
+ (SSYWrappingCheckbox*)wrappingCheckboxWithTitle:(NSString*)title
maxWidth:(CGFloat)width ;
/*!
@brief Resizes the height of the receiver to accomodate the its current values,
subject to allowsShrinking.
@param allowShrinking YES if the height is allowed to be reduced. If this parameter
is NO, and less height than the current height is required, this invocation will not reduce
the height but will instead leave empty space.
*/
- (void)sizeHeightToFitAllowShrinking:(BOOL)allowShrinking ;
@end