Panda3D
|
00001 // Filename: awWebViewListener.h 00002 // Created by: rurbino (12Oct09) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 #ifndef AWWEBVIEWLISTENER_H 00015 #define AWWEBVIEWLISTENER_H 00016 00017 #include "pandabase.h" 00018 #include "typedReferenceCount.h" 00019 #include "luse.h" 00020 00021 #include "awesomium_includes.h" 00022 00023 //////////////////////////////////////////////////////////////////// 00024 // Class : AwWebViewListener 00025 // Description : Thin bindings, wraps a WebViewListener 00026 //////////////////////////////////////////////////////////////////// 00027 class EXPCL_PANDAAWESOMIUM AwWebViewListener : public TypedReferenceCount, public Awesomium::WebCore { 00028 PUBLISHED: 00029 00030 00031 PUBLISHED: 00032 AwWebViewListener(); 00033 00034 virtual ~AwWebViewListener() {} 00035 00036 /** 00037 * This event is fired when a WebView begins navigating to a new URL. 00038 * 00039 * @param url The URL that is being navigated to. 00040 * 00041 * @param frameName The name of the frame that this event originated from. 00042 */ 00043 void onBeginNavigation(const std::string& url, const std::wstring& frameName) ; 00044 00045 /** 00046 * This event is fired when a WebView begins to actually receive data from a server. 00047 * 00048 * @param url The URL of the frame that is being loaded. 00049 * 00050 * @param frameName The name of the frame that this event originated from. 00051 * 00052 * @param statusCode The HTTP status code returned by the server. 00053 * 00054 * @param mimeType The mime-type of the content that is being loaded. 00055 */ 00056 void onBeginLoading(const std::string& url, const std::wstring& frameName, int statusCode, const std::wstring& mimeType); 00057 00058 /** 00059 * This event is fired when all loads have finished for a WebView. 00060 */ 00061 void onFinishLoading(); 00062 00063 /** 00064 * This event is fired when a Client callback has been invoked via Javascript from a page. 00065 * 00066 * @param name The name of the client callback that was invoked (specifically, "Client._this_name_here_(...)"). 00067 * 00068 * @param args The arguments passed to the callback. 00069 */ 00070 void onCallback(const std::string& name, const Awesomium::JSArguments& args); 00071 00072 /** 00073 * This event is fired when a page title is received. 00074 * 00075 * @param title The page title. 00076 * 00077 * @param frameName The name of the frame that this event originated from. 00078 */ 00079 void onReceiveTitle(const std::wstring& title, const std::wstring& frameName) ; 00080 00081 /** 00082 * This event is fired when a tooltip has changed state. 00083 * 00084 * @param tooltip The tooltip text (or, is an empty string when the tooltip should disappear). 00085 */ 00086 void onChangeTooltip(const std::wstring& tooltip); 00087 00088 /** 00089 * This event is fired when keyboard focus has changed. 00090 * 00091 * @param isFocused Whether or not the keyboard is currently focused. 00092 */ 00093 void onChangeKeyboardFocus(bool isFocused) ; 00094 00095 /** 00096 * This event is fired when the target URL has changed. This is usually the result of 00097 * hovering over a link on the page. 00098 * 00099 * @param url The updated target URL (or empty if the target URL is cleared). 00100 */ 00101 void onChangeTargetURL(const std::string& url) ; 00102 00103 00104 public: 00105 static TypeHandle get_class_type() { 00106 return _type_handle; 00107 } 00108 static void init_type() { 00109 TypedReferenceCount::init_type(); 00110 register_type(_type_handle, "AwWebViewListener", 00111 TypedReferenceCount::get_class_type()); 00112 } 00113 virtual TypeHandle get_type() const { 00114 return get_class_type(); 00115 } 00116 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00117 00118 private: 00119 static TypeHandle _type_handle; 00120 }; 00121 00122 // #include "awWebViewListener.I" 00123 00124 #endif