36- (id) initWithDelegate: (
id) _remoteControlDelegate {
37 if ( (
self = [super initWithDelegate:_remoteControlDelegate]) ) {
40 NSLog(
@"Apple Remote: ControlContainer initWithDelegate ok");
43 NSLog(
@"Apple Remote: RemoteControlContainer initWithDelegate failed");
51 [
self stopListening: self];
52 [remoteControls release];
56- (
BOOL) instantiateAndAddRemoteControlDeviceWithClass: (
Class) clazz {
58 RemoteControl* remoteControl = [[clazz alloc] initWithDelegate: delegate];
60 [remoteControls addObject: remoteControl];
61 [remoteControl addObserver: self forKeyPath:@"listeningToRemote" options:NSKeyValueObservingOptionNew context:nil];
66 NSLog(
@"Apple Remote: ControlContainer instantiateAndAddRemoteControlDeviceWithClass failed");
74 return [remoteControls count];
78 [
self willChangeValueForKey:@"listeningToRemote"];
79 [
self didChangeValueForKey:@"listeningToRemote"];
82 NSLog(
@"Apple Remote: reset... (after listening)");
86- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(
id)object change:(NSDictionary *)change context:(
void *)context {
94- (void) setListeningToRemote: (
BOOL) value {
95 for(NSUInteger i=0;
i < [remoteControls count];
i++) {
96 [[remoteControls objectAtIndex: i] setListeningToRemote: value];
98 if (value && value != [
self isListeningToRemote]) [
self performSelector:@selector(reset) withObject:nil afterDelay:0.01];
101 for(NSUInteger i=0;
i < [remoteControls count];
i++) {
109- (void) startListening: (
id) sender {
111 NSLog(
@"Apple Remote: start listening to events... ");
113 for(NSUInteger i=0;
i < [remoteControls count];
i++) {
114 [[remoteControls objectAtIndex: i] startListening: sender];
117- (void) stopListening: (
id) sender {
119 NSLog(
@"Apple Remote: stopListening to events... ");
121 for(NSUInteger i=0;
i < [remoteControls count];
i++) {
122 [[remoteControls objectAtIndex: i] stopListening: sender];
128 for(NSUInteger i=0;
i < [remoteControls count];
i++) {
129 mode =
mode && ([[remoteControls objectAtIndex: i] isOpenInExclusiveMode]);
133- (void) setOpenInExclusiveMode: (
BOOL) value {
134 for(NSUInteger i=0;
i < [remoteControls count];
i++) {
135 [[remoteControls objectAtIndex: i] setOpenInExclusiveMode:value];
BOOL isListeningToRemote()
BOOL isOpenInExclusiveMode()
NSMutableArray * remoteControls
const wchar_t *typedef BOOL
const wchar_t *typedef int(__stdcall *DllNativeUnregProc)(int