| 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 "src/core/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: |
| 21 |
Window_ios() |
| 22 |
: Window() |
| 23 |
, fWindow(nil) {} |
| 24 |
~Window_ios() override { this->closeWindow(); } |
| 25 |
|
| 26 |
bool initWindow(); |
| 27 |
|
| 28 |
void setTitle(const char*) override {} |
| 29 |
void show() override {} |
| 30 |
|
| 31 |
bool attach(BackendType) override; |
| 32 |
|
| 33 |
void onInval() override; |
| 34 |
|
| 35 |
static void PaintWindow(); |
| 36 |
|
| 37 |
UIWindow* uiWindow() { return fWindow; } |
| 38 |
|
| 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 |
|
| 49 |
} // namespace sk_app |
| 50 |
|
| 51 |
////////////////////////////////////////////////////////////////////////// |
| 52 |
|
| 53 |
@interface MainView : UIView |
| 54 |
|
| 55 |
- (MainView*)initWithWindow:(sk_app::Window_ios*)initWindow; |
| 56 |
|
| 57 |
@end |
| 58 |
|
| 59 |
#endif |