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, LLCoordScreen size, BOOL disable_vsync);
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();
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 BOOL restoreGamma();
00082 ESwapMethod getSwapMethod() { return mSwapMethod; }
00083 void gatherInput();
00084 void delayInputProcessing() {};
00085 void swapBuffers();
00086
00087 LLString getTempFileName();
00088 void deleteFile( const char* file_name );
00089 S32 stat( const char* file_name, struct stat* stat_info );
00090 BOOL sendEmail(const char* address,const char* subject,const char* body_text,const char* attachment=NULL, const char* attachment_displayed_name=NULL);
00091
00092
00093
00094 BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to);
00095 BOOL convertCoords(LLCoordWindow from, LLCoordScreen *to);
00096 BOOL convertCoords(LLCoordWindow from, LLCoordGL *to);
00097 BOOL convertCoords(LLCoordGL from, LLCoordWindow *to);
00098 BOOL convertCoords(LLCoordScreen from, LLCoordGL *to);
00099 BOOL convertCoords(LLCoordGL from, LLCoordScreen *to);
00100
00101 LLWindowResolution* getSupportedResolutions(S32 &num_resolutions);
00102 F32 getNativeAspectRatio();
00103 F32 getPixelAspectRatio();
00104 void setNativeAspectRatio(F32 ratio) { mOverrideAspectRatio = ratio; }
00105
00106 void beforeDialog();
00107 void afterDialog();
00108
00109 BOOL dialog_color_picker(F32 *r, F32 *g, F32 *b);
00110
00111 void *getPlatformWindow();
00112 void bringToFront() {};
00113
00114 void allowLanguageTextInput(BOOL b);
00115
00116 protected:
00117 LLWindowMacOSX(
00118 char *title, char *name, int x, int y, int width, int height, U32 flags,
00119 BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl,
00120 BOOL ignore_pixel_depth);
00121 ~LLWindowMacOSX();
00122
00123 void initCursors();
00124 BOOL isValid();
00125 void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size);
00126
00127
00128
00129 BOOL setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh);
00130
00131
00132 BOOL setFullscreenResolution();
00133
00134
00135 BOOL resetDisplayResolution();
00136
00137 void minimize();
00138 void restore();
00139
00140 BOOL shouldPostQuit() { return mPostQuit; }
00141
00142
00143 protected:
00144
00145
00146
00147
00148
00149 BOOL createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL disable_vsync);
00150 void destroyContext();
00151 void setupFailure(const char* text, const char* caption, U32 type);
00152 static pascal OSStatus staticEventHandler (EventHandlerCallRef myHandler, EventRef event, void* userData);
00153 OSStatus eventHandler (EventHandlerCallRef myHandler, EventRef event);
00154 void adjustCursorDecouple(bool warpingMouse = false);
00155 void fixWindowSize(void);
00156 void stopDockTileBounce();
00157
00158
00159
00160
00161
00162 WindowRef mWindow;
00163 AGLContext mContext;
00164 AGLPixelFormat mPixelFormat;
00165 CGDirectDisplayID mDisplay;
00166 CFDictionaryRef mOldDisplayMode;
00167 EventLoopTimerRef mTimer;
00168 EventHandlerUPP mEventHandlerUPP;
00169 EventHandlerRef mGlobalHandlerRef;
00170 EventHandlerRef mWindowHandlerRef;
00171 Rect mOldMouseClip;
00172 Str255 mWindowTitle;
00173 double mOriginalAspectRatio;
00174 BOOL mSimulatedRightClick;
00175 UInt32 mLastModifiers;
00176 BOOL mHandsOffEvents;
00177
00178 BOOL mCursorDecoupled;
00179 S32 mCursorLastEventDeltaX;
00180 S32 mCursorLastEventDeltaY;
00181 BOOL mCursorIgnoreNextDelta;
00182 BOOL mNeedsResize;
00183 LLCoordScreen mNeedsResizeSize;
00184 F32 mOverrideAspectRatio;
00185 BOOL mMinimized;
00186
00187 F32 mBounceTime;
00188 NMRec mBounceRec;
00189 LLTimer mBounceTimer;
00190
00191
00192 TSMDocumentID mTSMDocument;
00193 BOOL mLanguageTextInputAllowed;
00194 ScriptCode mTSMScriptCode;
00195 LangCode mTSMLangCode;
00196
00197 friend class LLWindowManager;
00198 };
00199
00200
00201 class LLSplashScreenMacOSX : public LLSplashScreen
00202 {
00203 public:
00204 LLSplashScreenMacOSX();
00205 virtual ~LLSplashScreenMacOSX();
00206
00207 void showImpl();
00208 void updateImpl(const char* mesg);
00209 void hideImpl();
00210
00211 private:
00212 WindowRef mWindow;
00213 };
00214
00215 S32 OSMessageBoxMacOSX(const char* text, const char* caption, U32 type);
00216
00217 void load_url_external(const char* url);
00218 void shell_open( const char* file_path );
00219
00220 #endif //LL_LLWINDOWMACOSX_H