blob: 90f3d9e7766a498bafb5fad7904586c2a23300ef [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
reed@android.com8a1c16f2008-12-17 15:59:43 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * Copyright 2006 The Android Open Source Project
reed@android.com8a1c16f2008-12-17 15:59:43 +00004 *
epoger@google.comec3ed6a2011-07-28 14:26:00 +00005 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
reed@android.com8a1c16f2008-12-17 15:59:43 +00007 */
8
epoger@google.comec3ed6a2011-07-28 14:26:00 +00009
reed@android.com8a1c16f2008-12-17 15:59:43 +000010#ifndef SkOSWindow_Mac_DEFINED
11#define SkOSWindow_Mac_DEFINED
12
reed@android.com64dbab72009-01-23 16:33:13 +000013#include <Carbon/Carbon.h>
reed@android.com8a1c16f2008-12-17 15:59:43 +000014#include "SkWindow.h"
15
16class SkOSWindow : public SkWindow {
17public:
18 SkOSWindow(void* hwnd);
19
20 void* getHWND() const { return fHWND; }
reed@android.com6efdc472008-12-19 18:24:35 +000021 void* getHVIEW() const { return fHVIEW; }
reed@android.com8a1c16f2008-12-17 15:59:43 +000022 void updateSize();
23
24 static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay);
25
reed@android.com91861032009-09-23 00:43:53 +000026 static OSStatus EventHandler(EventHandlerCallRef inHandler,
27 EventRef inEvent, void* userData);
reed@android.com8a1c16f2008-12-17 15:59:43 +000028
reed@android.comf2b98d62010-12-20 18:26:13 +000029 void doPaint(void* ctx);
30
31
bsalomon@google.com498a6232011-03-10 18:24:15 +000032 bool attachGL();
reed@android.comf2b98d62010-12-20 18:26:13 +000033 void detachGL();
34 void presentGL();
reed@android.com6efdc472008-12-19 18:24:35 +000035
reed@android.com8a1c16f2008-12-17 15:59:43 +000036protected:
reed@android.com6efdc472008-12-19 18:24:35 +000037 // overrides from SkEventSink
38 virtual bool onEvent(const SkEvent& evt);
reed@android.com8a1c16f2008-12-17 15:59:43 +000039 // 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.comf2b98d62010-12-20 18:26:13 +000044
reed@android.com8a1c16f2008-12-17 15:59:43 +000045
46private:
47 void* fHWND;
reed@android.com6efdc472008-12-19 18:24:35 +000048 void* fHVIEW;
reed@android.comf2b98d62010-12-20 18:26:13 +000049 void* fAGLCtx;
reed@android.com8a1c16f2008-12-17 15:59:43 +000050
51 typedef SkWindow INHERITED;
52};
53
54#endif
55