| reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2006 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef SkOSWindow_Mac_DEFINED |
| 18 | #define SkOSWindow_Mac_DEFINED |
| 19 | |
| reed@android.com | 64dbab7 | 2009-01-23 16:33:13 +0000 | [diff] [blame] | 20 | #include <Carbon/Carbon.h> |
| reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 21 | #include "SkWindow.h" |
| 22 | |
| 23 | class SkOSWindow : public SkWindow { |
| 24 | public: |
| 25 | SkOSWindow(void* hwnd); |
| 26 | |
| 27 | void* getHWND() const { return fHWND; } |
| reed@android.com | 6efdc47 | 2008-12-19 18:24:35 +0000 | [diff] [blame] | 28 | void* getHVIEW() const { return fHVIEW; } |
| reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 29 | void updateSize(); |
| 30 | |
| 31 | static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay); |
| 32 | |
| reed@android.com | 9186103 | 2009-09-23 00:43:53 +0000 | [diff] [blame] | 33 | static OSStatus EventHandler(EventHandlerCallRef inHandler, |
| 34 | EventRef inEvent, void* userData); |
| reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 35 | |
| reed@android.com | f2b98d6 | 2010-12-20 18:26:13 +0000 | [diff] [blame^] | 36 | void doPaint(void* ctx); |
| 37 | |
| 38 | |
| 39 | bool attachGL(const SkBitmap* offscreen); |
| 40 | void detachGL(); |
| 41 | void presentGL(); |
| reed@android.com | 6efdc47 | 2008-12-19 18:24:35 +0000 | [diff] [blame] | 42 | |
| reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 43 | protected: |
| reed@android.com | 6efdc47 | 2008-12-19 18:24:35 +0000 | [diff] [blame] | 44 | // overrides from SkEventSink |
| 45 | virtual bool onEvent(const SkEvent& evt); |
| reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 46 | // overrides from SkWindow |
| 47 | virtual void onHandleInval(const SkIRect&); |
| 48 | // overrides from SkView |
| 49 | virtual void onAddMenu(const SkOSMenu*); |
| 50 | virtual void onSetTitle(const char[]); |
| reed@android.com | f2b98d6 | 2010-12-20 18:26:13 +0000 | [diff] [blame^] | 51 | |
| reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 52 | |
| 53 | private: |
| 54 | void* fHWND; |
| reed@android.com | 6efdc47 | 2008-12-19 18:24:35 +0000 | [diff] [blame] | 55 | void* fHVIEW; |
| reed@android.com | f2b98d6 | 2010-12-20 18:26:13 +0000 | [diff] [blame^] | 56 | void* fAGLCtx; |
| reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 57 | |
| 58 | typedef SkWindow INHERITED; |
| 59 | }; |
| 60 | |
| 61 | #endif |
| 62 | |