src/video/cocoa/SDL_cocoawindow.h
author Sam Lantinga <slouken@libsdl.org>
Fri, 23 Oct 2009 03:58:23 +0000
changeset 3413 4b1f10cfd304
parent 3400 4ec48602f1db
child 3506 e829b6098435
permissions -rw-r--r--
Adam Strzelecki to SDL

When using deployment in Xcode we use 10.4 SDK for PPC & i386 and 10.6 SDK for x86_64 unfortunately MAC_OS_X_VERSION_10_6 is defined only in 10.6 SDK, in older SDKs it is undefined which makes >= comparison return always TRUTH, so the GCC complains about undefined <NSWindowDelegate>, even if the original intention was to omit <NSWindowDelegate> on older SDKs.

Solution, don't relay on MAC_OS_X_VERSION_10_6 but use OSX revision number 1060 directly as SDL does in many other places.
slouken@1933
     1
/*
slouken@1933
     2
    SDL - Simple DirectMedia Layer
slouken@2859
     3
    Copyright (C) 1997-2009 Sam Lantinga
slouken@1933
     4
slouken@1933
     5
    This library is free software; you can redistribute it and/or
slouken@1933
     6
    modify it under the terms of the GNU Lesser General Public
slouken@1933
     7
    License as published by the Free Software Foundation; either
slouken@1933
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@1933
     9
slouken@1933
    10
    This library is distributed in the hope that it will be useful,
slouken@1933
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@1933
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@1933
    13
    Lesser General Public License for more details.
slouken@1933
    14
slouken@1933
    15
    You should have received a copy of the GNU Lesser General Public
slouken@1933
    16
    License along with this library; if not, write to the Free Software
slouken@1933
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@1933
    18
slouken@1933
    19
    Sam Lantinga
slouken@1933
    20
    slouken@libsdl.org
slouken@1933
    21
*/
slouken@1933
    22
#include "SDL_config.h"
slouken@1933
    23
slouken@1933
    24
#ifndef _SDL_cocoawindow_h
slouken@1933
    25
#define _SDL_cocoawindow_h
slouken@1933
    26
slouken@3400
    27
#import <Cocoa/Cocoa.h>
slouken@3400
    28
slouken@1933
    29
typedef struct SDL_WindowData SDL_WindowData;
slouken@1933
    30
slouken@1936
    31
/* *INDENT-OFF* */
slouken@3413
    32
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
slouken@3400
    33
@interface Cocoa_WindowListener : NSResponder <NSWindowDelegate> {
slouken@3400
    34
#else
slouken@3400
    35
@interface Cocoa_WindowListener : NSResponder {
slouken@3400
    36
#endif		
slouken@1933
    37
    SDL_WindowData *_data;
slouken@1933
    38
}
slouken@1933
    39
slouken@1933
    40
-(void) listen:(SDL_WindowData *) data;
slouken@1933
    41
-(void) close;
slouken@1933
    42
slouken@1933
    43
/* Window delegate functionality */
slouken@1933
    44
-(BOOL) windowShouldClose:(id) sender;
slouken@1933
    45
-(void) windowDidExpose:(NSNotification *) aNotification;
slouken@1933
    46
-(void) windowDidMove:(NSNotification *) aNotification;
slouken@1933
    47
-(void) windowDidResize:(NSNotification *) aNotification;
slouken@1933
    48
-(void) windowDidMiniaturize:(NSNotification *) aNotification;
slouken@1933
    49
-(void) windowDidDeminiaturize:(NSNotification *) aNotification;
slouken@1933
    50
-(void) windowDidBecomeKey:(NSNotification *) aNotification;
slouken@1933
    51
-(void) windowDidResignKey:(NSNotification *) aNotification;
slouken@1933
    52
-(void) windowDidHide:(NSNotification *) aNotification;
slouken@1933
    53
-(void) windowDidUnhide:(NSNotification *) aNotification;
slouken@1933
    54
slouken@1933
    55
/* Window event handling */
slouken@1933
    56
-(void) mouseDown:(NSEvent *) theEvent;
slouken@1933
    57
-(void) rightMouseDown:(NSEvent *) theEvent;
slouken@1933
    58
-(void) otherMouseDown:(NSEvent *) theEvent;
slouken@1933
    59
-(void) mouseUp:(NSEvent *) theEvent;
slouken@1933
    60
-(void) rightMouseUp:(NSEvent *) theEvent;
slouken@1933
    61
-(void) otherMouseUp:(NSEvent *) theEvent;
slouken@1933
    62
-(void) mouseMoved:(NSEvent *) theEvent;
slouken@1957
    63
-(void) mouseDragged:(NSEvent *) theEvent;
slouken@1958
    64
-(void) rightMouseDragged:(NSEvent *) theEvent;
slouken@1958
    65
-(void) otherMouseDragged:(NSEvent *) theEvent;
slouken@1933
    66
-(void) scrollWheel:(NSEvent *) theEvent;
slouken@1936
    67
@end
slouken@1936
    68
/* *INDENT-ON* */
slouken@1936
    69
slouken@1936
    70
struct SDL_WindowData
slouken@1933
    71
{
slouken@1933
    72
    SDL_WindowID windowID;
slouken@1933
    73
    NSWindow *window;
slouken@1951
    74
    SDL_bool created;
slouken@1933
    75
    Cocoa_WindowListener *listener;
slouken@1933
    76
    struct SDL_VideoData *videodata;
slouken@1933
    77
};
slouken@1933
    78
slouken@1933
    79
extern int Cocoa_CreateWindow(_THIS, SDL_Window * window);
slouken@1933
    80
extern int Cocoa_CreateWindowFrom(_THIS, SDL_Window * window,
slouken@1933
    81
                                  const void *data);
slouken@1933
    82
extern void Cocoa_SetWindowTitle(_THIS, SDL_Window * window);
slouken@1933
    83
extern void Cocoa_SetWindowPosition(_THIS, SDL_Window * window);
slouken@1933
    84
extern void Cocoa_SetWindowSize(_THIS, SDL_Window * window);
slouken@1933
    85
extern void Cocoa_ShowWindow(_THIS, SDL_Window * window);
slouken@1933
    86
extern void Cocoa_HideWindow(_THIS, SDL_Window * window);
slouken@1933
    87
extern void Cocoa_RaiseWindow(_THIS, SDL_Window * window);
slouken@1933
    88
extern void Cocoa_MaximizeWindow(_THIS, SDL_Window * window);
slouken@1933
    89
extern void Cocoa_MinimizeWindow(_THIS, SDL_Window * window);
slouken@1933
    90
extern void Cocoa_RestoreWindow(_THIS, SDL_Window * window);
slouken@1933
    91
extern void Cocoa_SetWindowGrab(_THIS, SDL_Window * window);
slouken@1933
    92
extern void Cocoa_DestroyWindow(_THIS, SDL_Window * window);
slouken@1933
    93
extern SDL_bool Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window,
slouken@1933
    94
                                      struct SDL_SysWMinfo *info);
slouken@1933
    95
slouken@1933
    96
#endif /* _SDL_cocoawindow_h */
slouken@1933
    97
slouken@1933
    98
/* vi: set ts=4 sw=4 expandtab: */