~brandontschaefer/+junk/sdl-mir-support-v2

« back to all changes in this revision

Viewing changes to src/video/cocoa/SDL_cocoawindow.h

  • Committer: Brandon Schaefer
  • Date: 2013-12-19 23:38:26 UTC
  • Revision ID: brandontschaefer@gmail.com-20131219233826-3jipv3mkvm8ajt1r
* Trunk SDL2 Rev: 8064

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  Simple DirectMedia Layer
 
3
  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
 
4
 
 
5
  This software is provided 'as-is', without any express or implied
 
6
  warranty.  In no event will the authors be held liable for any damages
 
7
  arising from the use of this software.
 
8
 
 
9
  Permission is granted to anyone to use this software for any purpose,
 
10
  including commercial applications, and to alter it and redistribute it
 
11
  freely, subject to the following restrictions:
 
12
 
 
13
  1. The origin of this software must not be misrepresented; you must not
 
14
     claim that you wrote the original software. If you use this software
 
15
     in a product, an acknowledgment in the product documentation would be
 
16
     appreciated but is not required.
 
17
  2. Altered source versions must be plainly marked as such, and must not be
 
18
     misrepresented as being the original software.
 
19
  3. This notice may not be removed or altered from any source distribution.
 
20
*/
 
21
#include "SDL_config.h"
 
22
 
 
23
#ifndef _SDL_cocoawindow_h
 
24
#define _SDL_cocoawindow_h
 
25
 
 
26
#import <Cocoa/Cocoa.h>
 
27
 
 
28
typedef struct SDL_WindowData SDL_WindowData;
 
29
 
 
30
typedef enum
 
31
{
 
32
    PENDING_OPERATION_NONE,
 
33
    PENDING_OPERATION_ENTER_FULLSCREEN,
 
34
    PENDING_OPERATION_LEAVE_FULLSCREEN,
 
35
    PENDING_OPERATION_MINIMIZE
 
36
} PendingWindowOperation;
 
37
 
 
38
@interface Cocoa_WindowListener : NSResponder <NSWindowDelegate> {
 
39
    SDL_WindowData *_data;
 
40
    BOOL observingVisible;
 
41
    BOOL wasCtrlLeft;
 
42
    BOOL wasVisible;
 
43
    BOOL isFullscreenSpace;
 
44
    BOOL inFullscreenTransition;
 
45
    PendingWindowOperation pendingWindowOperation;
 
46
}
 
47
 
 
48
-(void) listen:(SDL_WindowData *) data;
 
49
-(void) pauseVisibleObservation;
 
50
-(void) resumeVisibleObservation;
 
51
-(BOOL) setFullscreenSpace:(BOOL) state;
 
52
-(BOOL) isInFullscreenSpace;
 
53
-(BOOL) isInFullscreenSpaceTransition;
 
54
-(void) addPendingWindowOperation:(PendingWindowOperation) operation;
 
55
-(void) close;
 
56
 
 
57
/* Window delegate functionality */
 
58
-(BOOL) windowShouldClose:(id) sender;
 
59
-(void) windowDidExpose:(NSNotification *) aNotification;
 
60
-(void) windowDidMove:(NSNotification *) aNotification;
 
61
-(void) windowDidResize:(NSNotification *) aNotification;
 
62
-(void) windowDidMiniaturize:(NSNotification *) aNotification;
 
63
-(void) windowDidDeminiaturize:(NSNotification *) aNotification;
 
64
-(void) windowDidBecomeKey:(NSNotification *) aNotification;
 
65
-(void) windowDidResignKey:(NSNotification *) aNotification;
 
66
-(void) windowWillEnterFullScreen:(NSNotification *) aNotification;
 
67
-(void) windowDidEnterFullScreen:(NSNotification *) aNotification;
 
68
-(void) windowWillExitFullScreen:(NSNotification *) aNotification;
 
69
-(void) windowDidExitFullScreen:(NSNotification *) aNotification;
 
