2005-01-20 23:22:22 +00:00
|
|
|
// Berkeley Open Infrastructure for Network Computing
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2005 University of California
|
2004-09-21 01:30:29 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This 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 2.1 of the License, or (at your option) any later version.
|
2004-09-21 01:30:29 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This software 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.
|
2004-09-21 01:30:29 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// To view the GNU Lesser General Public License visit
|
|
|
|
// http://www.gnu.org/copyleft/lesser.html
|
|
|
|
// or write to the Free Software Foundation, Inc.,
|
2007-10-09 11:35:47 +00:00
|
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2004-09-21 01:30:29 +00:00
|
|
|
|
|
|
|
#ifndef _BOINCLISTCTRL_H_
|
|
|
|
#define _BOINCLISTCTRL_H_
|
|
|
|
|
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma interface "BOINCListCtrl.cpp"
|
|
|
|
#endif
|
|
|
|
|
2008-06-24 10:52:12 +00:00
|
|
|
#ifdef __WXMSW__
|
|
|
|
#define USE_NATIVE_LISTCONTROL 1
|
|
|
|
#else
|
|
|
|
#define USE_NATIVE_LISTCONTROL 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if USE_NATIVE_LISTCONTROL
|
|
|
|
#define LISTCTRL_BASE wxListCtrl
|
|
|
|
#include "wx/listctrl.h"
|
|
|
|
#else
|
|
|
|
#define LISTCTRL_BASE wxGenericListCtrl
|
|
|
|
#include "wx/generic/listctrl.h"
|
|
|
|
#endif
|
2004-09-21 01:30:29 +00:00
|
|
|
|
|
|
|
class CBOINCBaseView;
|
2008-06-24 10:52:12 +00:00
|
|
|
class CDrawBarGraphEvent;
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2008-06-24 10:52:12 +00:00
|
|
|
class CBOINCListCtrl : public LISTCTRL_BASE {
|
2005-04-10 19:01:23 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(CBOINCListCtrl)
|
2004-09-21 01:30:29 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
CBOINCListCtrl();
|
2005-04-10 19:01:23 +00:00
|
|
|
CBOINCListCtrl(CBOINCBaseView* pView, wxWindowID iListWindowID, int iListWindowFlags);
|
2004-09-21 01:30:29 +00:00
|
|
|
|
|
|
|
~CBOINCListCtrl();
|
|
|
|
|
2005-04-10 19:01:23 +00:00
|
|
|
virtual bool OnSaveState(wxConfigBase* pConfig);
|
|
|
|
virtual bool OnRestoreState(wxConfigBase* pConfig);
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2008-06-27 04:34:47 +00:00
|
|
|
long GetFocusedItem() { return GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED); }
|
2008-06-24 11:47:34 +00:00
|
|
|
long GetFirstSelected() { return GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); }
|
2008-06-27 04:34:47 +00:00
|
|
|
|
|
|
|
bool m_bIsSingleSelection;
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
private:
|
2005-04-10 19:01:23 +00:00
|
|
|
virtual void OnClick(wxCommandEvent& event);
|
2004-12-10 20:46:43 +00:00
|
|
|
|
2005-04-10 19:01:23 +00:00
|
|
|
virtual wxString OnGetItemText(long item, long column) const;
|
|
|
|
virtual int OnGetItemImage(long item) const;
|
|
|
|
virtual wxListItemAttr* OnGetItemAttr(long item) const;
|
2004-09-24 02:01:53 +00:00
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
CBOINCBaseView* m_pParentView;
|
|
|
|
|
2008-06-24 10:52:12 +00:00
|
|
|
#if USE_NATIVE_LISTCONTROL
|
|
|
|
public:
|
2008-06-24 11:56:06 +00:00
|
|
|
void PostDrawBarGraphEvent();
|
2008-06-24 10:52:12 +00:00
|
|
|
private:
|
2008-06-24 11:56:06 +00:00
|
|
|
void OnDrawBarGraph(CDrawBarGraphEvent& event);
|
|
|
|
void DrawBarGraphs(void);
|
2008-06-24 10:52:12 +00:00
|
|
|
|
2008-06-24 11:56:06 +00:00
|
|
|
bool m_bBarGraphEventPending;
|
2008-06-24 11:47:34 +00:00
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
2008-06-24 10:52:12 +00:00
|
|
|
#else
|
|
|
|
public:
|
2008-06-24 11:56:06 +00:00
|
|
|
void DrawBarGraphs(void);
|
|
|
|
wxScrolledWindow* GetMainWin(void) { return (wxScrolledWindow*) m_mainWin; }
|
|
|
|
wxCoord GetHeaderHeight(void) { return m_headerHeight; }
|
2008-06-24 10:52:12 +00:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
class CDrawBarGraphEvent : public wxEvent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CDrawBarGraphEvent(wxEventType evtType, CBOINCListCtrl* myCtrl)
|
|
|
|
: wxEvent(-1, evtType)
|
|
|
|
{
|
|
|
|
SetEventObject(myCtrl);
|
|
|
|
}
|
|
|
|
|
2008-06-24 11:56:06 +00:00
|
|
|
virtual wxEvent * Clone() const { return new CDrawBarGraphEvent(*this); }
|
2004-09-21 01:30:29 +00:00
|
|
|
};
|
|
|
|
|
2008-06-24 10:52:12 +00:00
|
|
|
BEGIN_DECLARE_EVENT_TYPES()
|
|
|
|
DECLARE_EVENT_TYPE( wxEVT_DRAW_BARGRAPH, 10000 )
|
|
|
|
END_DECLARE_EVENT_TYPES()
|
|
|
|
|
|
|
|
#define EVT_DRAW_BARGRAPH(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_DRAW_BARGRAPH, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
|
|
|
|
|
|
|
|
|
|
|
|
// Define a custom event handler
|
|
|
|
class MyEvtHandler : public wxEvtHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
MyEvtHandler(CBOINCListCtrl *theListControl) { m_listCtrl = theListControl; }
|
2008-06-24 11:56:06 +00:00
|
|
|
void OnPaint(wxPaintEvent & event);
|
2008-06-24 10:52:12 +00:00
|
|
|
|
|
|
|
private:
|
2008-06-24 11:56:06 +00:00
|
|
|
CBOINCListCtrl * m_listCtrl;
|
2008-06-24 10:52:12 +00:00
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
2004-09-21 01:30:29 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|