00001
00032 #ifndef LL_LLWINDOWMACOSX_H
00033 #define LL_LLWINDOWMACOSX_H
00034
00035 #include "llwindow.h"
00036
00037 #include <Carbon/Carbon.h>
00038 #include <AGL/agl.h>
00039
00040
00041 #undef verify
00042 #undef check
00043 #undef require
00044
00045
00046 class LLWindowMacOSX : 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 U32 getFSAASamples();
00082 void setFSAASamples(const U32 fsaa_samples);
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 void beforeDialog();
00109 void afterDialog();
00110
00111 BOOL dialog_color_picker(F32 *r, F32 *g, F32 *b);
00112
00113 void *getPlatformWindow();
00114 void bringToFront() {};
00115
00116 void allowLanguageTextInput(LLPreeditor *preeditor, BOOL b);
00117 void interruptLanguageTextInput();
00118
00119 static std::string getFontListSans();
00120
00121 protected:
00122 LLWindowMacOSX(
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,
00126 U32 fsaa_samples);
00127 ~LLWindowMacOSX();
00128
00129 void initCursors();
00130 BOOL isValid();
00131 void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size);
00132
00133
00134
00135 BOOL setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh);
00136
00137
00138 BOOL setFullscreenResolution();
00139
00140
00141 BOOL resetDisplayResolution();
00142
00143 void minimize();
00144 void restore();
00145
00146 BOOL shouldPostQuit() { return mPostQuit; }
00147
00148
00149 protected:
00150
00151
00152
00153
00154
00155 BOOL createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL disable_vsync);
00156 void destroyContext();
00157 void setupFailure(const char* text, const char* caption, U32 type);
00158 static pascal OSStatus staticEventHandler (EventHandlerCallRef myHandler, EventRef event, void* userData);
00159 OSStatus eventHandler (EventHandlerCallRef myHandler, EventRef event);
00160 void adjustCursorDecouple(bool warpingMouse = false);
00161 void fixWindowSize(void);
00162 void stopDockTileBounce();
00163
00164
00165
00166
00167
00168 WindowRef mWindow;
00169 AGLContext mContext;
00170 AGLPixelFormat mPixelFormat;
00171 CGDirectDisplayID mDisplay;
00172 CFDictionaryRef mOldDisplayMode;
00173 EventLoopTimerRef mTimer;
00174 EventHandlerUPP mEventHandlerUPP;
00175 EventHandlerRef mGlobalHandlerRef;
00176 EventHandlerRef mWindowHandlerRef;
00177 Rect mOldMouseClip;
00178 Str255 mWindowTitle;
00179 double mOriginalAspectRatio;
00180 BOOL mSimulatedRightClick;
00181 UInt32 mLastModifiers;
00182 BOOL mHandsOffEvents;
00183
00184 BOOL mCursorDecoupled;
00185 S32 mCursorLastEventDeltaX;
00186 S32 mCursorLastEventDeltaY;
00187 BOOL mCursorIgnoreNextDelta;
00188 BOOL mNeedsResize;
00189 LLCoordScreen mNeedsResizeSize;
00190 F32 mOverrideAspectRatio;
00191 BOOL mMinimized;
00192 U32 mFSAASamples;
00193 BOOL mForceRebuild;
00194
00195 F32 mBounceTime;
00196 NMRec mBounceRec;
00197 LLTimer mBounceTimer;
00198
00199
00200 TSMDocumentID mTSMDocument;
00201 BOOL mLanguageTextInputAllowed;
00202 ScriptCode mTSMScriptCode;
00203 LangCode mTSMLangCode;
00204 LLPreeditor* mPreeditor;
00205
00206 friend class LLWindowManager;
00207 };
00208
00209
00210 class LLSplashScreenMacOSX : public LLSplashScreen
00211 {
00212 public:
00213 LLSplashScreenMacOSX();
00214 virtual ~LLSplashScreenMacOSX();
00215
00216 void showImpl();
00217 void updateImpl(const char* mesg);
00218 void hideImpl();
00219
00220 private:
00221 WindowRef mWindow;
00222 };
00223
00224 S32 OSMessageBoxMacOSX(const char* text, const char* caption, U32 type);
00225
00226 void load_url_external(const char* url);
00227
00228 #endif //LL_LLWINDOWMACOSX_H