00001 /* 00002 * Copyright (C) 2006 The Android Open Source Project 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef SkOSWindow_Win_DEFINED 00018 #define SkOSWindow_Win_DEFINED 00019 00020 #include "SkWindow.h" 00021 00022 class SkOSWindow : public SkWindow { 00023 public: 00024 SkOSWindow(void* hwnd); 00025 00026 void* getHWND() const { return fHWND; } 00027 void setSize(int width, int height); 00028 void updateSize(); 00029 00030 static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay); 00031 00032 static bool WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); 00033 static bool SkOSWindow::QuitOnDeactivate(HWND hWnd); 00034 00035 enum { 00036 SK_WM_SkEvent = WM_APP + 1000, 00037 SK_WM_SkTimerID = 0xFFFF // just need a non-zero value 00038 }; 00039 00040 protected: 00041 virtual bool quitOnDeactivate() { return true; } 00042 00043 // overrides from SkWindow 00044 virtual void onHandleInval(const SkIRect&); 00045 // overrides from SkView 00046 virtual void onAddMenu(const SkOSMenu*); 00047 00048 private: 00049 void* fHWND; 00050 00051 void doPaint(void* ctx); 00052 00053 HMENU fMBar; 00054 00055 typedef SkWindow INHERITED; 00056 }; 00057 00058 #endif 00059