13 #import <Cocoa/Cocoa.h>
20 enum RightMouseButtonEmulationState {
26 extern NSString *OTTDMainLaunchGameEngine;
30 + (NSCursor *) clearCocoaCursor;
33 #ifdef HAVE_OSX_1015_SDK
35 static NSArray *touchBarButtonIdentifiers = @[
37 @"openttd.fastforward",
40 @"openttd.build_rail",
41 @"openttd.build_road",
42 @"openttd.build_tram",
43 @"openttd.build_docks",
44 @"openttd.build_airport",
45 NSTouchBarItemIdentifierOtherItemsProxy
48 static NSDictionary *touchBarButtonSprites = @{
49 @"openttd.pause": [NSNumber numberWithInt:SPR_IMG_PAUSE],
50 @"openttd.fastforward": [NSNumber numberWithInt:SPR_IMG_FASTFORWARD],
51 @"openttd.zoom_in": [NSNumber numberWithInt:SPR_IMG_ZOOMIN],
52 @"openttd.zoom_out": [NSNumber numberWithInt:SPR_IMG_ZOOMOUT],
53 @"openttd.build_rail": [NSNumber numberWithInt:SPR_IMG_BUILDRAIL],
54 @"openttd.build_road": [NSNumber numberWithInt:SPR_IMG_BUILDROAD],
55 @"openttd.build_tram": [NSNumber numberWithInt:SPR_IMG_BUILDTRAMS],
56 @"openttd.build_docks": [NSNumber numberWithInt:SPR_IMG_BUILDWATER],
57 @"openttd.build_airport": [NSNumber numberWithInt:SPR_IMG_BUILDAIR],
60 static NSDictionary *touchBarButtonActions = @{
61 @"openttd.pause": [NSNumber numberWithInt:MTHK_PAUSE],
62 @"openttd.fastforward": [NSNumber numberWithInt:MTHK_FASTFORWARD],
63 @"openttd.zoom_in": [NSNumber numberWithInt:MTHK_ZOOM_IN],
64 @"openttd.zoom_out": [NSNumber numberWithInt:MTHK_ZOOM_OUT],
65 @"openttd.build_rail": [NSNumber numberWithInt:MTHK_BUILD_RAIL],
66 @"openttd.build_road": [NSNumber numberWithInt:MTHK_BUILD_ROAD],
67 @"openttd.build_tram": [NSNumber numberWithInt:MTHK_BUILD_TRAM],
68 @"openttd.build_docks": [NSNumber numberWithInt:MTHK_BUILD_DOCKS],
69 @"openttd.build_airport": [NSNumber numberWithInt:MTHK_BUILD_AIRPORT],
72 static NSDictionary *touchBarFallbackText = @{
73 @"openttd.pause":
@"Pause",
74 @"openttd.fastforward":
@"Fast Forward",
75 @"openttd.zoom_in":
@"Zoom In",
76 @"openttd.zoom_out":
@"Zoom Out",
77 @"openttd.build_rail":
@"Rail",
78 @"openttd.build_road":
@"Road",
79 @"openttd.build_tram":
@"Tram",
80 @"openttd.build_docks":
@"Docks",
81 @"openttd.build_airport":
@"Airport",
86 #ifdef HAVE_OSX_1015_SDK
88 @property (strong) NSSet *touchbarItems;
89 - (NSImage*)generateImage:(
int)spriteId;
94 - (instancetype)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag driver:(
VideoDriver_Cocoa *)drv;
96 - (void)setFrame:(NSRect)frameRect display:(BOOL)flag;
101 - (NSRect)getRealRect:(NSRect)rect;
102 - (NSRect)getVirtualRect:(NSRect)rect;
103 - (CGFloat)getContentsScale;
104 - (NSPoint)mousePositionFromEvent:(NSEvent *)e;
111 - (BOOL)windowShouldClose:(
id)sender;
112 - (void)windowDidEnterFullScreen:(NSNotification *)aNotification;
113 - (void)windowDidChangeBackingProperties:(NSNotification *)notification;
114 - (NSApplicationPresentationOptions)window:(NSWindow *)window willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions;
118 extern bool _allow_hidpi_window;
120 bool CocoaSetupApplication();
121 void CocoaExitApplication();