summaryrefslogtreecommitdiffstats
path: root/OSX/SaverRunner.h
blob: 399eec0eb468949eb1204b8b585d3917a361e3a5 (plain) (blame)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/* xscreensaver, Copyright (c) 2006-2016 Jamie Zawinski <jwz@jwz.org>
 *
 * Permission to use, copy, modify, distribute, and sell this software and its
 * documentation for any purpose is hereby granted without fee, provided that
 * the above copyright notice appear in all copies and that both that
 * copyright notice and this permission notice appear in supporting
 * documentation.  No representations are made about the suitability of this
 * software for any purpose.  It is provided "as is" without express or 
 * implied warranty.
 */

#ifdef USE_IPHONE
# import <Foundation/Foundation.h>
# import <UIKit/UIKit.h>
# import <OpenGLES/EAGL.h>
# import <OpenGLES/ES1/gl.h>
# import <OpenGLES/ES1/glext.h>
# import <QuartzCore/QuartzCore.h>
# define NSView  UIView
# define NSRect  CGRect
# define NSSize  CGSize
# define NSColor UIColor
# define NSImage UIImage
# define NSEvent UIEvent
# define NSWindow UIWindow
# define NSButton UIButton
# define NSApplication UIApplication
# define NSScreen UIScreen
#else
# import <Cocoa/Cocoa.h>
# import <ScreenSaver/ScreenSaver.h>
#endif

#import "XScreenSaverView.h"

#ifdef USE_IPHONE

@class SaverRunner;

@interface SaverViewController : UIViewController
{
  SaverRunner *_parent;
  NSString *_saverName;
  XScreenSaverView *_saverView;

  /* When a the SaverViewController is presented, iOS automatically changes
     the status bar orientation. (And, by extension, the notification center
     orientation.) But there's no willPresentAsModal: event for a
     UIViewController so that it knows when this is going to happen, and the
     other event handlers occur after the status bar is changed. So save the
     orientation just before the view controller is modal-presented, and
     restore the proper status bar orientation just before the saverView is
     created so it can pick it up in didRotate:. */
  // UIInterfaceOrientation _storedOrientation;

  BOOL _showAboutBox;
  UIView *aboutBox;
  NSTimer *splashTimer;
}

@property(nonatomic, retain) NSString *saverName;

@end

#endif

@interface SaverRunner : NSObject
# ifdef USE_IPHONE
  <XScreenSaverViewDelegate>
# else
  <NSWindowDelegate>
# endif
{
  NSString *saverName;		// the one currently loaded
  NSArray  *saverNames;		// Names of available savers
  NSString *saverDir;		// Where we find saver bundles

# ifndef USE_IPHONE

  NSBundle *saverBundle;
  NSArray  *windows;
  IBOutlet NSMenu *menubar;
  NSTimer *anim_timer;

# else  // USE_IPHONE

  UINavigationController *rotating_nav;		// Hierarchy 1 (UI)
  IBOutlet UIWindow *window;
  IBOutlet UIView *view;

  SaverViewController *nonrotating_controller;	// Hierarchy 2 (savers)

  UIImage *saved_screenshot;

# endif // USE_IPHONE
}

- (XScreenSaverView *) newSaverView: (NSString *) module
                           withSize: (NSSize) size;
- (void) loadSaver: (NSString *)name;
- (void) selectedSaverDidChange:(NSDictionary *)change;

#ifndef USE_IPHONE
- (void) openPreferences: (id)sender;
#else  // USE_IPHONE
- (UIImage *) screenshot;
- (NSString *) makeDesc:(NSString *)saver
               yearOnly:(BOOL) yearp;
#endif // USE_IPHONE

@end