## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# csplugincommon/macosx/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 {
    00027   NSTrackingRectTag trackingMouseTag;
    00028   BOOL trackingMouse;
    00030   BOOL hideMouse;
    00031
    00036   NSWindow *window;
    00037   int style;
    00038   NSString *title, *pausedTitle;
    00039
    00041   BOOL isPaused;
    00042
    00044   OSXDriver2D driver;
    00045
    00047   int lastEventType;
    00048 }
    00049
    00051 - (id) initWithDriver:(OSXDriver2D) drv;
    00052
    00054 - (void) dealloc;
    00055
    00057 - (BOOL) openWindow:(const char *) winTitle width:(int) w height:(int) h
    00058   depth:(int) d fullscreen:(BOOL) fs onDisplay:(CGDirectDisplayID)
    00059   display onScreen:(unsigned int) screen;
    00060
    00062 - (void) setTitle:(char *) newTitle;
    00063
    00065 - (BOOL) setMouseCursor:(csMouseCursorID) cursor;
    00066
    00068 - (void) startTrackingMouse;
    00069 - (void) stopTrackingMouse;
    00070
    00072 - (void) mouseEntered:(NSEvent *) ev;
    00073 - (void) mouseExited:(NSEvent *) ev;
    00074
    00076 - (void) closeWindow;
    00077
    00079 - (void) focusChanged:(BOOL) focused shouldPause:(BOOL) pause;
    00080
    00082 - (void) dispatchEvent:(NSEvent *) ev forView:(NSView *) view;
    00083
    00084 @end
    00085
    00086 #else // __cplusplus
    00087
    00088 #include <ApplicationServices/ApplicationServices.h>
    00089
    00090 #define DEL2D_FUNC(ret, func) __private_extern__ "C" ret OSXDelegate2D_##func
    00091
    00092 typedef void *OSXDelegate2D;
    00093 typedef void *csGraphics2DHandle;
    00094
    00095 // C API to driver delegate class
    00096 DEL2D_FUNC(OSXDelegate2D, new)(csGraphics2DHandle drv);
    00097 DEL2D_FUNC(void, delete)(OSXDelegate2D);
    00098 DEL2D_FUNC(bool, openWindow)(OSXDelegate2D,const char *title, int w, int h,
    00099   int d, bool fs, CGDirectDisplayID display, unsigned int screen);
    00100 DEL2D_FUNC(void, closeWindow)(OSXDelegate2D);
    00101 DEL2D_FUNC(void, setTitle)(OSXDelegate2D, char *title);
    00102 DEL2D_FUNC(bool, setMouseCursor)(OSXDelegate2D, csMouseCursorID);
    00103 DEL2D_FUNC(void, focusChanged)(OSXDelegate2D, bool focused, bool shouldPause);
    00104 DEL2D_FUNC(void, setLevel)(OSXDelegate2D, int level);
    00105 DEL2D_FUNC(void, setMousePosition)(OSXDelegate2D, CGPoint point);
    00106
    00107 #undef DEL2D_FUNC
    00108
    00109 #endif // __cplusplus
    00110
    00111 #endif // __CS_OSXDELEGATE2D_H__