%pythoncode { wx = _core }
%pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
-%include _html_rename.i
-
-
MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
MAKE_CONST_WXSTRING2(HtmlWindowNameStr, wxT("htmlWindow"))
MAKE_CONST_WXSTRING2(HtmlPrintoutTitleStr, wxT("Printout"))
// TODO: Split this file into multiple %included files that coresponds to the
// wx/html include files (more or less.)
-//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
%newgroup
// void AddText(const char* txt) = 0;
// void AddTag(const wxHtmlTag& tag);
+
+
+ // Returns HTML source inside the element (i.e. between the starting
+ // and ending tag)
+ wxString GetInnerSource(const wxHtmlTag& tag);
};
int GetCharHeight();
int GetCharWidth();
wxPyHtmlWindow* GetWindow();
+ %pythoncode { GetWindow = wx._deprecated(GetWindow) }
+
+ wxHtmlWindowInterface *GetWindowInterface();
// Sets fonts to be used when displaying HTML page. (if size null then default sizes used).
%extend {
%{
class wxPyHtmlTagHandler : public wxHtmlTagHandler {
- DECLARE_DYNAMIC_CLASS(wxPyHtmlTagHandler);
+ DECLARE_DYNAMIC_CLASS(wxPyHtmlTagHandler)
public:
wxPyHtmlTagHandler() : wxHtmlTagHandler() {};
%{
class wxPyHtmlWinTagHandler : public wxHtmlWinTagHandler {
- DECLARE_DYNAMIC_CLASS(wxPyHtmlWinTagHandler);
+ DECLARE_DYNAMIC_CLASS(wxPyHtmlWinTagHandler)
public:
wxPyHtmlWinTagHandler() : wxHtmlWinTagHandler() {};
//---------------------------------------------------------------------------
+
+%typemap(out) wxHtmlCell* { $result = wxPyMake_wxObject($1, $owner); }
+%typemap(out) const wxHtmlCell* { $result = wxPyMake_wxObject($1, $owner); }
+
//---------------------------------------------------------------------------
%newgroup
class wxHtmlCell : public wxObject {
public:
+ %typemap(out) wxHtmlCell*; // turn off this typemap
+
wxHtmlCell();
+ ~wxHtmlCell();
+
+ // Turn it back on again
+ %typemap(out) wxHtmlCell* { $result = wxPyMake_wxObject($1, $owner); }
int GetPosX();
int GetPosY();
wxHtmlContainerCell* GetParent();
wxHtmlCell* GetFirstChild() const;
+ // Returns cursor to be used when mouse is over the cell:
+ virtual wxCursor GetMouseCursor(wxHtmlWindowInterface *window) const;
+
// Returns cursor to be used when mouse is over the cell:
wxCursor GetCursor() const;
+ %pythoncode { GetCursor = wx._deprecated(GetCursor) }
// Formatting cells are not visible on the screen, they only alter
// renderer's state.
void SetLink(const wxHtmlLinkInfo& link);
+
+ %disownarg(wxHtmlCell*);
void SetNext(wxHtmlCell *cell);
+ %cleardisown(wxHtmlCell*);
+
void SetParent(wxHtmlContainerCell *p);
void SetPos(int x, int y);
void Layout(int w);
wxHtmlRenderingInfo& info);
const wxHtmlCell* Find(int condition, const void* param);
- bool AdjustPagebreak(int* INOUT);
+
+ virtual bool ProcessMouseClick(wxHtmlWindowInterface *window,
+ const wxPoint& pos,
+ const wxMouseEvent& event);
+
+// TODO: bool AdjustPagebreak(int* INOUT,
+// wxArrayInt& known_pagebreaks);
void SetCanLiveOnPagebreak(bool can);
// Can the line be broken before this cell?
unsigned flags = wxHTML_FIND_EXACT) const;
// Returns absolute position of the cell on HTML canvas
- wxPoint GetAbsPos() const;
+ // If rootCell is provided, then it's considered to be the root of the
+ // hierarchy and the returned value is relative to it.
+ wxPoint GetAbsPos(wxHtmlCell *rootCell = NULL) const;
+
+ // Returns root cell of the hierarchy (i.e. grand-grand-...-parent that
+ // doesn't have a parent itself)
+ wxHtmlCell *GetRootCell() const;
// Returns first (last) terminal cell inside this cell. It may return NULL,
// but it is rare -- only if there are no terminals in the tree.
{
public:
wxHtmlWordCell(const wxString& word, wxDC& dc);
+ wxString ConvertToText(wxHtmlSelection *sel) const;
+ bool IsLinebreakAllowed() const;
+ void SetPreviousWord(wxHtmlWordCell *cell);
};
public:
wxHtmlContainerCell(wxHtmlContainerCell *parent);
+ %disownarg(wxHtmlCell*);
void InsertCell(wxHtmlCell *cell);
+ %cleardisown(wxHtmlCell*);
+
void SetAlignHor(int al);
int GetAlignHor();
void SetAlignVer(int al);
%{ // here's the C++ version
class wxPyHtmlFilter : public wxHtmlFilter {
- DECLARE_ABSTRACT_CLASS(wxPyHtmlFilter);
+ DECLARE_ABSTRACT_CLASS(wxPyHtmlFilter)
public:
wxPyHtmlFilter() : wxHtmlFilter() {}
//---------------------------------------------------------------------------
-// wxHtmlWindow
+
+
+class wxHtmlWindowInterface
+{
+public:
+ /// Ctor
+ wxHtmlWindowInterface();
+ virtual ~wxHtmlWindowInterface();
+
+ /**
+ Called by the parser to set window's title to given text.
+ */
+ virtual void SetHTMLWindowTitle(const wxString& title) = 0;
+
+// /**
+// Called when a link is clicked.
+
+// @param link information about the clicked link
+// */
+// virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link) = 0;
+
+// /**
+// Called when the parser needs to open another URL (e.g. an image).
+
+// @param type Type of the URL request (e.g. image)
+// @param url URL the parser wants to open
+// @param redirect If the return value is wxHTML_REDIRECT, then the
+// URL to redirect to will be stored in this variable
+// (the pointer must never be NULL)
+
+// @return indicator of how to treat the request
+// */
+// virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type,
+// const wxString& url,
+// wxString *redirect) const = 0;
+
+ /**
+ Converts coordinates @a pos relative to given @a cell to
+ physical coordinates in the window.
+ */
+ virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell,
+ const wxPoint& pos) const = 0;
+
+ /// Returns the window used for rendering (may be NULL).
+ virtual wxWindow* GetHTMLWindow() = 0;
+
+ /// Returns background colour to use by default.
+ virtual wxColour GetHTMLBackgroundColour() const = 0;
+
+ /// Sets window's background to colour @a clr.
+ virtual void SetHTMLBackgroundColour(const wxColour& clr) = 0;
+
+ /// Sets window's background to given bitmap.
+ virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg) = 0;
+
+ /// Sets status bar text.
+ virtual void SetHTMLStatusText(const wxString& text) = 0;
+
+ /// Type of mouse cursor
+ enum HTMLCursor
+ {
+ /// Standard mouse cursor (typically an arrow)
+ HTMLCursor_Default,
+ /// Cursor shown over links
+ HTMLCursor_Link,
+ /// Cursor shown over selectable text
+ HTMLCursor_Text
+ };
+
+ /**
+ Returns mouse cursor of given @a type.
+ */
+// virtual wxCursor GetHTMLCursor(HTMLCursor type) const = 0;
+};
+
+
+//---------------------------------------------------------------------------
+// wxHtmlWindow
//---------------------------------------------------------------------------
%newgroup
+// TODO?
+// wxHtmlWindowInterface and wxHtmlWindowMouseHelper
+
+
%{
class wxPyHtmlWindow : public wxHtmlWindow {
- DECLARE_ABSTRACT_CLASS(wxPyHtmlWindow);
+ DECLARE_ABSTRACT_CLASS(wxPyHtmlWindow)
public:
wxPyHtmlWindow(wxWindow *parent, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
}
void OnLinkClicked(const wxHtmlLinkInfo& link);
- void base_OnLinkClicked(const wxHtmlLinkInfo& link);
wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType type,
const wxString& url,
DEC_PYCALLBACK__STRING(OnSetTitle);
DEC_PYCALLBACK__CELLINTINT(OnCellMouseHover);
- DEC_PYCALLBACK__CELLINTINTME(OnCellClicked);
+ DEC_PYCALLBACK_BOOL_CELLINTINTME(OnCellClicked);
+
PYPRIVATE;
};
IMPLEMENT_ABSTRACT_CLASS( wxPyHtmlWindow, wxHtmlWindow );
IMP_PYCALLBACK__STRING(wxPyHtmlWindow, wxHtmlWindow, OnSetTitle);
IMP_PYCALLBACK__CELLINTINT(wxPyHtmlWindow, wxHtmlWindow, OnCellMouseHover);
-IMP_PYCALLBACK__CELLINTINTME(wxPyHtmlWindow, wxHtmlWindow, OnCellClicked);
+IMP_PYCALLBACK_BOOL_CELLINTINTME(wxPyHtmlWindow, wxHtmlWindow, OnCellClicked);
void wxPyHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) {
if (! found)
wxHtmlWindow::OnLinkClicked(link);
}
-void wxPyHtmlWindow::base_OnLinkClicked(const wxHtmlLinkInfo& link) {
- wxHtmlWindow::OnLinkClicked(link);
-}
wxHtmlOpeningStatus wxPyHtmlWindow::OnOpeningURL(wxHtmlURLType type,
MustHaveApp(wxPyHtmlWindow);
%rename(HtmlWindow) wxPyHtmlWindow;
-class wxPyHtmlWindow : public wxScrolledWindow {
+class wxPyHtmlWindow : public wxScrolledWindow //,
+ // public wxHtmlWindowInterface //,
+ // public wxHtmlWindowMouseHelper
+{
public:
%pythonAppend wxPyHtmlWindow "self._setCallbackInfo(self, HtmlWindow); self._setOORInfo(self)"
%pythonAppend wxPyHtmlWindow() ""
// Set HTML page and display it. !! source is HTML document itself,
// it is NOT address/filename of HTML document. If you want to
- // specify document location, use LoadPage() istead
+ // specify document location, use LoadPage() instead
// Return value : False if an error occurred, True otherwise
bool SetPage(const wxString& source);
// Converts current page to text:
wxString ToText();
- void base_OnLinkClicked(const wxHtmlLinkInfo& link);
- void base_OnSetTitle(const wxString& title);
- void base_OnCellMouseHover(wxHtmlCell *cell, wxCoord x, wxCoord y);
- void base_OnCellClicked(wxHtmlCell *cell,
- wxCoord x, wxCoord y,
- const wxMouseEvent& event);
+ void OnLinkClicked(const wxHtmlLinkInfo& link);
+ void OnSetTitle(const wxString& title);
+ void OnCellMouseHover(wxHtmlCell *cell, wxCoord x, wxCoord y);
+ bool OnCellClicked(wxHtmlCell *cell,
+ wxCoord x, wxCoord y,
+ const wxMouseEvent& event);
+ wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType type,
+ const wxString& url,
+ wxString *redirect) const;
+ %MAKE_BASE_FUNC(HtmlWindow, OnLinkClicked);
+ %MAKE_BASE_FUNC(HtmlWindow, OnSetTitle);
+ %MAKE_BASE_FUNC(HtmlWindow, OnCellMouseHover);
+ %MAKE_BASE_FUNC(HtmlWindow, OnCellClicked);
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+ /// Type of mouse cursor
+ enum HTMLCursor
+ {
+ /// Standard mouse cursor (typically an arrow)
+ HTMLCursor_Default,
+ /// Cursor shown over links
+ HTMLCursor_Link,
+ /// Cursor shown over selectable text
+ HTMLCursor_Text
+ };
+
+ // Returns standard HTML cursor as used by wxHtmlWindow
+ static wxCursor GetDefaultHTMLCursor(HTMLCursor type);
+
+
+// private:
+// // wxHtmlWindowInterface methods:
+// virtual void SetHTMLWindowTitle(const wxString& title);
+// virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link);
+// virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type,
+// const wxString& url,
+// wxString *redirect) const;
+// virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell,
+// const wxPoint& pos) const;
+// virtual wxWindow* GetHTMLWindow();
+// virtual wxColour GetHTMLBackgroundColour() const;
+// virtual void SetHTMLBackgroundColour(const wxColour& clr);
+// virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg);
+// virtual void SetHTMLStatusText(const wxString& text);
+// virtual wxCursor GetHTMLCursor(HTMLCursor type) const;
+
};
const wxString& normal_face = wxPyEmptyString,
const wxString& fixed_face = wxPyEmptyString);
- int Render(int x, int y, int from = 0, int dont_render = false, int maxHeight = INT_MAX,
- //int *known_pagebreaks = NULL, int number_of_pages = 0
- int* choices=NULL, int LCOUNT = 0
- );
+ int Render(int x, int y, wxArrayInt& known_pagebreaks, int from = 0,
+ int dont_render = FALSE, int to = INT_MAX);
int GetTotalHeight();
// returns total height of the html document
// (compare Render's return value with this)
int GetCurIndex();
int GetMaxIndex();
const wxString& GetName();
- // WXWIN_COMPATIBILITY_2_4
-#if 0
- wxHtmlContentsItem* GetContentsItem();
-#endif
};
//---------------------------------------------------------------------------
// TODO: this one needs fixed...
const wxHtmlBookRecArray& GetBookRecArray();
- // WXWIN_COMPATIBILITY_2_4
-#if 0
- wxHtmlContentsItem* GetContents();
- int GetContentsCnt();
- wxHtmlContentsItem* GetIndex();
- int GetIndexCnt();
-#endif
};
//---------------------------------------------------------------------------
wxID_HTML_SEARCHBUTTON,
wxID_HTML_SEARCHCHOICE,
wxID_HTML_COUNTINFO
-};
+};
int helpStyle = wxHF_DEFAULT_STYLE,
wxHtmlHelpData* data = NULL);
%RenameCtor(PreHtmlHelpWindow, wxHtmlHelpWindow(wxHtmlHelpData* data = NULL));
-
+
// Turn it back on again
%typemap(out) wxHtmlHelpWindow* { $result = wxPyMake_wxObject($1, $owner); }
wxHtmlHelpData* GetData();
wxHtmlHelpController* GetController() const;
+
+ %disownarg( wxHtmlHelpController* controller );
void SetController(wxHtmlHelpController* controller);
+ %cleardisown( wxHtmlHelpController* controller );
// Displays page x. If not found it will offect the user a choice of
// searching books.
// Turn it back on again
%typemap(out) wxHtmlHelpFrame* { $result = wxPyMake_wxObject($1, $owner); }
-
+
bool Create(wxWindow* parent, wxWindowID id,
const wxString& title = wxPyEmptyString,
int style = wxHF_DEFAULT_STYLE);
wxHtmlHelpController* GetController() const;
/// Sets the help controller associated with the window.
+ %disownarg( wxHtmlHelpController* controller );
void SetController(wxHtmlHelpController* controller);
+ %cleardisown( wxHtmlHelpController* controller );
/// Returns the help window.
wxHtmlHelpWindow* GetHelpWindow() const;
def KeywordSearch(self, keyword):
return self.GetHelpWindow().KeywordSearch(keyword)
-
+
def UseConfig(self, config, rootpath=""):
return self.GetHelpWindow().UseConfig(config, rootpath)
def ReadCustomization(self, config, rootpath=""):
// Turn it back on again
%typemap(out) wxHtmlHelpDialog* { $result = wxPyMake_wxObject($1, $owner); }
-
+
bool Create(wxWindow* parent, wxWindowID id, const wxString& title = wxPyEmptyString,
int style = wxHF_DEFAULT_STYLE);
wxHtmlHelpController* GetController() const;
/// Sets the controller associated with this dialog.
+ %disownarg( wxHtmlHelpController* controller );
void SetController(wxHtmlHelpController* controller);
+ %cleardisown( wxHtmlHelpController* controller );
/// Returns the help window.
wxHtmlHelpWindow* GetHelpWindow() const;
/// Get the window that can optionally be used for the help window's parent.
virtual wxWindow* GetParentWindow() const;
+
};
wxHtmlHelpWindow* GetHelpWindow();
void SetHelpWindow(wxHtmlHelpWindow* helpWindow);
+ wxHtmlHelpFrame* GetFrame();
+ wxHtmlHelpDialog* GetDialog();
+
void SetTitleFormat(const wxString& format);
void SetTempDir(const wxString& path);
bool AddBook(const wxString& book, int show_wait_msg = false);
void MakeModalIfNeeded();
wxWindow* FindTopLevelWindow();
-
- %pythoncode { def Destroy(self): pass }
};