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 | |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 9 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 10 | #ifndef SkOSWindow_Mac_DEFINED |
| 11 | #define SkOSWindow_Mac_DEFINED |
| 12 | |
reed@android.com | 64dbab7 | 2009-01-23 16:33:13 +0000 | [diff] [blame] | 13 | #include <Carbon/Carbon.h> |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 14 | #include "SkWindow.h" |
| 15 | |
| 16 | class SkOSWindow : public SkWindow { |
| 17 | public: |
| 18 | SkOSWindow(void* hwnd); |
| 19 | |
| 20 | void* getHWND() const { return fHWND; } |
reed@android.com | 6efdc47 | 2008-12-19 18:24:35 +0000 | [diff] [blame] | 21 | void* getHVIEW() const { return fHVIEW; } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 22 | void updateSize(); |
| 23 | |
| 24 | static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay); |
| 25 | |
reed@android.com | 9186103 | 2009-09-23 00:43:53 +0000 | [diff] [blame] | 26 | static OSStatus EventHandler(EventHandlerCallRef inHandler, |
| 27 | EventRef inEvent, void* userData); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 28 | |
reed@android.com | f2b98d6 | 2010-12-20 18:26:13 +0000 | [diff] [blame] | 29 | void doPaint(void* ctx); |
| 30 | |
| 31 | |
bsalomon@google.com | 498a623 | 2011-03-10 18:24:15 +0000 | [diff] [blame] | 32 | bool attachGL(); |
reed@android.com | f2b98d6 | 2010-12-20 18:26:13 +0000 | [diff] [blame] | 33 | void detachGL(); |
| 34 | void presentGL(); |
reed@android.com | 6efdc47 | 2008-12-19 18:24:35 +0000 | [diff] [blame] | 35 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 36 | protected: |
reed@android.com | 6efdc47 | 2008-12-19 18:24:35 +0000 | [diff] [blame] | 37 | // overrides from SkEventSink |
| 38 | virtual bool onEvent(const SkEvent& evt); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 39 | // overrides from SkWindow |
| 40 | virtual void onHandleInval(const SkIRect&); |
| 41 | // overrides from SkView |
| 42 | virtual void onAddMenu(const SkOSMenu*); |
| 43 | virtual void onSetTitle(const char[]); |
reed@android.com | f2b98d6 | 2010-12-20 18:26:13 +0000 | [diff] [blame] | 44 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 45 | |
| 46 | private: |
| 47 | void* fHWND; |
reed@android.com | 6efdc47 | 2008-12-19 18:24:35 +0000 | [diff] [blame] | 48 | void* fHVIEW; |
reed@android.com | f2b98d6 | 2010-12-20 18:26:13 +0000 | [diff] [blame] | 49 | void* fAGLCtx; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 50 | |
| 51 | typedef SkWindow INHERITED; |
| 52 | }; |
| 53 | |
| 54 | #endif |
| 55 | |