epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 2 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 3 | * Copyright 2006 The Android Open Source Project |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 4 | * |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
yangsu@google.com | a854041 | 2011-08-30 14:40:49 +0000 | [diff] [blame] | 9 | #ifndef SkOSWindow_MacCocoa_DEFINED |
| 10 | #define SkOSWindow_MacCocoa_DEFINED |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 11 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 12 | #include "SkWindow.h" |
| 13 | |
| 14 | class SkOSWindow : public SkWindow { |
| 15 | public: |
| 16 | SkOSWindow(void* hwnd); |
yangsu@google.com | a854041 | 2011-08-30 14:40:49 +0000 | [diff] [blame] | 17 | ~SkOSWindow(); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 18 | void* getHWND() const { return fHWND; } |
bsalomon@google.com | 1195925 | 2012-04-06 20:13:38 +0000 | [diff] [blame] | 19 | |
yangsu@google.com | a854041 | 2011-08-30 14:40:49 +0000 | [diff] [blame] | 20 | virtual bool onDispatchClick(int x, int y, Click::State state, |
| 21 | void* owner); |
robertphillips@google.com | b442a6d | 2012-04-02 19:24:21 +0000 | [diff] [blame] | 22 | enum SkBackEndTypes { |
| 23 | kNone_BackEndType, |
bsalomon@google.com | cf8fb1f | 2012-08-02 14:03:32 +0000 | [diff] [blame^] | 24 | #if SK_SUPPORT_GPU |
robertphillips@google.com | b442a6d | 2012-04-02 19:24:21 +0000 | [diff] [blame] | 25 | kNativeGL_BackEndType, |
bsalomon@google.com | cf8fb1f | 2012-08-02 14:03:32 +0000 | [diff] [blame^] | 26 | #endif |
robertphillips@google.com | b442a6d | 2012-04-02 19:24:21 +0000 | [diff] [blame] | 27 | }; |
| 28 | |
| 29 | void detach(); |
bsalomon@google.com | 1195925 | 2012-04-06 20:13:38 +0000 | [diff] [blame] | 30 | bool attach(SkBackEndTypes attachType, int msaaSampleCount); |
robertphillips@google.com | b442a6d | 2012-04-02 19:24:21 +0000 | [diff] [blame] | 31 | void present(); |
bsalomon@google.com | 1195925 | 2012-04-06 20:13:38 +0000 | [diff] [blame] | 32 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 33 | protected: |
reed@android.com | 6efdc47 | 2008-12-19 18:24:35 +0000 | [diff] [blame] | 34 | // overrides from SkEventSink |
| 35 | virtual bool onEvent(const SkEvent& evt); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 36 | // overrides from SkWindow |
| 37 | virtual void onHandleInval(const SkIRect&); |
| 38 | // overrides from SkView |
| 39 | virtual void onAddMenu(const SkOSMenu*); |
yangsu@google.com | a854041 | 2011-08-30 14:40:49 +0000 | [diff] [blame] | 40 | virtual void onUpdateMenu(const SkOSMenu*); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 41 | virtual void onSetTitle(const char[]); |
reed@android.com | f2b98d6 | 2010-12-20 18:26:13 +0000 | [diff] [blame] | 42 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 43 | private: |
| 44 | void* fHWND; |
yangsu@google.com | a854041 | 2011-08-30 14:40:49 +0000 | [diff] [blame] | 45 | bool fInvalEventIsPending; |
| 46 | void* fNotifier; |
bsalomon@google.com | cf8fb1f | 2012-08-02 14:03:32 +0000 | [diff] [blame^] | 47 | #if SK_SUPPORT_GPU |
yangsu@google.com | a854041 | 2011-08-30 14:40:49 +0000 | [diff] [blame] | 48 | void* fGLContext; |
bsalomon@google.com | cf8fb1f | 2012-08-02 14:03:32 +0000 | [diff] [blame^] | 49 | #endif |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 50 | typedef SkWindow INHERITED; |
| 51 | }; |
| 52 | |
caryclark@google.com | 4ee8aea | 2011-11-23 14:54:19 +0000 | [diff] [blame] | 53 | #endif |