blob: 41766a0f53adf85ea7b9c5436953f05246aae18b [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
rmistry@google.comfbfcd562012-08-23 18:09:54 +000020 virtual bool onDispatchClick(int x, int y, Click::State state,
reed@google.com4d5c26d2013-01-08 16:17:50 +000021 void* owner, unsigned modi);
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
hendrikw9a740412015-10-28 08:42:29 -070027#if SK_ANGLE
28 kANGLE_BackEndType,
29#endif // SK_ANGLE
robertphillips@google.comb442a6d2012-04-02 19:24:21 +000030 };
31
mtklein18300a32016-03-16 13:53:35 -070032 void release();
brianosman2d1ee792016-05-05 12:24:31 -070033 bool attach(SkBackEndTypes attachType, int msaaSampleCount, bool deepColor,
34 AttachmentInfo*);
robertphillips@google.comb442a6d2012-04-02 19:24:21 +000035 void present();
bsalomon@google.com11959252012-04-06 20:13:38 +000036
bsalomon241b56d2015-06-18 11:49:42 -070037 bool makeFullscreen();
38 void closeWindow();
39 void setVsync(bool);
reed@android.com8a1c16f2008-12-17 15:59:43 +000040protected:
reed@android.com6efdc472008-12-19 18:24:35 +000041 // overrides from SkEventSink
42 virtual bool onEvent(const SkEvent& evt);
reed@android.com8a1c16f2008-12-17 15:59:43 +000043 // overrides from SkWindow
44 virtual void onHandleInval(const SkIRect&);
45 // overrides from SkView
46 virtual void onAddMenu(const SkOSMenu*);
yangsu@google.coma8540412011-08-30 14:40:49 +000047 virtual void onUpdateMenu(const SkOSMenu*);
reed@android.com8a1c16f2008-12-17 15:59:43 +000048 virtual void onSetTitle(const char[]);
rmistry@google.comfbfcd562012-08-23 18:09:54 +000049
reed@android.com8a1c16f2008-12-17 15:59:43 +000050private:
51 void* fHWND;
yangsu@google.coma8540412011-08-30 14:40:49 +000052 bool fInvalEventIsPending;
53 void* fNotifier;
bsalomon@google.comcf8fb1f2012-08-02 14:03:32 +000054#if SK_SUPPORT_GPU
yangsu@google.coma8540412011-08-30 14:40:49 +000055 void* fGLContext;
bsalomon@google.comcf8fb1f2012-08-02 14:03:32 +000056#endif
reed@android.com8a1c16f2008-12-17 15:59:43 +000057 typedef SkWindow INHERITED;
58};
59
caryclark@google.com4ee8aea2011-11-23 14:54:19 +000060#endif