diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/llwindow/llwindowwin32.h | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llwindow/llwindowwin32.h | 209 |
1 files changed, 209 insertions, 0 deletions
diff --git a/linden/indra/llwindow/llwindowwin32.h b/linden/indra/llwindow/llwindowwin32.h new file mode 100644 index 0000000..77696e6 --- /dev/null +++ b/linden/indra/llwindow/llwindowwin32.h | |||
@@ -0,0 +1,209 @@ | |||
1 | /** | ||
2 | * @file llwindowwin32.h | ||
3 | * @brief Windows implementation of LLWindow class | ||
4 | * | ||
5 | * Copyright (c) 2001-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | #ifndef LL_LLWINDOWWIN32_H | ||
29 | #define LL_LLWINDOWWIN32_H | ||
30 | |||
31 | // Limit Windows API to small and manageable set. | ||
32 | #define WIN32_LEAN_AND_MEAN | ||
33 | #include <winsock2.h> | ||
34 | #include <windows.h> | ||
35 | |||
36 | #include "llwindow.h" | ||
37 | |||
38 | // Hack for async host by name | ||
39 | #define LL_WM_HOST_RESOLVED (WM_APP + 1) | ||
40 | typedef void (*LLW32MsgCallback)(const MSG &msg); | ||
41 | |||
42 | class LLWindowWin32 : public LLWindow | ||
43 | { | ||
44 | public: | ||
45 | /*virtual*/ void show(); | ||
46 | /*virtual*/ void hide(); | ||
47 | /*virtual*/ void close(); | ||
48 | /*virtual*/ BOOL getVisible(); | ||
49 | /*virtual*/ BOOL getMinimized(); | ||
50 | /*virtual*/ BOOL getMaximized(); | ||
51 | /*virtual*/ BOOL maximize(); | ||
52 | /*virtual*/ BOOL getFullscreen(); | ||
53 | /*virtual*/ BOOL getPosition(LLCoordScreen *position); | ||
54 | /*virtual*/ BOOL getSize(LLCoordScreen *size); | ||
55 | /*virtual*/ BOOL getSize(LLCoordWindow *size); | ||
56 | /*virtual*/ BOOL setPosition(LLCoordScreen position); | ||
57 | /*virtual*/ BOOL setSize(LLCoordScreen size); | ||
58 | /*virtual*/ BOOL switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync); | ||
59 | /*virtual*/ BOOL setCursorPosition(LLCoordWindow position); | ||
60 | /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position); | ||
61 | /*virtual*/ void showCursor(); | ||
62 | /*virtual*/ void hideCursor(); | ||
63 | /*virtual*/ void showCursorFromMouseMove(); | ||
64 | /*virtual*/ void hideCursorUntilMouseMove(); | ||
65 | /*virtual*/ BOOL isCursorHidden(); | ||
66 | /*virtual*/ void setCursor(ECursorType cursor); | ||
67 | /*virtual*/ ECursorType getCursor(); | ||
68 | /*virtual*/ void captureMouse(); | ||
69 | /*virtual*/ void releaseMouse(); | ||
70 | /*virtual*/ void setMouseClipping( BOOL b ); | ||
71 | /*virtual*/ BOOL isClipboardTextAvailable(); | ||
72 | /*virtual*/ BOOL pasteTextFromClipboard(LLWString &dst); | ||
73 | /*virtual*/ BOOL copyTextToClipboard(const LLWString &src); | ||
74 | /*virtual*/ void flashIcon(F32 seconds); | ||
75 | /*virtual*/ F32 getGamma(); | ||
76 | /*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma | ||
77 | /*virtual*/ BOOL restoreGamma(); // Restore original gamma table (before updating gamma) | ||
78 | /*virtual*/ ESwapMethod getSwapMethod() { return mSwapMethod; } | ||
79 | /*virtual*/ void gatherInput(); | ||
80 | /*virtual*/ void delayInputProcessing(); | ||
81 | /*virtual*/ void swapBuffers(); | ||
82 | |||
83 | /*virtual*/ LLString getTempFileName(); | ||
84 | /*virtual*/ void deleteFile( const char* file_name ); | ||
85 | /*virtual*/ S32 stat( const char* file_name, struct stat* stat_info ); | ||
86 | /*virtual*/ BOOL sendEmail(const char* address,const char* subject,const char* body_text,const char* attachment=NULL, const char* attachment_displayed_name=NULL); | ||
87 | |||
88 | |||
89 | // handy coordinate space conversion routines | ||
90 | /*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to); | ||
91 | /*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordScreen *to); | ||
92 | /*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordGL *to); | ||
93 | /*virtual*/ BOOL convertCoords(LLCoordGL from, LLCoordWindow *to); | ||
94 | /*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordGL *to); | ||
95 | /*virtual*/ BOOL convertCoords(LLCoordGL from, LLCoordScreen *to); | ||
96 | |||
97 | /*virtual*/ LLWindowResolution* getSupportedResolutions(S32 &num_resolutions); | ||
98 | /*virtual*/ F32 getNativeAspectRatio(); | ||
99 | /*virtual*/ F32 getPixelAspectRatio(); | ||
100 | /*virtual*/ void setNativeAspectRatio(F32 ratio) { mOverrideAspectRatio = ratio; } | ||
101 | |||
102 | /*virtual*/ BOOL dialog_color_picker (F32 *r, F32 *g, F32 *b ); | ||
103 | |||
104 | /*virtual*/ void *getPlatformWindow(); | ||
105 | /*virtual*/ void bringToFront(); | ||
106 | /*virtual*/ void focusClient(); | ||
107 | |||
108 | protected: | ||
109 | LLWindowWin32( | ||
110 | char *title, char *name, int x, int y, int width, int height, U32 flags, | ||
111 | BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl, | ||
112 | BOOL ignore_pixel_depth); | ||
113 | ~LLWindowWin32(); | ||
114 | |||
115 | void initCursors(); | ||
116 | HCURSOR loadColorCursor(LPCTSTR name); | ||
117 | BOOL isValid(); | ||
118 | void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size); | ||
119 | |||
120 | |||
121 | // Changes display resolution. Returns true if successful | ||
122 | BOOL setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh); | ||
123 | |||
124 | // Go back to last fullscreen display resolution. | ||
125 | BOOL setFullscreenResolution(); | ||
126 | |||
127 | // Restore the display resolution to its value before we ran the app. | ||
128 | BOOL resetDisplayResolution(); | ||
129 | |||
130 | void minimize(); | ||
131 | void restore(); | ||
132 | |||
133 | BOOL shouldPostQuit() { return mPostQuit; } | ||
134 | |||
135 | |||
136 | protected: | ||
137 | // | ||
138 | // Platform specific methods | ||
139 | // | ||
140 | |||
141 | BOOL getClientRectInScreenSpace(RECT* rectp); | ||
142 | void updateJoystick( ); | ||
143 | |||
144 | static LRESULT CALLBACK mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_param, LPARAM l_param); | ||
145 | static BOOL CALLBACK enumChildWindows(HWND h_wnd, LPARAM l_param); | ||
146 | |||
147 | |||
148 | // | ||
149 | // Platform specific variables | ||
150 | // | ||
151 | WCHAR *mWindowTitle; | ||
152 | WCHAR *mWindowClassName; | ||
153 | |||
154 | HWND mWindowHandle; // window handle | ||
155 | HGLRC mhRC; // OpenGL rendering context | ||
156 | HDC mhDC; // Windows Device context handle | ||
157 | HINSTANCE mhInstance; // handle to application instance | ||
158 | WNDPROC mWndProc; // user-installable window proc | ||
159 | RECT mOldMouseClip; // Screen rect to which the mouse cursor was globally constrained before we changed it in clipMouse() | ||
160 | WPARAM mLastSizeWParam; | ||
161 | F32 mOverrideAspectRatio; | ||
162 | F32 mNativeAspectRatio; | ||
163 | |||
164 | HCURSOR mCursor[ UI_CURSOR_COUNT ]; // Array of all mouse cursors | ||
165 | |||
166 | static BOOL sIsClassRegistered; // has the window class been registered? | ||
167 | |||
168 | F32 mCurrentGamma; | ||
169 | WORD mPrevGammaRamp[256*3]; | ||
170 | WORD mCurrentGammaRamp[256*3]; | ||
171 | |||
172 | U32 mJoyStickState; | ||
173 | U32 mJoyButtonState; | ||
174 | |||
175 | LPWSTR mIconResource; | ||
176 | BOOL mMousePositionModified; | ||
177 | BOOL mInputProcessingPaused; | ||
178 | |||
179 | friend class LLWindowManager; | ||
180 | }; | ||
181 | |||
182 | class LLSplashScreenWin32 : public LLSplashScreen | ||
183 | { | ||
184 | public: | ||
185 | LLSplashScreenWin32(); | ||
186 | virtual ~LLSplashScreenWin32(); | ||
187 | |||
188 | /*virtual*/ void showImpl(); | ||
189 | /*virtual*/ void updateImpl(const char* mesg); | ||
190 | /*virtual*/ void hideImpl(); | ||
191 | |||
192 | #if LL_WINDOWS | ||
193 | static LRESULT CALLBACK windowProc(HWND h_wnd, UINT u_msg, | ||
194 | WPARAM w_param, LPARAM l_param); | ||
195 | #endif | ||
196 | |||
197 | private: | ||
198 | #if LL_WINDOWS | ||
199 | HWND mWindow; | ||
200 | #endif | ||
201 | }; | ||
202 | |||
203 | extern LLW32MsgCallback gAsyncMsgCallback; | ||
204 | |||
205 | static void handleMessage( const MSG& msg ); | ||
206 | |||
207 | S32 OSMessageBoxWin32(const char* text, const char* caption, U32 type); | ||
208 | |||
209 | #endif //LL_LLWINDOWWIN32_H | ||