-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathSSYToolbarButton.h
More file actions
140 lines (116 loc) · 4.12 KB
/
SSYToolbarButton.h
File metadata and controls
140 lines (116 loc) · 4.12 KB
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
#import <Cocoa/Cocoa.h>
/*!
@brief A toolbar item which has a tristate 'value' attribute,
and three each additional images, labels and tooltips which
replace super's image, label and tooltip when the value is changed,
and/or may be configured to flash when clicked.
@details
*/
@interface SSYToolbarButton : NSToolbarItem {
NSInteger m_value ;
NSImage* m_onImage ;
NSImage* m_offImage ;
NSImage* m_disImage ;
NSImage* m_backgroundImage;
NSImage* m_originalImage ;
NSString* m_onLabel ;
NSString* m_offLabel ;
NSString* m_disLabel ;
NSString* m_onToolTip ;
NSString* m_offToolTip ;
NSString* m_disToolTip ;
id m_externalTarget ;
SEL m_externalAction ;
NSTimeInterval m_flashDuration ;
NSTimer* m_flashTimer ;
}
/*!
@brief An internal variable, generally NSControlStateValueOn,
NSControlStateValueOff or NSControlStateValueMixed.
@details This is KVO-compliant and is also exposed as a binding.
*/
@property (assign) NSInteger value ;
/*!
@brief The image that will be displayed when the receiver's value is
NSControlStateValueOn.
*/
@property (retain) NSImage* onImage ;
/*!
@brief The image that will be displayed when the receiver's value is
NSControlStateValueOn.
*/
@property (retain) NSImage* offImage ;
/*!
@brief The image that will be displayed when the receiver's value is
NSControlStateValueMixed.
*/
@property (retain) NSImage* disImage ;
/*!
@brief An image that will always be displayed regardless of the receiver's
value.
*/
@property (retain) NSImage* backgroundImage;
/*!
@brief The string that will be displayed under the button
when the receiver's value is set to NSControlStateValueOn. This value
defaults to nil, and if it is nil when the receiver's value
is changed to this state, the label does not change. Thus,
for a fixed, constant label, use super's -setLabel:
*/
@property (retain) NSString* onLabel ;
/*!
@brief The string that will be displayed under the button
when the receiver's value is set to NSControlStateValueOn. This value
defaults to nil, and if it is nil when the receiver's value
is changed to this state, the label does not change. Thus,
for a fixed, constant label, use super's -setLabel:
*/
@property (retain) NSString* offLabel ;
/*!
@brief The string that will be displayed under the button
when the receiver's value is set to NSControlStateValueMixed. This value
defaults to nil, and if it is nil when the receiver's value
is changed to this state, the label does not change. Thus,
for a fixed, constant label, use super's -setLabel:
*/
@property (retain) NSString* disLabel ;
/*!
@brief The receiver's toolTip
when the receiver's value is set to NSControlStateValueOn. This value
defaults to nil, and if it is nil when the receiver's value
is changed to this state, the label does not change. Thus,
for a fixed, constant toolTip, use super's -setToolTip:
*/
@property (retain) NSString* onToolTip ;
/*!
@brief The receiver's toolTip
when the receiver's value is set to NSControlStateValueOn. This value
defaults to nil, and if it is nil when the receiver's value
is changed to this state, the label does not change. Thus,
for a fixed, constant toolTip, use super's -setToolTip:
*/
@property (retain) NSString* offToolTip ;
/*!
@brief The receiver's toolTip
when the receiver's value is set to NSControlStateValueMixed. This value
defaults to nil, and if it is nil when the receiver's value
is changed to this state, the label does not change. Thus,
for a fixed, constant toolTip, use super's -setToolTip:
*/
@property (retain) NSString* disToolTip ;
/*!
@brief Duration for which the receiver shall flash when it is clicked
@details The default value is 0 (no flash)
*/
@property (assign) NSTimeInterval flashDuration ;
@end
@interface SSYToolbarButtonView : NSView
@property (weak) SSYToolbarButton* toolbarItem;
/*!
@brief Workaround for the fact that intrinsicContentSize is not a property
of NSToolbarItem
@details Oddly, although it does not change the size, this value affects
the centering of the image in macOS 10.11.
*/
@property (assign) NSSize ssyIntrinsicContentSize ;
@end