1 /* xscreensaver, Copyright (c) 2006-2019 Jamie Zawinski <jwz@jwz.org> 2 * 3 * Permission to use, copy, modify, distribute, and sell this software and its 4 * documentation for any purpose is hereby granted without fee, provided that 5 * the above copyright notice appear in all copies and that both that 6 * copyright notice and this permission notice appear in supporting 7 * documentation. No representations are made about the suitability of this 8 * software for any purpose. It is provided "as is" without express or 9 * implied warranty. 10 */ 11 12 #ifdef USE_IPHONE 13 # import <Foundation/Foundation.h> 14 # import <UIKit/UIKit.h> 15 # import <OpenGLES/EAGL.h> 16 # import <OpenGLES/ES1/gl.h> 17 # import <OpenGLES/ES1/glext.h> 18 # import <QuartzCore/QuartzCore.h> 19 # define NSView UIView 20 # define NSRect CGRect 21 # define NSSize CGSize 22 # define NSColor UIColor 23 # define NSImage UIImage 24 # define NSEvent UIEvent 25 # define NSWindow UIWindow 26 # define NSButton UIButton 27 # define NSApplication UIApplication 28 # define NSScreen UIScreen 29 #else 30 # import <Cocoa/Cocoa.h> 31 # import <ScreenSaver/ScreenSaver.h> 32 #endif 33 34 #import "XScreenSaverView.h" 35 36 #ifdef USE_IPHONE 37 38 @class SaverRunner; 39 40 @interface SaverViewController : UIViewController 41 { 42 SaverRunner *_parent; 43 NSString *_saverName; 44 XScreenSaverView *_saverView; 45 BOOL _showAboutBox; 46 UIView *aboutBox; 47 NSTimer *splashTimer; 48 } 49 property(nonatomic,retain)50@property(nonatomic, retain) NSString *saverName; 51 52 @end 53 54 #endif 55 56 @interface SaverRunner : NSObject 57 # ifdef USE_IPHONE 58 <XScreenSaverViewDelegate> 59 # else 60 <NSWindowDelegate> 61 # endif 62 { 63 NSString *saverName; // the one currently loaded 64 NSArray *saverNames; // Names of available savers 65 NSString *saverDir; // Where we find saver bundles 66 67 # ifndef USE_IPHONE 68 69 NSBundle *saverBundle; 70 NSArray *windows; 71 IBOutlet NSMenu *menubar; 72 NSTimer *anim_timer; 73 74 # else // USE_IPHONE 75 76 UINavigationController *rotating_nav; // Hierarchy 1 (UI) 77 IBOutlet UIWindow *window; 78 IBOutlet UIView *view; 79 80 SaverViewController *nonrotating_controller; // Hierarchy 2 (savers) 81 82 UIImage *saved_screenshot; 83 84 # endif // USE_IPHONE 85 } 86 87 - (XScreenSaverView *) newSaverView: (NSString *) module 88 withSize: (NSSize) size; 89 - (void) loadSaver: (NSString *)name; 90 - (void) selectedSaverDidChange:(NSDictionary *)change; 91 92 #ifndef USE_IPHONE 93 - (void) openPreferences: (id)sender; 94 #else // USE_IPHONE 95 - (UIImage *) screenshot; 96 - (NSString *) makeDesc:(NSString *)saver 97 yearOnly:(BOOL) yearp; 98 #endif // USE_IPHONE 99 100 @end 101