2008-08-06 18:36:30 +00:00
|
|
|
// This file is part of BOINC.
|
2007-03-17 19:37:56 +00:00
|
|
|
// http://boinc.berkeley.edu
|
2008-08-06 18:36:30 +00:00
|
|
|
// Copyright (C) 2008 University of California
|
2007-03-17 19:37:56 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +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.
|
2007-03-17 19:37:56 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
2007-03-17 19:37:56 +00:00
|
|
|
// 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.
|
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2007-03-17 19:37:56 +00:00
|
|
|
//
|
|
|
|
#ifndef _WIZ_PROJECTLISTCTRL_H_
|
|
|
|
#define _WIZ_PROJECTLISTCTRL_H_
|
|
|
|
|
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma interface "ProjectListCtrl.cpp"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2009-06-30 02:05:46 +00:00
|
|
|
/*!
|
|
|
|
* CProjectListItem class declaration
|
|
|
|
*/
|
|
|
|
|
|
|
|
class CProjectListItem: public wxObject
|
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS( CProjectListItem )
|
|
|
|
public:
|
|
|
|
|
|
|
|
wxString GetURL() const { return m_strURL ; }
|
|
|
|
void SetURL(wxString value) { m_strURL = value ; }
|
|
|
|
|
|
|
|
wxString GetTitle() const { return m_strTitle ; }
|
|
|
|
void SetTitle(wxString value) { m_strTitle = value ; }
|
|
|
|
|
2009-11-18 01:31:15 +00:00
|
|
|
wxString GetImage() const { return m_strImage ; }
|
|
|
|
void SetImage(wxString value) { m_strImage = value ; }
|
|
|
|
|
2009-06-30 02:05:46 +00:00
|
|
|
wxString GetOrganization() const { return m_strOrganization ; }
|
|
|
|
void SetOrganization(wxString value) { m_strOrganization = value ; }
|
|
|
|
|
|
|
|
wxString GetDescription() const { return m_strDescription ; }
|
|
|
|
void SetDescription(wxString value) { m_strDescription = value ; }
|
|
|
|
|
|
|
|
wxString GetCategory() const { return m_strCategory ; }
|
|
|
|
void SetCategory(wxString value) { m_strCategory = value ; }
|
|
|
|
|
2009-11-18 01:31:15 +00:00
|
|
|
bool IsNvidiaGPUSupported() const { return m_bNvidiaGPUSupported ; }
|
|
|
|
void SetNvidiaGPUSupported(bool value) { m_bNvidiaGPUSupported = value ; }
|
|
|
|
|
|
|
|
bool IsATIGPUSupported() const { return m_bATIGPUSupported ; }
|
|
|
|
void SetATIGPUSupported(bool value) { m_bATIGPUSupported = value ; }
|
|
|
|
|
|
|
|
bool IsMulticoreSupported() const { return m_bMulticoreSupported ; }
|
|
|
|
void SetMulticoreSupported(bool value) { m_bMulticoreSupported = value ; }
|
|
|
|
|
2009-06-30 02:05:46 +00:00
|
|
|
bool IsPlatformSupported() const { return m_bSupported ; }
|
|
|
|
void SetPlatformSupported(bool value) { m_bSupported = value ; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
wxString m_strURL;
|
|
|
|
wxString m_strTitle;
|
2009-11-18 01:31:15 +00:00
|
|
|
wxString m_strImage;
|
2009-06-30 02:05:46 +00:00
|
|
|
wxString m_strOrganization;
|
|
|
|
wxString m_strDescription;
|
|
|
|
wxString m_strCategory;
|
2009-11-18 01:31:15 +00:00
|
|
|
bool m_bNvidiaGPUSupported;
|
|
|
|
bool m_bATIGPUSupported;
|
|
|
|
bool m_bMulticoreSupported;
|
2009-06-30 02:05:46 +00:00
|
|
|
bool m_bSupported;
|
|
|
|
};
|
2007-03-17 19:37:56 +00:00
|
|
|
|
2009-10-30 11:32:57 +00:00
|
|
|
#if wxUSE_ACCESSIBILITY || defined(__WXMAC__)
|
2007-03-17 19:37:56 +00:00
|
|
|
|
2009-10-30 11:32:57 +00:00
|
|
|
#ifdef __WXMAC__
|
2009-06-30 02:05:46 +00:00
|
|
|
|
2009-10-30 11:32:57 +00:00
|
|
|
#define wxACC_SELF 0
|
|
|
|
#define wxACC_OK noErr
|
|
|
|
#define wxAccStatus OSStatus
|
|
|
|
#define wxACC_NOT_IMPLEMENTED eventNotHandledErr
|
|
|
|
#define wxACC_FALSE eventNotHandledErr
|
|
|
|
#define wxAccessible wxObject
|
|
|
|
|
|
|
|
class CProjectListCtrlAccessible
|
|
|
|
#else
|
2009-06-30 02:05:46 +00:00
|
|
|
class CProjectListCtrlAccessible: public wxWindowAccessible
|
2009-10-30 11:32:57 +00:00
|
|
|
#endif
|
2009-06-30 02:05:46 +00:00
|
|
|
{
|
|
|
|
public:
|
2009-10-30 11:32:57 +00:00
|
|
|
|
|
|
|
#ifdef __WXMAC__
|
|
|
|
CProjectListCtrlAccessible(wxWindow* win);
|
|
|
|
virtual ~CProjectListCtrlAccessible();
|
|
|
|
#else
|
2009-06-30 02:05:46 +00:00
|
|
|
CProjectListCtrlAccessible(wxWindow* win): wxWindowAccessible(win) {}
|
2009-10-30 11:32:57 +00:00
|
|
|
#endif
|
2009-06-30 02:05:46 +00:00
|
|
|
|
|
|
|
virtual wxAccStatus GetName(int childId, wxString* name);
|
|
|
|
virtual wxAccStatus HitTest(const wxPoint& pt, int* childId, wxAccessible** childObject);
|
|
|
|
virtual wxAccStatus GetLocation(wxRect& rect, int elementId);
|
|
|
|
virtual wxAccStatus GetChildCount(int* childCount);
|
|
|
|
virtual wxAccStatus DoDefaultAction(int childId);
|
|
|
|
virtual wxAccStatus GetDescription(int childId, wxString* description);
|
2009-10-30 11:32:57 +00:00
|
|
|
#ifndef __WXMAC__
|
|
|
|
virtual wxAccStatus Navigate(wxNavDir navDir, int fromId, int* toId, wxAccessible** toObject);
|
|
|
|
virtual wxAccStatus GetDefaultAction(int childId, wxString* actionName);
|
2009-06-30 02:05:46 +00:00
|
|
|
virtual wxAccStatus GetRole(int childId, wxAccRole* role);
|
|
|
|
virtual wxAccStatus GetState(int childId, long* state);
|
|
|
|
virtual wxAccStatus Select(int childId, wxAccSelectionFlags selectFlags);
|
|
|
|
virtual wxAccStatus GetSelections(wxVariant* selections);
|
2009-10-30 11:32:57 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __WXMAC__
|
|
|
|
wxWindow *mp_win;
|
|
|
|
HIViewRef m_listView;
|
|
|
|
EventHandlerRef m_plistAccessibilityEventHandlerRef;
|
|
|
|
|
|
|
|
wxWindow *GetWindow() { return mp_win; }
|
2009-11-25 12:43:22 +00:00
|
|
|
void SetupMacAccessibilitySupport();
|
|
|
|
void RemoveMacAccessibilitySupport();
|
2009-10-30 11:32:57 +00:00
|
|
|
#endif
|
2009-06-30 02:05:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
2007-11-07 18:08:21 +00:00
|
|
|
|
|
|
|
|
2007-03-17 19:37:56 +00:00
|
|
|
/*!
|
|
|
|
* CProjectListCtrl class declaration
|
|
|
|
*/
|
|
|
|
|
2009-06-30 02:05:46 +00:00
|
|
|
class CProjectListCtrl: public wxHtmlListBox
|
2007-03-17 19:37:56 +00:00
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS( CProjectListCtrl )
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
|
|
|
|
public:
|
|
|
|
/// Constructors
|
|
|
|
CProjectListCtrl( );
|
|
|
|
|
2009-06-19 07:51:22 +00:00
|
|
|
CProjectListCtrl( wxWindow* parent );
|
2009-10-30 11:32:57 +00:00
|
|
|
#ifdef __WXMAC__
|
|
|
|
~CProjectListCtrl();
|
|
|
|
#endif
|
2007-03-17 19:37:56 +00:00
|
|
|
|
|
|
|
/// Creation
|
2009-06-19 07:51:22 +00:00
|
|
|
bool Create( wxWindow* parent );
|
2007-03-17 19:37:56 +00:00
|
|
|
|
|
|
|
////@begin CProjectListCtrl event handler declarations
|
|
|
|
|
2009-06-30 02:05:46 +00:00
|
|
|
void OnSelected( wxCommandEvent& event );
|
|
|
|
void OnClicked( wxHtmlCellEvent& event );
|
|
|
|
void OnDClicked( wxCommandEvent& event );
|
|
|
|
void OnLinkClicked( wxHtmlLinkEvent& event );
|
|
|
|
void OnHover( wxHtmlCellEvent& event );
|
2007-03-17 19:37:56 +00:00
|
|
|
|
|
|
|
////@end CProjectListCtrl event handler declarations
|
|
|
|
|
2009-06-30 02:05:46 +00:00
|
|
|
virtual wxString OnGetItem(size_t i) const;
|
|
|
|
|
2010-07-09 10:18:48 +00:00
|
|
|
int GetItemHeight(size_t i) { return (int)OnMeasureItem(i); }
|
|
|
|
|
2007-03-17 19:37:56 +00:00
|
|
|
/// Methods
|
|
|
|
bool Append(
|
2009-02-05 05:57:30 +00:00
|
|
|
wxString strURL,
|
2009-06-30 02:05:46 +00:00
|
|
|
wxString strTitle,
|
2009-11-18 01:31:15 +00:00
|
|
|
wxString strImage,
|
2009-06-30 02:05:46 +00:00
|
|
|
wxString strDescription,
|
2009-11-18 01:31:15 +00:00
|
|
|
bool bNvidiaGPUSupported,
|
|
|
|
bool bATIGPUSupported,
|
|
|
|
bool bMulticoreSupported,
|
2009-02-05 05:57:30 +00:00
|
|
|
bool bSupported
|
2007-03-17 19:37:56 +00:00
|
|
|
);
|
|
|
|
|
2009-06-30 02:05:46 +00:00
|
|
|
CProjectListItem* GetItem(
|
|
|
|
int iIndex
|
|
|
|
);
|
|
|
|
|
2007-03-17 19:37:56 +00:00
|
|
|
private:
|
2009-06-30 02:05:46 +00:00
|
|
|
std::vector<CProjectListItem*> m_Items;
|
2009-11-30 18:26:21 +00:00
|
|
|
|
2009-10-30 11:32:57 +00:00
|
|
|
#ifdef __WXMAC__
|
2009-11-18 01:31:15 +00:00
|
|
|
CProjectListCtrlAccessible* m_accessible;
|
2009-10-30 11:32:57 +00:00
|
|
|
#endif
|
2007-03-17 19:37:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* ProjectListCtrlEvent class declaration
|
|
|
|
*/
|
|
|
|
|
|
|
|
class ProjectListCtrlEvent : public wxNotifyEvent
|
|
|
|
{
|
|
|
|
public:
|
2009-02-05 05:57:30 +00:00
|
|
|
ProjectListCtrlEvent( wxEventType evtType = wxEVT_NULL, wxString strName = wxEmptyString, wxString strURL = wxEmptyString, bool bSupported = false ) :
|
2007-03-17 19:37:56 +00:00
|
|
|
wxNotifyEvent( evtType, wxID_ANY )
|
|
|
|
{
|
|
|
|
m_strName = strName;
|
|
|
|
m_strURL = strURL;
|
2009-02-05 05:57:30 +00:00
|
|
|
m_bSupported = bSupported;
|
2007-03-17 19:37:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
wxString GetName() { return m_strName; };
|
|
|
|
wxString GetURL() { return m_strURL; };
|
2009-02-05 05:57:30 +00:00
|
|
|
bool IsSupported() { return m_bSupported; };
|
2007-03-17 19:37:56 +00:00
|
|
|
|
|
|
|
virtual wxNotifyEvent* Clone() const { return new ProjectListCtrlEvent(*this); }
|
|
|
|
|
|
|
|
private:
|
|
|
|
wxString m_strName;
|
|
|
|
wxString m_strURL;
|
2009-02-05 05:57:30 +00:00
|
|
|
bool m_bSupported;
|
2007-03-17 19:37:56 +00:00
|
|
|
|
|
|
|
DECLARE_DYNAMIC_CLASS(ProjectListCtrlEvent)
|
|
|
|
};
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// macros for handling ProjectListCtrlEvent
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
BEGIN_DECLARE_EVENT_TYPES()
|
2009-06-23 15:20:48 +00:00
|
|
|
DECLARE_EVENT_TYPE( wxEVT_PROJECTLIST_ITEM_CHANGE, 100000 )
|
|
|
|
DECLARE_EVENT_TYPE( wxEVT_PROJECTLIST_ITEM_DISPLAY, 100001 )
|
2007-03-17 19:37:56 +00:00
|
|
|
END_DECLARE_EVENT_TYPES()
|
|
|
|
|
|
|
|
typedef void (wxEvtHandler::*ProjectListCtrlEventFunction)(ProjectListCtrlEvent&);
|
|
|
|
|
|
|
|
#define ProjectListCtrlEventHandler(func) \
|
|
|
|
(wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(ProjectListCtrlEventFunction, &func)
|
|
|
|
|
2009-06-23 15:20:48 +00:00
|
|
|
#define wx__DECLARE_PROJECTLISTEVT(evt, fn) \
|
|
|
|
wx__DECLARE_EVT0(wxEVT_PROJECTLIST_ ## evt, ProjectListCtrlEventHandler(fn))
|
2007-03-17 19:37:56 +00:00
|
|
|
|
2009-06-23 15:20:48 +00:00
|
|
|
#define EVT_PROJECTLIST_ITEM_CHANGE(fn) wx__DECLARE_PROJECTLISTEVT(ITEM_CHANGE, fn)
|
|
|
|
#define EVT_PROJECTLIST_ITEM_DISPLAY(fn) wx__DECLARE_PROJECTLISTEVT(ITEM_DISPLAY, fn)
|
2007-03-17 19:37:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
#endif // _WIZ_PROJECTLISTCTRL_H_
|