Windows are individual web pages, the equivalent of a single tab in a normal browser. More...
#include <Window.hpp>
Public Types | |
typedef WidgetList::const_iterator | BackToFrontIter |
typedef WidgetList::const_reverse_iterator | FrontToBackIter |
Public Member Functions | |
void | destroy () |
Deletes this window object. | |
virtual | ~Window () |
Deprecated virtual destructor. | |
virtual Widget * | getWidget () const =0 |
A Window should have a root widget object, unless the window crashed or has never been navigated. | |
Context * | getContext () const |
Get the rendering context for this Window. | |
void | setDelegate (WindowDelegate *delegate) |
Set the delegate for receiving events, such as paint events and alerts, from this Window. | |
BackToFrontIter | backIter () const |
loop from the backmost (usually obscured) widget to the frontmost (focused) widget. | |
BackToFrontIter | backEnd () const |
Corresponding end() to compare against the backIter. | |
FrontToBackIter | frontIter () const |
loop from the frontmost (focused) widget to the backmost (usually obscured) widget. | |
FrontToBackIter | frontEnd () const |
Corresponding end() to compare against the frontIter. | |
Widget * | getWidgetAtPoint (int xPos, int yPos, bool returnRootIfOutside=false) const |
Look up which widget is at the specified point in the Window. | |
virtual int | getId () const =0 |
Gets an id for this window. | |
virtual void | setTransparent (bool istrans)=0 |
Sets the transparency flag for this Window. | |
virtual void | focus ()=0 |
Set the topmost Widget for this Window as focused. | |
virtual void | unfocus ()=0 |
Blurs all widgets on this Window. | |
virtual void | mouseMoved (int xPos, int yPos)=0 |
Inject a mouse movement event into the Window at the specified position. | |
virtual void | mouseButton (unsigned int buttonID, bool down, int clickCount=1)=0 |
Inject a mouse button event into the Window. | |
virtual void | mouseWheel (int xScroll, int yScroll)=0 |
Inject a mouse wheel scroll event into the Window. | |
virtual void | textEvent (const wchar_t *evt, size_t evtLength)=0 |
Inject a text event into the Window. | |
virtual void | keyEvent (bool pressed, int mods, int vk_code, int scancode)=0 |
Inject an individual key event into the Window. | |
virtual void | resize (int width, int height)=0 |
Resize the Window. | |
virtual void | adjustZoom (int mode)=0 |
Changes the zoom level of the page in fixed increments (same as Ctrl--, Ctrl-0, and Ctrl-+ in most browsers. | |
virtual void | executeJavascript (WideString javascript)=0 |
Execute Javascript in the context of the Window. | |
virtual void | insertCSS (WideString css, WideString elementId)=0 |
Insert the given text as a STYLE element at the beginning of the document. | |
virtual bool | navigateTo (URLString url)=0 |
Request navigation to a URL. | |
bool | navigateTo (const char *url, size_t url_length) |
Request navigation to a URL. | |
virtual void | refresh ()=0 |
Request that the page be reloaded. | |
virtual void | stop ()=0 |
Stop ongoing navigations. | |
virtual void | goBack ()=0 |
Goes back by one history item. | |
virtual void | goForward ()=0 |
Goes forward by one history item. | |
virtual bool | canGoBack () const =0 |
True if you can go back at all (if back button should be enabled). | |
virtual bool | canGoForward () const =0 |
True if you can go forward (if forwrad button should be enabled). | |
virtual void | cut ()=0 |
Cut the currently selected data to the clipboard. | |
virtual void | copy ()=0 |
Copy the currently selected data to the clipboard. | |
virtual void | paste ()=0 |
Paste the current clipboard contents to the current cursoor position in the Window. | |
virtual void | undo ()=0 |
Request the last action be undone. | |
virtual void | redo ()=0 |
Request the last undone action be reperformed. | |
virtual void | del ()=0 |
Request deletion action. | |
virtual void | selectAll ()=0 |
Request all data be selected. | |
virtual void | filesSelected (FileString *files)=0 |
Call after the file chooser has finished. | |
virtual void | synchronousScriptReturn (void *handle, const Script::Variant &result)=0 |
Call after the file chooser has finished. | |
virtual void | bind (WideString lvalue, const Script::Variant &rvalue)=0 |
Binds a proxy function in Javascript to call. | |
virtual void | addBindOnStartLoading (WideString lvalue, const Script::Variant &rvalue)=0 |
Binds a proxy function in Javascript at the beginning of each page load. | |
virtual void | addEvalOnStartLoading (WideString script)=0 |
Runs code in Javascript at the beginning of each page load. | |
virtual void | clearStartLoading ()=0 |
Removes all bindings in Javascript. | |
Static Public Member Functions | |
static Window * | create (const Context *context) |
Create a new Window with all default properties which uses an existing Context for rendering. | |
Protected Types | |
typedef std::vector< Widget * > | WidgetList |
Protected Member Functions | |
Window () | |
Construct a completely uninitialized Window -- it will have no backing renderer or delegate and use a new Context. | |
Window (const Context *otherContext) | |
Construct a Window which uses the specified Context for rendering. | |
void | appendWidget (Widget *wid) |
void | removeWidget (Widget *wid) |
Protected Attributes | |
Context * | mContext |
WindowDelegate * | mDelegate |
WidgetList | mWidgets |
Windows are individual web pages, the equivalent of a single tab in a normal browser.
Windows mediate interaction between the user and the renderer. They allow inspection of the page (access to UI widgets), injection of input (keyboard, mouse), injection of Javascript code, navigation controls (forward, back, loading URLs), and other utility methods (cut, copy, paste, etc). Since the represent off-screen renderers, they also allow manipulation such as resizting.
typedef WidgetList::const_iterator Berkelium::Window::BackToFrontIter |
typedef WidgetList::const_reverse_iterator Berkelium::Window::FrontToBackIter |
typedef std::vector<Widget*> Berkelium::Window::WidgetList [protected] |
Berkelium::Window::Window | ( | ) | [protected] |
Berkelium::Window::Window | ( | const Context * | otherContext | ) | [protected] |
virtual Berkelium::Window::~Window | ( | ) | [virtual] |
Deprecated virtual destructor.
virtual void Berkelium::Window::addBindOnStartLoading | ( | WideString | lvalue, | |
const Script::Variant & | rvalue | |||
) | [pure virtual] |
Binds a proxy function in Javascript at the beginning of each page load.
virtual void Berkelium::Window::addEvalOnStartLoading | ( | WideString | script | ) | [pure virtual] |
Runs code in Javascript at the beginning of each page load.
virtual void Berkelium::Window::adjustZoom | ( | int | mode | ) | [pure virtual] |
Changes the zoom level of the page in fixed increments (same as Ctrl--, Ctrl-0, and Ctrl-+ in most browsers.
mode | -1 to zoom out, 0 to reset zoom, 1 to zoom in |
void Berkelium::Window::appendWidget | ( | Widget * | wid | ) | [inline, protected] |
BackToFrontIter Berkelium::Window::backEnd | ( | ) | const [inline] |
Corresponding end() to compare against the backIter.
BackToFrontIter Berkelium::Window::backIter | ( | ) | const [inline] |
loop from the backmost (usually obscured) widget to the frontmost (focused) widget.
virtual void Berkelium::Window::bind | ( | WideString | lvalue, | |
const Script::Variant & | rvalue | |||
) | [pure virtual] |
Binds a proxy function in Javascript to call.
virtual bool Berkelium::Window::canGoBack | ( | ) | const [pure virtual] |
True if you can go back at all (if back button should be enabled).
virtual bool Berkelium::Window::canGoForward | ( | ) | const [pure virtual] |
True if you can go forward (if forwrad button should be enabled).
virtual void Berkelium::Window::clearStartLoading | ( | ) | [pure virtual] |
Removes all bindings in Javascript.
virtual void Berkelium::Window::copy | ( | ) | [pure virtual] |
Copy the currently selected data to the clipboard.
virtual void Berkelium::Window::cut | ( | ) | [pure virtual] |
Cut the currently selected data to the clipboard.
virtual void Berkelium::Window::del | ( | ) | [pure virtual] |
Request deletion action.
void Berkelium::Window::destroy | ( | ) |
Deletes this window object.
virtual void Berkelium::Window::executeJavascript | ( | WideString | javascript | ) | [pure virtual] |
Execute Javascript in the context of the Window.
This is equivalent to executing Javascript in the address bar of a regular browser. The javascript is copied so the caller retains ownership of the string.
javascript | pointer to a string containing Javascript code |
virtual void Berkelium::Window::filesSelected | ( | FileString * | files | ) | [pure virtual] |
Call after the file chooser has finished.
Cancels if |files| is NULL or empty.
files | List of FileString's terminated with empty FileString. |
virtual void Berkelium::Window::focus | ( | ) | [pure virtual] |
FrontToBackIter Berkelium::Window::frontEnd | ( | ) | const [inline] |
Corresponding end() to compare against the frontIter.
FrontToBackIter Berkelium::Window::frontIter | ( | ) | const [inline] |
loop from the frontmost (focused) widget to the backmost (usually obscured) widget.
Context* Berkelium::Window::getContext | ( | ) | const [inline] |
Get the rendering context for this Window.
virtual int Berkelium::Window::getId | ( | ) | const [pure virtual] |
Gets an id for this window.
virtual Widget* Berkelium::Window::getWidget | ( | ) | const [pure virtual] |
A Window should have a root widget object, unless the window crashed or has never been navigated.
If such a widget exists, returns non-null.
Widget* Berkelium::Window::getWidgetAtPoint | ( | int | xPos, | |
int | yPos, | |||
bool | returnRootIfOutside = false | |||
) | const |
Look up which widget is at the specified point in the Window.
xPos | the position on the x-axis of the point to look up | |
yPos | the position on the y-axis of the point to look up | |
returnRootIfOutside | if true and the specified point lies outside the Window, returns the root Widget instead of NULL |
virtual void Berkelium::Window::goBack | ( | ) | [pure virtual] |
Goes back by one history item.
virtual void Berkelium::Window::goForward | ( | ) | [pure virtual] |
Goes forward by one history item.
virtual void Berkelium::Window::insertCSS | ( | WideString | css, | |
WideString | elementId | |||
) | [pure virtual] |
Insert the given text as a STYLE element at the beginning of the document.
css | Stylesheet content to insert. | |
elementId | Can be empty, but if specified then it is used as the id for the newly inserted element (replacing an existing one with the same id, if any). |
virtual void Berkelium::Window::keyEvent | ( | bool | pressed, | |
int | mods, | |||
int | vk_code, | |||
int | scancode | |||
) | [pure virtual] |
Inject an individual key event into the Window.
pressed | if true indicates the key was pressed, if false indicates it was released | |
mods | a modifier code created by a logical or of KeyModifiers | |
vk_code | the virtual key code received from the OS | |
scancode | the original scancode that generated the event |
virtual void Berkelium::Window::mouseButton | ( | unsigned int | buttonID, | |
bool | down, | |||
int | clickCount = 1 | |||
) | [pure virtual] |
Inject a mouse button event into the Window.
buttonID | index of the button that caused the event | |
down | if true, indicates the mouse button was pressed, if false indicates it was released | |
clickCount | the number of clicks to send, e.g. 1 for single click, 2 for double click |
virtual void Berkelium::Window::mouseMoved | ( | int | xPos, | |
int | yPos | |||
) | [pure virtual] |
Inject a mouse movement event into the Window at the specified position.
xPos | the position along the x-axis of the mouse movement | |
yPos | the position along the y-axis of the mouse movement |
virtual void Berkelium::Window::mouseWheel | ( | int | xScroll, | |
int | yScroll | |||
) | [pure virtual] |
Inject a mouse wheel scroll event into the Window.
xScroll | amount scrolled horizontally | |
yScroll | amount scrolled vertically |
bool Berkelium::Window::navigateTo | ( | const char * | url, | |
size_t | url_length | |||
) | [inline] |
Request navigation to a URL.
The URL string is copied so the caller retains ownership of the string.
url | pointer to an ASCII string containing a URL | |
url_length | the length of the URL string |
virtual bool Berkelium::Window::navigateTo | ( | URLString | url | ) | [pure virtual] |
Request navigation to a URL.
Depending on the url, this might not cause an actual navigation.
url | URLString pointer to an ASCII URL. |
virtual void Berkelium::Window::paste | ( | ) | [pure virtual] |
Paste the current clipboard contents to the current cursoor position in the Window.
virtual void Berkelium::Window::redo | ( | ) | [pure virtual] |
Request the last undone action be reperformed.
virtual void Berkelium::Window::refresh | ( | ) | [pure virtual] |
Request that the page be reloaded.
void Berkelium::Window::removeWidget | ( | Widget * | wid | ) | [inline, protected] |
virtual void Berkelium::Window::resize | ( | int | width, | |
int | height | |||
) | [pure virtual] |
Resize the Window.
You should receive an onPaint message as an acknowledgement.
width | the new width | |
height | the new height |
virtual void Berkelium::Window::selectAll | ( | ) | [pure virtual] |
Request all data be selected.
void Berkelium::Window::setDelegate | ( | WindowDelegate * | delegate | ) | [inline] |
Set the delegate for receiving events, such as paint events and alerts, from this Window.
delegate | the WindowDelegate that should receive events, or NULL to disable delegation of events |
virtual void Berkelium::Window::setTransparent | ( | bool | istrans | ) | [pure virtual] |
Sets the transparency flag for this Window.
Note that the buffer will be ARGB regardless of transparency, but if the window is not set as transparent, the alpha channel should always be 1. Transparency defaults to false and must be enabled on each Window.
istrans | Whether to enable a transparent background. |
virtual void Berkelium::Window::stop | ( | ) | [pure virtual] |
Stop ongoing navigations.
virtual void Berkelium::Window::synchronousScriptReturn | ( | void * | handle, | |
const Script::Variant & | result | |||
) | [pure virtual] |
Call after the file chooser has finished.
Cancels if |files| is NULL or empty. Note: This *MUST* be called after onJavascriptCallback is called with synchronous. If not called, the owning RenderViewHost will no longer run scripts.
handle | Opaque |replyMsg| passed in WindowDelegate::onJavascriptCallback | |
result | Javascript value to return. |
virtual void Berkelium::Window::textEvent | ( | const wchar_t * | evt, | |
size_t | evtLength | |||
) | [pure virtual] |
Inject a text event into the Window.
evt | pointer to text string to inject | |
evtLength | length of string |
virtual void Berkelium::Window::undo | ( | ) | [pure virtual] |
Request the last action be undone.
virtual void Berkelium::Window::unfocus | ( | ) | [pure virtual] |
Blurs all widgets on this Window.
Context* Berkelium::Window::mContext [protected] |
WindowDelegate* Berkelium::Window::mDelegate [protected] |
WidgetList Berkelium::Window::mWidgets [protected] |