1 2 /* 3 * Copyright 2006 The Android Open Source Project 4 * 5 * Use of this source code is governed by a BSD-style license that can be 6 * found in the LICENSE file. 7 */ 8 9 10 #ifndef SkOSWindow_Win_DEFINED 11 #define SkOSWindow_Win_DEFINED 12 13 #include "SkWindow.h" 14 15 class SkOSWindow : public SkWindow { 16 public: 17 SkOSWindow(void* hwnd); 18 virtual ~SkOSWindow(); 19 getHWND()20 void* getHWND() const { return fHWND; } 21 void setSize(int width, int height); 22 void updateSize(); 23 24 static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay); 25 26 bool attachGL(); 27 void detachGL(); 28 void presentGL(); 29 30 bool attachD3D9(); 31 void detachD3D9(); 32 void presentD3D9(); 33 d3d9Device()34 void* d3d9Device() { return fD3D9Device; } 35 36 bool wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); 37 static bool QuitOnDeactivate(HWND hWnd); 38 39 enum { 40 SK_WM_SkEvent = WM_APP + 1000, 41 SK_WM_SkTimerID = 0xFFFF // just need a non-zero value 42 }; 43 44 protected: quitOnDeactivate()45 virtual bool quitOnDeactivate() { return true; } 46 47 // overrides from SkWindow 48 virtual void onHandleInval(const SkIRect&); 49 // overrides from SkView 50 virtual void onAddMenu(const SkOSMenu*); 51 52 virtual void onSetTitle(const char title[]); 53 54 private: 55 void* fHWND; 56 57 void doPaint(void* ctx); 58 59 void* fHGLRC; 60 61 bool fGLAttached; 62 63 void* fD3D9Device; 64 bool fD3D9Attached; 65 66 HMENU fMBar; 67 68 typedef SkWindow INHERITED; 69 }; 70 71 #endif 72 73