@@ -185,10 +185,6 @@ @interface SSYAlert ()
185
185
@end
186
186
187
187
188
- @interface SSYAlertWindow : NSWindow
189
-
190
- @end
191
-
192
188
@implementation SSYAlertWindow
193
189
194
190
/* !
@@ -243,7 +239,26 @@ - (void)setFrameOrigin:(NSPoint)frameOrigin {
243
239
}
244
240
}
245
241
246
- #pragma mark *
242
+ - (NSInteger )checkboxState {
243
+ NSInteger state = NSMixedState ; // default answer in case we can't find checkbox
244
+ BOOL didFindCheckbox = NO ;
245
+ for (NSView * view in [[self contentView ] subviews ]) {
246
+ if ([view isKindOfClass: [SSYWrappingCheckbox class ]]) {
247
+ SSYWrappingCheckbox* checkbox = (SSYWrappingCheckbox*)view ;
248
+ state = [checkbox state ] ;
249
+ didFindCheckbox = YES ;
250
+ break ;
251
+ }
252
+ }
253
+
254
+ if (!didFindCheckbox) {
255
+ NSLog (@" Internal Error 624-9382 %@ %@ " , [self title ], [[self contentView ] subviews ]) ;
256
+ }
257
+
258
+ return state ;
259
+ }
260
+
261
+ #pragma mark *
247
262
248
263
// At one time, I thought that NSWindow's keyboard loop was
249
264
// broken in a programmatically-created window.
@@ -841,48 +856,6 @@ - (void)setSupportEmail {
841
856
}
842
857
}
843
858
844
- // #define DEFAULT_MIN_TEXT_FIELD_WIDTH 250.0
845
- - (void )cleanSlate {
846
- [self setWindowTitle: nil ] ; // Defaults to mainBundle's CFBundleName (which should be the localized name of the app)
847
- [self setShowsProgressBar: NO ] ;
848
- [self setTitleText: nil ] ;
849
- [self setSmallText: nil ] ;
850
- [self setIconStyle: SSYAlertIconNoIcon] ;
851
- [self setButton1Title: nil ] ;
852
- [self setButton2Title: nil ] ;
853
- [self setButton3Title: nil ] ;
854
- [self setHelpAnchor: nil ] ;
855
- [self setCheckboxTitle: nil ] ;
856
- [self setWhyDisabled: nil ] ;
857
- [self removeAllOtherSubviews ] ;
858
-
859
- // The following is a holdover from when SSYAlert support a
860
- // configuration stack, and may no longer be needed...
861
- // Now, there may still be some subviews left in the view...
862
- // The -removeAllOtherSubviews only removed those which are in
863
- // the current self.otherSubviews array. But if the configuration has
864
- // been pushed, self.otherSubviews will be a new, empty array.
865
- // Therefore, we now ask the -contentView if it has any more subviews
866
- // left and if so remove them...
867
- NSView * contentView = [[self window ] contentView ] ;
868
- // We use a regular C loop since -removeFromSuperviewWithoutNeedingDisplay
869
- // mutates the [contentView subviews] and therefore we cannot
870
- // use an enumeration
871
- NSArray * subviews = [contentView subviews ] ;
872
- NSInteger i ;
873
- for (i=[subviews count ]-1 ; i>=0 ; i--) {
874
- NSView * subview = [subviews objectAtIndex: i] ;
875
- [subview removeFromSuperviewWithoutNeedingDisplay ] ;
876
- }
877
-
878
- self.allowsShrinking = YES ;
879
- [self setIsEnabled: YES ] ;
880
- self.isVisible = YES ;
881
- self.progressBarShouldAnimate = NO ;
882
- [self setRightColumnMinimumWidth: 0.0 ] ;
883
- [self setRightColumnMaximumWidth: CGFLOAT_MAX] ;
884
- }
885
-
886
859
- (void )setWindowTitle : (NSString *)title {
887
860
if (!title) {
888
861
title = [[NSBundle mainBundle ] objectForInfoDictionaryKey: @" CFBundleName" ] ; // CFBundleName may be localized
@@ -1200,6 +1173,48 @@ - (void)setCheckboxState:(NSCellStateValue)state {
1200
1173
[[self checkbox ] setState: state] ;
1201
1174
}
1202
1175
1176
+ // #define DEFAULT_MIN_TEXT_FIELD_WIDTH 250.0
1177
+ - (void )cleanSlate {
1178
+ [self setWindowTitle: nil ] ; // Defaults to mainBundle's CFBundleName (which should be the localized name of the app)
1179
+ [self setShowsProgressBar: NO ] ;
1180
+ [self setTitleText: nil ] ;
1181
+ [self setSmallText: nil ] ;
1182
+ [self setIconStyle: SSYAlertIconNoIcon] ;
1183
+ [self setButton1Title: nil ] ;
1184
+ [self setButton2Title: nil ] ;
1185
+ [self setButton3Title: nil ] ;
1186
+ [self setHelpAnchor: nil ] ;
1187
+ [self setCheckboxTitle: nil ] ;
1188
+ [self setWhyDisabled: nil ] ;
1189
+ [self removeAllOtherSubviews ] ;
1190
+
1191
+ // The following is a holdover from when SSYAlert support a
1192
+ // configuration stack, and may no longer be needed...
1193
+ // Now, there may still be some subviews left in the view...
1194
+ // The -removeAllOtherSubviews only removed those which are in
1195
+ // the current self.otherSubviews array. But if the configuration has
1196
+ // been pushed, self.otherSubviews will be a new, empty array.
1197
+ // Therefore, we now ask the -contentView if it has any more subviews
1198
+ // left and if so remove them...
1199
+ NSView * contentView = [[self window ] contentView ] ;
1200
+ // We use a regular C loop since -removeFromSuperviewWithoutNeedingDisplay
1201
+ // mutates the [contentView subviews] and therefore we cannot
1202
+ // use an enumeration
1203
+ NSArray * subviews = [contentView subviews ] ;
1204
+ NSInteger i ;
1205
+ for (i=[subviews count ]-1 ; i>=0 ; i--) {
1206
+ NSView * subview = [subviews objectAtIndex: i] ;
1207
+ [subview removeFromSuperviewWithoutNeedingDisplay ] ;
1208
+ }
1209
+
1210
+ self.allowsShrinking = YES ;
1211
+ [self setIsEnabled: YES ] ;
1212
+ self.isVisible = YES ;
1213
+ self.progressBarShouldAnimate = NO ;
1214
+ [self setRightColumnMinimumWidth: 0.0 ] ;
1215
+ [self setRightColumnMaximumWidth: CGFLOAT_MAX] ;
1216
+ }
1217
+
1203
1218
#pragma mark * Public Methods for Displaying and Running
1204
1219
1205
1220
- (void )errorSheetDidEnd : (NSWindow *)sheet
0 commit comments