A component that displays an embedded web browser. More...
Inherits Component.
Public Member Functions | |
| WebBrowserComponent (bool unloadPageWhenBrowserIsHidden=true) | |
| Creates a WebBrowserComponent. | |
| ~WebBrowserComponent () | |
| Destructor. | |
| void | goToURL (const String &url, const StringArray *headers=nullptr, const MemoryBlock *postData=nullptr) |
| Sends the browser to a particular URL. | |
| void | stop () |
| Stops the current page loading. | |
| void | goBack () |
| Sends the browser back one page. | |
| void | goForward () |
| Sends the browser forward one page. | |
| void | refresh () |
| Refreshes the browser. | |
| virtual bool | pageAboutToLoad (const String &newURL) |
| This callback is called when the browser is about to navigate to a new location. | |
| void | paint (Graphics &g) |
| Components can override this method to draw their content. | |
| void | resized () |
| Called when this component's size has been changed. | |
| void | parentHierarchyChanged () |
| Called to indicate that the component's parents have changed. | |
| void | visibilityChanged () |
| Called when this component's visiblility changes. | |
A component that displays an embedded web browser.
The browser itself will be platform-dependent. On the Mac, probably Safari, on Windows, probably IE.
| WebBrowserComponent::WebBrowserComponent | ( | bool | unloadPageWhenBrowserIsHidden = true ) |
[explicit] |
Creates a WebBrowserComponent.
Once it's created and visible, send the browser to a URL using goToURL().
| unloadPageWhenBrowserIsHidden | if this is true, then when the browser component is taken offscreen, it'll clear the current page and replace it with a blank page - this can be handy to stop the browser using resources in the background when it's not actually being used. |
| WebBrowserComponent::~WebBrowserComponent | ( | ) |
Destructor.
| void WebBrowserComponent::goToURL | ( | const String & | url, |
| const StringArray * | headers = nullptr, |
||
| const MemoryBlock * | postData = nullptr |
||
| ) |
Sends the browser to a particular URL.
| url | the URL to go to. |
| headers | an optional set of parameters to put in the HTTP header. If you supply this, it should be a set of string in the form "HeaderKey: HeaderValue" |
| postData | an optional block of data that will be attached to the HTTP POST request |
| void WebBrowserComponent::stop | ( | ) |
Stops the current page loading.
| void WebBrowserComponent::goBack | ( | ) |
Sends the browser back one page.
| void WebBrowserComponent::goForward | ( | ) |
Sends the browser forward one page.
| void WebBrowserComponent::refresh | ( | ) |
Refreshes the browser.
| virtual bool WebBrowserComponent::pageAboutToLoad | ( | const String & | newURL ) | [virtual] |
This callback is called when the browser is about to navigate to a new location.
You can override this method to perform some action when the user tries to go to a particular URL. To allow the operation to carry on, return true, or return false to stop the navigation happening.
| void WebBrowserComponent::paint | ( | Graphics & | g ) | [virtual] |
Components can override this method to draw their content.
The paint() method gets called when a region of a component needs redrawing, either because the component's repaint() method has been called, or because something has happened on the screen that means a section of a window needs to be redrawn.
Any child components will draw themselves over whatever this method draws. If you need to paint over the top of your child components, you can also implement the paintOverChildren() method to do this.
If you want to cause a component to redraw itself, this is done asynchronously - calling the repaint() method marks a region of the component as "dirty", and the paint() method will automatically be called sometime later, by the message thread, to paint any bits that need refreshing. In Juce (and almost all modern UI frameworks), you never redraw something synchronously.
You should never need to call this method directly - to take a snapshot of the component you could use createComponentSnapshot() or paintEntireComponent().
| g | the graphics context that must be used to do the drawing operations. |
Reimplemented from Component.
| void WebBrowserComponent::resized | ( | ) | [virtual] |
Called when this component's size has been changed.
A component can implement this method to do things such as laying out its child components when its width or height changes.
The method is called synchronously as a result of the setBounds or setSize methods, so repeatedly changing a components size will repeatedly call its resized method (unlike things like repainting, where multiple calls to repaint are coalesced together).
If the component is a top-level window on the desktop, its size could also be changed by operating-system factors beyond the application's control.
Reimplemented from Component.
| void WebBrowserComponent::parentHierarchyChanged | ( | ) | [virtual] |
Called to indicate that the component's parents have changed.
When a component is added or removed from its parent, this method will be called on all of its children (recursively - so all children of its children will also be called as well).
Subclasses can override this if they need to react to this in some way.
Reimplemented from Component.
| void WebBrowserComponent::visibilityChanged | ( | ) | [virtual] |
Called when this component's visiblility changes.
Reimplemented from Component.