llwindowmacosx.h

Go to the documentation of this file.
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 // AssertMacros.h does bad things.
00041 #undef verify
00042 #undef check
00043 #undef require
00044 
00045 
00046 class LLWindowMacOSX : public LLWindow
00047 {
00048 public:
00049         /*virtual*/ void show();
00050         /*virtual*/ void hide();
00051         /*virtual*/ void close();
00052         /*virtual*/ BOOL getVisible();
00053         /*virtual*/ BOOL getMinimized();
00054         /*virtual*/ BOOL getMaximized();
00055         /*virtual*/ BOOL maximize();
00056         /*virtual*/ BOOL getFullscreen();
00057         /*virtual*/ BOOL getPosition(LLCoordScreen *position);
00058         /*virtual*/ BOOL getSize(LLCoordScreen *size);
00059         /*virtual*/ BOOL getSize(LLCoordWindow *size);
00060         /*virtual*/ BOOL setPosition(LLCoordScreen position);
00061         /*virtual*/ BOOL setSize(LLCoordScreen size);
00062         /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL);
00063         /*virtual*/ BOOL setCursorPosition(LLCoordWindow position);
00064         /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position);
00065         /*virtual*/ void showCursor();
00066         /*virtual*/ void hideCursor();
00067         /*virtual*/ void showCursorFromMouseMove();
00068         /*virtual*/ void hideCursorUntilMouseMove();
00069         /*virtual*/ BOOL isCursorHidden();
00070         /*virtual*/ void setCursor(ECursorType cursor);
00071         /*virtual*/ ECursorType getCursor() const;
00072         /*virtual*/ void captureMouse();
00073         /*virtual*/ void releaseMouse();
00074         /*virtual*/ void setMouseClipping( BOOL b );
00075         /*virtual*/ BOOL isClipboardTextAvailable();
00076         /*virtual*/ BOOL pasteTextFromClipboard(LLWString &dst);
00077         /*virtual*/ BOOL copyTextToClipboard(const LLWString & src);
00078         /*virtual*/ void flashIcon(F32 seconds);
00079         /*virtual*/ F32 getGamma();
00080         /*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma
00081         /*virtual*/ U32 getFSAASamples();
00082         /*virtual*/ void setFSAASamples(const U32 fsaa_samples);
00083         /*virtual*/ BOOL restoreGamma();                        // Restore original gamma table (before updating gamma)
00084         /*virtual*/ ESwapMethod getSwapMethod() { return mSwapMethod; }
00085         /*virtual*/ void gatherInput();
00086         /*virtual*/ void delayInputProcessing() {};
00087         /*virtual*/ void swapBuffers();
00088 
00089         /*virtual*/ LLString getTempFileName();
00090         /*virtual*/ void deleteFile( const char* file_name );
00091         /*virtual*/ S32 stat( const char* file_name, struct stat* stat_info );
00092         /*virtual*/ 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         // handy coordinate space conversion routines
00096         /*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to);
00097         /*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordScreen *to);
00098         /*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordGL *to);
00099         /*virtual*/ BOOL convertCoords(LLCoordGL from, LLCoordWindow *to);
00100         /*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordGL *to);
00101         /*virtual*/ BOOL convertCoords(LLCoordGL from, LLCoordScreen *to);
00102 
00103         /*virtual*/ LLWindowResolution* getSupportedResolutions(S32 &num_resolutions);
00104         /*virtual*/ F32 getNativeAspectRatio();
00105         /*virtual*/ F32 getPixelAspectRatio();
00106         /*virtual*/ void setNativeAspectRatio(F32 ratio) { mOverrideAspectRatio = ratio; }
00107 
00108         /*virtual*/ void beforeDialog();
00109         /*virtual*/ void afterDialog();
00110 
00111         /*virtual*/ BOOL dialog_color_picker(F32 *r, F32 *g, F32 *b);
00112 
00113         /*virtual*/ void *getPlatformWindow();
00114         /*virtual*/ void bringToFront() {};
00115         
00116         /*virtual*/ void allowLanguageTextInput(LLPreeditor *preeditor, BOOL b);
00117         /*virtual*/ 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         // Changes display resolution. Returns true if successful
00135         BOOL    setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh);
00136 
00137         // Go back to last fullscreen display resolution.
00138         BOOL    setFullscreenResolution();
00139 
00140         // Restore the display resolution to its value before we ran the app.
00141         BOOL    resetDisplayResolution();
00142 
00143         void    minimize();
00144         void    restore();
00145 
00146         BOOL    shouldPostQuit() { return mPostQuit; }
00147 
00148 
00149 protected:
00150         //
00151         // Platform specific methods
00152         //
00153 
00154         // create or re-create the GL context/window.  Called from the constructor and switchContext().
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         // Platform specific variables
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;  // Screen rect to which the mouse cursor was globally constrained before we changed it in clipMouse()
00178         Str255          mWindowTitle;
00179         double          mOriginalAspectRatio;
00180         BOOL            mSimulatedRightClick;
00181         UInt32          mLastModifiers;
00182         BOOL            mHandsOffEvents;        // When true, temporarially disable CarbonEvent processing.
00183         // Used to allow event processing when putting up dialogs in fullscreen mode.
00184         BOOL            mCursorDecoupled;
00185         S32                     mCursorLastEventDeltaX;
00186         S32                     mCursorLastEventDeltaY;
00187         BOOL            mCursorIgnoreNextDelta;
00188         BOOL            mNeedsResize;           // Constructor figured out the window is too big, it needs a resize.
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         // Imput method management through Text Service Manager.
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         /*virtual*/ void showImpl();
00217         /*virtual*/ void updateImpl(const char* mesg);
00218         /*virtual*/ 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

Generated on Fri May 16 08:33:03 2008 for SecondLife by  doxygen 1.5.5