Ultralight  1.0.0
A fast, lightweight, HTML UI engine for native apps.
View.h
Go to the documentation of this file.
1 #pragma once
15 #include <JavaScriptCore/JavaScript.h>
16 #include <Ultralight/Defines.h>
17 #include <Ultralight/RefPtr.h>
18 #include <Ultralight/KeyEvent.h>
19 #include <Ultralight/MouseEvent.h>
20 #include <Ultralight/ScrollEvent.h>
22 #include <Ultralight/Bitmap.h>
23 #include <Ultralight/Listener.h>
24 
25 namespace ultralight {
26 
34 class UExport View : public RefCounted {
35 public:
39  virtual String url() = 0;
40 
44  virtual String title() = 0;
45 
49  virtual bool is_loading() = 0;
50 
65  virtual RenderTarget render_target() = 0;
66 
72  virtual bool is_bitmap_dirty() = 0;
73 
77  // @note Only valid when using the default, offscreen GPUDriver.
79  virtual RefPtr<Bitmap> bitmap() = 0;
80 
84  virtual void LoadHTML(const String& html) = 0;
85 
92  virtual void LoadURL(const String& url) = 0;
93 
105  virtual void Resize(uint32_t width, uint32_t height) = 0;
106 
116  virtual JSContextRef js_context() = 0;
117 
124  virtual JSValueRef EvaluateScript(const String& script) = 0;
125 
129  virtual bool CanGoBack() = 0;
130 
134  virtual bool CanGoForward() = 0;
135 
139  virtual void GoBack() = 0;
140 
144  virtual void GoForward() = 0;
145 
149  virtual void GoToHistoryOffset(int offset) = 0;
150 
154  virtual void Reload() = 0;
155 
159  virtual void Stop() = 0;
160 
166  virtual void FireKeyEvent(const KeyEvent& evt) = 0;
167 
171  virtual void FireMouseEvent(const MouseEvent& evt) = 0;
172 
176  virtual void FireScrollEvent(const ScrollEvent& evt) = 0;
177 
183  virtual void set_view_listener(ViewListener* listener) = 0;
184 
188  virtual ViewListener* view_listener() const = 0;
189 
195  virtual void set_load_listener(LoadListener* listener) = 0;
196 
200  virtual LoadListener* load_listener() const = 0;
201 
209  virtual void set_needs_paint(bool needs_paint) = 0;
210 
215  virtual bool needs_paint() const = 0;
216 
217 protected:
218  virtual ~View();
219 };
220 
221 } // namespace ultralight
The header for the Bitmap class.
The header for the RenderTarget struct.
The header for View listener interfaces.
The header for the MouseEvent class.
A nullable smart pointer.
Definition: RefPtr.h:281
A generic scroll event.
Definition: ScrollEvent.h:24
This is a set of common JavaScriptCore Helper functions to simplify sample code.
Definition: App.h:19
The header for all ref-counting utilities.
Interface for all ref-counted objects that will be managed using the Ref<> and RefPtr<> smart pointer...
Definition: RefPtr.h:53
UTF-16 String container with conversions for UTF-8 and UTF-32.
Definition: String.h:27
A generic mouse event.
Definition: MouseEvent.h:24
Interface for Load-related events.
Definition: Listener.h:150
The header for the ScrollEvent class.
A generic keyboard event that can be created from a platform event or synthesized from scratch.
Definition: KeyEvent.h:30
Rendering details for a View, to be used with your own GPUDriver.
Definition: RenderTarget.h:31
A View is similar to a tab in a browser– you load web content into it and display it however you want...
Definition: View.h:34
Interface for View-related events.
Definition: Listener.h:105
The header for the KeyEvent class.