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 | 3a0b5be | 2009-01-23 16:23:10 +0000 | [diff] [blame] | 33 | static OSStatus SkOSWindow::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 | 6efdc47 | 2008-12-19 18:24:35 +0000 | [diff] [blame] | 36 | void doPaint(void* ctx); |
| 37 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 38 | protected: |
reed@android.com | 6efdc47 | 2008-12-19 18:24:35 +0000 | [diff] [blame] | 39 | // overrides from SkEventSink |
| 40 | virtual bool onEvent(const SkEvent& evt); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 41 | // overrides from SkWindow |
| 42 | virtual void onHandleInval(const SkIRect&); |
| 43 | // overrides from SkView |
| 44 | virtual void onAddMenu(const SkOSMenu*); |
| 45 | virtual void onSetTitle(const char[]); |
| 46 | |
| 47 | private: |
| 48 | void* fHWND; |
reed@android.com | 6efdc47 | 2008-12-19 18:24:35 +0000 | [diff] [blame] | 49 | void* fHVIEW; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 50 | |
| 51 | typedef SkWindow INHERITED; |
| 52 | }; |
| 53 | |
| 54 | #endif |
| 55 | |