aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llwindow/llwindowmacosx.h
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llwindow/llwindowmacosx.h')
-rw-r--r--linden/indra/llwindow/llwindowmacosx.h208
1 files changed, 208 insertions, 0 deletions
diff --git a/linden/indra/llwindow/llwindowmacosx.h b/linden/indra/llwindow/llwindowmacosx.h
new file mode 100644
index 0000000..7425077
--- /dev/null
+++ b/linden/indra/llwindow/llwindowmacosx.h
@@ -0,0 +1,208 @@
1/**
2 * @file llwindowmacosx.h
3 * @brief Mac 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_LLWINDOWMACOSX_H
29#define LL_LLWINDOWMACOSX_H
30
31#include "llwindow.h"
32
33#include <Carbon/Carbon.h>
34#include <AGL/agl.h>
35
36// AssertMacros.h does bad things.
37#undef verify
38#undef check
39#undef require
40
41
42class LLWindowMacOSX : public LLWindow
43{
44public:
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*/ void beforeDialog();
103 /*virtual*/ void afterDialog();
104
105 /*virtual*/ BOOL dialog_color_picker(F32 *r, F32 *g, F32 *b);
106
107 /*virtual*/ void *getPlatformWindow();
108 /*virtual*/ void bringToFront() {};
109
110protected:
111 LLWindowMacOSX(
112 char *title, char *name, int x, int y, int width, int height, U32 flags,
113 BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl,
114 BOOL ignore_pixel_depth);
115 ~LLWindowMacOSX();
116
117 void initCursors();
118 BOOL isValid();
119 void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size);
120
121
122 // Changes display resolution. Returns true if successful
123 BOOL setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh);
124
125 // Go back to last fullscreen display resolution.
126 BOOL setFullscreenResolution();
127
128 // Restore the display resolution to its value before we ran the app.
129 BOOL resetDisplayResolution();
130
131 void minimize();
132 void restore();
133
134 BOOL shouldPostQuit() { return mPostQuit; }
135
136
137protected:
138 //
139 // Platform specific methods
140 //
141
142 // create or re-create the GL context/window. Called from the constructor and switchContext().
143 BOOL createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL disable_vsync);
144 void destroyContext();
145 void setupFailure(const char* text, const char* caption, U32 type);
146 static pascal OSStatus staticEventHandler (EventHandlerCallRef myHandler, EventRef event, void* userData);
147 OSStatus eventHandler (EventHandlerCallRef myHandler, EventRef event);
148 void adjustCursorDecouple(bool warpingMouse = false);
149 void fixWindowSize(void);
150 void stopDockTileBounce();
151
152
153 //
154 // Platform specific variables
155 //
156 WindowRef mWindow;
157 AGLContext mContext;
158 AGLPixelFormat mPixelFormat;
159 CGDirectDisplayID mDisplay;
160 CFDictionaryRef mOldDisplayMode;
161 EventLoopTimerRef mTimer;
162 EventHandlerUPP mEventHandlerUPP;
163 EventHandlerRef mGlobalHandlerRef;
164 EventHandlerRef mWindowHandlerRef;
165 Rect mOldMouseClip; // Screen rect to which the mouse cursor was globally constrained before we changed it in clipMouse()
166 Str255 mWindowTitle;
167 double mOriginalAspectRatio;
168 BOOL mSimulatedRightClick;
169 UInt32 mLastModifiers;
170 BOOL mHandsOffEvents; // When true, temporarially disable CarbonEvent processing.
171 // Used to allow event processing when putting up dialogs in fullscreen mode.
172 BOOL mCursorDecoupled;
173 S32 mCursorLastEventDeltaX;
174 S32 mCursorLastEventDeltaY;
175 BOOL mCursorIgnoreNextDelta;
176 BOOL mNeedsResize; // Constructor figured out the window is too big, it needs a resize.
177 LLCoordScreen mNeedsResizeSize;
178 F32 mOverrideAspectRatio;
179 BOOL mMinimized;
180
181 F32 mBounceTime;
182 NMRec mBounceRec;
183 LLTimer mBounceTimer;
184
185 friend class LLWindowManager;
186};
187
188
189class LLSplashScreenMacOSX : public LLSplashScreen
190{
191public:
192 LLSplashScreenMacOSX();
193 virtual ~LLSplashScreenMacOSX();
194
195 /*virtual*/ void showImpl();
196 /*virtual*/ void updateImpl(const char* mesg);
197 /*virtual*/ void hideImpl();
198
199private:
200 WindowRef mWindow;
201};
202
203S32 OSMessageBoxMacOSX(const char* text, const char* caption, U32 type);
204
205void load_url_external(const char* url);
206void shell_open( const char* file_path );
207
208#endif //LL_LLWINDOWMACOSX_H