/
window.h
72 lines (61 loc) · 1.85 KB
/
window.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// LAF OS Library
// Copyright (C) 2018-2021 Igara Studio S.A.
// Copyright (C) 2012-2017 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef OS_OSX_WINDOW_H_INCLUDED
#define OS_OSX_WINDOW_H_INCLUDED
#pragma once
#include <Cocoa/Cocoa.h>
#include "gfx/point.h"
#include "gfx/rect.h"
#include "gfx/size.h"
#include "os/keys.h"
#include "os/native_cursor.h"
namespace os {
class Event;
class Surface;
}
class OSXWindowImpl {
public:
virtual ~OSXWindowImpl() { }
void queueEvent(os::Event& ev) {
onQueueEvent(ev);
}
virtual void onQueueEvent(os::Event& ev) = 0;
virtual void onClose() = 0;
virtual void onResize(const gfx::Size& size) = 0;
virtual void onDrawRect(const gfx::Rect& rect) = 0;
virtual void onWindowChanged() = 0;
virtual void onStartResizing() = 0;
virtual void onResizing(gfx::Size& size) = 0;
virtual void onEndResizing() = 0;
// This generally happens when the window is moved to another
// monitor with different scale (e.g. Retina vs non-Retina display),
// or when the color space changes.
virtual void onChangeBackingProperties() = 0;
};
@class OSXWindowDelegate;
@interface OSXWindow : NSWindow {
@private
OSXWindowImpl* m_impl;
OSXWindowDelegate* m_delegate;
int m_scale;
}
- (OSXWindow*)initWithImpl:(OSXWindowImpl*)impl
width:(int)width
height:(int)height
scale:(int)scale;
- (OSXWindowImpl*)impl;
- (int)scale;
- (void)setScale:(int)scale;
- (gfx::Size)clientSize;
- (gfx::Size)restoredSize;
- (void)setMousePosition:(const gfx::Point&)position;
- (BOOL)setNativeMouseCursor:(os::NativeCursor)cursor;
- (BOOL)setNativeMouseCursor:(const os::Surface*)surface
focus:(const gfx::Point&)focus
scale:(const int)scale;
@end
#endif