Ultralight  1.0.0
A fast, lightweight, HTML UI engine for native apps.
Listener.h
Go to the documentation of this file.
1 #pragma once
15 #include <Ultralight/Defines.h>
16 #include <Ultralight/String.h>
17 
18 namespace ultralight {
19 
20 class View;
21 
26  kMessageSource_XML = 0,
27  kMessageSource_JS,
28  kMessageSource_Network,
29  kMessageSource_ConsoleAPI,
30  kMessageSource_Storage,
31  kMessageSource_AppCache,
32  kMessageSource_Rendering,
33  kMessageSource_CSS,
34  kMessageSource_Security,
35  kMessageSource_ContentBlocker,
36  kMessageSource_Other,
37 };
38 
43  kMessageLevel_Log = 1,
44  kMessageLevel_Warning = 2,
45  kMessageLevel_Error = 3,
46  kMessageLevel_Debug = 4,
47  kMessageLevel_Info = 5,
48 };
49 
53 enum Cursor {
54  kCursor_Pointer = 0,
55  kCursor_Cross,
56  kCursor_Hand,
57  kCursor_IBeam,
58  kCursor_Wait,
59  kCursor_Help,
60  kCursor_EastResize,
61  kCursor_NorthResize,
62  kCursor_NorthEastResize,
63  kCursor_NorthWestResize,
64  kCursor_SouthResize,
65  kCursor_SouthEastResize,
66  kCursor_SouthWestResize,
67  kCursor_WestResize,
68  kCursor_NorthSouthResize,
69  kCursor_EastWestResize,
70  kCursor_NorthEastSouthWestResize,
71  kCursor_NorthWestSouthEastResize,
72  kCursor_ColumnResize,
73  kCursor_RowResize,
74  kCursor_MiddlePanning,
75  kCursor_EastPanning,
76  kCursor_NorthPanning,
77  kCursor_NorthEastPanning,
78  kCursor_NorthWestPanning,
79  kCursor_SouthPanning,
80  kCursor_SouthEastPanning,
81  kCursor_SouthWestPanning,
82  kCursor_WestPanning,
83  kCursor_Move,
84  kCursor_VerticalText,
85  kCursor_Cell,
86  kCursor_ContextMenu,
87  kCursor_Alias,
88  kCursor_Progress,
89  kCursor_NoDrop,
90  kCursor_Copy,
91  kCursor_None,
92  kCursor_NotAllowed,
93  kCursor_ZoomIn,
94  kCursor_ZoomOut,
95  kCursor_Grab,
96  kCursor_Grabbing,
97  kCursor_Custom
98 };
99 
105 class UExport ViewListener {
106 public:
107  virtual ~ViewListener() {}
108 
112  virtual void OnChangeTitle(ultralight::View* caller,
113  const String& title) {}
114 
118  virtual void OnChangeURL(ultralight::View* caller,
119  const String& url) {}
120 
124  virtual void OnChangeTooltip(ultralight::View* caller,
125  const String& tooltip) {}
126 
130  virtual void OnChangeCursor(ultralight::View* caller,
131  Cursor cursor) {}
132 
136  virtual void OnAddConsoleMessage(ultralight::View* caller,
137  MessageSource source,
138  MessageLevel level,
139  const String& message,
140  uint32_t line_number,
141  uint32_t column_number,
142  const String& source_id) {}
143 };
144 
150 class UExport LoadListener {
151 public:
152  virtual ~LoadListener() {}
153 
157  virtual void OnBeginLoading(ultralight::View* caller) {}
158 
162  virtual void OnFinishLoading(ultralight::View* caller) {}
163 
167  virtual void OnUpdateHistory(ultralight::View* caller) {}
168 
173  virtual void OnDOMReady(ultralight::View* caller) {}
174 };
175 
176 } // namespace ultralight
virtual void OnChangeTitle(ultralight::View *caller, const String &title)
Called when the page title changes.
Definition: Listener.h:112
This is a set of common JavaScriptCore Helper functions to simplify sample code.
Definition: App.h:19
MessageSource
MessageSource types,.
Definition: Listener.h:25
virtual void OnChangeURL(ultralight::View *caller, const String &url)
Called when the page URL changes.
Definition: Listener.h:118
UTF-16 String container with conversions for UTF-8 and UTF-32.
Definition: String.h:27
virtual void OnAddConsoleMessage(ultralight::View *caller, MessageSource source, MessageLevel level, const String &message, uint32_t line_number, uint32_t column_number, const String &source_id)
Called when a message is added to the console (useful for errors / debug)
Definition: Listener.h:136
Cursor
Cursor types,.
Definition: Listener.h:53
virtual void OnBeginLoading(ultralight::View *caller)
Called when the page begins loading new URL into main frame.
Definition: Listener.h:157
virtual void OnUpdateHistory(ultralight::View *caller)
Called when the history (back/forward state) is modified.
Definition: Listener.h:167
virtual void OnDOMReady(ultralight::View *caller)
Called when all JavaScript has been parsed and the document is ready.
Definition: Listener.h:173
virtual void OnFinishLoading(ultralight::View *caller)
Called when the page finishes loading URL into main frame.
Definition: Listener.h:162
Interface for Load-related events.
Definition: Listener.h:150
virtual void OnChangeCursor(ultralight::View *caller, Cursor cursor)
Called when the mouse cursor changes.
Definition: Listener.h:130
The header for the String class.
virtual void OnChangeTooltip(ultralight::View *caller, const String &tooltip)
Called when the tooltip changes (usually as result of a mouse hover)
Definition: Listener.h:124
MessageLevel
MessageLevel types,.
Definition: Listener.h:42
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