00001
00032 #ifndef LL_LLWINDOWWIN32_H
00033 #define LL_LLWINDOWWIN32_H
00034
00035
00036 #define WIN32_LEAN_AND_MEAN
00037 #include <winsock2.h>
00038 #include <windows.h>
00039
00040 #include "llwindow.h"
00041
00042
00043 #define LL_WM_HOST_RESOLVED (WM_APP + 1)
00044 typedef void (*LLW32MsgCallback)(const MSG &msg);
00045
00046 class LLWindowWin32 : public LLWindow
00047 {
00048 public:
00049 void show();
00050 void hide();
00051 void close();
00052 BOOL getVisible();
00053 BOOL getMinimized();
00054 BOOL getMaximized();
00055 BOOL maximize();
00056 BOOL getFullscreen();
00057 BOOL getPosition(LLCoordScreen *position);
00058 BOOL getSize(LLCoordScreen *size);
00059 BOOL getSize(LLCoordWindow *size);
00060 BOOL setPosition(LLCoordScreen position);
00061 BOOL setSize(LLCoordScreen size);
00062 BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL);
00063 BOOL setCursorPosition(LLCoordWindow position);
00064 BOOL getCursorPosition(LLCoordWindow *position);
00065 void showCursor();
00066 void hideCursor();
00067 void showCursorFromMouseMove();
00068 void hideCursorUntilMouseMove();
00069 BOOL isCursorHidden();
00070 void setCursor(ECursorType cursor);
00071 ECursorType getCursor() const;
00072 void captureMouse();
00073 void releaseMouse();
00074 void setMouseClipping( BOOL b );
00075 BOOL isClipboardTextAvailable();
00076 BOOL pasteTextFromClipboard(LLWString &dst);
00077 BOOL copyTextToClipboard(const LLWString &src);
00078 void flashIcon(F32 seconds);
00079 F32 getGamma();
00080 BOOL setGamma(const F32 gamma);
00081 void setFSAASamples(const U32 fsaa_samples);
00082 U32 getFSAASamples();
00083 BOOL restoreGamma();
00084 ESwapMethod getSwapMethod() { return mSwapMethod; }
00085 void gatherInput();
00086 void delayInputProcessing();
00087 void swapBuffers();
00088
00089 LLString getTempFileName();
00090 void deleteFile( const char* file_name );
00091 S32 stat( const char* file_name, struct stat* stat_info );
00092 BOOL sendEmail(const char* address,const char* subject,const char* body_text,const char* attachment=NULL, const char* attachment_displayed_name=NULL);
00093
00094
00095
00096 BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to);
00097 BOOL convertCoords(LLCoordWindow from, LLCoordScreen *to);
00098 BOOL convertCoords(LLCoordWindow from, LLCoordGL *to);
00099 BOOL convertCoords(LLCoordGL from, LLCoordWindow *to);
00100 BOOL convertCoords(LLCoordScreen from, LLCoordGL *to);
00101 BOOL convertCoords(LLCoordGL from, LLCoordScreen *to);
00102
00103 LLWindowResolution* getSupportedResolutions(S32 &num_resolutions);
00104 F32 getNativeAspectRatio();
00105 F32 getPixelAspectRatio();
00106 void setNativeAspectRatio(F32 ratio) { mOverrideAspectRatio = ratio; }
00107
00108 BOOL dialog_color_picker (F32 *r, F32 *g, F32 *b );
00109
00110 void *getPlatformWindow();
00111 void bringToFront();
00112 void focusClient();
00113
00114 void allowLanguageTextInput(LLPreeditor *preeditor, BOOL b);
00115 void setLanguageTextInput( const LLCoordGL & pos );
00116 void updateLanguageTextInputArea();
00117 void interruptLanguageTextInput();
00118
00119 static std::string getFontListSans();
00120
00121 protected:
00122 LLWindowWin32(
00123 char *title, char *name, int x, int y, int width, int height, U32 flags,
00124 BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl,
00125 BOOL ignore_pixel_depth, U32 fsaa_samples);
00126 ~LLWindowWin32();
00127
00128 void initCursors();
00129 void initInputDevices();
00130 HCURSOR loadColorCursor(LPCTSTR name);
00131 BOOL isValid();
00132 void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size);
00133
00134
00135
00136 BOOL setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh);
00137
00138
00139 BOOL setFullscreenResolution();
00140
00141
00142 BOOL resetDisplayResolution();
00143
00144 void minimize();
00145 void restore();
00146
00147 BOOL shouldPostQuit() { return mPostQuit; }
00148
00149 void fillCompositionForm(const LLRect& bounds, COMPOSITIONFORM *form);
00150 void fillCandidateForm(const LLCoordGL& caret, const LLRect& bounds, CANDIDATEFORM *form);
00151 void fillCharPosition(const LLCoordGL& caret, const LLRect& bounds, const LLRect& control, IMECHARPOSITION *char_position);
00152 void fillCompositionLogfont(LOGFONT *logfont);
00153 U32 fillReconvertString(const LLWString &text, S32 focus, S32 focus_length, RECONVERTSTRING *reconvert_string);
00154 void handleStartCompositionMessage();
00155 void handleCompositionMessage(U32 indexes);
00156 BOOL handleImeRequests(U32 request, U32 param, LRESULT *result);
00157
00158 protected:
00159
00160
00161
00162
00163 BOOL getClientRectInScreenSpace(RECT* rectp);
00164 void updateJoystick( );
00165
00166 static LRESULT CALLBACK mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_param, LPARAM l_param);
00167 static BOOL CALLBACK enumChildWindows(HWND h_wnd, LPARAM l_param);
00168
00169
00170
00171
00172
00173 WCHAR *mWindowTitle;
00174 WCHAR *mWindowClassName;
00175
00176 HWND mWindowHandle;
00177 HGLRC mhRC;
00178 HDC mhDC;
00179 HINSTANCE mhInstance;
00180 WNDPROC mWndProc;
00181 RECT mOldMouseClip;
00182 WPARAM mLastSizeWParam;
00183 F32 mOverrideAspectRatio;
00184 F32 mNativeAspectRatio;
00185
00186 HCURSOR mCursor[ UI_CURSOR_COUNT ];
00187
00188 static BOOL sIsClassRegistered;
00189
00190 F32 mCurrentGamma;
00191 U32 mFSAASamples;
00192 WORD mPrevGammaRamp[256*3];
00193 WORD mCurrentGammaRamp[256*3];
00194
00195 LPWSTR mIconResource;
00196 BOOL mMousePositionModified;
00197 BOOL mInputProcessingPaused;
00198
00199
00200
00201
00202 static BOOL sLanguageTextInputAllowed;
00203 static BOOL sWinIMEOpened;
00204 static HKL sWinInputLocale;
00205 static DWORD sWinIMEConversionMode;
00206 static DWORD sWinIMESentenceMode;
00207 static LLCoordWindow sWinIMEWindowPosition;
00208 LLCoordGL mLanguageTextInputPointGL;
00209 LLRect mLanguageTextInputAreaGL;
00210
00211 LLPreeditor *mPreeditor;
00212
00213 friend class LLWindowManager;
00214 };
00215
00216 class LLSplashScreenWin32 : public LLSplashScreen
00217 {
00218 public:
00219 LLSplashScreenWin32();
00220 virtual ~LLSplashScreenWin32();
00221
00222 void showImpl();
00223 void updateImpl(const char* mesg);
00224 void hideImpl();
00225
00226 #if LL_WINDOWS
00227 static LRESULT CALLBACK windowProc(HWND h_wnd, UINT u_msg,
00228 WPARAM w_param, LPARAM l_param);
00229 #endif
00230
00231 private:
00232 #if LL_WINDOWS
00233 HWND mWindow;
00234 #endif
00235 };
00236
00237 extern LLW32MsgCallback gAsyncMsgCallback;
00238 extern LPWSTR gIconResource;
00239
00240 static void handleMessage( const MSG& msg );
00241
00242 S32 OSMessageBoxWin32(const char* text, const char* caption, U32 type);
00243
00244 #endif //LL_LLWINDOWWIN32_H