• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2006 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef SkOSWindow_Win_DEFINED
18 #define SkOSWindow_Win_DEFINED
19 
20 #include "SkWindow.h"
21 
22 class SkOSWindow : public SkWindow {
23 public:
24     SkOSWindow(void* hwnd);
25     virtual ~SkOSWindow();
26 
getHWND()27     void*   getHWND() const { return fHWND; }
28     void    setSize(int width, int height);
29     void    updateSize();
30 
31     static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay);
32 
33     bool attachGL();
34     void detachGL();
35     void presentGL();
36 
37     bool attachD3D9();
38     void detachD3D9();
39     void presentD3D9();
40 
d3d9Device()41     void* d3d9Device() { return fD3D9Device; }
42 
43     bool wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
44     static bool QuitOnDeactivate(HWND hWnd);
45 
46     enum {
47         SK_WM_SkEvent = WM_APP + 1000,
48         SK_WM_SkTimerID = 0xFFFF    // just need a non-zero value
49     };
50 
51 protected:
quitOnDeactivate()52     virtual bool quitOnDeactivate() { return true; }
53 
54     // overrides from SkWindow
55     virtual void onHandleInval(const SkIRect&);
56     // overrides from SkView
57     virtual void onAddMenu(const SkOSMenu*);
58 
59     virtual void onSetTitle(const char title[]);
60 
61 private:
62     void*               fHWND;
63 
64     void                doPaint(void* ctx);
65 
66     void*               fHGLRC;
67 
68     bool                fGLAttached;
69 
70     void*               fD3D9Device;
71     bool                fD3D9Attached;
72 
73     HMENU               fMBar;
74 
75     typedef SkWindow INHERITED;
76 };
77 
78 #endif
79 
80