blob: 01fa29f3340496b1d67e7ea3f9bcf9724edb0950 [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.com3c4d0322012-04-03 18:04:51 +000019
yangsu@google.coma8540412011-08-30 14:40:49 +000020 virtual bool onDispatchClick(int x, int y, Click::State state,
21 void* owner);
bsalomon@google.com3c4d0322012-04-03 18:04:51 +000022
robertphillips@google.comb442a6d2012-04-02 19:24:21 +000023 enum SkBackEndTypes {
24 kNone_BackEndType,
25 kNativeGL_BackEndType,
26 };
27
28 void detach();
bsalomon@google.com3c4d0322012-04-03 18:04:51 +000029 bool attach(SkBackEndTypes attachType);
robertphillips@google.comb442a6d2012-04-02 19:24:21 +000030 void present();
bsalomon@google.com3c4d0322012-04-03 18:04:51 +000031
reed@android.com8a1c16f2008-12-17 15:59:43 +000032protected:
reed@android.com6efdc472008-12-19 18:24:35 +000033 // overrides from SkEventSink
34 virtual bool onEvent(const SkEvent& evt);
reed@android.com8a1c16f2008-12-17 15:59:43 +000035 // overrides from SkWindow
36 virtual void onHandleInval(const SkIRect&);
37 // overrides from SkView
38 virtual void onAddMenu(const SkOSMenu*);
yangsu@google.coma8540412011-08-30 14:40:49 +000039 virtual void onUpdateMenu(const SkOSMenu*);
reed@android.com8a1c16f2008-12-17 15:59:43 +000040 virtual void onSetTitle(const char[]);
reed@android.comf2b98d62010-12-20 18:26:13 +000041
reed@android.com8a1c16f2008-12-17 15:59:43 +000042private:
43 void* fHWND;
yangsu@google.coma8540412011-08-30 14:40:49 +000044 bool fInvalEventIsPending;
45 void* fNotifier;
46 void* fGLContext;
reed@android.com8a1c16f2008-12-17 15:59:43 +000047 typedef SkWindow INHERITED;
48};
49
caryclark@google.com4ee8aea2011-11-23 14:54:19 +000050#endif