wxWidgets
wxHtmlWindow 상속받아서
OnLinkClicked 를 overriding 해 본다.
==================== 클래스 =========================
class MyHtmlWin : public wxHtmlWindow {
public:
MyHtmlWin(){}
MyHtmlWin( wxWindow *parent ) : wxHtmlWindow( parent ){}
~MyHtmlWin(){}
virtual void OnLinkClicked(const wxHtmlLinkInfo& link)
{
wxString msg;
msg.Append(wxString("link to [")).Append(link.GetHref()).Append(wxString("]"));
wxString msgTitle;
msgTitle.Printf(_T("Message (%s)"), wxVERSION_STRING );
wxMessageBox(msg, msgTitle, wxOK | wxICON_INFORMATION, this);
wxHtmlWindow::OnLinkClicked(link);
}
};
==================== 사용 =========================
MyHtmlWin *html;
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size)
html = new MyHtmlWin(this);
html -> SetRelatedFrame(this, _("HTML : %s"));
html -> SetRelatedStatusBar(0); // 상태바
html -> LoadPage(wxT("start.htm"));
wxHtmlWindow 상속받아서
OnLinkClicked 를 overriding 해 본다.
==================== 클래스 =========================
class MyHtmlWin : public wxHtmlWindow {
public:
MyHtmlWin(){}
MyHtmlWin( wxWindow *parent ) : wxHtmlWindow( parent ){}
~MyHtmlWin(){}
virtual void OnLinkClicked(const wxHtmlLinkInfo& link)
{
wxString msg;
msg.Append(wxString("link to [")).Append(link.GetHref()).Append(wxString("]"));
wxString msgTitle;
msgTitle.Printf(_T("Message (%s)"), wxVERSION_STRING );
wxMessageBox(msg, msgTitle, wxOK | wxICON_INFORMATION, this);
wxHtmlWindow::OnLinkClicked(link);
}
};
==================== 사용 =========================
MyHtmlWin *html;
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size)
html = new MyHtmlWin(this);
html -> SetRelatedFrame(this, _("HTML : %s"));
html -> SetRelatedStatusBar(0); // 상태바
html -> LoadPage(wxT("start.htm"));