|
@@ -12,6 +12,7 @@ namespace Atomic
|
|
|
class WebClientPrivate;
|
|
class WebClientPrivate;
|
|
|
class WebMessageHandler;
|
|
class WebMessageHandler;
|
|
|
|
|
|
|
|
|
|
+/// WebClient is the main interface for communicating with a browser instance
|
|
|
class ATOMIC_API WebClient : public Object
|
|
class ATOMIC_API WebClient : public Object
|
|
|
{
|
|
{
|
|
|
friend class WebBrowserHost;
|
|
friend class WebBrowserHost;
|
|
@@ -20,52 +21,82 @@ class ATOMIC_API WebClient : public Object
|
|
|
OBJECT(WebClient)
|
|
OBJECT(WebClient)
|
|
|
|
|
|
|
|
public:
|
|
public:
|
|
|
|
|
+
|
|
|
/// Construct.
|
|
/// Construct.
|
|
|
WebClient(Context* context);
|
|
WebClient(Context* context);
|
|
|
|
|
|
|
|
/// Destruct.
|
|
/// Destruct.
|
|
|
virtual ~WebClient();
|
|
virtual ~WebClient();
|
|
|
|
|
|
|
|
- /// call once initialized with handlers
|
|
|
|
|
|
|
+ /// Create the browser, call only once initialized with handlers
|
|
|
bool CreateBrowser(const String& initialURL, int width, int height);
|
|
bool CreateBrowser(const String& initialURL, int width, int height);
|
|
|
|
|
|
|
|
|
|
+ /// Set the browser's width and height
|
|
|
void SetSize(int width, int height);
|
|
void SetSize(int width, int height);
|
|
|
|
|
|
|
|
- void SetWebRenderHandler(WebRenderHandler* handler);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ /// Send a mouse click event to the browser
|
|
|
void SendMouseClickEvent(int x, int y, unsigned button, bool mouseUp, unsigned modifier) const;
|
|
void SendMouseClickEvent(int x, int y, unsigned button, bool mouseUp, unsigned modifier) const;
|
|
|
|
|
+ /// Send a mouse press event to the browser
|
|
|
void SendMousePressEvent(int x, int y, unsigned button = 0, unsigned modifier = 0) const;
|
|
void SendMousePressEvent(int x, int y, unsigned button = 0, unsigned modifier = 0) const;
|
|
|
|
|
+ /// Send a mouse move event to the browser
|
|
|
void SendMouseMoveEvent(int x, int y, unsigned modifier, bool mouseLeave = false) const;
|
|
void SendMouseMoveEvent(int x, int y, unsigned modifier, bool mouseLeave = false) const;
|
|
|
|
|
+ /// Send a mouse wheel event to the browser
|
|
|
void SendMouseWheelEvent(int x, int y, unsigned modifier, int deltaX, int deltaY) const;
|
|
void SendMouseWheelEvent(int x, int y, unsigned modifier, int deltaX, int deltaY) const;
|
|
|
|
|
|
|
|
|
|
+ /// Send a focus event to the browser
|
|
|
void SendFocusEvent(bool focus = true);
|
|
void SendFocusEvent(bool focus = true);
|
|
|
|
|
|
|
|
|
|
+ /// Send a TextInput event to the browser
|
|
|
void SendTextInputEvent(const StringHash eventType, VariantMap& eventData);
|
|
void SendTextInputEvent(const StringHash eventType, VariantMap& eventData);
|
|
|
|
|
+ /// Send a key event to the browser
|
|
|
void SendKeyEvent(const StringHash eventType, VariantMap& eventData);
|
|
void SendKeyEvent(const StringHash eventType, VariantMap& eventData);
|
|
|
|
|
|
|
|
|
|
+ // Shortcuts, note that some web pages (notably some text editors)
|
|
|
|
|
+ // only work with key events and not all shorcuts
|
|
|
|
|
+
|
|
|
|
|
+ /// Invoke the Cut shortcut on the browser's main frame
|
|
|
void ShortcutCut();
|
|
void ShortcutCut();
|
|
|
|
|
+ /// Invoke the Copy shortcut on the browser's main frame
|
|
|
void ShortcutCopy();
|
|
void ShortcutCopy();
|
|
|
|
|
+ /// Invoke the Paste shortcut on the browser's main frame
|
|
|
void ShortcutPaste();
|
|
void ShortcutPaste();
|
|
|
|
|
+ /// Invoke the SelectAll shortcut on the browser's main frame
|
|
|
void ShortcutSelectAll();
|
|
void ShortcutSelectAll();
|
|
|
|
|
+ /// Invoke the Undo shortcut on the browser's main frame
|
|
|
void ShortcutUndo();
|
|
void ShortcutUndo();
|
|
|
|
|
+ /// Invoke the Redo shortcut on the browser's main frame
|
|
|
void ShortcutRedo();
|
|
void ShortcutRedo();
|
|
|
|
|
+ /// Invoke the Delete shortcut on the browser's main frame
|
|
|
void ShortcutDelete();
|
|
void ShortcutDelete();
|
|
|
|
|
|
|
|
|
|
+ /// Add a message handler to the WebClient
|
|
|
void AddMessageHandler(WebMessageHandler* handler, bool first = false);
|
|
void AddMessageHandler(WebMessageHandler* handler, bool first = false);
|
|
|
|
|
+ /// Remove a message handler to the WebClient
|
|
|
void RemoveMessageHandler(WebMessageHandler* handler);
|
|
void RemoveMessageHandler(WebMessageHandler* handler);
|
|
|
|
|
+
|
|
|
|
|
+ /// Execute some JavaScript in the browser
|
|
|
void ExecuteJavaScript(const String& script);
|
|
void ExecuteJavaScript(const String& script);
|
|
|
|
|
|
|
|
// Navigation
|
|
// Navigation
|
|
|
|
|
|
|
|
|
|
+ /// Returns true if the page is currently loading
|
|
|
bool IsLoading();
|
|
bool IsLoading();
|
|
|
|
|
|
|
|
/// Load the specified url into the main frame of the browser
|
|
/// Load the specified url into the main frame of the browser
|
|
|
void LoadURL(const String& url);
|
|
void LoadURL(const String& url);
|
|
|
|
|
+
|
|
|
|
|
+ /// Go back in page history
|
|
|
void GoBack();
|
|
void GoBack();
|
|
|
|
|
+ /// Go forward in page history
|
|
|
void GoForward();
|
|
void GoForward();
|
|
|
|
|
|
|
|
|
|
+ /// Reload the current page
|
|
|
void Reload();
|
|
void Reload();
|
|
|
|
|
|
|
|
|
|
+ /// Set the render handler for this client
|
|
|
|
|
+ void SetWebRenderHandler(WebRenderHandler* handler);
|
|
|
|
|
+
|
|
|
|
|
+ /// Get the (internal) CefClient for this WebClient
|
|
|
CefClient* GetCefClient();
|
|
CefClient* GetCefClient();
|
|
|
|
|
|
|
|
private:
|
|
private:
|