1 2 /* 3 * Copyright 2006 The Android Open Source Project 4 * 5 * Use of this source code is governed by a BSD-style license that can be 6 * found in the LICENSE file. 7 */ 8 9 #ifndef SkOSWindow_MacCocoa_DEFINED 10 #define SkOSWindow_MacCocoa_DEFINED 11 12 #include "SkWindow.h" 13 14 class SkOSWindow : public SkWindow { 15 public: 16 SkOSWindow(void* hwnd); 17 ~SkOSWindow(); getHWND()18 void* getHWND() const { return fHWND; } 19 20 virtual bool onDispatchClick(int x, int y, Click::State state, 21 void* owner, unsigned modi); 22 enum SkBackEndTypes { 23 kNone_BackEndType, 24 #if SK_SUPPORT_GPU 25 kNativeGL_BackEndType, 26 #endif 27 }; 28 29 struct AttachmentInfo { 30 int fSampleCount; 31 int fStencilBits; 32 }; 33 34 void detach(); 35 bool attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo*); 36 void present(); 37 38 protected: 39 // overrides from SkEventSink 40 virtual bool onEvent(const SkEvent& evt); 41 // overrides from SkWindow 42 virtual void onHandleInval(const SkIRect&); 43 // overrides from SkView 44 virtual void onAddMenu(const SkOSMenu*); 45 virtual void onUpdateMenu(const SkOSMenu*); 46 virtual void onSetTitle(const char[]); 47 48 private: 49 void* fHWND; 50 bool fInvalEventIsPending; 51 void* fNotifier; 52 #if SK_SUPPORT_GPU 53 void* fGLContext; 54 #endif 55 typedef SkWindow INHERITED; 56 }; 57 58 #endif 59