|
Blender
V2.59
|
00001 /* 00002 * $Id: GHOST_WindowWin32.h 38908 2011-08-02 04:28:05Z merwin $ 00003 * ***** BEGIN GPL LICENSE BLOCK ***** 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software Foundation, 00017 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 * 00019 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00020 * All rights reserved. 00021 * 00022 * The Original Code is: all of this file. 00023 * 00024 * Contributor(s): none yet. 00025 * 00026 * ***** END GPL LICENSE BLOCK ***** 00027 */ 00028 00034 #ifndef _GHOST_WINDOW_WIN32_H_ 00035 #define _GHOST_WINDOW_WIN32_H_ 00036 00037 #ifndef WIN32 00038 #error WIN32 only! 00039 #endif // WIN32 00040 00041 #include "GHOST_Window.h" 00042 #include "GHOST_TaskbarWin32.h" 00043 00044 #define _WIN32_WINNT 0x501 // require Windows XP or newer 00045 #define WIN32_LEAN_AND_MEAN 00046 #include <windows.h> 00047 00048 00049 #include <wintab.h> 00050 #define PACKETDATA (PK_BUTTONS | PK_NORMAL_PRESSURE | PK_ORIENTATION | PK_CURSOR) 00051 #define PACKETMODE PK_BUTTONS 00052 #include <pktdef.h> 00053 00054 class GHOST_SystemWin32; 00055 class GHOST_DropTargetWin32; 00056 00057 // typedefs for WinTab functions to allow dynamic loading 00058 typedef UINT (API * GHOST_WIN32_WTInfo) ( UINT, UINT, LPVOID ); 00059 typedef HCTX (API * GHOST_WIN32_WTOpen) (HWND, LPLOGCONTEXTA, BOOL); 00060 typedef BOOL (API * GHOST_WIN32_WTClose) (HCTX); 00061 typedef BOOL (API * GHOST_WIN32_WTPacket) (HCTX, UINT, LPVOID); 00062 00068 class GHOST_WindowWin32 : public GHOST_Window { 00069 public: 00084 GHOST_WindowWin32( 00085 GHOST_SystemWin32 * system, 00086 const STR_String& title, 00087 GHOST_TInt32 left, 00088 GHOST_TInt32 top, 00089 GHOST_TUns32 width, 00090 GHOST_TUns32 height, 00091 GHOST_TWindowState state, 00092 GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone, 00093 const bool stereoVisual = false, 00094 const GHOST_TUns16 numOfAASamples = 0, 00095 GHOST_TEmbedderWindowID parentWindowHwnd=0, 00096 GHOST_TSuccess msEnabled = GHOST_kFailure, 00097 int msPixelFormat = 0 00098 ); 00099 00104 virtual ~GHOST_WindowWin32(); 00105 00111 GHOST_Window *getNextWindow(); 00112 00117 virtual bool getValid() const; 00118 00123 virtual HWND getHWND() const; 00124 00129 virtual void setTitle(const STR_String& title); 00130 00135 virtual void getTitle(STR_String& title) const; 00136 00142 virtual void getWindowBounds(GHOST_Rect& bounds) const; 00143 00149 virtual void getClientBounds(GHOST_Rect& bounds) const; 00150 00155 virtual GHOST_TSuccess setClientWidth(GHOST_TUns32 width); 00156 00161 virtual GHOST_TSuccess setClientHeight(GHOST_TUns32 height); 00162 00168 virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height); 00169 00174 virtual GHOST_TWindowState getState() const; 00175 00183 virtual void screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const; 00184 00192 virtual void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const; 00193 00199 virtual GHOST_TSuccess setState(GHOST_TWindowState state); 00200 00206 virtual GHOST_TSuccess setOrder(GHOST_TWindowOrder order); 00207 00212 virtual GHOST_TSuccess swapBuffers(); 00213 00218 virtual GHOST_TSuccess activateDrawingContext(); 00219 00223 virtual GHOST_TSuccess invalidate(); 00224 00229 virtual GHOST_TSuccess setProgressBar(float progress); 00230 00234 virtual GHOST_TSuccess endProgressBar(); 00235 00240 static LPCSTR getWindowClassName() { return s_windowClassName; } 00241 00253 void registerMouseClickEvent(int press); 00254 00259 void lostMouseCapture(); 00260 00266 void loadCursor(bool visible, GHOST_TStandardCursor cursorShape) const; 00267 00268 const GHOST_TabletData* GetTabletData() 00269 { return m_tabletData; } 00270 00271 void processWin32TabletInitEvent(); 00272 void processWin32TabletEvent(WPARAM wParam, LPARAM lParam); 00273 00274 protected: 00275 GHOST_TSuccess initMultisample(PIXELFORMATDESCRIPTOR pfd); 00276 00282 virtual GHOST_TSuccess installDrawingContext(GHOST_TDrawingContextType type); 00283 00288 virtual GHOST_TSuccess removeDrawingContext(); 00289 00294 virtual GHOST_TSuccess setWindowCursorVisibility(bool visible); 00295 00301 virtual GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode); 00302 00307 virtual GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape); 00308 00313 virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2], int hotX, int hotY); 00314 00315 virtual GHOST_TSuccess setWindowCustomCursorShape( 00316 GHOST_TUns8 *bitmap, 00317 GHOST_TUns8 *mask, 00318 int sizex, 00319 int sizey, 00320 int hotX, 00321 int hotY, 00322 int fg_color, 00323 int bg_color 00324 ); 00325 00327 GHOST_SystemWin32 * m_system; 00329 GHOST_DropTargetWin32 * m_dropTarget; 00331 HWND m_hWnd; 00333 HDC m_hDC; 00335 HGLRC m_hGlRc; 00337 static HGLRC s_firsthGLRc; 00339 static HDC s_firstHDC; 00341 bool m_hasMouseCaptured; 00344 bool m_hasGrabMouse; 00346 int m_nPressedButtons; 00348 HCURSOR m_customCursor; 00349 00351 ITaskbarList3 * m_Bar; 00352 00353 static LPCSTR s_windowClassName; 00354 static const int s_maxTitleLength; 00355 00357 HMODULE m_wintab; 00358 00360 GHOST_TabletData* m_tabletData; 00361 00363 HCTX m_tablet; 00364 LONG m_maxPressure; 00365 LONG m_maxAzimuth, m_maxAltitude; 00366 00368 GHOST_TUns16 m_multisample; 00369 00371 GHOST_TSuccess m_multisampleEnabled; 00372 00374 int m_msPixelFormat; 00375 00377 const STR_String& m_title; 00378 GHOST_TInt32 m_left; 00379 GHOST_TInt32 m_top; 00380 GHOST_TUns32 m_width; 00381 GHOST_TUns32 m_height; 00382 GHOST_TWindowState m_normal_state; 00383 bool m_stereo; 00384 00386 GHOST_Window *m_nextWindow; 00387 00389 GHOST_TEmbedderWindowID m_parentWindowHwnd; 00390 }; 00391 00392 #endif // _GHOST_WINDOW_WIN32_H_