Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages
OSXDelegate2D.h
00001 // 00002 // OSXDelegate2D.h 00003 // 00004 // 00005 // Created by mreda on Wed Oct 31 2001. 00006 // Copyright (c) 2001 Matt Reda. All rights reserved. 00007 // 00008 00009 #ifndef __CS_OSXDELEGATE2D_H__ 00010 #define __CS_OSXDELEGATE2D_H__ 00011 00012 #include "csextern_osx.h" 00013 #include "ivideo/cursor.h" 00014 00015 #include <OpenGL/OpenGL.h> 00016 00017 // Part of this API must be callable from C++ code. So we have to generate a C 00018 // API that provides access to this class 00019 #if !defined(__cplusplus) 00020 00021 #import <Cocoa/Cocoa.h> 00022 #import "OSXDriver2D.h" 00023 00024 @interface OSXDelegate2D : NSObject 00025 { 00026 // Keep track of mouse tracking state 00027 NSTrackingRectTag trackingMouseTag; 00028 BOOL trackingMouse; 00029 BOOL hideMouse; // YES if mouse is not visible 00030 00031 // Window - created even in fullscreen mode to get events (but with a 00032 // different style) Window can have one of two titles - Paused or active 00033 NSWindow *window; 00034 int style; 00035 NSString *title, *pausedTitle; 00036 00037 // Is window paused (out of focus, etc) 00038 BOOL isPaused; 00039 00040 // Driver that this object works with 00041 OSXDriver2D driver; 00042 00043 // Last processed event type. 00044 int lastEventType; 00045 } 00046 00047 // Initialize with driver 00048 - (id) initWithDriver:(OSXDriver2D) drv; 00049 00050 // Deallocate object 00051 - (void) dealloc; 00052 00053 // Open a window if none open 00054 - (BOOL) openWindow:(char *) winTitle width:(int) w height:(int) h 00055 depth:(int) d fullscreen:(BOOL) fs onDisplay:(CGDirectDisplayID) 00056 display onScreen:(unsigned int) screen; 00057 00058 // Set the window's title 00059 - (void) setTitle:(char *) newTitle; 00060 00061 // Set the mouse cursor 00062 - (BOOL) setMouseCursor:(csMouseCursorID) cursor; 00063 00064 // Start/Stop tracking mouse position 00065 - (void) startTrackingMouse; 00066 - (void) stopTrackingMouse; 00067 00068 // Handle mouse entering or leaving the tracking area 00069 - (void) mouseEntered:(NSEvent *) ev; 00070 - (void) mouseExited:(NSEvent *) ev; 00071 00072 // Close window (destroys OpenGL context as well) 00073 - (void) closeWindow; 00074 00075 // Change focus of window and adjust title 00076 - (void) focusChanged:(BOOL) focused shouldPause:(BOOL) pause; 00077 00078 // Dispatch an event to the driver 00079 - (void) dispatchEvent:(NSEvent *) ev forView:(NSView *) view; 00080 00081 @end 00082 00083 #else // __cplusplus 00084 00085 #include <ApplicationServices/ApplicationServices.h> 00086 00087 #define DEL2D_FUNC(ret, func) __private_extern__ "C" ret OSXDelegate2D_##func 00088 00089 typedef void *OSXDelegate2D; 00090 typedef void *csGraphics2DHandle; 00091 00092 // C API to driver delegate class 00093 DEL2D_FUNC(OSXDelegate2D, new)(csGraphics2DHandle drv); 00094 DEL2D_FUNC(void, delete)(OSXDelegate2D); 00095 DEL2D_FUNC(bool, openWindow)(OSXDelegate2D, char *title, int w, int h, 00096 int d, bool fs, CGDirectDisplayID display, unsigned int screen); 00097 DEL2D_FUNC(void, closeWindow)(OSXDelegate2D); 00098 DEL2D_FUNC(void, setTitle)(OSXDelegate2D, char *title); 00099 DEL2D_FUNC(bool, setMouseCursor)(OSXDelegate2D, csMouseCursorID); 00100 DEL2D_FUNC(void, focusChanged)(OSXDelegate2D, bool focused, bool shouldPause); 00101 DEL2D_FUNC(void, setLevel)(OSXDelegate2D, int level); 00102 DEL2D_FUNC(void, setMousePosition)(OSXDelegate2D, CGPoint point); 00103 00104 #undef DEL2D_FUNC 00105 00106 #endif // __cplusplus 00107 00108 #endif // __CS_OSXDELEGATE2D_H__
Generated for Crystal Space by doxygen 1.4.4