diff options
Diffstat (limited to 'linden/libraries/include/llmozlib2.h')
-rw-r--r-- | linden/libraries/include/llmozlib2.h | 383 |
1 files changed, 0 insertions, 383 deletions
diff --git a/linden/libraries/include/llmozlib2.h b/linden/libraries/include/llmozlib2.h deleted file mode 100644 index d85caf9..0000000 --- a/linden/libraries/include/llmozlib2.h +++ /dev/null | |||
@@ -1,383 +0,0 @@ | |||
1 | /* ***** BEGIN LICENSE BLOCK ***** | ||
2 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | ||
3 | * | ||
4 | * The contents of this file are subject to the Mozilla Public License Version | ||
5 | * 1.1 (the "License"); you may not use this file except in compliance with | ||
6 | * the License. You may obtain a copy of the License at | ||
7 | * http://www.mozilla.org/MPL/ | ||
8 | * | ||
9 | * Software distributed under the License is distributed on an "AS IS" basis, | ||
10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | ||
11 | * for the specific language governing rights and limitations under the | ||
12 | * License. | ||
13 | * | ||
14 | * The Original Code is Linden Lab Inc. (http://lindenlab.com) code. | ||
15 | * | ||
16 | * The Initial Developer of the Original Code is: | ||
17 | * Callum Prentice (callum@ubrowser.com) | ||
18 | * | ||
19 | * Portions created by the Initial Developer are Copyright (C) 2006 | ||
20 | * the Initial Developer. All Rights Reserved. | ||
21 | * | ||
22 | * Contributor(s): | ||
23 | * Callum Prentice (callum@ubrowser.com) | ||
24 | * | ||
25 | * Alternatively, the contents of this file may be used under the terms of | ||
26 | * either the GNU General Public License Version 2 or later (the "GPL"), or | ||
27 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), | ||
28 | * in which case the provisions of the GPL or the LGPL are applicable instead | ||
29 | * of those above. If you wish to allow use of your version of this file only | ||
30 | * under the terms of either the GPL or the LGPL, and not to allow others to | ||
31 | * use your version of this file under the terms of the MPL, indicate your | ||
32 | * decision by deleting the provisions above and replace them with the notice | ||
33 | * and other provisions required by the GPL or the LGPL. If you do not delete | ||
34 | * the provisions above, a recipient may use your version of this file under | ||
35 | * the terms of any one of the MPL, the GPL or the LGPL. | ||
36 | * | ||
37 | * ***** END LICENSE BLOCK ***** */ | ||
38 | |||
39 | #ifndef LLMOZLIB_H | ||
40 | #define LLMOZLIB_H | ||
41 | |||
42 | #include <string> | ||
43 | #include <map> | ||
44 | |||
45 | class LLEmbeddedBrowser; | ||
46 | class LLEmbeddedBrowserWindow; | ||
47 | |||
48 | //////////////////////////////////////////////////////////////////////////////// | ||
49 | // data class that is passed with an event | ||
50 | class LLEmbeddedBrowserWindowEvent | ||
51 | { | ||
52 | public: | ||
53 | LLEmbeddedBrowserWindowEvent( int eventWindowIdIn, std::string uriIn ) : | ||
54 | mEventWindowId( eventWindowIdIn ), | ||
55 | mEventUri( uriIn ) | ||
56 | { | ||
57 | }; | ||
58 | |||
59 | // single int passed with the event - e.g. progress | ||
60 | LLEmbeddedBrowserWindowEvent( int eventWindowIdIn, std::string uriIn, int intValIn ) : | ||
61 | mEventWindowId( eventWindowIdIn ), | ||
62 | mEventUri( uriIn ), | ||
63 | mIntVal( intValIn ) | ||
64 | { | ||
65 | }; | ||
66 | |||
67 | // string passed with the event | ||
68 | LLEmbeddedBrowserWindowEvent( int eventWindowIdIn, std::string uriIn, std::string stringValIn ) : | ||
69 | mEventWindowId( eventWindowIdIn ), | ||
70 | mEventUri( uriIn ), | ||
71 | mStringVal( stringValIn ) | ||
72 | { | ||
73 | }; | ||
74 | |||
75 | // 2 strings passed with the event | ||
76 | LLEmbeddedBrowserWindowEvent( int eventWindowIdIn, std::string uriIn, std::string stringValIn, std::string stringVal2In ) : | ||
77 | mEventWindowId( eventWindowIdIn ), | ||
78 | mEventUri( uriIn ), | ||
79 | mStringVal( stringValIn ), | ||
80 | mStringVal2( stringVal2In ) | ||
81 | { | ||
82 | }; | ||
83 | |||
84 | // string and an int passed with the event | ||
85 | LLEmbeddedBrowserWindowEvent( int eventWindowIdIn, std::string uriIn, std::string stringValIn, int intValIn ) : | ||
86 | mEventWindowId( eventWindowIdIn ), | ||
87 | mEventUri( uriIn ), | ||
88 | mStringVal( stringValIn ), | ||
89 | mIntVal( intValIn ) | ||
90 | { | ||
91 | }; | ||
92 | |||
93 | // 4 ints passed (semantically as a rectangle but could be anything - didn't want to make a RECT type structure) | ||
94 | LLEmbeddedBrowserWindowEvent( int eventWindowIdIn, std::string uriIn, int xIn, int yIn, int widthIn, int heightIn ) : | ||
95 | mEventWindowId( eventWindowIdIn ), | ||
96 | mEventUri( uriIn ), | ||
97 | mXVal( xIn ), | ||
98 | mYVal( yIn ), | ||
99 | mWidthVal( widthIn ), | ||
100 | mHeightVal( heightIn ) | ||
101 | { | ||
102 | }; | ||
103 | |||
104 | virtual ~LLEmbeddedBrowserWindowEvent() | ||
105 | { | ||
106 | }; | ||
107 | |||
108 | int getEventWindowId() const | ||
109 | { | ||
110 | return mEventWindowId; | ||
111 | }; | ||
112 | |||
113 | std::string getEventUri() const | ||
114 | { | ||
115 | return mEventUri; | ||
116 | }; | ||
117 | |||
118 | int getIntValue() const | ||
119 | { | ||
120 | return mIntVal; | ||
121 | }; | ||
122 | |||
123 | std::string getStringValue() const | ||
124 | { | ||
125 | return mStringVal; | ||
126 | }; | ||
127 | |||
128 | std::string getStringValue2() const | ||
129 | { | ||
130 | return mStringVal2; | ||
131 | }; | ||
132 | |||
133 | void getRectValue( int& xOut, int& yOut, int& widthOut, int& heightOut ) const | ||
134 | { | ||
135 | xOut = mXVal; | ||
136 | yOut = mYVal; | ||
137 | widthOut = mWidthVal; | ||
138 | heightOut = mHeightVal; | ||
139 | }; | ||
140 | |||
141 | private: | ||
142 | int mEventWindowId; | ||
143 | std::string mEventUri; | ||
144 | int mIntVal; | ||
145 | std::string mStringVal; | ||
146 | std::string mStringVal2; | ||
147 | int mXVal; | ||
148 | int mYVal; | ||
149 | int mWidthVal; | ||
150 | int mHeightVal; | ||
151 | }; | ||
152 | |||
153 | //////////////////////////////////////////////////////////////////////////////// | ||
154 | // derrive from this class and override these methods to observe these events | ||
155 | class LLEmbeddedBrowserWindowObserver | ||
156 | { | ||
157 | public: | ||
158 | virtual ~LLEmbeddedBrowserWindowObserver() { }; | ||
159 | typedef LLEmbeddedBrowserWindowEvent EventType; | ||
160 | |||
161 | virtual void onPageChanged( const EventType& eventIn ) { }; | ||
162 | virtual void onNavigateBegin( const EventType& eventIn ) { }; | ||
163 | virtual void onNavigateComplete( const EventType& eventIn ) { }; | ||
164 | virtual void onUpdateProgress( const EventType& eventIn ) { }; | ||
165 | virtual void onStatusTextChange( const EventType& eventIn ) { }; | ||
166 | virtual void onLocationChange( const EventType& eventIn ) { }; | ||
167 | virtual void onClickLinkHref( const EventType& eventIn ) { }; | ||
168 | virtual void onClickLinkNoFollow( const EventType& eventIn ) { }; | ||
169 | }; | ||
170 | |||
171 | //////////////////////////////////////////////////////////////////////////////// | ||
172 | // main library class | ||
173 | class LLMozLib | ||
174 | { | ||
175 | public: | ||
176 | virtual ~LLMozLib(); | ||
177 | |||
178 | // singleton access | ||
179 | static LLMozLib* getInstance(); | ||
180 | |||
181 | // housekeeping | ||
182 | bool init( std::string applicationDir, std::string componentDir, std::string profileDir, void* nativeWindowHandleIn ); | ||
183 | bool reset(); | ||
184 | bool clearCache(); | ||
185 | int getLastError(); | ||
186 | const std::string getVersion(); | ||
187 | void setBrowserAgentId( std::string idIn ); | ||
188 | bool enableProxy( bool proxyEnabledIn, std::string proxyHostNameIn, int proxyPortIn ); | ||
189 | bool enableCookies( bool enabledIn ); | ||
190 | bool clearAllCookies(); | ||
191 | bool enablePlugins( bool enabledIn ); | ||
192 | |||
193 | // browser window - creation/deletion, mutation etc. | ||
194 | int createBrowserWindow( int browserWindowWidthIn, int browserWindowHeightIn ); | ||
195 | bool destroyBrowserWindow( int browserWindowIdIn ); | ||
196 | bool setSize( int browserWindowIdIn, int widthIn, int heightIn ); | ||
197 | bool scrollByLines( int browserWindowIdIn, int linesIn ); | ||
198 | bool setBackgroundColor( int browserWindowIdIn, const int redIn, const int greenIn, const int blueIn ); | ||
199 | bool setCaretColor( int browserWindowIdIn, const int redIn, const int greenIn, const int blueIn ); | ||
200 | bool setEnabled( int browserWindowIdIn, bool enabledIn ); | ||
201 | |||
202 | // add/remove yourself as an observer on browser events - see LLEmbeddedBrowserWindowObserver declaration | ||
203 | bool addObserver( int browserWindowIdIn, LLEmbeddedBrowserWindowObserver* subjectIn ); | ||
204 | bool remObserver( int browserWindowIdIn, LLEmbeddedBrowserWindowObserver* subjectIn ); | ||
205 | |||
206 | // navigation - self explanatory | ||
207 | bool navigateTo( int browserWindowIdIn, const std::string uriIn ); | ||
208 | bool navigateStop( int browserWindowIdIn ); | ||
209 | bool canNavigateBack( int browserWindowIdIn ); | ||
210 | bool navigateBack( int browserWindowIdIn ); | ||
211 | bool canNavigateForward( int browserWindowIdIn ); | ||
212 | bool navigateForward( int browserWindowIdIn ); | ||
213 | |||
214 | // javascript access/control | ||
215 | std::string evaluateJavascript( int browserWindowIdIn, const std::string scriptIn ); | ||
216 | |||
217 | // set/clear URL to redirect to when a 404 page is reached | ||
218 | bool set404RedirectUrl( int browser_window_in, std::string redirect_url ); | ||
219 | bool clr404RedirectUrl( int browser_window_in ); | ||
220 | |||
221 | // access to rendered bitmap data | ||
222 | const unsigned char* grabBrowserWindow( int browserWindowIdIn ); // renders page to memory and returns pixels | ||
223 | const unsigned char* getBrowserWindowPixels( int browserWindowIdIn ); // just returns pixels - no render | ||
224 | const bool flipWindow( int browserWindowIdIn, bool flipIn ); // optionally flip window (pixels) you get back | ||
225 | const int getBrowserWidth( int browserWindowIdIn ); // current browser width (can vary slightly after page is rendered) | ||
226 | const int getBrowserHeight( int browserWindowIdIn ); // current height | ||
227 | const int getBrowserDepth( int browserWindowIdIn ); // depth in bytes | ||
228 | const int getBrowserRowSpan( int browserWindowIdIn ); // width in pixels * depth in bytes | ||
229 | |||
230 | // mouse/keyboard interaction | ||
231 | bool mouseDown( int browserWindowIdIn, int xPosIn, int yPosIn ); // send a mouse down event to a browser window at given XY in browser space | ||
232 | bool mouseUp( int browserWindowIdIn, int xPosIn, int yPosIn ); // send a mouse up event to a browser window at given XY in browser space | ||
233 | bool mouseMove( int browserWindowIdIn, int xPosIn, int yPosIn ); // send a mouse move event to a browser window at given XY in browser space | ||
234 | bool mouseLeftDoubleClick( int browserWindowIdIn, int xPosIn, int yPosIn ); // send a mouse left button double click to a browser window at given XY in browser space | ||
235 | bool keyPress( int browserWindowIdIn, int keyCodeIn ); // send a key press event to a browser window | ||
236 | bool unicodeInput ( int browserWindowIdIn, unsigned long uni_char ); // send a unicode keypress event to a browser window | ||
237 | bool focusBrowser( int browserWindowIdIn, bool focusBrowserIn ); // set/remove focus to given browser window | ||
238 | |||
239 | // accessor/mutator for scheme that browser doesn't follow - e.g. secondlife.com:// | ||
240 | void setNoFollowScheme( int browserWindowIdIn, std::string schemeIn ); | ||
241 | std::string getNoFollowScheme( int browserWindowIdIn ); | ||
242 | |||
243 | private: | ||
244 | LLMozLib(); | ||
245 | LLEmbeddedBrowserWindow* getBrowserWindowFromWindowId( int browserWindowIdIn ); | ||
246 | static LLMozLib* sInstance; | ||
247 | const int mMaxBrowserWindows; | ||
248 | typedef std::map< int, LLEmbeddedBrowserWindow* > BrowserWindowMap; | ||
249 | typedef std::map< int, LLEmbeddedBrowserWindow* >::iterator BrowserWindowMapIter; | ||
250 | BrowserWindowMap mBrowserWindowMap; | ||
251 | }; | ||
252 | |||
253 | // Mozilla virtual keycodes. | ||
254 | // We don't want to suck in Mozilla headers so we copy these consts | ||
255 | // from nsIDOMKeyEvent.idl. | ||
256 | |||
257 | const unsigned long LL_DOM_VK_CANCEL = 0x03; | ||
258 | const unsigned long LL_DOM_VK_HELP = 0x06; | ||
259 | const unsigned long LL_DOM_VK_BACK_SPACE = 0x08; | ||
260 | const unsigned long LL_DOM_VK_TAB = 0x09; | ||
261 | const unsigned long LL_DOM_VK_CLEAR = 0x0C; | ||
262 | const unsigned long LL_DOM_VK_RETURN = 0x0D; | ||
263 | const unsigned long LL_DOM_VK_ENTER = 0x0E; | ||
264 | const unsigned long LL_DOM_VK_SHIFT = 0x10; | ||
265 | const unsigned long LL_DOM_VK_CONTROL = 0x11; | ||
266 | const unsigned long LL_DOM_VK_ALT = 0x12; | ||
267 | const unsigned long LL_DOM_VK_PAUSE = 0x13; | ||
268 | const unsigned long LL_DOM_VK_CAPS_LOCK = 0x14; | ||
269 | const unsigned long LL_DOM_VK_ESCAPE = 0x1B; | ||
270 | const unsigned long LL_DOM_VK_SPACE = 0x20; | ||
271 | const unsigned long LL_DOM_VK_PAGE_UP = 0x21; | ||
272 | const unsigned long LL_DOM_VK_PAGE_DOWN = 0x22; | ||
273 | const unsigned long LL_DOM_VK_END = 0x23; | ||
274 | const unsigned long LL_DOM_VK_HOME = 0x24; | ||
275 | const unsigned long LL_DOM_VK_LEFT = 0x25; | ||
276 | const unsigned long LL_DOM_VK_UP = 0x26; | ||
277 | const unsigned long LL_DOM_VK_RIGHT = 0x27; | ||
278 | const unsigned long LL_DOM_VK_DOWN = 0x28; | ||
279 | const unsigned long LL_DOM_VK_PRINTSCREEN = 0x2C; | ||
280 | const unsigned long LL_DOM_VK_INSERT = 0x2D; | ||
281 | const unsigned long LL_DOM_VK_DELETE = 0x2E; | ||
282 | |||
283 | // LL_DOM_VK_0 - LL_DOM_VK_9 match their ASCII values | ||
284 | const unsigned long LL_DOM_VK_0 = 0x30; | ||
285 | const unsigned long LL_DOM_VK_1 = 0x31; | ||
286 | const unsigned long LL_DOM_VK_2 = 0x32; | ||
287 | const unsigned long LL_DOM_VK_3 = 0x33; | ||
288 | const unsigned long LL_DOM_VK_4 = 0x34; | ||
289 | const unsigned long LL_DOM_VK_5 = 0x35; | ||
290 | const unsigned long LL_DOM_VK_6 = 0x36; | ||
291 | const unsigned long LL_DOM_VK_7 = 0x37; | ||
292 | const unsigned long LL_DOM_VK_8 = 0x38; | ||
293 | const unsigned long LL_DOM_VK_9 = 0x39; | ||
294 | |||
295 | const unsigned long LL_DOM_VK_SEMICOLON = 0x3B; | ||
296 | const unsigned long LL_DOM_VK_EQUALS = 0x3D; | ||
297 | |||
298 | // LL_DOM_VK_A - LL_DOM_VK_Z match their ASCII values | ||
299 | const unsigned long LL_DOM_VK_A = 0x41; | ||
300 | const unsigned long LL_DOM_VK_B = 0x42; | ||
301 | const unsigned long LL_DOM_VK_C = 0x43; | ||
302 | const unsigned long LL_DOM_VK_D = 0x44; | ||
303 | const unsigned long LL_DOM_VK_E = 0x45; | ||
304 | const unsigned long LL_DOM_VK_F = 0x46; | ||
305 | const unsigned long LL_DOM_VK_G = 0x47; | ||
306 | const unsigned long LL_DOM_VK_H = 0x48; | ||
307 | const unsigned long LL_DOM_VK_I = 0x49; | ||
308 | const unsigned long LL_DOM_VK_J = 0x4A; | ||
309 | const unsigned long LL_DOM_VK_K = 0x4B; | ||
310 | const unsigned long LL_DOM_VK_L = 0x4C; | ||
311 | const unsigned long LL_DOM_VK_M = 0x4D; | ||
312 | const unsigned long LL_DOM_VK_N = 0x4E; | ||
313 | const unsigned long LL_DOM_VK_O = 0x4F; | ||
314 | const unsigned long LL_DOM_VK_P = 0x50; | ||
315 | const unsigned long LL_DOM_VK_Q = 0x51; | ||
316 | const unsigned long LL_DOM_VK_R = 0x52; | ||
317 | const unsigned long LL_DOM_VK_S = 0x53; | ||
318 | const unsigned long LL_DOM_VK_T = 0x54; | ||
319 | const unsigned long LL_DOM_VK_U = 0x55; | ||
320 | const unsigned long LL_DOM_VK_V = 0x56; | ||
321 | const unsigned long LL_DOM_VK_W = 0x57; | ||
322 | const unsigned long LL_DOM_VK_X = 0x58; | ||
323 | const unsigned long LL_DOM_VK_Y = 0x59; | ||
324 | const unsigned long LL_DOM_VK_Z = 0x5A; | ||
325 | |||
326 | const unsigned long LL_DOM_VK_CONTEXT_MENU = 0x5D; | ||
327 | |||
328 | const unsigned long LL_DOM_VK_NUMPAD0 = 0x60; | ||
329 | const unsigned long LL_DOM_VK_NUMPAD1 = 0x61; | ||
330 | const unsigned long LL_DOM_VK_NUMPAD2 = 0x62; | ||
331 | const unsigned long LL_DOM_VK_NUMPAD3 = 0x63; | ||
332 | const unsigned long LL_DOM_VK_NUMPAD4 = 0x64; | ||
333 | const unsigned long LL_DOM_VK_NUMPAD5 = 0x65; | ||
334 | const unsigned long LL_DOM_VK_NUMPAD6 = 0x66; | ||
335 | const unsigned long LL_DOM_VK_NUMPAD7 = 0x67; | ||
336 | const unsigned long LL_DOM_VK_NUMPAD8 = 0x68; | ||
337 | const unsigned long LL_DOM_VK_NUMPAD9 = 0x69; | ||
338 | const unsigned long LL_DOM_VK_MULTIPLY = 0x6A; | ||
339 | const unsigned long LL_DOM_VK_ADD = 0x6B; | ||
340 | const unsigned long LL_DOM_VK_SEPARATOR = 0x6C; | ||
341 | const unsigned long LL_DOM_VK_SUBTRACT = 0x6D; | ||
342 | const unsigned long LL_DOM_VK_DECIMAL = 0x6E; | ||
343 | const unsigned long LL_DOM_VK_DIVIDE = 0x6F; | ||
344 | const unsigned long LL_DOM_VK_F1 = 0x70; | ||
345 | const unsigned long LL_DOM_VK_F2 = 0x71; | ||
346 | const unsigned long LL_DOM_VK_F3 = 0x72; | ||
347 | const unsigned long LL_DOM_VK_F4 = 0x73; | ||
348 | const unsigned long LL_DOM_VK_F5 = 0x74; | ||
349 | const unsigned long LL_DOM_VK_F6 = 0x75; | ||
350 | const unsigned long LL_DOM_VK_F7 = 0x76; | ||
351 | const unsigned long LL_DOM_VK_F8 = 0x77; | ||
352 | const unsigned long LL_DOM_VK_F9 = 0x78; | ||
353 | const unsigned long LL_DOM_VK_F10 = 0x79; | ||
354 | const unsigned long LL_DOM_VK_F11 = 0x7A; | ||
355 | const unsigned long LL_DOM_VK_F12 = 0x7B; | ||
356 | const unsigned long LL_DOM_VK_F13 = 0x7C; | ||
357 | const unsigned long LL_DOM_VK_F14 = 0x7D; | ||
358 | const unsigned long LL_DOM_VK_F15 = 0x7E; | ||
359 | const unsigned long LL_DOM_VK_F16 = 0x7F; | ||
360 | const unsigned long LL_DOM_VK_F17 = 0x80; | ||
361 | const unsigned long LL_DOM_VK_F18 = 0x81; | ||
362 | const unsigned long LL_DOM_VK_F19 = 0x82; | ||
363 | const unsigned long LL_DOM_VK_F20 = 0x83; | ||
364 | const unsigned long LL_DOM_VK_F21 = 0x84; | ||
365 | const unsigned long LL_DOM_VK_F22 = 0x85; | ||
366 | const unsigned long LL_DOM_VK_F23 = 0x86; | ||
367 | const unsigned long LL_DOM_VK_F24 = 0x87; | ||
368 | |||
369 | const unsigned long LL_DOM_VK_NUM_LOCK = 0x90; | ||
370 | const unsigned long LL_DOM_VK_SCROLL_LOCK = 0x91; | ||
371 | |||
372 | const unsigned long LL_DOM_VK_COMMA = 0xBC; | ||
373 | const unsigned long LL_DOM_VK_PERIOD = 0xBE; | ||
374 | const unsigned long LL_DOM_VK_SLASH = 0xBF; | ||
375 | const unsigned long LL_DOM_VK_BACK_QUOTE = 0xC0; | ||
376 | const unsigned long LL_DOM_VK_OPEN_BRACKET = 0xDB; | ||
377 | const unsigned long LL_DOM_VK_BACK_SLASH = 0xDC; | ||
378 | const unsigned long LL_DOM_VK_CLOSE_BRACKET = 0xDD; | ||
379 | const unsigned long LL_DOM_VK_QUOTE = 0xDE; | ||
380 | |||
381 | const unsigned long LL_DOM_VK_META = 0xE0; | ||
382 | |||
383 | #endif // LLMOZLIB_H | ||