1 /* xdaliclock - a melting digital clock 2 * Copyright (c) 1991-2018 Jamie Zawinski <jwz@jwz.org> 3 * 4 * Permission to use, copy, modify, distribute, and sell this software and its 5 * documentation for any purpose is hereby granted without fee, provided that 6 * the above copyright notice appear in all copies and that both that 7 * copyright notice and this permission notice appear in supporting 8 * documentation. No representations are made about the suitability of this 9 * software for any purpose. It is provided "as is" without express or 10 * implied warranty. 11 */ 12 13 #ifdef USE_IPHONE 14 15 # import <Foundation/Foundation.h> 16 # import <UIKit/UIKit.h> 17 # import <OpenGLES/EAGL.h> 18 # import <OpenGLES/ES1/gl.h> 19 # import <OpenGLES/ES1/glext.h> 20 # import <QuartzCore/QuartzCore.h> 21 22 # define NSView UIView 23 # define NSRect CGRect 24 # define NSSize CGSize 25 # define NSColor UIColor 26 # define NSImage UIImage 27 # define colorWithCalibratedHue colorWithHue 28 # define NSUserDefaultsController NSUserDefaults 29 # define NSArchiver NSKeyedArchiver 30 # define NSOpenGLContext EAGLContext 31 # define glOrtho glOrthof 32 33 #else /* !USE_IPHONE */ 34 35 # import <Cocoa/Cocoa.h> 36 # import <AppKit/NSOpenGL.h> 37 # import <OpenGL/OpenGL.h> 38 # import <OpenGL/gl.h> 39 40 #endif /* !USE_IPHONE */ 41 42 #import "xdaliclock.h" 43 44 typedef struct touch_data touch_data; 45 46 @interface DaliClockView : NSView 47 { 48 dali_config config; 49 50 NSOpenGLContext *ogl_ctx; // OpenGL rendering context 51 52 #ifdef USE_IPHONE 53 54 /* The OpenGL names for the framebuffer and renderbuffer used to 55 render to this view. */ 56 GLuint gl_framebuffer, gl_renderbuffer; 57 UIView *aboutBox; 58 BOOL screenLocked; 59 60 # endif /* !USE_IPHONE */ 61 62 GLuint textures[2]; 63 64 NSTimer *clockTimer; 65 NSTimer *colorTimer; 66 NSTimer *dateTimer; 67 float autoDateInterval; 68 69 BOOL ownWindow; 70 BOOL constrainSizes; 71 BOOL usesCountdownTimer; 72 NSDate *countdownDate; 73 74 NSColor *fg; 75 NSColor *bg; 76 NSColor *initialForegroundColor; 77 NSColor *initialBackgroundColor; 78 } 79 80 + (void)registerDefaults:(NSUserDefaults *)defs; 81 + (void)setUserDefaultsController:(NSUserDefaultsController *)ctl; 82 + (NSUserDefaultsController *)userDefaultsController; 83 84 - (id)initWithFrame:(NSRect)rect ownWindow:(BOOL)own_p; 85 86 - (void)setInitialForegroundColor:(NSColor *)c; 87 - (void)setInitialBackgroundColor:(NSColor *)c; 88 89 - (void)setConstrainSizes:(BOOL)constrain_p; 90 - (void)setAutoDate:(float)interval; 91 - (IBAction) aboutClick: (id)sender; 92 93 #ifdef USE_IPHONE 94 - (void)setScreenLocked:(BOOL)locked; 95 #endif /* USE_IPHONE */ 96 97 98 // Start timers 99 - (void)clockTick; 100 - (void)colorTick; 101 - (void)dateTick; 102 103 104 /* Bindable Properties: 105 hourStyle 106 timeStyle 107 dateStyle 108 cycleSpeed 109 usesCountdownTimer 110 countdownDate 111 initialForegroundColor 112 initialBackgroundColor 113 */ 114 115 #ifdef USE_IPHONE 116 @property (nonatomic) int hourStyle; 117 @property (nonatomic) int timeStyle; 118 @property (nonatomic) int dateStyle; 119 @property (nonatomic) float cycleSpeed; 120 @property (nonatomic) int usesCountdownTimer; 121 @property (nonatomic, retain) NSDate *countdownDate; 122 #endif /* USE_IPHONE */ 123 124 @end 125