Panda3D
awWebViewListener.h
1 // Filename: awWebViewListener.h
2 // Created by: rurbino (12Oct09)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 #ifndef AWWEBVIEWLISTENER_H
15 #define AWWEBVIEWLISTENER_H
16 
17 #include "pandabase.h"
18 #include "typedReferenceCount.h"
19 #include "luse.h"
20 
21 #include "awesomium_includes.h"
22 
23 ////////////////////////////////////////////////////////////////////
24 // Class : AwWebViewListener
25 // Description : Thin bindings, wraps a WebViewListener
26 ////////////////////////////////////////////////////////////////////
27 class EXPCL_PANDAAWESOMIUM AwWebViewListener : public TypedReferenceCount, public Awesomium::WebCore {
28 PUBLISHED:
29 
30 
31 PUBLISHED:
33 
34  virtual ~AwWebViewListener() {}
35 
36  /**
37  * This event is fired when a WebView begins navigating to a new URL.
38  *
39  * @param url The URL that is being navigated to.
40  *
41  * @param frameName The name of the frame that this event originated from.
42  */
43  void onBeginNavigation(const std::string& url, const std::wstring& frameName) ;
44 
45  /**
46  * This event is fired when a WebView begins to actually receive data from a server.
47  *
48  * @param url The URL of the frame that is being loaded.
49  *
50  * @param frameName The name of the frame that this event originated from.
51  *
52  * @param statusCode The HTTP status code returned by the server.
53  *
54  * @param mimeType The mime-type of the content that is being loaded.
55  */
56  void onBeginLoading(const std::string& url, const std::wstring& frameName, int statusCode, const std::wstring& mimeType);
57 
58  /**
59  * This event is fired when all loads have finished for a WebView.
60  */
61  void onFinishLoading();
62 
63  /**
64  * This event is fired when a Client callback has been invoked via Javascript from a page.
65  *
66  * @param name The name of the client callback that was invoked (specifically, "Client._this_name_here_(...)").
67  *
68  * @param args The arguments passed to the callback.
69  */
70  void onCallback(const std::string& name, const Awesomium::JSArguments& args);
71 
72  /**
73  * This event is fired when a page title is received.
74  *
75  * @param title The page title.
76  *
77  * @param frameName The name of the frame that this event originated from.
78  */
79  void onReceiveTitle(const std::wstring& title, const std::wstring& frameName) ;
80 
81  /**
82  * This event is fired when a tooltip has changed state.
83  *
84  * @param tooltip The tooltip text (or, is an empty string when the tooltip should disappear).
85  */
86  void onChangeTooltip(const std::wstring& tooltip);
87 
88  /**
89  * This event is fired when keyboard focus has changed.
90  *
91  * @param isFocused Whether or not the keyboard is currently focused.
92  */
93  void onChangeKeyboardFocus(bool isFocused) ;
94 
95  /**
96  * This event is fired when the target URL has changed. This is usually the result of
97  * hovering over a link on the page.
98  *
99  * @param url The updated target URL (or empty if the target URL is cleared).
100  */
101  void onChangeTargetURL(const std::string& url) ;
102 
103 
104 public:
105  static TypeHandle get_class_type() {
106  return _type_handle;
107  }
108  static void init_type() {
109  TypedReferenceCount::init_type();
110  register_type(_type_handle, "AwWebViewListener",
111  TypedReferenceCount::get_class_type());
112  }
113  virtual TypeHandle get_type() const {
114  return get_class_type();
115  }
116  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
117 
118 private:
119  static TypeHandle _type_handle;
120 };
121 
122 // #include "awWebViewListener.I"
123 
124 #endif
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
Thin bindings, wraps a WebViewListener.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85