blob: 81ae37c60a1fe0da70ad96ba1f0f82e996d4f55b (
plain)
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
|
#import <UIKit/UIKit.h>
#include "SkCanvas.h"
#include "SkGraphics.h"
#import "SkEventNotifier.h"
#include "SkOSMenu.h"
#include "SkTime.h"
#include "SkTypes.h"
#import "SkUIView.h"
#include "SkWindow.h"
#define kINVAL_UIVIEW_EventType "inval-uiview"
SkOSWindow::SkOSWindow(void* hWnd) : fHWND(hWnd) {
fInvalEventIsPending = false;
fNotifier = [[SkEventNotifier alloc] init];
}
SkOSWindow::~SkOSWindow() {
[(SkEventNotifier*)fNotifier release];
}
void SkOSWindow::onHandleInval(const SkIRect& r) {
if (!fInvalEventIsPending) {
fInvalEventIsPending = true;
(new SkEvent(kINVAL_UIVIEW_EventType, this->getSinkID()))->post();
}
}
bool SkOSWindow::onEvent(const SkEvent& evt) {
if (evt.isType(kINVAL_UIVIEW_EventType)) {
fInvalEventIsPending = false;
const SkIRect& r = this->getDirtyBounds();
[(SkUIView*)fHWND postInvalWithRect:&r];
return true;
}
if ([(SkUIView*)fHWND onHandleEvent:evt]) {
return true;
}
return this->INHERITED::onEvent(evt);
}
bool SkOSWindow::onDispatchClick(int x, int y, Click::State state, void* owner) {
return this->INHERITED::onDispatchClick(x, y, state, owner);
}
void SkOSWindow::onSetTitle(const char title[]) {
[(SkUIView*)fHWND setSkTitle:title];
}
void SkOSWindow::onAddMenu(const SkOSMenu* menu) {
[(SkUIView*)fHWND onAddMenu:menu];
}
void SkOSWindow::onUpdateMenu(const SkOSMenu* menu) {
[(SkUIView*)fHWND onUpdateMenu:menu];
}
bool SkOSWindow::attach(SkBackEndTypes /* attachType */) {
bool success = true;
return success;
}
void SkOSWindow::detach() {}
void SkOSWindow::present() {
}
|