blob: e3bcea9081b80a258b4a9baf73f6d70ee7eb401d [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,
24 kNativeGL_BackEndType,
25 };
26
27 void detach();
bsalomon@google.com11959252012-04-06 20:13:38 +000028 bool attach(SkBackEndTypes attachType, int msaaSampleCount);
robertphillips@google.comb442a6d2012-04-02 19:24:21 +000029 void present();
bsalomon@google.com11959252012-04-06 20:13:38 +000030
reed@android.com8a1c16f2008-12-17 15:59:43 +000031protected:
reed@android.com6efdc472008-12-19 18:24:35 +000032 // overrides from SkEventSink
33 virtual bool onEvent(const SkEvent& evt);
reed@android.com8a1c16f2008-12-17 15:59:43 +000034 // overrides from SkWindow
35 virtual void onHandleInval(const SkIRect&);
36 // overrides from SkView
37 virtual void onAddMenu(const SkOSMenu*);
yangsu@google.coma8540412011-08-30 14:40:49 +000038 virtual void onUpdateMenu(const SkOSMenu*);
reed@android.com8a1c16f2008-12-17 15:59:43 +000039 virtual void onSetTitle(const char[]);
reed@android.comf2b98d62010-12-20 18:26:13 +000040
reed@android.com8a1c16f2008-12-17 15:59:43 +000041private:
42 void* fHWND;
yangsu@google.coma8540412011-08-30 14:40:49 +000043 bool fInvalEventIsPending;
44 void* fNotifier;
45 void* fGLContext;
reed@android.com8a1c16f2008-12-17 15:59:43 +000046 typedef SkWindow INHERITED;
47};
48
caryclark@google.com4ee8aea2011-11-23 14:54:19 +000049#endif