michael@0: #import michael@0: #include "SkCanvas.h" michael@0: #include "SkGraphics.h" michael@0: #import "SkEventNotifier.h" michael@0: #include "SkOSMenu.h" michael@0: #include "SkTime.h" michael@0: #include "SkTypes.h" michael@0: #import "SkUIView.h" michael@0: #include "SkWindow.h" michael@0: michael@0: #define kINVAL_UIVIEW_EventType "inval-uiview" michael@0: michael@0: SkOSWindow::SkOSWindow(void* hWnd) : fHWND(hWnd) { michael@0: fInvalEventIsPending = false; michael@0: fNotifier = [[SkEventNotifier alloc] init]; michael@0: } michael@0: SkOSWindow::~SkOSWindow() { michael@0: [(SkEventNotifier*)fNotifier release]; michael@0: } michael@0: michael@0: void SkOSWindow::onHandleInval(const SkIRect& r) { michael@0: if (!fInvalEventIsPending) { michael@0: fInvalEventIsPending = true; michael@0: (new SkEvent(kINVAL_UIVIEW_EventType, this->getSinkID()))->post(); michael@0: } michael@0: } michael@0: michael@0: bool SkOSWindow::onEvent(const SkEvent& evt) { michael@0: if (evt.isType(kINVAL_UIVIEW_EventType)) { michael@0: fInvalEventIsPending = false; michael@0: const SkIRect& r = this->getDirtyBounds(); michael@0: [(SkUIView*)fHWND postInvalWithRect:&r]; michael@0: return true; michael@0: } michael@0: if ([(SkUIView*)fHWND onHandleEvent:evt]) { michael@0: return true; michael@0: } michael@0: return this->INHERITED::onEvent(evt); michael@0: } michael@0: michael@0: void SkOSWindow::onSetTitle(const char title[]) { michael@0: [(SkUIView*)fHWND setSkTitle:title]; michael@0: } michael@0: michael@0: void SkOSWindow::onAddMenu(const SkOSMenu* menu) { michael@0: [(SkUIView*)fHWND onAddMenu:menu]; michael@0: } michael@0: michael@0: void SkOSWindow::onUpdateMenu(SkOSMenu* menu) { michael@0: [(SkUIView*)fHWND onUpdateMenu:menu]; michael@0: } michael@0: michael@0: bool SkOSWindow::attach(SkBackEndTypes /* attachType */, michael@0: int /* msaaSampleCount */, michael@0: AttachmentInfo* info) { michael@0: [(SkUIView*)fHWND getAttachmentInfo:info]; michael@0: bool success = true; michael@0: return success; michael@0: } michael@0: michael@0: void SkOSWindow::detach() {} michael@0: michael@0: void SkOSWindow::present() { michael@0: }