WebClient.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #include <Atomic/Core/Object.h>
  2. #include "WebRenderHandler.h"
  3. #pragma once
  4. class CefClient;
  5. namespace Atomic
  6. {
  7. class WebClientPrivate;
  8. class ATOMIC_API WebClient : public Object
  9. {
  10. friend class WebBrowserHost;
  11. friend class WebClientPrivate;
  12. OBJECT(WebClient)
  13. public:
  14. /// Construct.
  15. WebClient(Context* context);
  16. /// Destruct.
  17. virtual ~WebClient();
  18. /// call once initialized with handlers
  19. bool CreateBrowser(const String& initialURL, int width, int height);
  20. void SetSize(int width, int height);
  21. void SetWebRenderHandler(WebRenderHandler* handler);
  22. CefClient* GetCefClient();
  23. void SendMouseClickEvent(int x, int y, unsigned button, bool mouseUp, unsigned modifier) const;
  24. void SendMousePressEvent(int x, int y, unsigned button = 0, unsigned modifier = 0) const;
  25. void SendMouseMoveEvent(int x, int y, unsigned modifier, bool mouseLeave = false) const;
  26. void SendMouseWheelEvent(int x, int y, unsigned modifier, int deltaX, int deltaY) const;
  27. void SendFocusEvent(bool focus = true);
  28. void SendTextInputEvent(const StringHash eventType, VariantMap& eventData);
  29. void SendKeyEvent(const StringHash eventType, VariantMap& eventData);
  30. void ShortcutCut();
  31. void ShortcutCopy();
  32. void ShortcutPaste();
  33. void ShortcutSelectAll();
  34. void ShortcutUndo();
  35. void ShortcutRedo();
  36. void ShortcutDelete();
  37. void ExecuteJavaScript(const String& script);
  38. // Navigation
  39. bool IsLoading();
  40. /// Load the specified url into the main frame of the browser
  41. void LoadURL(const String& url);
  42. void GoBack();
  43. void GoForward();
  44. void Reload();
  45. private:
  46. void WasResized();
  47. SharedPtr<WebRenderHandler> renderHandler_;
  48. WebClientPrivate* d_;
  49. };
  50. }