mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-09-21 05:15:41 +08:00
Wrapper updates for wxHtmlLinkInfo and other changes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5098 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -14,11 +14,17 @@ class MyHtmlWindow(wxHtmlWindow):
|
||||
wxHtmlWindow.__init__(self, parent, id)
|
||||
self.log = log
|
||||
|
||||
def OnLinkClicked(self, link):
|
||||
self.log.WriteText('OnLinkClicked: %s\n' % link)
|
||||
|
||||
def OnLinkClicked(self, linkinfo):
|
||||
self.log.WriteText('OnLinkClicked: %s\n' % linkinfo.GetHref())
|
||||
|
||||
# Virtuals in the base class have been renamed with base_ on the font.
|
||||
self.base_OnLinkClicked(link)
|
||||
self.base_OnLinkClicked(linkinfo)
|
||||
|
||||
|
||||
def OnSetTitle(self, title):
|
||||
self.log.WriteText('OnSetTitle: %s\n' % title)
|
||||
self.base_OnSetTitle(title)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -11,3 +11,4 @@ wx.wxHtmlContainerCellPtr = wxHtmlContainerCellPtr
|
||||
wx.wxHtmlWidgetCellPtr = wxHtmlWidgetCellPtr
|
||||
wx.HtmlHistoryItemPtr = HtmlHistoryItemPtr
|
||||
wx.wxHtmlWindowPtr = wxHtmlWindowPtr
|
||||
wx.wxHtmlLinkInfoPtr = wxHtmlLinkInfo
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -83,6 +83,15 @@ enum {
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class wxHtmlLinkInfo {
|
||||
public:
|
||||
wxHtmlLinkInfo(const wxString& href, const wxString& target = wxEmptyString);
|
||||
wxString GetHref();
|
||||
wxString GetTarget();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class wxHtmlTag {
|
||||
@@ -141,8 +150,7 @@ public:
|
||||
int GetCharHeight();
|
||||
int GetCharWidth();
|
||||
wxWindow* GetWindow();
|
||||
void SetFonts(wxString normal_face, int normal_italic_mode,
|
||||
wxString fixed_face, int fixed_italic_mode, int *LIST);
|
||||
void SetFonts(wxString normal_face, wxString fixed_face, int *LIST);
|
||||
|
||||
wxHtmlContainerCell* GetContainer();
|
||||
wxHtmlContainerCell* OpenContainer();
|
||||
@@ -165,9 +173,10 @@ public:
|
||||
void SetLinkColor(const wxColour& clr);
|
||||
const wxColour& GetActualColor();
|
||||
void SetActualColor(const wxColour& clr);
|
||||
const wxString& GetLink();
|
||||
void SetLink(const wxString& link);
|
||||
wxFont* CreateCurrentFont();
|
||||
wxHtmlLinkInfo GetLink();
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -310,18 +319,18 @@ class wxHtmlCell {
|
||||
public:
|
||||
wxHtmlCell();
|
||||
|
||||
void SetParent(wxHtmlContainerCell *p);
|
||||
wxHtmlContainerCell* GetParent();
|
||||
int GetPosX();
|
||||
int GetPosY();
|
||||
int GetWidth();
|
||||
int GetHeight();
|
||||
int GetDescent();
|
||||
wxString GetLink(int x = 0, int y = 0);
|
||||
wxHtmlLinkInfo* GetLink(int x = 0, int y = 0);
|
||||
wxHtmlCell* GetNext();
|
||||
void SetPos(int x, int y);
|
||||
void SetLink(const wxString& link);
|
||||
wxHtmlContainerCell* GetParent();
|
||||
void SetLink(const wxHtmlLinkInfo& link);
|
||||
void SetNext(wxHtmlCell *cell);
|
||||
void SetParent(wxHtmlContainerCell *p);
|
||||
void SetPos(int x, int y);
|
||||
void Layout(int w);
|
||||
void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
|
||||
void DrawInvisible(wxDC& dc, int x, int y);
|
||||
@@ -329,6 +338,7 @@ public:
|
||||
|
||||
bool AdjustPagebreak(int * pagebreak);
|
||||
void SetCanLiveOnPagebreak(bool can);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -356,6 +366,13 @@ public:
|
||||
|
||||
|
||||
|
||||
class wxHtmlColourCell : public wxHtmlCell {
|
||||
public:
|
||||
wxHtmlColourCell(wxColour clr, int flags = wxHTML_CLR_FOREGROUND);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
class wxHtmlWidgetCell : public wxHtmlCell {
|
||||
public:
|
||||
@@ -392,13 +409,29 @@ public:
|
||||
const wxString& name = "htmlWindow")
|
||||
: wxHtmlWindow(parent, id, pos, size, style, name) {};
|
||||
|
||||
DEC_PYCALLBACK__STRING(OnLinkClicked);
|
||||
|
||||
void OnLinkClicked(wxHtmlLinkInfo* link);
|
||||
void base_OnLinkClicked(wxHtmlLinkInfo* link);
|
||||
|
||||
DEC_PYCALLBACK__STRING(OnSetTitle);
|
||||
PYPRIVATE;
|
||||
};
|
||||
|
||||
IMP_PYCALLBACK__STRING(wxPyHtmlWindow, wxHtmlWindow, OnLinkClicked);
|
||||
IMP_PYCALLBACK__STRING(wxPyHtmlWindow, wxHtmlWindow, OnSetTitle);
|
||||
|
||||
void wxPyHtmlWindow::OnLinkClicked(wxHtmlLinkInfo* link) {
|
||||
bool doSave = wxPyRestoreThread();
|
||||
if (m_myInst.findCallback("OnLinkClicked")) {
|
||||
PyObject* obj = wxPyConstructObject(link, "wxHtmlLinkInfo");
|
||||
m_myInst.callCallback(Py_BuildValue("(O)", obj));
|
||||
}
|
||||
else
|
||||
wxHtmlWindow::OnLinkClicked(link);
|
||||
wxPySaveThread(doSave);
|
||||
}
|
||||
void wxPyHtmlWindow::base_OnLinkClicked(wxHtmlLinkInfo* link) {
|
||||
wxHtmlWindow::OnLinkClicked(link);
|
||||
}
|
||||
%}
|
||||
|
||||
|
||||
@@ -422,8 +455,7 @@ public:
|
||||
void SetRelatedFrame(wxFrame* frame, const char* format);
|
||||
wxFrame* GetRelatedFrame();
|
||||
void SetRelatedStatusBar(int bar);
|
||||
void SetFonts(wxString normal_face, int normal_italic_mode,
|
||||
wxString fixed_face, int fixed_italic_mode, int *LIST);
|
||||
void SetFonts(wxString normal_face, wxString fixed_face, int *LIST);
|
||||
void SetTitle(const char* title);
|
||||
void SetBorders(int b);
|
||||
void ReadCustomization(wxConfigBase *cfg, char* path = "");
|
||||
@@ -435,7 +467,7 @@ public:
|
||||
wxHtmlWinParser* GetParser();
|
||||
|
||||
|
||||
void base_OnLinkClicked(const char* link);
|
||||
void base_OnSetTitle(const char* title);
|
||||
};
|
||||
|
||||
// Static methods are mapped to stand-alone functions
|
||||
|
||||
@@ -35,6 +35,26 @@ from printfw import *
|
||||
|
||||
from sizers import *
|
||||
import wx
|
||||
class wxHtmlLinkInfoPtr :
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def GetHref(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlLinkInfo_GetHref,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetTarget(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlLinkInfo_GetTarget,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxHtmlLinkInfo instance at %s>" % (self.this,)
|
||||
class wxHtmlLinkInfo(wxHtmlLinkInfoPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(htmlc.new_wxHtmlLinkInfo,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
|
||||
|
||||
|
||||
|
||||
class wxHtmlTagPtr :
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
@@ -208,9 +228,6 @@ class wxHtmlWinParserPtr(wxHtmlParserPtr):
|
||||
def SetActualColor(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWinParser_SetActualColor,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetLink(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWinParser_GetLink,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetLink(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWinParser_SetLink,(self,) + _args, _kwargs)
|
||||
return val
|
||||
@@ -218,6 +235,10 @@ class wxHtmlWinParserPtr(wxHtmlParserPtr):
|
||||
val = apply(htmlc.wxHtmlWinParser_CreateCurrentFont,(self,) + _args, _kwargs)
|
||||
if val: val = wxFontPtr(val)
|
||||
return val
|
||||
def GetLink(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWinParser_GetLink,(self,) + _args, _kwargs)
|
||||
if val: val = wxHtmlLinkInfoPtr(val) ; val.thisown = 1
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxHtmlWinParser instance at %s>" % (self.this,)
|
||||
class wxHtmlWinParser(wxHtmlWinParserPtr):
|
||||
@@ -288,13 +309,6 @@ class wxHtmlCellPtr :
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def SetParent(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlCell_SetParent,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetParent(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlCell_GetParent,(self,) + _args, _kwargs)
|
||||
if val: val = wxHtmlContainerCellPtr(val)
|
||||
return val
|
||||
def GetPosX(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlCell_GetPosX,(self,) + _args, _kwargs)
|
||||
return val
|
||||
@@ -312,13 +326,15 @@ class wxHtmlCellPtr :
|
||||
return val
|
||||
def GetLink(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlCell_GetLink,(self,) + _args, _kwargs)
|
||||
if val: val = wxHtmlLinkInfoPtr(val)
|
||||
return val
|
||||
def GetNext(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlCell_GetNext,(self,) + _args, _kwargs)
|
||||
if val: val = wxHtmlCellPtr(val)
|
||||
return val
|
||||
def SetPos(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlCell_SetPos,(self,) + _args, _kwargs)
|
||||
def GetParent(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlCell_GetParent,(self,) + _args, _kwargs)
|
||||
if val: val = wxHtmlContainerCellPtr(val)
|
||||
return val
|
||||
def SetLink(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlCell_SetLink,(self,) + _args, _kwargs)
|
||||
@@ -326,6 +342,12 @@ class wxHtmlCellPtr :
|
||||
def SetNext(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlCell_SetNext,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetParent(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlCell_SetParent,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetPos(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlCell_SetPos,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def Layout(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlCell_Layout,(self,) + _args, _kwargs)
|
||||
return val
|
||||
@@ -418,6 +440,20 @@ class wxHtmlContainerCell(wxHtmlContainerCellPtr):
|
||||
|
||||
|
||||
|
||||
class wxHtmlColourCellPtr(wxHtmlCellPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def __repr__(self):
|
||||
return "<C wxHtmlColourCell instance at %s>" % (self.this,)
|
||||
class wxHtmlColourCell(wxHtmlColourCellPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(htmlc.new_wxHtmlColourCell,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
|
||||
|
||||
|
||||
|
||||
class wxHtmlWidgetCellPtr(wxHtmlCellPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
@@ -516,8 +552,8 @@ class wxHtmlWindowPtr(wxScrolledWindowPtr):
|
||||
val = apply(htmlc.wxHtmlWindow_GetParser,(self,) + _args, _kwargs)
|
||||
if val: val = wxHtmlWinParserPtr(val)
|
||||
return val
|
||||
def base_OnLinkClicked(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWindow_base_OnLinkClicked,(self,) + _args, _kwargs)
|
||||
def base_OnSetTitle(self, *_args, **_kwargs):
|
||||
val = apply(htmlc.wxHtmlWindow_base_OnSetTitle,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxHtmlWindow instance at %s>" % (self.this,)
|
||||
@@ -696,3 +732,4 @@ wx.wxHtmlContainerCellPtr = wxHtmlContainerCellPtr
|
||||
wx.wxHtmlWidgetCellPtr = wxHtmlWidgetCellPtr
|
||||
wx.HtmlHistoryItemPtr = HtmlHistoryItemPtr
|
||||
wx.wxHtmlWindowPtr = wxHtmlWindowPtr
|
||||
wx.wxHtmlLinkInfoPtr = wxHtmlLinkInfo
|
||||
|
||||
Reference in New Issue
Block a user