mirror of https://github.com/BOINC/boinc.git
MGR: Fix display of CBOINCListCtrl progress bars when using wxGenericListCtrl (on Mac)
This commit is contained in:
parent
e83c2993f2
commit
d73e1c3261
|
@ -106,6 +106,7 @@ CBOINCBaseView::CBOINCBaseView(wxNotebook* pNotebook, wxWindowID iTaskWindowID,
|
|||
#if USE_NATIVE_LISTCONTROL
|
||||
m_pListPane->PushEventHandler(new MyEvtHandler(m_pListPane));
|
||||
#else
|
||||
m_pListPane->SaveEventHandler((m_pListPane->GetMainWin())->GetEventHandler());
|
||||
(m_pListPane->GetMainWin())->PushEventHandler(new MyEvtHandler(m_pListPane));
|
||||
#endif
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "Events.h"
|
||||
|
||||
|
||||
#if 1 // USE_NATIVE_LISTCONTROL
|
||||
#if USE_NATIVE_LISTCONTROL
|
||||
DEFINE_EVENT_TYPE(wxEVT_DRAW_PROGRESSBAR)
|
||||
|
||||
BEGIN_EVENT_TABLE(CBOINCListCtrl, LISTCTRL_BASE)
|
||||
|
@ -53,8 +53,9 @@ CBOINCListCtrl::CBOINCListCtrl(
|
|||
|
||||
m_bIsSingleSelection = (iListWindowFlags & wxLC_SINGLE_SEL) ? true : false ;
|
||||
|
||||
#if USE_NATIVE_LISTCONTROL
|
||||
m_bProgressBarEventPending = false;
|
||||
#if ! USE_NATIVE_LISTCONTROL
|
||||
#else
|
||||
#ifdef __WXMAC__
|
||||
SetupMacAccessibilitySupport();
|
||||
#endif
|
||||
|
@ -72,7 +73,7 @@ CBOINCListCtrl::~CBOINCListCtrl()
|
|||
{
|
||||
m_iRowsNeedingProgressBars.Clear();
|
||||
#ifdef __WXMAC__
|
||||
#if ! USE_NATIVE_LISTCONTROL
|
||||
#if !USE_NATIVE_LISTCONTROL
|
||||
RemoveMacAccessibilitySupport();
|
||||
#endif
|
||||
#endif
|
||||
|
@ -266,14 +267,14 @@ wxListItemAttr* CBOINCListCtrl::OnGetItemAttr(long item) const {
|
|||
|
||||
void CBOINCListCtrl::DrawProgressBars()
|
||||
{
|
||||
long topItem, numItems, numVisibleItems, i, row;
|
||||
long topItem, numItems, numVisibleItems, row;
|
||||
wxRect r, rr;
|
||||
int w = 0, x = 0, xx, yy, ww;
|
||||
int progressColumn = m_pParentView->GetProgressColumn();
|
||||
|
||||
m_bProgressBarEventPending = false;
|
||||
#if USE_NATIVE_LISTCONTROL
|
||||
wxClientDC dc(this);
|
||||
m_bProgressBarEventPending = false;
|
||||
#else
|
||||
wxClientDC dc(GetMainWin()); // Available only in wxGenericListCtrl
|
||||
#endif
|
||||
|
@ -299,15 +300,15 @@ void CBOINCListCtrl::DrawProgressBars()
|
|||
if (numItems <= (topItem + numVisibleItems)) numVisibleItems = numItems - topItem;
|
||||
|
||||
x = 0;
|
||||
for (i=0; i< progressColumn; i++) {
|
||||
for (int i=0; i< progressColumn; i++) {
|
||||
x += GetColumnWidth(i);
|
||||
}
|
||||
w = GetColumnWidth(progressColumn);
|
||||
|
||||
#if 1 //USE_NATIVE_LISTCONTROL
|
||||
#if USE_NATIVE_LISTCONTROL
|
||||
x -= GetScrollPos(wxHORIZONTAL);
|
||||
#else
|
||||
GetMainWin()->CalcScrolledPosition(x, 0, &x, &yy);
|
||||
CalcScrolledPosition(x, 0, &x, &yy);
|
||||
#endif
|
||||
wxFont theFont = GetFont();
|
||||
dc.SetFont(theFont);
|
||||
|
@ -384,7 +385,7 @@ void CBOINCListCtrl::DrawProgressBars()
|
|||
m_iRowsNeedingProgressBars.Clear();
|
||||
}
|
||||
|
||||
#if 1 //USE_NATIVE_LISTCONTROL
|
||||
#if USE_NATIVE_LISTCONTROL
|
||||
|
||||
void MyEvtHandler::OnPaint(wxPaintEvent & event)
|
||||
{
|
||||
|
@ -398,7 +399,7 @@ void CBOINCListCtrl::PostDrawProgressBarEvent() {
|
|||
if (m_bProgressBarEventPending) return;
|
||||
|
||||
CDrawProgressBarEvent newEvent(wxEVT_DRAW_PROGRESSBAR, this);
|
||||
GetEventHandler()->AddPendingEvent(newEvent);
|
||||
AddPendingEvent(newEvent);
|
||||
m_bProgressBarEventPending = true;
|
||||
}
|
||||
|
||||
|
@ -412,7 +413,7 @@ void CBOINCListCtrl::OnDrawProgressBar(CDrawProgressBarEvent& event) {
|
|||
void MyEvtHandler::OnPaint(wxPaintEvent & event)
|
||||
{
|
||||
if (m_listCtrl) {
|
||||
(m_listCtrl->GetMainWin())->ProcessEvent(event);
|
||||
m_listCtrl->savedHandler->ProcessEvent(event);
|
||||
m_listCtrl->DrawProgressBars();
|
||||
} else {
|
||||
event.Skip();
|
||||
|
@ -422,16 +423,6 @@ void MyEvtHandler::OnPaint(wxPaintEvent & event)
|
|||
#endif
|
||||
|
||||
|
||||
#if ! USE_NATIVE_LISTCONTROL
|
||||
wxCoord CBOINCListCtrl::GetHeaderHeight(void) {
|
||||
if (m_headerWin) {
|
||||
return ((wxWindow*)m_headerWin)->GetSize().y;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// To reduce flicker, refresh only changed columns (except
|
||||
// on Mac, which is double-buffered to eliminate flicker.)
|
||||
void CBOINCListCtrl::RefreshCell(int row, int col) {
|
||||
|
|
|
@ -85,6 +85,7 @@ private:
|
|||
CBOINCBaseView* m_pParentView;
|
||||
wxArrayInt m_iRowsNeedingProgressBars;
|
||||
|
||||
#if USE_NATIVE_LISTCONTROL
|
||||
public:
|
||||
void PostDrawProgressBarEvent();
|
||||
private:
|
||||
|
@ -94,10 +95,13 @@ private:
|
|||
bool m_bProgressBarEventPending;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
#if ! USE_NATIVE_LISTCONTROL
|
||||
#else
|
||||
public:
|
||||
void SaveEventHandler(wxEvtHandler *stdHandler) { savedHandler = stdHandler; }
|
||||
void DrawProgressBars(void);
|
||||
wxScrolledWindow* GetMainWin(void) { return (wxScrolledWindow*) m_mainWin; }
|
||||
wxCoord GetHeaderHeight(void);
|
||||
wxCoord GetHeaderHeight(void) { return ((wxWindow *)m_headerWin)->GetSize().y; }
|
||||
wxEvtHandler* savedHandler;
|
||||
#ifdef __WXMAC__
|
||||
void SetupMacAccessibilitySupport();
|
||||
void RemoveMacAccessibilitySupport();
|
||||
|
|
Loading…
Reference in New Issue