Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / apple_remote / RemoteControl.h
blob0b943920e6ee6ab79f5470db010d16443d635cc4
1 /* -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*****************************************************************************
3 * RemoteControl.h
4 * RemoteControlWrapper
6 * Created by Martin Kahr on 11.03.06 under a MIT-style license.
7 * Copyright (c) 2006 martinkahr.com. All rights reserved.
9 * Code modified and adapted to OpenOffice.org
10 * by Eric Bachard on 11.08.2008 under the same License
12 * Permission is hereby granted, free of charge, to any person obtaining a
13 * copy of this software and associated documentation files (the "Software"),
14 * to deal in the Software without restriction, including without limitation
15 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16 * and/or sell copies of the Software, and to permit persons to whom the
17 * Software is furnished to do so, subject to the following conditions:
19 * The above copyright notice and this permission notice shall be included
20 * in all copies or substantial portions of the Software.
22 * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28 * THE SOFTWARE.
30 *****************************************************************************/
32 #include <sal/config.h>
34 #import <Cocoa/Cocoa.h>
36 #include <sal/types.h>
38 // notification names that are being used to signal that an application wants to
39 // have access to the remote control device or if the application has finished
40 // using the remote control device
41 extern NSString* REQUEST_FOR_REMOTE_CONTROL_NOTIFCATION;
42 extern NSString* FINISHED_USING_REMOTE_CONTROL_NOTIFICATION;
44 // keys used in user objects for distributed notifications
45 extern NSString* kRemoteControlDeviceName;
46 extern NSString* kApplicationIdentifier;
47 extern NSString* kTargetApplicationIdentifier;
49 // we have a 6 bit offset to make a hold event out of a normal event
50 #define EVENT_TO_HOLD_EVENT_OFFSET 6
52 @class RemoteControl;
54 typedef enum {
55 // normal events
56 kRemoteButtonPlus =1<<1,
57 kRemoteButtonMinus =1<<2,
58 kRemoteButtonMenu =1<<3,
59 kRemoteButtonPlay =1<<4,
60 kRemoteButtonRight =1<<5,
61 kRemoteButtonLeft =1<<6,
63 // hold events
64 kRemoteButtonPlus_Hold =1<<7,
65 kRemoteButtonMinus_Hold =1<<8,
66 kRemoteButtonMenu_Hold =1<<9,
67 kRemoteButtonPlay_Hold =1<<10,
68 kRemoteButtonRight_Hold =1<<11,
69 kRemoteButtonLeft_Hold =1<<12,
71 // special events (not supported by all devices)
72 kRemoteControl_Switched =1<<13,
74 // New values for the "metallic" Remote (2009 model)
75 kMetallicRemote2009ButtonPlay =1<<14,
76 kMetallicRemote2009ButtonMiddlePlay =1<<15
78 } RemoteControlEventIdentifier;
80 @interface NSObject(RemoteControlDelegate)
82 - (void) sendRemoteButtonEvent: (RemoteControlEventIdentifier) event pressedDown: (BOOL) pressedDown remoteControl: (RemoteControl*) remoteControl;
84 @end
87 Base Interface for Remote Control devices
89 SAL_DLLPUBLIC_EXPORT @interface RemoteControl : NSObject {
90 id delegate;
93 // returns nil if the remote control device is not available
94 - (id) initWithDelegate: (id) remoteControlDelegate;
96 - (void) setListeningToRemote: (BOOL) value;
97 - (BOOL) isListeningToRemote;
99 - (BOOL) isOpenInExclusiveMode;
100 - (void) setOpenInExclusiveMode: (BOOL) value;
102 - (void) startListening: (id) sender;
103 - (void) stopListening: (id) sender;
105 // is this remote control sending the given event?
106 - (BOOL) sendsEventForButtonIdentifier: (RemoteControlEventIdentifier) identifier;
108 // sending of notifications between applications
109 + (void) sendFinishedNotifcationForAppIdentifier: (NSString*) identifier;
110 + (void) sendRequestForRemoteControlNotification;
112 // name of the device
113 + (const char*) remoteControlDeviceName;
115 @end
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */