Changeset 8 for trunk/llmozlib2/llembeddedbrowserwindow.h
- Timestamp:
- 02/29/08 19:32:35 (2 years ago)
- Files:
-
- trunk/llmozlib2/llembeddedbrowserwindow.h (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/llmozlib2/llembeddedbrowserwindow.h
r3 r8 1 /** 2 * @file llembeddedbrowserwindow.h 3 * @brief LLEmbeddedBrowserWindow and associated helpers declaration. 4 * 5 * $LicenseInfo:firstyear=2006&license=viewergpl$ 6 * 7 * Copyright (c) 2006-2007, Linden Research, Inc. 8 * 9 * Second Life Viewer Source Code 10 * The source code in this file ("Source Code") is provided by Linden Lab 11 * to you under the terms of the GNU General Public License, version 2.0 12 * ("GPL"), unless you have obtained a separate licensing agreement 13 * ("Other License"), formally executed by you and Linden Lab. Terms of 14 * the GPL can be found in doc/GPL-license.txt in this distribution, or 15 * online at http://secondlife.com/developers/opensource/gplv2 16 * 17 * There are special exceptions to the terms and conditions of the GPL as 18 * it is applied to this Source Code. View the full text of the exception 19 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * online at http://secondlife.com/developers/opensource/flossexception 21 * 22 * By copying, modifying or distributing this software, you acknowledge 23 * that you have read and understood your obligations described above, 24 * and agree to abide by those obligations. 25 * 26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 28 * COMPLETENESS OR PERFORMANCE. 29 * $/LicenseInfo$ 30 */ 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 ***** */ 31 38 32 39 #ifndef LLEMBEDDEDBROWSERWINDOW_H … … 48 55 #include "nsWeakReference.h" 49 56 #include "nsIWebBrowser.h" 57 #include "nsIToolkit.h" 58 #include "nsIScriptGlobalObject.h" 59 #include "nsIScriptGlobalObjectOwner.h" 60 #include "nsIScriptContext.h" 61 62 #ifdef WIN32 63 #pragma warning( 3 : 4265 ) // "class has virtual functions, but destructor is not virtual" 64 #endif 50 65 51 66 #include <string> … … 53 68 #include <algorithm> 54 69 55 #include "llmozlib .h"70 #include "llmozlib2.h" 56 71 57 72 /////////////////////////////////////////////////////////////////////////////// 58 // manages the process of s otring and emitting events that the consumer73 // manages the process of storing and emitting events that the consumer 59 74 // of the embedding class can observe 60 75 template< class T > … … 124 139 public nsIURIContentListener, 125 140 public nsSupportsWeakReference, 126 public nsIDOMEventListener 141 public nsIDOMEventListener, 142 public nsIToolkitObserver 127 143 { 128 144 public: … … 136 152 NS_DECL_NSIURICONTENTLISTENER 137 153 NS_DECL_NSIDOMEVENTLISTENER 138 154 NS_DECL_NSITOOLKITOBSERVER 155 156 // housekeeping 139 157 nsresult createBrowser( void* nativeWindowHandleIn, PRInt32 widthIn, PRInt32 heightIn, nsIWebBrowser** aBrowser ); 158 void setParent( LLEmbeddedBrowser* parentIn ) { mParent = parentIn; }; 140 159 PRBool setSize( PRInt16 widthIn, PRInt16 heightIn ); 141 160 void focusBrowser( PRBool focusBrowserIn ); … … 144 163 int getWindowId(); 145 164 165 // random accessors 146 166 const PRInt16 getPercentComplete(); 147 167 const std::string& getStatusMsg(); 148 168 const std::string& getCurrentUri(); 149 169 const std::string& getClickLinkHref(); 150 151 unsigned char* grabWindow(); 170 const std::string& getClickLinkTarget(); 171 172 // memory buffer management 173 unsigned char* grabWindow( int xIn, int yIn, int widthIn, int heightIn ); 174 PRBool flipWindow( PRBool flip ); 152 175 unsigned char* getPageBuffer(); 153 176 PRInt16 getBrowserWidth(); … … 156 179 PRInt32 getBrowserRowSpan(); 157 180 158 void setBackgroundColor( PRUint8 redIn, PRUint8 greenIn, PRUint8 blueIn ); 181 // set background color that you see in between pages - default is white but sometimes useful to change 182 void setBackgroundColor( const PRUint8 redIn, const PRUint8 greenIn, const PRUint8 blueIn ); 183 184 // change the caret color (we have different backgrounds to edit fields - black caret on black background == bad) 159 185 void setCaretColor( const PRUint8 redIn, const PRUint8 greenIn, const PRUint8 blueIn ); 160 186 187 // can turn off updates to a page - e.g. when it's hidden by your windowing system 188 void setEnabled( PRBool enabledIn ); 189 190 // navigation 161 191 void navigateStop(); 162 192 PRBool navigateTo( const std::string uriIn ); … … 166 196 void navigateForward(); 167 197 198 // javascript access/control 199 std::string evaluateJavascript( std::string scriptIn ); 200 201 // redirection when you hit a missing page 168 202 bool set404RedirectUrl( std::string redirect_url ); 169 203 bool clr404RedirectUrl(); 170 204 205 // mouse & keyboard events 171 206 void mouseDown( PRInt16 xPosIn, PRInt16 yPosIn ); 172 207 void mouseUp( PRInt16 xPosIn, PRInt16 yPosIn ); … … 176 211 void unicodeInput( PRUint32 uni_char ); 177 212 213 // allow consumers of this class and to observe browser events 178 214 bool addObserver( LLEmbeddedBrowserWindowObserver* observerIn ); 179 215 bool remObserver( LLEmbeddedBrowserWindowObserver* observerIn ); 216 217 // accessor/mutator for scheme that browser doesn't follow - e.g. secondlife.com:// 218 void setNoFollowScheme( std::string schemeIn ); 219 std::string getNoFollowScheme(); 180 220 181 221 private: … … 183 223 PRBool sendMozillaKeyboardEvent( PRUint32 keyIn, PRUint32 ns_vk_code ); 184 224 PRBool renderCaret(); 225 PRBool enableToolkitObserver( PRBool enableIn ); 226 185 227 LLEmbeddedBrowserWindowEmitter< LLEmbeddedBrowserWindowObserver > mEventEmitter; 228 229 LLEmbeddedBrowser* mParent; 186 230 PRInt16 mPercentComplete; 187 231 std::string mStatusText; 188 232 std::string mCurrentUri; 189 233 std::string mClickHref; 190 std::string m 404RedirectUrl;191 234 std::string mClickTarget; 235 std::string mNoFollowScheme; 192 236 nsCOMPtr< nsIWebBrowser > mWebBrowser; 193 237 nsCOMPtr< nsIBaseWindow > mBaseWindow; 194 238 nsCOMPtr< nsIWebNavigation > mWebNav; 195 196 239 int mWindowId; 197 198 PRUint8 mBackgroundRed;199 PRUint8 mBackgroundGreen;200 PRUint8 mBackgroundBlue;201 PRUint8 mCaretRed;202 PRUint8 mCaretGreen;203 PRUint8 mCaretBlue;204 205 240 unsigned char* mPageBuffer; 206 size_t mPageBufferSize; 241 std::string m404RedirectUrl; 242 PRBool mEnabled; 243 PRBool mFlipBitmap; 207 244 PRInt32 mBrowserRowSpan; 208 245 PRInt16 mBrowserWidth; 209 246 PRInt16 mBrowserHeight; 210 247 PRInt16 mBrowserDepth; 248 PRUint8 mBkgRed; 249 PRUint8 mBkgGreen; 250 PRUint8 mBkgBlue; 251 PRUint8 mCaretRed; 252 PRUint8 mCaretGreen; 253 PRUint8 mCaretBlue; 211 254 }; 212 255 213 #ifdef WIN32214 #pragma warning( 3 : 4265 ) // "class has virtual functions, but destructor is not virtual"215 #endif216 217 256 #endif // LLEMBEDEDDBROWSERWINDOW_H