70
 
 
71
/* Window event handling */
 
72
-(void) mouseDown:(NSEvent *) theEvent;
 
73
-(void) rightMouseDown:(NSEvent *) theEvent;
 
74
-(void) otherMouseDown:(NSEvent *) theEvent;
 
75
-(void) mouseUp:(NSEvent *) theEvent;
 
76
-(void) rightMouseUp:(NSEvent *) theEvent;
 
77
-(void) otherMouseUp:(NSEvent *) theEvent;
 
78
-(void) mouseMoved:(NSEvent *) theEvent;
 
79
-(void) mouseDragged:(NSEvent *) theEvent;
 
80
-(void) rightMouseDragged:(NSEvent *) theEvent;
 
81
-(void) otherMouseDragged:(NSEvent *) theEvent;
 
82
-(void) scrollWheel:(NSEvent *) theEvent;
 
83
-(void) touchesBeganWithEvent:(NSEvent *) theEvent;
 
84
-(void) touchesMovedWithEvent:(NSEvent *) theEvent;
 
85
-(void) touchesEndedWithEvent:(NSEvent *) theEvent;
 
86
-(void) touchesCancelledWithEvent:(NSEvent *) theEvent;
 
87
 
 
88
/* Touch event handling */
 
89
typedef enum {
 
90
    COCOA_TOUCH_DOWN,
 
91
    COCOA_TOUCH_UP,
 
92
    COCOA_TOUCH_MOVE,
 
93
    COCOA_TOUCH_CANCELLED
 
94
} cocoaTouchType;
 
95
-(void) handleTouches:(cocoaTouchType)type withEvent:(NSEvent*) event;
 
96
 
 
97
@end
 
98
/* *INDENT-ON* */
 
99
 
 
100
@class SDLOpenGLContext;
 
101
 
 
102
struct SDL_WindowData
 
103
{
 
104
    SDL_Window *window;
 
105
    NSWindow *nswindow;
 
106
    NSMutableArray *nscontexts;
 
107
    SDL_bool created;
 
108
    Cocoa_WindowListener *listener;
 
109
    struct SDL_VideoData *videodata;
 
110
};
 
111
 
 
112
extern int Cocoa_CreateWindow(_THIS, SDL_Window * window);
 
113
extern int Cocoa_CreateWindowFrom(_THIS, SDL_Window * window,
 
114
                                  const void *data);
 
115
extern void Cocoa_SetWindowTitle(_THIS, SDL_Window * window);
 
116
extern void Cocoa_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon);
 
117
extern void Cocoa_SetWindowPosition(_THIS, SDL_Window * window);
 
118
extern void Cocoa_SetWindowSize(_THIS, SDL_Window * window);
 
119
extern void Cocoa_SetWindowMinimumSize(_THIS, SDL_Window * window);
 
120
extern void Cocoa_SetWindowMaximumSize(_THIS, SDL_Window * window);
 
121
extern void Cocoa_ShowWindow(_THIS, SDL_Window * window);
 
122
extern void Cocoa_HideWindow(_THIS, SDL_Window * window);
 
123
extern void Cocoa_RaiseWindow(_THIS, SDL_Window * window);
 
124
extern void Cocoa_MaximizeWindow(_THIS, SDL_Window * window);
 
125
extern void Cocoa_MinimizeWindow(_THIS, SDL_Window * window);
 
126
extern void Cocoa_RestoreWindow(_THIS, SDL_Window * window);
 
127
extern void Cocoa_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered);
 
128
extern void Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen);
 
129
extern int Cocoa_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp);
 
130
extern int Cocoa_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp);
 
131
extern void Cocoa_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed);
 
132
extern void Cocoa_DestroyWindow(_THIS, SDL_Window * window);
 
133
extern SDL_bool Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window,
 
134
                                      struct SDL_SysWMinfo *info);
 
135
 
 
136
#endif /* _SDL_cocoawindow_h */
 
137
 
 
138
/* vi: set ts=4 sw=4 expandtab: */