WebClient.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. /// Load the specified url into the main frame of the browser
  38. void LoadURL(const String& url);
  39. private:
  40. void WasResized();
  41. SharedPtr<WebRenderHandler> renderHandler_;
  42. WebClientPrivate* d_;
  43. };
  44. }