mirror of https://github.com/BOINC/boinc.git
MGR: 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
82dbec6671
commit
68d4d4e699
|
@ -30,6 +30,23 @@
|
|||
#define GetColumnIndexFromOrder(x) x
|
||||
#endif
|
||||
|
||||
BEGIN_EVENT_TABLE(MyEvtHandler, wxEvtHandler)
|
||||
EVT_PAINT(MyEvtHandler::OnPaint)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(MyEvtHandler, wxEvtHandler)
|
||||
|
||||
MyEvtHandler::MyEvtHandler() {}
|
||||
|
||||
MyEvtHandler::MyEvtHandler(CBOINCListCtrl *theListControl) {
|
||||
m_listCtrl = theListControl;
|
||||
#ifdef __WXGTK__
|
||||
m_view_startX = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
DEFINE_EVENT_TYPE(wxEVT_CHECK_SELECTION_CHANGED)
|
||||
|
||||
#if USE_NATIVE_LISTCONTROL
|
||||
|
@ -52,11 +69,6 @@ BEGIN_EVENT_TABLE(CBOINCListCtrl, LISTCTRL_BASE)
|
|||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE(MyEvtHandler, wxEvtHandler)
|
||||
EVT_PAINT(MyEvtHandler::OnPaint)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(CBOINCListCtrl, LISTCTRL_BASE)
|
||||
|
||||
|
||||
|
@ -585,6 +597,20 @@ void MyEvtHandler::OnPaint(wxPaintEvent & event)
|
|||
if (m_listCtrl) {
|
||||
m_listCtrl->savedHandler->ProcessEvent(event);
|
||||
m_listCtrl->DrawProgressBars();
|
||||
#ifdef __WXGTK__
|
||||
// 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;
|
||||
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();
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
event.Skip();
|
||||
}
|
||||
|
@ -623,4 +649,3 @@ void CBOINCListCtrl::RefreshCell(int row, int col) {
|
|||
GetSubItemRect(row, col, r);
|
||||
RefreshRect(r);
|
||||
}
|
||||
|
||||
|
|
|
@ -168,12 +168,21 @@ END_DECLARE_EVENT_TYPES()
|
|||
// Define a custom event handler
|
||||
class MyEvtHandler : public wxEvtHandler
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(MyEvtHandler)
|
||||
|
||||
public:
|
||||
MyEvtHandler(CBOINCListCtrl *theListControl) { m_listCtrl = theListControl; }
|
||||
MyEvtHandler();
|
||||
MyEvtHandler(CBOINCListCtrl *theListControl);
|
||||
void OnPaint(wxPaintEvent & event);
|
||||
|
||||
private:
|
||||
CBOINCListCtrl * m_listCtrl;
|
||||
|
||||
#if !USE_NATIVE_LISTCONTROL
|
||||
#ifdef __WXGTK__
|
||||
int m_view_startX;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue