Merge pull request #4196 from arnova/sub_fallback
[vuplus_xbmc] / xbmc / osx / ios / XBMCController.h
1 /*
2  *      Copyright (C) 2010-2013 Team XBMC
3  *      http://xbmc.org
4  *
5  *  This Program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2, or (at your option)
8  *  any later version.
9  *
10  *  This Program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with XBMC; see the file COPYING.  If not, see
17  *  <http://www.gnu.org/licenses/>.
18  *
19  */
20
21 #import <UIKit/UIKit.h>
22 #import <OpenGLES/EAGL.h>
23 #import <OpenGLES/ES2/gl.h>
24 #import <AudioToolbox/AudioToolbox.h>
25
26 #import "XBMC_events.h"
27 #include "XBMC_keysym.h"
28
29 @class IOSEAGLView;
30
31 typedef enum
32 {
33   IOS_PLAYBACK_STOPPED,
34   IOS_PLAYBACK_PAUSED,
35   IOS_PLAYBACK_PLAYING
36 } IOSPlaybackState;
37
38 @interface XBMCController : UIViewController <UIGestureRecognizerDelegate, UIKeyInput>
39 {
40   UIWindow *m_window;
41   IOSEAGLView  *m_glView;
42   int m_screensaverTimeout;
43         
44   /* Touch handling */
45   CGSize screensize;
46   CGPoint lastGesturePoint;
47   CGFloat screenScale;
48   bool touchBeginSignaled;
49   int  m_screenIdx;
50
51   UIInterfaceOrientation orientation;
52   
53   bool m_isPlayingBeforeInactive;
54   UIBackgroundTaskIdentifier m_bgTask;
55   NSTimer *m_networkAutoSuspendTimer;
56   IOSPlaybackState m_playbackState;
57   NSDictionary *nowPlayingInfo;
58 }
59 @property (readonly, nonatomic, getter=isAnimating) BOOL animating;
60 @property CGPoint lastGesturePoint;
61 @property CGFloat screenScale;
62 @property bool touchBeginSignaled;
63 @property int  m_screenIdx;
64 @property CGSize screensize;
65 @property (nonatomic, retain) NSTimer *m_networkAutoSuspendTimer;
66 @property (nonatomic, retain) NSDictionary *nowPlayingInfo;
67
68 // message from which our instance is obtained
69 - (void) pauseAnimation;
70 - (void) resumeAnimation;
71 - (void) startAnimation;
72 - (void) stopAnimation;
73 - (void) enterBackground;
74 - (void) enterForeground;
75 - (void) becomeInactive;
76 - (void) setIOSNowPlayingInfo:(NSDictionary *)info;
77 - (void) sendKey: (XBMCKey) key;
78 - (void) observeDefaultCenterStuff: (NSNotification *) notification;
79 - (void) initDisplayLink;
80 - (void) deinitDisplayLink;
81 - (double) getDisplayLinkFPS;
82 - (void) setFramebuffer;
83 - (bool) presentFramebuffer;
84 - (CGSize) getScreenSize;
85 - (CGFloat) getScreenScale:(UIScreen *)screen;
86 - (UIInterfaceOrientation) getOrientation;
87 - (void) createGestureRecognizers;
88 - (void) activateKeyboard:(UIView *)view;
89 - (void) deactivateKeyboard:(UIView *)view;
90
91 - (void) disableNetworkAutoSuspend;
92 - (void) enableNetworkAutoSuspend:(id)obj;
93 - (void) disableSystemSleep;
94 - (void) enableSystemSleep;
95 - (void) disableScreenSaver;
96 - (void) enableScreenSaver;
97 - (bool) changeScreen: (unsigned int)screenIdx withMode:(UIScreenMode *)mode;
98 - (void) activateScreen: (UIScreen *)screen withOrientation:(UIInterfaceOrientation)newOrientation;
99 - (id)   initWithFrame:(CGRect)frame withScreen:(UIScreen *)screen;
100 @end
101
102 extern XBMCController *g_xbmcController;