blob: 3391785ef9004a6fcef62621e12bb91043667ca1 [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
yangsu@google.coma8540412011-08-30 14:40:49 +00009#ifndef SkOSWindow_MacCocoa_DEFINED
10#define SkOSWindow_MacCocoa_DEFINED
epoger@google.comec3ed6a2011-07-28 14:26:00 +000011
reed@android.com8a1c16f2008-12-17 15:59:43 +000012#include "SkWindow.h"
13
14class SkOSWindow : public SkWindow {
15public:
16 SkOSWindow(void* hwnd);
yangsu@google.coma8540412011-08-30 14:40:49 +000017 ~SkOSWindow();
reed@android.com8a1c16f2008-12-17 15:59:43 +000018 void* getHWND() const { return fHWND; }
bsalomon@google.com11959252012-04-06 20:13:38 +000019
yangsu@google.coma8540412011-08-30 14:40:49 +000020 virtual bool onDispatchClick(int x, int y, Click::State state,
21 void* owner);
robertphillips@google.comb442a6d2012-04-02 19:24:21 +000022 enum SkBackEndTypes {
23 kNone_BackEndType,
bsalomon@google.comcf8fb1f2012-08-02 14:03:32 +000024#if SK_SUPPORT_GPU
robertphillips@google.comb442a6d2012-04-02 19:24:21 +000025 kNativeGL_BackEndType,
bsalomon@google.comcf8fb1f2012-08-02 14:03:32 +000026#endif
robertphillips@google.comb442a6d2012-04-02 19:24:21 +000027 };
28
29 void detach();
bsalomon@google.com11959252012-04-06 20:13:38 +000030 bool attach(SkBackEndTypes attachType, int msaaSampleCount);
robertphillips@google.comb442a6d2012-04-02 19:24:21 +000031 void present();
bsalomon@google.com11959252012-04-06 20:13:38 +000032
reed@android.com8a1c16f2008-12-17 15:59:43 +000033protected:
reed@android.com6efdc472008-12-19 18:24:35 +000034 // overrides from SkEventSink
35 virtual bool onEvent(const SkEvent& evt);
reed@android.com8a1c16f2008-12-17 15:59:43 +000036 // overrides from SkWindow
37 virtual void onHandleInval(const SkIRect&);
38 // overrides from SkView
39 virtual void onAddMenu(const SkOSMenu*);
yangsu@google.coma8540412011-08-30 14:40:49 +000040 virtual void onUpdateMenu(const SkOSMenu*);
reed@android.com8a1c16f2008-12-17 15:59:43 +000041 virtual void onSetTitle(const char[]);
reed@android.comf2b98d62010-12-20 18:26:13 +000042
reed@android.com8a1c16f2008-12-17 15:59:43 +000043private:
44 void* fHWND;
yangsu@google.coma8540412011-08-30 14:40:49 +000045 bool fInvalEventIsPending;
46 void* fNotifier;
bsalomon@google.comcf8fb1f2012-08-02 14:03:32 +000047#if SK_SUPPORT_GPU
yangsu@google.coma8540412011-08-30 14:40:49 +000048 void* fGLContext;
bsalomon@google.comcf8fb1f2012-08-02 14:03:32 +000049#endif
reed@android.com8a1c16f2008-12-17 15:59:43 +000050 typedef SkWindow INHERITED;
51};
52
caryclark@google.com4ee8aea2011-11-23 14:54:19 +000053#endif