2012-12-21 18:05:01 +00:00
|
|
|
// This file is part of BOINC.
|
|
|
|
// http://boinc.berkeley.edu
|
2015-10-20 10:18:40 +00:00
|
|
|
// Copyright (C) 2015 University of California
|
2012-12-21 18:05:01 +00:00
|
|
|
//
|
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma implementation "DlgEventLogListCtrl.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "stdwx.h"
|
|
|
|
#include "diagnostics.h"
|
|
|
|
#include "util.h"
|
|
|
|
#include "mfile.h"
|
|
|
|
#include "miofile.h"
|
|
|
|
#include "parse.h"
|
|
|
|
#include "error_numbers.h"
|
|
|
|
#include "BOINCGUIApp.h"
|
|
|
|
#include "SkinManager.h"
|
|
|
|
#include "MainDocument.h"
|
|
|
|
#include "DlgEventLogListCtrl.h"
|
|
|
|
#include "DlgEventLog.h"
|
|
|
|
|
2015-10-06 13:34:16 +00:00
|
|
|
#ifdef __WXGTK__
|
|
|
|
IMPLEMENT_DYNAMIC_CLASS(MyEvtLogEvtHandler, wxEvtHandler)
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(MyEvtLogEvtHandler, wxEvtHandler)
|
|
|
|
EVT_PAINT(MyEvtLogEvtHandler::OnPaint)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
2015-10-20 10:18:40 +00:00
|
|
|
MyEvtLogEvtHandler::MyEvtLogEvtHandler() {
|
|
|
|
m_view_startX = 0;
|
|
|
|
}
|
2015-10-06 13:34:16 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2012-12-21 18:05:01 +00:00
|
|
|
|
|
|
|
IMPLEMENT_DYNAMIC_CLASS(CDlgEventLogListCtrl, DLG_LISTCTRL_BASE)
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(CDlgEventLogListCtrl, DLG_LISTCTRL_BASE)
|
|
|
|
EVT_LEFT_UP(CDlgEventLogListCtrl::OnMouseUp)
|
2013-10-22 10:53:45 +00:00
|
|
|
#ifdef __WXMAC__
|
|
|
|
EVT_SIZE(CDlgEventLogListCtrl::OnSize)
|
|
|
|
#endif
|
2015-10-06 13:34:16 +00:00
|
|
|
|
2012-12-21 18:05:01 +00:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
|
|
|
CDlgEventLogListCtrl::CDlgEventLogListCtrl() {}
|
|
|
|
|
|
|
|
CDlgEventLogListCtrl::CDlgEventLogListCtrl(CDlgEventLog* pView, wxWindowID iListWindowID, wxInt32 iListWindowFlags)
|
2023-05-05 18:05:20 +00:00
|
|
|
: DLG_LISTCTRL_BASE(pView, iListWindowID, wxDefaultPosition, wxDefaultSize, iListWindowFlags)
|
2012-12-21 18:05:01 +00:00
|
|
|
{
|
|
|
|
m_pParentView = pView;
|
|
|
|
|
|
|
|
m_bIsSingleSelection = (iListWindowFlags & wxLC_SINGLE_SEL) ? true : false ;
|
2023-05-05 18:05:20 +00:00
|
|
|
|
2015-10-20 10:18:40 +00:00
|
|
|
#ifdef __WXGTK__
|
|
|
|
savedHandler = GetMainWin()->GetEventHandler();
|
|
|
|
GetMainWin()->PushEventHandler(new MyEvtLogEvtHandler(this));
|
|
|
|
#endif
|
|
|
|
|
2013-10-22 10:53:45 +00:00
|
|
|
#ifdef __WXMAC__
|
|
|
|
m_fauxHeaderView = NULL;
|
|
|
|
m_fauxBodyView = NULL;
|
2012-12-21 18:05:01 +00:00
|
|
|
SetupMacAccessibilitySupport();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CDlgEventLogListCtrl::~CDlgEventLogListCtrl()
|
|
|
|
{
|
2015-10-20 10:18:40 +00:00
|
|
|
#ifdef __WXGTK__
|
|
|
|
GetMainWin()->PopEventHandler(true);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __WXMAC__
|
2012-12-21 18:05:01 +00:00
|
|
|
RemoveMacAccessibilitySupport();
|
|
|
|
#endif
|
2015-10-20 10:18:40 +00:00
|
|
|
}
|
2012-12-21 18:05:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
wxString CDlgEventLogListCtrl::OnGetItemText(long item, long column) const {
|
|
|
|
wxASSERT(m_pParentView);
|
|
|
|
wxASSERT(wxDynamicCast(m_pParentView, CDlgEventLog));
|
|
|
|
|
|
|
|
return m_pParentView->OnListGetItemText(item, column);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int CDlgEventLogListCtrl::OnGetItemImage(long /* item */) const {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxListItemAttr* CDlgEventLogListCtrl::OnGetItemAttr(long item) const {
|
|
|
|
wxASSERT(m_pParentView);
|
|
|
|
wxASSERT(wxDynamicCast(m_pParentView, CDlgEventLog));
|
|
|
|
|
|
|
|
return m_pParentView->OnListGetItemAttr(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CDlgEventLogListCtrl::OnMouseUp(wxMouseEvent& event) {
|
|
|
|
m_pParentView->UpdateButtons();
|
|
|
|
event.Skip();
|
|
|
|
}
|
2013-10-22 10:53:45 +00:00
|
|
|
|