2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: html/htmlwin.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxHtmlWindow
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxHtmlWindow
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-10-25 16:44:52 -04:00
|
|
|
wxHtmlWindow is probably the only class you will directly use unless you want
|
|
|
|
to do something special (like adding new tag handlers or MIME filters).
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2011-11-08 06:35:38 -05:00
|
|
|
The purpose of this class is to display rich content pages (either local file or
|
|
|
|
downloaded via HTTP protocol) in a window based on a subset of the HTML standard.
|
2008-10-25 16:44:52 -04:00
|
|
|
The width of the window is constant - given in the constructor - and virtual height
|
2008-03-08 08:52:38 -05:00
|
|
|
is changed dynamically depending on page size.
|
2010-08-22 18:16:05 -04:00
|
|
|
Once the window is created you can set its content by calling SetPage() with raw HTML,
|
|
|
|
LoadPage() with a wxFileSystem location or LoadFile() with a filename.
|
2008-10-25 16:44:52 -04:00
|
|
|
|
2011-11-08 06:35:38 -05:00
|
|
|
@note
|
|
|
|
If you want complete HTML/CSS support as well as a Javascript engine, see instead
|
|
|
|
wxWebView.
|
|
|
|
|
2008-10-25 16:44:52 -04:00
|
|
|
@note
|
2010-08-22 18:16:05 -04:00
|
|
|
wxHtmlWindow uses the wxImage class for displaying images, as such you need to
|
|
|
|
initialize the handlers for any image formats you use before loading a page.
|
|
|
|
See ::wxInitAllImageHandlers and wxImage::AddHandler.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@beginStyleTable
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxHW_SCROLLBAR_NEVER}
|
2008-03-08 08:52:38 -05:00
|
|
|
Never display scrollbars, not even when the page is larger than the
|
|
|
|
window.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxHW_SCROLLBAR_AUTO}
|
2008-03-08 08:52:38 -05:00
|
|
|
Display scrollbars only if page's size exceeds window's size.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxHW_NO_SELECTION}
|
2008-03-08 08:52:38 -05:00
|
|
|
Don't allow the user to select text.
|
|
|
|
@endStyleTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-10-25 16:44:52 -04:00
|
|
|
|
2009-02-18 12:58:51 -05:00
|
|
|
@beginEventEmissionTable{wxHtmlCellEvent, wxHtmlLinkEvent}
|
2008-10-25 16:44:52 -04:00
|
|
|
@event{EVT_HTML_CELL_CLICKED(id, func)}
|
|
|
|
A wxHtmlCell was clicked.
|
|
|
|
@event{EVT_HTML_CELL_HOVER(id, func)}
|
|
|
|
The mouse passed over a wxHtmlCell.
|
|
|
|
@event{EVT_HTML_LINK_CLICKED(id, func)}
|
|
|
|
A wxHtmlCell which contains an hyperlink was clicked.
|
|
|
|
@endEventTable
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxhtml}
|
|
|
|
@category{html}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
@see wxHtmlLinkEvent, wxHtmlCellEvent
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxHtmlWindow : public wxScrolledWindow
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-10-25 16:44:52 -04:00
|
|
|
Default ctor.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
wxHtmlWindow();
|
2008-10-25 16:44:52 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Constructor.
|
|
|
|
The parameters are the same as wxScrolled::wxScrolled() constructor.
|
|
|
|
*/
|
2008-11-09 11:46:52 -05:00
|
|
|
wxHtmlWindow(wxWindow *parent, wxWindowID id = wxID_ANY,
|
2008-03-08 09:43:31 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxHW_DEFAULT_STYLE,
|
|
|
|
const wxString& name = "htmlWindow");
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-25 16:44:52 -04:00
|
|
|
Adds @ref overview_html_filters "input filter" to the static list of available
|
2008-03-08 08:52:38 -05:00
|
|
|
filters. These filters are present by default:
|
2008-10-25 16:44:52 -04:00
|
|
|
- @c text/html MIME type
|
|
|
|
- @c image/* MIME types
|
|
|
|
- Plain Text filter (this filter is used if no other filter matches)
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2009-01-10 17:42:09 -05:00
|
|
|
static void AddFilter(wxHtmlFilter* filter);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-03-08 09:43:31 -05:00
|
|
|
Appends HTML fragment to currently displayed text and refreshes the window.
|
2008-10-13 07:29:37 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param source
|
2008-03-09 08:33:59 -04:00
|
|
|
HTML code fragment
|
2008-10-13 07:29:37 -04:00
|
|
|
|
2008-05-10 21:38:53 -04:00
|
|
|
@return @false if an error occurred, @true otherwise.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool AppendToPage(const wxString& source);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns pointer to the top-level container.
|
2008-10-25 16:44:52 -04:00
|
|
|
|
|
|
|
@see @ref overview_html_cells, @ref overview_printing
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxHtmlContainerCell* GetInternalRepresentation() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-25 16:44:52 -04:00
|
|
|
Returns anchor within currently opened page (see wxHtmlWindow::GetOpenedPage).
|
|
|
|
If no page is opened or if the displayed page wasn't produced by call to
|
|
|
|
LoadPage(), empty string is returned.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
wxString GetOpenedAnchor() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-25 16:44:52 -04:00
|
|
|
Returns full location of the opened page.
|
|
|
|
If no page is opened or if the displayed page wasn't produced by call to
|
|
|
|
LoadPage(), empty string is returned.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
wxString GetOpenedPage() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2010-08-22 18:16:05 -04:00
|
|
|
Returns title of the opened page or wxEmptyString if the current page does not
|
2008-10-25 16:44:52 -04:00
|
|
|
contain \<TITLE\> tag.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
wxString GetOpenedPageTitle() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the related frame.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxFrame* GetRelatedFrame() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2010-08-22 18:16:05 -04:00
|
|
|
Moves back to the previous page. Only pages displayed using LoadPage()
|
|
|
|
are stored in history list.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool HistoryBack();
|
|
|
|
|
|
|
|
/**
|
2008-10-25 16:44:52 -04:00
|
|
|
Returns @true if it is possible to go back in the history
|
2010-08-22 18:16:05 -04:00
|
|
|
i.e. HistoryBack() won't fail.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool HistoryCanBack();
|
|
|
|
|
|
|
|
/**
|
2008-10-25 16:44:52 -04:00
|
|
|
Returns @true if it is possible to go forward in the history
|
2010-08-22 18:16:05 -04:00
|
|
|
i.e. HistoryForward() won't fail.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool HistoryCanForward();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Clears history.
|
|
|
|
*/
|
|
|
|
void HistoryClear();
|
|
|
|
|
|
|
|
/**
|
2010-08-22 18:16:05 -04:00
|
|
|
Moves to next page in history. Only pages displayed using LoadPage()
|
|
|
|
are stored in history list.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool HistoryForward();
|
|
|
|
|
|
|
|
/**
|
2010-08-22 18:16:05 -04:00
|
|
|
Loads an HTML page from a file and displays it.
|
2008-10-13 07:29:37 -04:00
|
|
|
|
2008-05-10 21:38:53 -04:00
|
|
|
@return @false if an error occurred, @true otherwise
|
2008-10-13 07:29:37 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see LoadPage()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
bool LoadFile(const wxFileName& filename);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2010-08-22 18:16:05 -04:00
|
|
|
Unlike SetPage() this function first loads the HTML page from @a location
|
|
|
|
and then displays it.
|
2008-10-13 07:29:37 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param location
|
2010-08-22 18:16:05 -04:00
|
|
|
The address of the document.
|
|
|
|
See the @ref overview_fs for details on the address format
|
|
|
|
and wxFileSystem for a description of how the file is opened.
|
2008-10-13 07:29:37 -04:00
|
|
|
|
2008-05-10 21:38:53 -04:00
|
|
|
@return @false if an error occurred, @true otherwise
|
2008-10-13 07:29:37 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see LoadFile()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
virtual bool LoadPage(const wxString& location);
|
|
|
|
|
|
|
|
/**
|
2008-10-25 16:44:52 -04:00
|
|
|
Called when user clicks on hypertext link.
|
|
|
|
Default behaviour is to emit a wxHtmlLinkEvent and, if the event was not
|
|
|
|
processed or skipped, call LoadPage() and do nothing else.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Overloading this method is deprecated; intercept the event instead.
|
2008-10-25 16:44:52 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Also see wxHtmlLinkInfo.
|
|
|
|
*/
|
|
|
|
virtual void OnLinkClicked(const wxHtmlLinkInfo& link);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Called when an URL is being opened (either when the user clicks on a link or
|
2008-10-25 16:44:52 -04:00
|
|
|
an image is loaded). The URL will be opened only if OnOpeningURL() returns
|
|
|
|
@c wxHTML_OPEN. This method is called by wxHtmlParser::OpenURL.
|
|
|
|
|
|
|
|
You can override OnOpeningURL() to selectively block some URLs
|
|
|
|
(e.g. for security reasons) or to redirect them elsewhere.
|
|
|
|
Default behaviour is to always return @c wxHTML_OPEN.
|
2008-10-13 07:29:37 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param type
|
2008-03-09 08:33:59 -04:00
|
|
|
Indicates type of the resource. Is one of
|
2008-10-25 16:44:52 -04:00
|
|
|
- wxHTML_URL_PAGE: Opening a HTML page.
|
|
|
|
- wxHTML_URL_IMAGE: Opening an image.
|
|
|
|
- wxHTML_URL_OTHER: Opening a resource that doesn't fall into
|
|
|
|
any other category.
|
2008-03-09 08:33:59 -04:00
|
|
|
@param url
|
|
|
|
URL being opened.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param redirect
|
2008-03-09 08:33:59 -04:00
|
|
|
Pointer to wxString variable that must be filled with an
|
2008-10-25 16:44:52 -04:00
|
|
|
URL if OnOpeningURL() returns @c wxHTML_REDIRECT.
|
|
|
|
|
|
|
|
The return value is:
|
|
|
|
- wxHTML_OPEN: Open the URL.
|
|
|
|
- wxHTML_BLOCK: Deny access to the URL, wxHtmlParser::OpenURL will return @NULL.
|
|
|
|
- wxHTML_REDIRECT: Don't open url, redirect to another URL.
|
|
|
|
OnOpeningURL() must fill *redirect with the new URL.
|
|
|
|
OnOpeningURL() will be called again on returned URL.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
virtual wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType type,
|
2008-09-27 07:21:10 -04:00
|
|
|
const wxString& url,
|
|
|
|
wxString* redirect) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-25 16:44:52 -04:00
|
|
|
Called on parsing \<TITLE\> tag.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
virtual void OnSetTitle(const wxString& title);
|
|
|
|
|
|
|
|
/**
|
|
|
|
This reads custom settings from wxConfig. It uses the path 'path'
|
|
|
|
if given, otherwise it saves info into currently selected path.
|
2008-10-25 16:44:52 -04:00
|
|
|
The values are stored in sub-path @c wxHtmlWindow.
|
|
|
|
Read values: all things set by SetFonts(), SetBorders().
|
2008-10-13 07:29:37 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param cfg
|
2008-03-09 08:33:59 -04:00
|
|
|
wxConfig from which you want to read the configuration.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param path
|
2008-03-09 08:33:59 -04:00
|
|
|
Optional path in config tree. If not given current path is used.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-29 11:34:31 -04:00
|
|
|
virtual void ReadCustomization(wxConfigBase* cfg,
|
2008-03-08 08:52:38 -05:00
|
|
|
wxString path = wxEmptyString);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Selects all text in the window.
|
2008-10-13 07:29:37 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SelectLine(), SelectWord()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SelectAll();
|
|
|
|
|
|
|
|
/**
|
2008-03-09 08:33:59 -04:00
|
|
|
Selects the line of text that @a pos points at. Note that @e pos
|
2008-03-08 08:52:38 -05:00
|
|
|
is relative to the top of displayed page, not to window's origin, use
|
2008-04-17 03:06:20 -04:00
|
|
|
wxScrolled::CalcUnscrolledPosition()
|
2008-03-08 08:52:38 -05:00
|
|
|
to convert physical coordinate.
|
2008-10-13 07:29:37 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SelectAll(), SelectWord()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SelectLine(const wxPoint& pos);
|
|
|
|
|
|
|
|
/**
|
2008-10-25 16:44:52 -04:00
|
|
|
Selects the word at position @a pos.
|
|
|
|
Note that @a pos is relative to the top of displayed page, not to window's
|
|
|
|
origin, use wxScrolled::CalcUnscrolledPosition() to convert physical coordinate.
|
2008-10-13 07:29:37 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SelectAll(), SelectLine()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SelectWord(const wxPoint& pos);
|
|
|
|
|
|
|
|
/**
|
2010-08-22 18:16:05 -04:00
|
|
|
Returns the current selection as plain text.
|
|
|
|
Returns an empty string if no text is currently selected.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
wxString SelectionToText();
|
|
|
|
|
|
|
|
/**
|
2008-10-25 16:44:52 -04:00
|
|
|
This function sets the space between border of window and HTML contents.
|
|
|
|
See image:
|
2009-01-21 17:54:29 -05:00
|
|
|
@image html htmlwin_border.png
|
2008-10-13 07:29:37 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param b
|
2008-03-09 08:33:59 -04:00
|
|
|
indentation from borders in pixels
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetBorders(int b);
|
|
|
|
|
|
|
|
/**
|
2009-07-03 08:03:39 -04:00
|
|
|
This function sets font sizes and faces. See wxHtmlDCRenderer::SetFonts
|
|
|
|
for detailed description.
|
|
|
|
|
|
|
|
@see SetSize()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-29 11:34:31 -04:00
|
|
|
void SetFonts(const wxString& normal_face, const wxString& fixed_face,
|
|
|
|
const int* sizes = NULL);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2009-07-03 08:03:39 -04:00
|
|
|
/**
|
|
|
|
Sets default font sizes and/or default font size.
|
|
|
|
See wxHtmlDCRenderer::SetStandardFonts for detailed description.
|
|
|
|
@see SetFonts()
|
|
|
|
*/
|
|
|
|
void SetStandardFonts(int size = -1,
|
|
|
|
const wxString& normal_face = wxEmptyString,
|
|
|
|
const wxString& fixed_face = wxEmptyString);
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2010-08-22 18:16:05 -04:00
|
|
|
Sets the source of a page and displays it, for example:
|
2008-10-25 16:44:52 -04:00
|
|
|
@code
|
|
|
|
htmlwin -> SetPage("<html><body>Hello, world!</body></html>");
|
|
|
|
@endcode
|
2008-10-13 07:29:37 -04:00
|
|
|
|
2008-10-25 16:44:52 -04:00
|
|
|
If you want to load a document from some location use LoadPage() instead.
|
2008-10-13 07:29:37 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param source
|
2010-08-22 18:16:05 -04:00
|
|
|
The HTML to be displayed.
|
2008-10-13 07:29:37 -04:00
|
|
|
|
2008-05-10 21:38:53 -04:00
|
|
|
@return @false if an error occurred, @true otherwise.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool SetPage(const wxString& source);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-25 16:44:52 -04:00
|
|
|
Sets the frame in which page title will be displayed.
|
|
|
|
@a format is the format of the frame title, e.g. "HtmlHelp : %s".
|
|
|
|
It must contain exactly one %s.
|
|
|
|
This %s is substituted with HTML page title.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetRelatedFrame(wxFrame* frame, const wxString& format);
|
|
|
|
|
|
|
|
/**
|
2008-10-25 16:44:52 -04:00
|
|
|
@b After calling SetRelatedFrame(), this sets statusbar slot where messages
|
|
|
|
will be displayed. (Default is -1 = no messages.)
|
2008-06-05 05:38:37 -04:00
|
|
|
|
|
|
|
@param index
|
|
|
|
Statusbar slot number (0..n)
|
|
|
|
*/
|
|
|
|
void SetRelatedStatusBar(int index);
|
|
|
|
|
|
|
|
/**
|
|
|
|
@b Sets the associated statusbar where messages will be displayed.
|
|
|
|
Call this instead of SetRelatedFrame() if you want statusbar updates only,
|
|
|
|
no changing of the frame title.
|
|
|
|
|
|
|
|
@param statusbar
|
|
|
|
Statusbar pointer
|
|
|
|
@param index
|
|
|
|
Statusbar slot number (0..n)
|
|
|
|
|
|
|
|
@since 2.9.0
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-06-05 05:38:37 -04:00
|
|
|
void SetRelatedStatusBar(wxStatusBar* statusbar, int index = 0);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns content of currently displayed page as plain text.
|
|
|
|
*/
|
|
|
|
wxString ToText();
|
|
|
|
|
|
|
|
/**
|
2008-10-25 16:44:52 -04:00
|
|
|
Saves custom settings into wxConfig.
|
|
|
|
It uses the path 'path' if given, otherwise it saves info into currently
|
|
|
|
selected path.
|
|
|
|
Regardless of whether the path is given or not, the function creates
|
|
|
|
sub-path @c wxHtmlWindow.
|
|
|
|
|
|
|
|
Saved values: all things set by SetFonts(), SetBorders().
|
2008-10-13 07:29:37 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param cfg
|
2008-03-09 08:33:59 -04:00
|
|
|
wxConfig to which you want to save the configuration.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param path
|
2008-03-09 08:33:59 -04:00
|
|
|
Optional path in config tree. If not given, the current path is used.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-29 11:34:31 -04:00
|
|
|
virtual void WriteCustomization(wxConfigBase* cfg,
|
2008-03-08 08:52:38 -05:00
|
|
|
wxString path = wxEmptyString);
|
2008-10-13 07:29:37 -04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
/**
|
|
|
|
This method is called when a mouse button is clicked inside wxHtmlWindow.
|
2008-10-25 16:44:52 -04:00
|
|
|
The default behaviour is to emit a wxHtmlCellEvent and, if the event was
|
|
|
|
not processed or skipped, call OnLinkClicked() if the cell contains an
|
2008-10-13 07:29:37 -04:00
|
|
|
hypertext link.
|
2008-10-25 16:44:52 -04:00
|
|
|
|
2008-10-13 07:29:37 -04:00
|
|
|
Overloading this method is deprecated; intercept the event instead.
|
|
|
|
|
|
|
|
@param cell
|
|
|
|
The cell inside which the mouse was clicked, always a simple
|
|
|
|
(i.e. non-container) cell
|
2008-10-25 16:44:52 -04:00
|
|
|
@param x
|
|
|
|
The logical x coordinate of the click point
|
|
|
|
@param y
|
|
|
|
The logical y coordinate of the click point
|
2008-10-13 07:29:37 -04:00
|
|
|
@param event
|
|
|
|
The mouse event containing other information about the click
|
|
|
|
|
|
|
|
@return @true if a link was clicked, @false otherwise.
|
|
|
|
*/
|
2008-10-29 11:34:31 -04:00
|
|
|
virtual bool OnCellClicked(wxHtmlCell* cell, wxCoord x, wxCoord y,
|
2008-10-13 07:29:37 -04:00
|
|
|
const wxMouseEvent& event);
|
|
|
|
|
|
|
|
/**
|
|
|
|
This method is called when a mouse moves over an HTML cell.
|
|
|
|
Default behaviour is to emit a wxHtmlCellEvent.
|
2008-10-25 16:44:52 -04:00
|
|
|
|
2008-10-13 07:29:37 -04:00
|
|
|
Overloading this method is deprecated; intercept the event instead.
|
|
|
|
|
|
|
|
@param cell
|
|
|
|
The cell inside which the mouse is currently, always a simple
|
|
|
|
(i.e. non-container) cell
|
2008-10-25 16:44:52 -04:00
|
|
|
@param x
|
|
|
|
The logical x coordinate of the click point
|
|
|
|
@param y
|
|
|
|
The logical y coordinate of the click point
|
2008-10-13 07:29:37 -04:00
|
|
|
*/
|
2008-10-29 11:34:31 -04:00
|
|
|
virtual void OnCellMouseHover(wxHtmlCell* cell, wxCoord x, wxCoord y);
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxHtmlLinkEvent
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This event class is used for the events generated by wxHtmlWindow.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-10-25 16:44:52 -04:00
|
|
|
@beginEventTable{wxHtmlLinkEvent}
|
|
|
|
@event{EVT_HTML_LINK_CLICKED(id, func)}
|
|
|
|
User clicked on an hyperlink.
|
|
|
|
@endEventTable
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxhtml}
|
2008-10-25 16:44:52 -04:00
|
|
|
@category{html}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxHtmlLinkEvent : public wxCommandEvent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
The constructor is not normally used by the user code.
|
|
|
|
*/
|
2009-01-08 11:33:08 -05:00
|
|
|
wxHtmlLinkEvent(int id, const wxHtmlLinkInfo& linkinfo);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-25 16:44:52 -04:00
|
|
|
Returns the wxHtmlLinkInfo which contains info about the cell clicked
|
|
|
|
and the hyperlink it contains.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-25 16:44:52 -04:00
|
|
|
const wxHtmlLinkInfo& GetLinkInfo() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxHtmlCellEvent
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This event class is used for the events generated by wxHtmlWindow.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-10-25 16:44:52 -04:00
|
|
|
@beginEventTable{wxHtmlCellEvent}
|
|
|
|
@event{EVT_HTML_CELL_HOVER(id, func)}
|
|
|
|
User moved the mouse over a wxHtmlCell.
|
|
|
|
@event{EVT_HTML_CELL_CLICKED(id, func)}
|
|
|
|
User clicked on a wxHtmlCell. When handling this event, remember to use
|
|
|
|
wxHtmlCell::SetLinkClicked(true) if the cell contains a link.
|
|
|
|
@endEventTable
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxhtml}
|
2008-10-25 16:44:52 -04:00
|
|
|
@category{html}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxHtmlCellEvent : public wxCommandEvent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
The constructor is not normally used by the user code.
|
|
|
|
*/
|
|
|
|
wxHtmlCellEvent(wxEventType commandType, int id,
|
2008-03-09 08:33:59 -04:00
|
|
|
wxHtmlCell* cell,
|
2008-11-09 11:46:52 -05:00
|
|
|
const wxPoint& point,
|
|
|
|
const wxMouseEvent& ev);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the wxHtmlCellEvent associated with the event.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxHtmlCell* GetCell() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-25 16:44:52 -04:00
|
|
|
Returns @true if SetLinkClicked(@true) has previously been called;
|
2008-03-08 08:52:38 -05:00
|
|
|
@false otherwise.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
bool GetLinkClicked() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the wxPoint associated with the event.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxPoint GetPoint() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-25 16:44:52 -04:00
|
|
|
Call this function with @a linkclicked set to @true if the cell which has
|
|
|
|
been clicked contained a link or @false otherwise (which is the default).
|
|
|
|
|
|
|
|
With this function the event handler can return info to the wxHtmlWindow
|
|
|
|
which sent the event.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-29 11:34:31 -04:00
|
|
|
void SetLinkClicked(bool linkclicked);
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|