1 /*
2 * Copyright 2017 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7 
8 #ifndef Window_ios_DEFINED
9 #define Window_ios_DEFINED
10 
11 #include "include/private/SkChecksum.h"
12 #include "src/core/SkTDynamicHash.h"
13 #include "tools/sk_app/Window.h"
14 
15 #import <UIKit/UIKit.h>
16 
17 namespace sk_app {
18 
19 class Window_ios : public Window {
20 public:
Window_ios()21     Window_ios()
22             : INHERITED()
23             , fWindow(nil) {}
~Window_ios()24     ~Window_ios() override { this->closeWindow(); }
25 
26     bool initWindow();
27 
setTitle(const char *)28     void setTitle(const char*) override {}
show()29     void show() override {}
30 
31     bool attach(BackendType) override;
32 
33     void onInval() override;
34 
35     static void PaintWindow();
36 
uiWindow()37     UIWindow* uiWindow() { return fWindow; }
38 
MainWindow()39     static Window_ios* MainWindow() { return gWindow; }
40 
41 private:
42     void closeWindow();
43 
44     UIWindow*    fWindow;
45 
46     static Window_ios* gWindow; // there should be only one
47 
48     using INHERITED = Window;
49 };
50 
51 }   // namespace sk_app
52 
53 //////////////////////////////////////////////////////////////////////////
54 
55 @interface MainView : UIView
56 
57 - (MainView*)initWithWindow:(sk_app::Window_ios*)initWindow;
58 
59 @end
60 
61 #endif
62