- MGR: Use an event handler, the function overload is deprecated.

clientgui/
        ViewNotices.cpp,h

svn path=/trunk/boinc/; revision=20152
This commit is contained in:
Rom Walton 2010-01-14 17:48:39 +00:00
parent dba395d5ce
commit efd60237f4
3 changed files with 214 additions and 214 deletions

View File

@ -421,3 +421,10 @@ David 13 Jan 2010
clientgui/
ViewNotices.cpp,h
Rom 14 Jan 2010
- MGR: Use an event handler, the function overload is deprecated.
clientgui/
ViewNotices.cpp,h

View File

@ -36,17 +36,9 @@
IMPLEMENT_DYNAMIC_CLASS(CViewNotices, CBOINCBaseView)
BEGIN_EVENT_TABLE (CViewNotices, CBOINCBaseView)
EVT_HTML_LINK_CLICKED(ID_HTML_NOTIFICATIONSVIEW, CViewNotices::OnLinkClicked)
END_EVENT_TABLE ()
HtmlWindow::HtmlWindow(wxWindow *parent, wxWindowID id, const wxPoint& pos,
const wxSize& size, long style, const wxString& name)
: wxHtmlWindow(parent, id, pos, size, style, name)
{}
void HtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) {
if (link.GetHref().StartsWith(_T("http://")))
wxLaunchDefaultBrowser(link.GetHref());
}
CViewNotices::CViewNotices()
{}
@ -70,7 +62,7 @@ CViewNotices::CViewNotices(wxNotebook* pNotebook) :
m_pTaskPane = new CBOINCTaskCtrl(this, ID_TASK_NOTIFICATIONSVIEW, DEFAULT_TASK_FLAGS);
wxASSERT(m_pTaskPane);
m_pHtmlPane = new HtmlWindow(this, ID_HTML_NOTIFICATIONSVIEW, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO | wxHSCROLL | wxVSCROLL);
m_pHtmlPane = new wxHtmlWindow(this, ID_HTML_NOTIFICATIONSVIEW, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO | wxHSCROLL | wxVSCROLL);
wxASSERT(m_pHtmlPane);
itemFlexGridSizer->Add(m_pTaskPane, 1, wxGROW|wxALL, 1);
@ -203,3 +195,12 @@ done:
wxLogTrace(wxT("Function Start/End"), wxT("CViewNotices::OnListRender - Function End"));
}
void CViewNotices::OnLinkClicked( wxHtmlLinkEvent& event ) {
wxHtmlLinkInfo link = event.GetLinkInfo();
if (link.GetHref().StartsWith(wxT("http://"))) {
wxLaunchDefaultBrowser(link.GetHref());
}
}

View File

@ -25,15 +25,6 @@
#include "BOINCBaseView.h"
// variant of wxHtmlWindow that directs links to default browser
//
class HtmlWindow: public wxHtmlWindow {
public:
HtmlWindow(wxWindow *parent, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxHW_SCROLLBAR_AUTO, const wxString& name = _T("htmlWindow"));
void OnLinkClicked(const wxHtmlLinkInfo& link);
};
class CViewNotices : public CBOINCBaseView {
DECLARE_DYNAMIC_CLASS( CViewNotices )
@ -51,13 +42,14 @@ public:
virtual const int GetViewCurrentViewPage();
protected:
HtmlWindow* m_pHtmlPane;
wxHtmlWindow* m_pHtmlPane;
int m_iOldNoticeCount;
virtual bool OnSaveState( wxConfigBase* pConfig );
virtual bool OnRestoreState( wxConfigBase* pConfig );
virtual void OnListRender( wxTimerEvent& event );
void OnLinkClicked( wxHtmlLinkEvent& event );
DECLARE_EVENT_TABLE()
};