mirror of https://github.com/BOINC/boinc.git
MGR: In Event Log, work around a wxWidgets 3.0 bug in wxGenericListCtrl (Linux only) which causes headers to be misaligned after horizontal scrolling.
This commit is contained in:
parent
edfa2bf428
commit
72fa38391b
|
@ -99,6 +99,11 @@ CDlgEventLog::CDlgEventLog( wxWindow* parent, wxWindowID id, const wxString& cap
|
||||||
|
|
||||||
Create(parent, id, caption, pos, size, style);
|
Create(parent, id, caption, pos, size, style);
|
||||||
|
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
m_pList->SaveEventHandler((m_pList->GetMainWin())->GetEventHandler());
|
||||||
|
(m_pList->GetMainWin())->PushEventHandler(new MyEvtLogEvtHandler(m_pList));
|
||||||
|
#endif
|
||||||
|
|
||||||
wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::CDlgEventLog - Constructor Function End"));
|
wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::CDlgEventLog - Constructor Function End"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,6 +111,10 @@ CDlgEventLog::CDlgEventLog( wxWindow* parent, wxWindowID id, const wxString& cap
|
||||||
CDlgEventLog::~CDlgEventLog() {
|
CDlgEventLog::~CDlgEventLog() {
|
||||||
wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::CDlgEventLog - Destructor Function Begin"));
|
wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::CDlgEventLog - Destructor Function Begin"));
|
||||||
|
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
m_pList->PopEventHandler(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (m_pMessageInfoAttr) {
|
if (m_pMessageInfoAttr) {
|
||||||
delete m_pMessageInfoAttr;
|
delete m_pMessageInfoAttr;
|
||||||
m_pMessageInfoAttr = NULL;
|
m_pMessageInfoAttr = NULL;
|
||||||
|
|
|
@ -32,6 +32,42 @@
|
||||||
#include "DlgEventLogListCtrl.h"
|
#include "DlgEventLogListCtrl.h"
|
||||||
#include "DlgEventLog.h"
|
#include "DlgEventLog.h"
|
||||||
|
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(MyEvtLogEvtHandler, wxEvtHandler)
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(MyEvtLogEvtHandler, wxEvtHandler)
|
||||||
|
EVT_PAINT(MyEvtLogEvtHandler::OnPaint)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
MyEvtLogEvtHandler::MyEvtLogEvtHandler() {}
|
||||||
|
|
||||||
|
MyEvtLogEvtHandler::MyEvtLogEvtHandler(wxGenericListCtrl *theListControl) {
|
||||||
|
m_listCtrl = theListControl;
|
||||||
|
m_view_startX = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyEvtLogEvtHandler::OnPaint(wxPaintEvent & event)
|
||||||
|
{
|
||||||
|
if (m_listCtrl) {
|
||||||
|
// Work around a wxWidgets 3.0 bug in wxGenericListCtrl (Linux
|
||||||
|
// only) which causes headers to be misaligned after horizontal
|
||||||
|
// scrolling due to wxListHeaderWindow::OnPaint() calling
|
||||||
|
// parent->GetViewStart() before the parent window has been
|
||||||
|
// scrolled to the new position.
|
||||||
|
int view_startX;
|
||||||
|
((CDlgEventLogListCtrl*)m_listCtrl)->savedHandler->ProcessEvent(event);
|
||||||
|
m_listCtrl->GetViewStart( &view_startX, NULL );
|
||||||
|
if (view_startX != m_view_startX) {
|
||||||
|
m_view_startX = view_startX;
|
||||||
|
((wxWindow *)m_listCtrl->m_headerWin)->Refresh();
|
||||||
|
((wxWindow *)m_listCtrl->m_headerWin)->Update();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(CDlgEventLogListCtrl, DLG_LISTCTRL_BASE)
|
IMPLEMENT_DYNAMIC_CLASS(CDlgEventLogListCtrl, DLG_LISTCTRL_BASE)
|
||||||
|
|
||||||
|
@ -40,6 +76,7 @@ BEGIN_EVENT_TABLE(CDlgEventLogListCtrl, DLG_LISTCTRL_BASE)
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
EVT_SIZE(CDlgEventLogListCtrl::OnSize)
|
EVT_SIZE(CDlgEventLogListCtrl::OnSize)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,10 +92,8 @@ CDlgEventLogListCtrl::CDlgEventLogListCtrl(CDlgEventLog* pView, wxWindowID iList
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
m_fauxHeaderView = NULL;
|
m_fauxHeaderView = NULL;
|
||||||
m_fauxBodyView = NULL;
|
m_fauxBodyView = NULL;
|
||||||
#ifdef __WXMAC__
|
|
||||||
SetupMacAccessibilitySupport();
|
SetupMacAccessibilitySupport();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#pragma interface "DlgEventLogListCtrl.cpp"
|
#pragma interface "DlgEventLogListCtrl.cpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
#if (defined(__WXMAC__) || defined(__WXGTK__))
|
||||||
#define DLG_LISTCTRL_BASE wxGenericListCtrl
|
#define DLG_LISTCTRL_BASE wxGenericListCtrl
|
||||||
#else
|
#else
|
||||||
#define DLG_LISTCTRL_BASE wxListView
|
#define DLG_LISTCTRL_BASE wxListView
|
||||||
|
@ -46,6 +46,12 @@ public:
|
||||||
~CDlgEventLogListCtrl();
|
~CDlgEventLogListCtrl();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
void SaveEventHandler(wxEvtHandler *stdHandler) { savedHandler = stdHandler; }
|
||||||
|
wxEvtHandler* savedHandler;
|
||||||
|
wxScrolledWindow* GetMainWin(void) { return (wxScrolledWindow*) m_mainWin; }
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
virtual wxString OnGetItemText(long item, long column) const;
|
virtual wxString OnGetItemText(long item, long column) const;
|
||||||
|
@ -70,4 +76,23 @@ private:
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
// Define a custom event handler
|
||||||
|
class MyEvtLogEvtHandler : public wxEvtHandler
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS(MyEvtLogEvtHandler)
|
||||||
|
|
||||||
|
public:
|
||||||
|
MyEvtLogEvtHandler();
|
||||||
|
MyEvtLogEvtHandler(wxGenericListCtrl *theListControl);
|
||||||
|
void OnPaint(wxPaintEvent & event);
|
||||||
|
|
||||||
|
private:
|
||||||
|
wxGenericListCtrl * m_listCtrl;
|
||||||
|
int m_view_startX;
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue