2016-07-19 21:17:20 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2016 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef Window_mac_DEFINED
|
|
|
|
#define Window_mac_DEFINED
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "src/core/SkTDynamicHash.h"
|
|
|
|
#include "tools/sk_app/Window.h"
|
2016-07-19 21:17:20 +00:00
|
|
|
|
2019-01-28 19:46:04 +00:00
|
|
|
#import <Cocoa/Cocoa.h>
|
2016-08-04 19:30:31 +00:00
|
|
|
|
2016-07-19 21:17:20 +00:00
|
|
|
namespace sk_app {
|
|
|
|
|
|
|
|
class Window_mac : public Window {
|
|
|
|
public:
|
2018-02-15 18:33:26 +00:00
|
|
|
Window_mac()
|
|
|
|
: INHERITED()
|
2019-07-11 19:40:53 +00:00
|
|
|
, fWindow(nil) {}
|
2019-01-28 19:46:04 +00:00
|
|
|
~Window_mac() override {
|
|
|
|
this->closeWindow();
|
|
|
|
}
|
2016-07-19 21:17:20 +00:00
|
|
|
|
2017-02-24 23:04:47 +00:00
|
|
|
bool initWindow();
|
2016-07-19 21:17:20 +00:00
|
|
|
|
|
|
|
void setTitle(const char*) override;
|
|
|
|
void show() override;
|
|
|
|
|
2017-02-24 23:04:47 +00:00
|
|
|
bool attach(BackendType) override;
|
2016-07-19 21:17:20 +00:00
|
|
|
|
2019-02-08 18:44:42 +00:00
|
|
|
void onInval() override {}
|
2019-02-13 17:26:35 +00:00
|
|
|
|
|
|
|
static void PaintWindows();
|
|
|
|
|
|
|
|
static const NSInteger& GetKey(const Window_mac& w) {
|
|
|
|
return w.fWindowNumber;
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint32_t Hash(const NSInteger& windowNumber) {
|
|
|
|
return windowNumber;
|
|
|
|
}
|
|
|
|
|
|
|
|
NSWindow* window() { return fWindow; }
|
2016-07-19 21:17:20 +00:00
|
|
|
void closeWindow();
|
|
|
|
|
2019-01-28 19:46:04 +00:00
|
|
|
private:
|
|
|
|
NSWindow* fWindow;
|
2019-02-13 17:26:35 +00:00
|
|
|
NSInteger fWindowNumber;
|
2017-10-09 19:45:33 +00:00
|
|
|
|
2019-02-13 17:26:35 +00:00
|
|
|
static SkTDynamicHash<Window_mac, NSInteger> gWindowMap;
|
|
|
|
|
2016-08-04 19:30:31 +00:00
|
|
|
typedef Window INHERITED;
|
2016-07-19 21:17:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace sk_app
|
|
|
|
|
|
|
|
#endif
|