-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNSView+SetSubviewsEnabled.m
More file actions
36 lines (28 loc) · 967 Bytes
/
NSView+SetSubviewsEnabled.m
File metadata and controls
36 lines (28 loc) · 967 Bytes
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
//
// NSBox (SWEnabledAddition).m
// This file is part of the "SWApplicationSupport" project, and is distributed under the MIT License.
//
// Created by Samuel Williams on 20/10/05.
// Copyright 2005 Samuel Williams. All rights reserved.
//
#import "NSView+SetSubviewsEnabled.h"
@interface NSView (SWEnabledAdditionPrivate)
- (void) recursivelySetEnabled: (BOOL)enabled;
@end
@implementation NSView (SWEnabledAddition)
- (void) setSubviewsEnabled: (BOOL)enabled {
[self recursivelySetEnabled:enabled];
}
- (void) recursivelySetEnabled: (BOOL)enabled {
NSArray *subviews = self.subviews;
NSEnumerator *iter = [subviews objectEnumerator];
id childView;
while ((childView = [iter nextObject])) {
//NSLog (@"%@", childView);
if ([childView respondsToSelector:@selector(setEnabled:)])
[childView setEnabled:enabled];
if ([childView respondsToSelector:@selector(recursivelySetEnabled:)])
[childView recursivelySetEnabled:enabled];
}
}
@end