OpenTTD Source  1.11.0-beta2
cocoa_wnd.h
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6  */
7 
10 #ifndef COCOA_WND_H
11 #define COCOA_WND_H
12 
13 #import <Cocoa/Cocoa.h>
14 
15 class VideoDriver_Cocoa;
16 
17 /* Right Mouse Button Emulation enum */
18 enum RightMouseButtonEmulationState {
19  RMBE_COMMAND = 0,
20  RMBE_CONTROL = 1,
21  RMBE_OFF = 2,
22 };
23 
24 extern NSString *OTTDMainLaunchGameEngine;
25 
28 + (NSCursor *) clearCocoaCursor;
29 @end
30 
32 @interface OTTD_CocoaWindow : NSWindow
33 - (instancetype)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag driver:(VideoDriver_Cocoa *)drv;
34 
35 - (void)display;
36 - (void)setFrame:(NSRect)frameRect display:(BOOL)flag;
37 @end
38 
40 @interface OTTD_CocoaView : NSView <NSTextInputClient>
41 - (NSRect)getRealRect:(NSRect)rect;
42 - (NSRect)getVirtualRect:(NSRect)rect;
43 - (CGFloat)getContentsScale;
44 - (NSPoint)mousePositionFromEvent:(NSEvent *)e;
45 @end
46 
48 @interface OTTD_CocoaWindowDelegate : NSObject <NSWindowDelegate>
49 - (instancetype)initWithDriver:(VideoDriver_Cocoa *)drv;
50 
51 - (BOOL)windowShouldClose:(id)sender;
52 - (void)windowDidEnterFullScreen:(NSNotification *)aNotification;
53 - (void)windowDidChangeBackingProperties:(NSNotification *)notification;
54 - (NSApplicationPresentationOptions)window:(NSWindow *)window willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions;
55 @end
56 
57 
58 extern bool _allow_hidpi_window;
59 
60 bool CocoaSetupApplication();
61 void CocoaExitApplication();
62 
63 #endif /* COCOA_WND_H */
OTTD_CocoaWindowDelegate
Delegate for our NSWindow to send ask for quit on close.
Definition: cocoa_wnd.h:48
OTTD_CocoaView
Subclass of NSView to support mouse awareness and text input.
Definition: cocoa_wnd.h:40
NSCursor(OTTD_QuickdrawCursor)
Category of NSCursor to allow cursor showing/hiding.
Definition: cocoa_wnd.h:27
VideoDriver_Cocoa
Definition: cocoa_v.h:23
OTTD_CocoaWindow
Subclass of NSWindow to cater our special needs.
Definition: cocoa_wnd.h:32