Berkelium

Berkelium::Window Class Reference

Windows are individual web pages, the equivalent of a single tab in a normal browser. More...

#include <Window.hpp>

List of all members.

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 WidgetgetWidget () const =0
 A Window should have a root widget object, unless the window crashed or has never been navigated.
ContextgetContext () 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.
WidgetgetWidgetAtPoint (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 Windowcreate (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

ContextmContext
WindowDelegatemDelegate
WidgetList mWidgets

Detailed Description

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.


Member Typedef Documentation

typedef WidgetList::const_iterator Berkelium::Window::BackToFrontIter
typedef WidgetList::const_reverse_iterator Berkelium::Window::FrontToBackIter
typedef std::vector<Widget*> Berkelium::Window::WidgetList [protected]

Constructor & Destructor Documentation

Berkelium::Window::Window (  )  [protected]

Construct a completely uninitialized Window -- it will have no backing renderer or delegate and use a new Context.

Berkelium::Window::Window ( const Context otherContext  )  [protected]

Construct a Window which uses the specified Context for rendering.

Parameters:
otherContext an existing rendering Context to use
virtual Berkelium::Window::~Window (  )  [virtual]

Deprecated virtual destructor.

Deprecated:
Use destroy() to avoid interference from custom allocators.

Member Function Documentation

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.

Parameters:
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.

static Window* Berkelium::Window::create ( const Context context  )  [static]

Create a new Window with all default properties which uses an existing Context for rendering.

It will be zero sized and use a default local web page.

Parameters:
context an existing context to use for rendering
Returns:
a new Window or NULL on failure
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.

Parameters:
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.

Parameters:
files List of FileString's terminated with empty FileString.
virtual void Berkelium::Window::focus (  )  [pure virtual]

Set the topmost Widget for this Window as focused.

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.

Returns:
the RenderView's unique routing id.
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.

Parameters:
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
Returns:
the Widget at the specified location or NULL if no widgets are at that point
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Deprecated:
Use navigateTo(URLString) instead
Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.


Member Data Documentation


The documentation for this class was generated from the following file:

Documentation generated on 22 Nov 2013