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