blob: 5dea2fc12e9a02ebf65a8a6ccbad4e843fef02e6 [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
robertphillips@google.comb442a6d2012-04-02 19:24:21 +000027 };
28
bsalomon@google.com64cc8102013-03-05 20:06:05 +000029 struct AttachmentInfo {
30 int fSampleCount;
31 int fStencilBits;
32 };
33
robertphillips@google.comb442a6d2012-04-02 19:24:21 +000034 void detach();
bsalomon@google.com64cc8102013-03-05 20:06:05 +000035 bool attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo*);
robertphillips@google.comb442a6d2012-04-02 19:24:21 +000036 void present();
bsalomon@google.com11959252012-04-06 20:13:38 +000037
reed@android.com8a1c16f2008-12-17 15:59:43 +000038protected:
reed@android.com6efdc472008-12-19 18:24:35 +000039 // overrides from SkEventSink
40 virtual bool onEvent(const SkEvent& evt);
reed@android.com8a1c16f2008-12-17 15:59:43 +000041 // overrides from SkWindow
42 virtual void onHandleInval(const SkIRect&);
43 // overrides from SkView
44 virtual void onAddMenu(const SkOSMenu*);
yangsu@google.coma8540412011-08-30 14:40:49 +000045 virtual void onUpdateMenu(const SkOSMenu*);
reed@android.com8a1c16f2008-12-17 15:59:43 +000046 virtual void onSetTitle(const char[]);
rmistry@google.comfbfcd562012-08-23 18:09:54 +000047
reed@android.com8a1c16f2008-12-17 15:59:43 +000048private:
49 void* fHWND;
yangsu@google.coma8540412011-08-30 14:40:49 +000050 bool fInvalEventIsPending;
51 void* fNotifier;
bsalomon@google.comcf8fb1f2012-08-02 14:03:32 +000052#if SK_SUPPORT_GPU
yangsu@google.coma8540412011-08-30 14:40:49 +000053 void* fGLContext;
bsalomon@google.comcf8fb1f2012-08-02 14:03:32 +000054#endif
reed@android.com8a1c16f2008-12-17 15:59:43 +000055 typedef SkWindow INHERITED;
56};
57
caryclark@google.com4ee8aea2011-11-23 14:54:19 +000058#endif