OpenTTD Source: src/video/cocoa/cocoa_wnd.h Source File

OpenTTD Source 12.2

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 #ifdef MAC_OS_X_VERSION_10_12_2
16 # define HAVE_TOUCHBAR_SUPPORT
17 #endif
18
19 class VideoDriver_Cocoa;
20
21 /* Right Mouse Button Emulation enum */
22 enum RightMouseButtonEmulationState {
23 RMBE_COMMAND = 0,
24 RMBE_CONTROL = 1,
25 RMBE_OFF = 2,
26 };
27
28 extern NSString *OTTDMainLaunchGameEngine;
29
31 @interface NSCursor (OTTD_QuickdrawCursor)
32 + (NSCursor *) clearCocoaCursor;
33 @end
34
36 @interface OTTD_CocoaWindow : NSWindow
37 #ifdef HAVE_TOUCHBAR_SUPPORT
38 <NSTouchBarDelegate>
39 #endif
40
41 - (instancetype)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag driver:(VideoDriver_Cocoa *)drv;
42
43 - (void)setFrame:(NSRect)frameRect display:(BOOL)flag;
44
45 - (void)refreshSystemSprites;
46 @end
47
49 @interface OTTD_CocoaView : NSView <NSTextInputClient>
50 - (NSRect)getRealRect:(NSRect)rect;
51 - (NSRect)getVirtualRect:(NSRect)rect;
52 - (CGFloat)getContentsScale;
53 - (NSPoint)mousePositionFromEvent:(NSEvent *)e;
54 @end
55
57 @interface OTTD_CocoaWindowDelegate : NSObject <NSWindowDelegate>
58 - (instancetype)initWithDriver:(VideoDriver_Cocoa *)drv;
59
60 - (BOOL)windowShouldClose:(id)sender;
61 - (void)windowDidEnterFullScreen:(NSNotification *)aNotification;
62 - (void)windowDidChangeBackingProperties:(NSNotification *)notification;
63 - (NSApplicationPresentationOptions)window:(NSWindow *)window willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions;
64 @end
65
66
67 extern bool _allow_hidpi_window;
68
69 bool CocoaSetupApplication();
70 void CocoaExitApplication();
71
72 #endif /* COCOA_WND_H */
OTTD_CocoaWindowDelegate
Delegate for our NSWindow to send ask for quit on close.
Definition: cocoa_wnd.h:57
OTTD_CocoaView
Subclass of NSView to support mouse awareness and text input.
Definition: cocoa_wnd.h:49
NSCursor(OTTD_QuickdrawCursor)
Category of NSCursor to allow cursor showing/hiding.
Definition: cocoa_wnd.h:31
VideoDriver_Cocoa
Definition: cocoa_v.h:23
OTTD_CocoaWindow
Subclass of NSWindow to cater our special needs.
Definition: cocoa_wnd.h:36