aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/libraries/include/llmozlib.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:50 -0500
committerJacek Antonelli2008-08-15 23:44:50 -0500
commit89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch)
treebcff14b7888d04a2fec799c59369f6095224bd08 /linden/libraries/include/llmozlib.h
parentSecond Life viewer sources 1.13.3.2 (diff)
downloadmeta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz
Second Life viewer sources 1.14.0.0
Diffstat (limited to 'linden/libraries/include/llmozlib.h')
-rw-r--r--linden/libraries/include/llmozlib.h438
1 files changed, 293 insertions, 145 deletions
diff --git a/linden/libraries/include/llmozlib.h b/linden/libraries/include/llmozlib.h
index a0897dc..8385706 100644
--- a/linden/libraries/include/llmozlib.h
+++ b/linden/libraries/include/llmozlib.h
@@ -1,145 +1,293 @@
1//////////////////////////////////////////////////////////////////////////////// 1/**
2// 2 * @file llmozlib.h
3// 3 * @brief Linden Lab Mozilla wrapper.
4// 4 *
5// 5 * Copyright (c) 2006-2007, Linden Research, Inc.
6// 6 *
7// 7 * The source code in this file ("Source Code") is provided by Linden Lab
8// 8 * to you under the terms of the GNU General Public License, version 2.0
9// 9 * ("GPL"), unless you have obtained a separate licensing agreement
10// 10 * ("Other License"), formally executed by you and Linden Lab. Terms of
11//////////////////////////////////////////////////////////////////////////////// 11 * the GPL can be found in doc/GPL-license.txt in this distribution, or
12#ifndef LLMOZLIB_H 12 * online at http://secondlife.com/developers/opensource/gplv2
13#define LLMOZLIB_H 13 *
14 14 * There are special exceptions to the terms and conditions of the GPL as
15#include <string> 15 * it is applied to this Source Code. View the full text of the exception
16#include <map> 16 * in the file doc/FLOSS-exception.txt in this software distribution, or
17 17 * online at http://secondlife.com/developers/opensource/flossexception
18class LLEmbeddedBrowser; 18 *
19class LLEmbeddedBrowserWindow; 19 * By copying, modifying or distributing this software, you acknowledge
20 20 * that you have read and understood your obligations described above,
21//////////////////////////////////////////////////////////////////////////////// 21 * and agree to abide by those obligations.
22// data class that is passed with an event 22 *
23class LLEmbeddedBrowserWindowEvent 23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24{ 24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 public: 25 * COMPLETENESS OR PERFORMANCE.
26 LLEmbeddedBrowserWindowEvent( int eventWindowIdIn ) : 26 */
27 mEventWindowId( eventWindowIdIn ) 27
28 { 28#ifndef LLMOZLIB_H
29 }; 29#define LLMOZLIB_H
30 30
31 LLEmbeddedBrowserWindowEvent( int eventWindowIdIn, int intValIn ) : 31#include <string>
32 mEventWindowId( eventWindowIdIn ), 32#include <map>
33 mIntVal( intValIn ) 33
34 { 34class LLEmbeddedBrowser;
35 }; 35class LLEmbeddedBrowserWindow;
36 36
37 LLEmbeddedBrowserWindowEvent( int eventWindowIdIn, std::string stringValIn ) : 37////////////////////////////////////////////////////////////////////////////////
38 mEventWindowId( eventWindowIdIn ), 38// data class that is passed with an event
39 mStringVal( stringValIn ) 39class LLEmbeddedBrowserWindowEvent
40 { 40{
41 }; 41 public:
42 42 LLEmbeddedBrowserWindowEvent( int eventWindowIdIn ) :
43 virtual ~LLEmbeddedBrowserWindowEvent() 43 mEventWindowId( eventWindowIdIn )
44 { 44 {
45 }; 45 };
46 46
47 int getEventWindowId() const 47 LLEmbeddedBrowserWindowEvent( int eventWindowIdIn, int intValIn ) :
48 { 48 mEventWindowId( eventWindowIdIn ),
49 return mEventWindowId; 49 mIntVal( intValIn )
50 }; 50 {
51 51 };
52 int getIntValue() const 52
53 { 53 LLEmbeddedBrowserWindowEvent( int eventWindowIdIn, std::string stringValIn ) :
54 return mIntVal; 54 mEventWindowId( eventWindowIdIn ),
55 }; 55 mStringVal( stringValIn )
56 56 {
57 std::string getStringValue() const 57 };
58 { 58
59 return mStringVal; 59 virtual ~LLEmbeddedBrowserWindowEvent()
60 }; 60 {
61 61 };
62 private: 62
63 int mEventWindowId; 63 int getEventWindowId() const
64 int mIntVal; 64 {
65 std::string mStringVal; 65 return mEventWindowId;
66}; 66 };
67 67
68//////////////////////////////////////////////////////////////////////////////// 68 int getIntValue() const
69// Override these methods to observe browser events 69 {
70class LLEmbeddedBrowserWindowObserver 70 return mIntVal;
71{ 71 };
72 public: 72
73 virtual ~LLEmbeddedBrowserWindowObserver() { }; 73 std::string getStringValue() const
74 74 {
75 typedef LLEmbeddedBrowserWindowEvent EventType; 75 return mStringVal;
76 virtual void onNavigateBegin( const EventType& eventIn ) { }; 76 };
77 virtual void onNavigateComplete( const EventType& eventIn ) { }; 77
78 virtual void onUpdateProgress( const EventType& eventIn ) { }; 78 private:
79 virtual void onStatusTextChange( const EventType& eventIn ) { }; 79 int mEventWindowId;
80 virtual void onLocationChange( const EventType& eventIn ) { }; 80 int mIntVal;
81 virtual void onClickLinkHref( const EventType& eventIn ) { }; 81 std::string mStringVal;
82 virtual void onClickLinkSecondLife( const EventType& eventIn ) { }; 82};
83}; 83
84 84////////////////////////////////////////////////////////////////////////////////
85//////////////////////////////////////////////////////////////////////////////// 85// Override these methods to observe browser events
86// 86class LLEmbeddedBrowserWindowObserver
87class LLMozLib 87{
88{ 88 public:
89 public: 89 virtual ~LLEmbeddedBrowserWindowObserver() { };
90 virtual ~LLMozLib(); 90
91 91 typedef LLEmbeddedBrowserWindowEvent EventType;
92 // singleton access 92 virtual void onNavigateBegin( const EventType& eventIn ) { };
93 static LLMozLib* getInstance(); 93 virtual void onNavigateComplete( const EventType& eventIn ) { };
94 94 virtual void onUpdateProgress( const EventType& eventIn ) { };
95 // housekeeping 95 virtual void onStatusTextChange( const EventType& eventIn ) { };
96 bool init( std::string appBaseDirIn, std::string profileDirIn ); 96 virtual void onLocationChange( const EventType& eventIn ) { };
97 bool reset(); 97 virtual void onClickLinkHref( const EventType& eventIn ) { };
98 bool clearCache(); 98 virtual void onClickLinkSecondLife( const EventType& eventIn ) { };
99 int getLastError(); 99};
100 const std::string getVersion(); 100
101 void setBrowserAgentId( std::string idIn ); 101////////////////////////////////////////////////////////////////////////////////
102 102//
103 // browser window 103class LLMozLib
104 int createBrowserWindow( void* nativeWindowHandleIn, int browserWindowWidthIn, int browserWindowHeightIn ); 104{
105 bool destroyBrowserWindow( int browserWindowIdIn ); 105 public:
106 bool setSize( int browserWindowIdIn, int widthIn, int heightIn ); 106 virtual ~LLMozLib();
107 bool scrollByLines( int browserWindowIdIn, int linesIn ); 107
108 void setBackgroundColor( int browserWindowIdIn, int redIn, int greenIn, int blueIn ); 108 // singleton access
109 109 static LLMozLib* getInstance();
110 // observer interface 110
111 bool addObserver( int browserWindowIdIn, LLEmbeddedBrowserWindowObserver* subjectIn ); 111 // housekeeping
112 bool remObserver( int browserWindowIdIn, LLEmbeddedBrowserWindowObserver* subjectIn ); 112 bool init( std::string appBaseDirIn, std::string profileDirIn );
113 113 bool reset();
114 // navigation 114 bool clearCache();
115 bool navigateTo( int browserWindowIdIn, const std::string uriIn ); 115 int getLastError();
116 bool navigateStop( int browserWindowIdIn ); 116 const std::string getVersion();
117 bool canNavigateBack( int browserWindowIdIn ); 117 void setBrowserAgentId( std::string idIn );
118 bool navigateBack( int browserWindowIdIn ); 118
119 bool canNavigateForward( int browserWindowIdIn ); 119 // browser window
120 bool navigateForward( int browserWindowIdIn ); 120 int createBrowserWindow( void* nativeWindowHandleIn, int browserWindowWidthIn, int browserWindowHeightIn );
121 121 bool destroyBrowserWindow( int browserWindowIdIn );
122 // access to rendered bitmap data 122 bool setSize( int browserWindowIdIn, int widthIn, int heightIn );
123 const unsigned char* grabBrowserWindow( int browserWindowIdIn ); 123 bool scrollByLines( int browserWindowIdIn, int linesIn );
124 const unsigned char* getBrowserWindowPixels( int browserWindowIdIn ); 124 void setBackgroundColor( int browserWindowIdIn, int redIn, int greenIn, int blueIn );
125 const int getBrowserWidth( int browserWindowIdIn ); 125
126 const int getBrowserHeight( int browserWindowIdIn ); 126 // observer interface
127 const int getBrowserDepth( int browserWindowIdIn ); 127 bool addObserver( int browserWindowIdIn, LLEmbeddedBrowserWindowObserver* subjectIn );
128 const int getBrowserRowSpan( int browserWindowIdIn ); 128 bool remObserver( int browserWindowIdIn, LLEmbeddedBrowserWindowObserver* subjectIn );
129 129
130 // mouse/keyboard interaction 130 // navigation
131 bool mouseDown( int browserWindowIdIn, int xPosIn, int yPosIn ); 131 bool navigateTo( int browserWindowIdIn, const std::string uriIn );
132 bool mouseUp( int browserWindowIdIn, int xPosIn, int yPosIn ); 132 bool navigateStop( int browserWindowIdIn );
133 bool mouseMove( int browserWindowIdIn, int xPosIn, int yPosIn ); 133 bool canNavigateBack( int browserWindowIdIn );
134 bool keyPress( int browserWindowIdIn, int keyCodeIn ); 134 bool navigateBack( int browserWindowIdIn );
135 bool focusBrowser( int browserWindowIdIn, bool focusBrowserIn ); 135 bool canNavigateForward( int browserWindowIdIn );
136 136 bool navigateForward( int browserWindowIdIn );
137 private: 137
138 LLMozLib(); 138 // access to rendered bitmap data
139 LLEmbeddedBrowserWindow* getBrowserWindowFromWindowId( int browserWindowIdIn ); 139 const unsigned char* grabBrowserWindow( int browserWindowIdIn );
140 static LLMozLib* sInstance; 140 const unsigned char* getBrowserWindowPixels( int browserWindowIdIn );
141 const int mMaxBrowserWindows; 141 const int getBrowserWidth( int browserWindowIdIn );
142 LLEmbeddedBrowserWindow** mBrowserWindowList; 142 const int getBrowserHeight( int browserWindowIdIn );
143}; 143 const int getBrowserDepth( int browserWindowIdIn );
144 144 const int getBrowserRowSpan( int browserWindowIdIn );
145#endif // LLMOZLIB_H 145
146 // mouse/keyboard interaction
147 bool mouseDown( int browserWindowIdIn, int xPosIn, int yPosIn );
148 bool mouseUp( int browserWindowIdIn, int xPosIn, int yPosIn );
149 bool mouseMove( int browserWindowIdIn, int xPosIn, int yPosIn );
150 bool keyPress( int browserWindowIdIn, int keyCodeIn );
151 bool unicodeInput ( int browserWindowIdIn, unsigned long uni_char );
152 bool focusBrowser( int browserWindowIdIn, bool focusBrowserIn );
153
154 private:
155 LLMozLib();
156 LLEmbeddedBrowserWindow* getBrowserWindowFromWindowId( int browserWindowIdIn );
157 static LLMozLib* sInstance;
158 const int mMaxBrowserWindows;
159 LLEmbeddedBrowserWindow** mBrowserWindowList;
160};
161
162
163// Mozilla virtual keycodes.
164// We don't want to suck in Mozilla headers so we copy these consts
165// from nsIDOMKeyEvent.idl.
166
167const unsigned long LL_DOM_VK_CANCEL = 0x03;
168const unsigned long LL_DOM_VK_HELP = 0x06;
169const unsigned long LL_DOM_VK_BACK_SPACE = 0x08;
170const unsigned long LL_DOM_VK_TAB = 0x09;
171const unsigned long LL_DOM_VK_CLEAR = 0x0C;
172const unsigned long LL_DOM_VK_RETURN = 0x0D;
173const unsigned long LL_DOM_VK_ENTER = 0x0E;
174const unsigned long LL_DOM_VK_SHIFT = 0x10;
175const unsigned long LL_DOM_VK_CONTROL = 0x11;
176const unsigned long LL_DOM_VK_ALT = 0x12;
177const unsigned long LL_DOM_VK_PAUSE = 0x13;
178const unsigned long LL_DOM_VK_CAPS_LOCK = 0x14;
179const unsigned long LL_DOM_VK_ESCAPE = 0x1B;
180const unsigned long LL_DOM_VK_SPACE = 0x20;
181const unsigned long LL_DOM_VK_PAGE_UP = 0x21;
182const unsigned long LL_DOM_VK_PAGE_DOWN = 0x22;
183const unsigned long LL_DOM_VK_END = 0x23;
184const unsigned long LL_DOM_VK_HOME = 0x24;
185const unsigned long LL_DOM_VK_LEFT = 0x25;
186const unsigned long LL_DOM_VK_UP = 0x26;
187const unsigned long LL_DOM_VK_RIGHT = 0x27;
188const unsigned long LL_DOM_VK_DOWN = 0x28;
189const unsigned long LL_DOM_VK_PRINTSCREEN = 0x2C;
190const unsigned long LL_DOM_VK_INSERT = 0x2D;
191const unsigned long LL_DOM_VK_DELETE = 0x2E;
192
193// LL_DOM_VK_0 - LL_DOM_VK_9 match their ASCII values
194const unsigned long LL_DOM_VK_0 = 0x30;
195const unsigned long LL_DOM_VK_1 = 0x31;
196const unsigned long LL_DOM_VK_2 = 0x32;
197const unsigned long LL_DOM_VK_3 = 0x33;
198const unsigned long LL_DOM_VK_4 = 0x34;
199const unsigned long LL_DOM_VK_5 = 0x35;
200const unsigned long LL_DOM_VK_6 = 0x36;
201const unsigned long LL_DOM_VK_7 = 0x37;
202const unsigned long LL_DOM_VK_8 = 0x38;
203const unsigned long LL_DOM_VK_9 = 0x39;
204
205const unsigned long LL_DOM_VK_SEMICOLON = 0x3B;
206const unsigned long LL_DOM_VK_EQUALS = 0x3D;
207
208// LL_DOM_VK_A - LL_DOM_VK_Z match their ASCII values
209const unsigned long LL_DOM_VK_A = 0x41;
210const unsigned long LL_DOM_VK_B = 0x42;
211const unsigned long LL_DOM_VK_C = 0x43;
212const unsigned long LL_DOM_VK_D = 0x44;
213const unsigned long LL_DOM_VK_E = 0x45;
214const unsigned long LL_DOM_VK_F = 0x46;
215const unsigned long LL_DOM_VK_G = 0x47;
216const unsigned long LL_DOM_VK_H = 0x48;
217const unsigned long LL_DOM_VK_I = 0x49;
218const unsigned long LL_DOM_VK_J = 0x4A;
219const unsigned long LL_DOM_VK_K = 0x4B;
220const unsigned long LL_DOM_VK_L = 0x4C;
221const unsigned long LL_DOM_VK_M = 0x4D;
222const unsigned long LL_DOM_VK_N = 0x4E;
223const unsigned long LL_DOM_VK_O = 0x4F;
224const unsigned long LL_DOM_VK_P = 0x50;
225const unsigned long LL_DOM_VK_Q = 0x51;
226const unsigned long LL_DOM_VK_R = 0x52;
227const unsigned long LL_DOM_VK_S = 0x53;
228const unsigned long LL_DOM_VK_T = 0x54;
229const unsigned long LL_DOM_VK_U = 0x55;
230const unsigned long LL_DOM_VK_V = 0x56;
231const unsigned long LL_DOM_VK_W = 0x57;
232const unsigned long LL_DOM_VK_X = 0x58;
233const unsigned long LL_DOM_VK_Y = 0x59;
234const unsigned long LL_DOM_VK_Z = 0x5A;
235
236const unsigned long LL_DOM_VK_CONTEXT_MENU = 0x5D;
237
238const unsigned long LL_DOM_VK_NUMPAD0 = 0x60;
239const unsigned long LL_DOM_VK_NUMPAD1 = 0x61;
240const unsigned long LL_DOM_VK_NUMPAD2 = 0x62;
241const unsigned long LL_DOM_VK_NUMPAD3 = 0x63;
242const unsigned long LL_DOM_VK_NUMPAD4 = 0x64;
243const unsigned long LL_DOM_VK_NUMPAD5 = 0x65;
244const unsigned long LL_DOM_VK_NUMPAD6 = 0x66;
245const unsigned long LL_DOM_VK_NUMPAD7 = 0x67;
246const unsigned long LL_DOM_VK_NUMPAD8 = 0x68;
247const unsigned long LL_DOM_VK_NUMPAD9 = 0x69;
248const unsigned long LL_DOM_VK_MULTIPLY = 0x6A;
249const unsigned long LL_DOM_VK_ADD = 0x6B;
250const unsigned long LL_DOM_VK_SEPARATOR = 0x6C;
251const unsigned long LL_DOM_VK_SUBTRACT = 0x6D;
252const unsigned long LL_DOM_VK_DECIMAL = 0x6E;
253const unsigned long LL_DOM_VK_DIVIDE = 0x6F;
254const unsigned long LL_DOM_VK_F1 = 0x70;
255const unsigned long LL_DOM_VK_F2 = 0x71;
256const unsigned long LL_DOM_VK_F3 = 0x72;
257const unsigned long LL_DOM_VK_F4 = 0x73;
258const unsigned long LL_DOM_VK_F5 = 0x74;
259const unsigned long LL_DOM_VK_F6 = 0x75;
260const unsigned long LL_DOM_VK_F7 = 0x76;
261const unsigned long LL_DOM_VK_F8 = 0x77;
262const unsigned long LL_DOM_VK_F9 = 0x78;
263const unsigned long LL_DOM_VK_F10 = 0x79;
264const unsigned long LL_DOM_VK_F11 = 0x7A;
265const unsigned long LL_DOM_VK_F12 = 0x7B;
266const unsigned long LL_DOM_VK_F13 = 0x7C;
267const unsigned long LL_DOM_VK_F14 = 0x7D;
268const unsigned long LL_DOM_VK_F15 = 0x7E;
269const unsigned long LL_DOM_VK_F16 = 0x7F;
270const unsigned long LL_DOM_VK_F17 = 0x80;
271const unsigned long LL_DOM_VK_F18 = 0x81;
272const unsigned long LL_DOM_VK_F19 = 0x82;
273const unsigned long LL_DOM_VK_F20 = 0x83;
274const unsigned long LL_DOM_VK_F21 = 0x84;
275const unsigned long LL_DOM_VK_F22 = 0x85;
276const unsigned long LL_DOM_VK_F23 = 0x86;
277const unsigned long LL_DOM_VK_F24 = 0x87;
278
279const unsigned long LL_DOM_VK_NUM_LOCK = 0x90;
280const unsigned long LL_DOM_VK_SCROLL_LOCK = 0x91;
281
282const unsigned long LL_DOM_VK_COMMA = 0xBC;
283const unsigned long LL_DOM_VK_PERIOD = 0xBE;
284const unsigned long LL_DOM_VK_SLASH = 0xBF;
285const unsigned long LL_DOM_VK_BACK_QUOTE = 0xC0;
286const unsigned long LL_DOM_VK_OPEN_BRACKET = 0xDB;
287const unsigned long LL_DOM_VK_BACK_SLASH = 0xDC;
288const unsigned long LL_DOM_VK_CLOSE_BRACKET = 0xDD;
289const unsigned long LL_DOM_VK_QUOTE = 0xDE;
290
291const unsigned long LL_DOM_VK_META = 0xE0;
292
293#endif // LLMOZLIB_H