WebClient.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 SendMouseMoveEvent(int x, int y, unsigned modifier, bool mouseLeave = false) const;
  25. void SendMouseWheelEvent(int x, int y, unsigned modifier, int deltaX, int deltaY) const;
  26. void SendFocusEvent(bool focus = true);
  27. void SendTextInputEvent(const StringHash eventType, VariantMap& eventData);
  28. void SendKeyEvent(const StringHash eventType, VariantMap& eventData);
  29. void ShortcutCut();
  30. void ShortcutCopy();
  31. void ShortcutPaste();
  32. void ShortcutSelectAll();
  33. void ShortcutUndo();
  34. void ShortcutRedo();
  35. void ShortcutDelete();
  36. // Navigation
  37. bool IsLoading();
  38. /// Load the specified url into the main frame of the browser
  39. void LoadURL(const String& url);
  40. void GoBack();
  41. void GoForward();
  42. void Reload();
  43. private:
  44. void WasResized();
  45. SharedPtr<WebRenderHandler> renderHandler_;
  46. WebClientPrivate* d_;
  47. };
  48. }