2010-05-11 19:10:29 +00:00
|
|
|
// This file is part of BOINC.
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2008 University of California
|
|
|
|
//
|
|
|
|
// 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/>.
|
|
|
|
//
|
|
|
|
#ifndef _NOTICELISTCTRL_H_
|
|
|
|
#define _NOTICELISTCTRL_H_
|
|
|
|
|
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma interface "NoticeListCtrl.cpp"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2010-06-23 16:59:35 +00:00
|
|
|
#ifdef __WXMAC__
|
|
|
|
#define wxACC_SELF 0
|
|
|
|
#define wxACC_OK noErr
|
|
|
|
#define wxAccStatus OSStatus
|
|
|
|
#define wxACC_NOT_IMPLEMENTED eventNotHandledErr
|
|
|
|
#define wxACC_FALSE eventNotHandledErr
|
|
|
|
#define wxAccessible wxObject
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2010-05-11 19:10:29 +00:00
|
|
|
/*!
|
|
|
|
* CNoticeListItem class declaration
|
|
|
|
*/
|
|
|
|
|
|
|
|
class CNoticeListItem: public wxObject
|
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS( CNoticeListItem )
|
|
|
|
public:
|
|
|
|
|
2010-06-23 16:59:35 +00:00
|
|
|
int GetSeqNo() const { return m_iSeqNo ; }
|
|
|
|
void SetSeqNo(int value) { m_iSeqNo = value ; }
|
2010-05-11 19:10:29 +00:00
|
|
|
|
2010-06-23 16:59:35 +00:00
|
|
|
wxString GetURL() const { return m_strURL ; }
|
|
|
|
void SetURL(wxString value) { m_strURL = value ; }
|
2010-05-11 19:10:29 +00:00
|
|
|
|
2010-06-23 16:59:35 +00:00
|
|
|
wxString GetTitle() const { return m_strTitle ; }
|
|
|
|
void SetTitle(wxString value) { m_strTitle = 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 ; }
|
|
|
|
|
|
|
|
wxString GetProjectName() const { return m_strProjectName ; }
|
|
|
|
void SetProjectName(wxString value) { m_strProjectName = value ; }
|
|
|
|
|
2010-06-23 21:44:31 +00:00
|
|
|
wxString GetArrivalTime() const { return m_strArrivalTime ; }
|
|
|
|
void SetArrivalTime(wxString value) { m_strArrivalTime = value ; }
|
2010-06-23 16:59:35 +00:00
|
|
|
|
2010-06-25 23:34:38 +00:00
|
|
|
double GetArrivalTimeD() const { return m_dArrivalTime ; }
|
|
|
|
void SetArrivalTimeD(double value) { m_dArrivalTime = value ; }
|
|
|
|
|
2010-06-23 16:59:35 +00:00
|
|
|
private:
|
|
|
|
int m_iSeqNo;
|
|
|
|
wxString m_strURL;
|
|
|
|
wxString m_strTitle;
|
|
|
|
wxString m_strDescription;
|
|
|
|
wxString m_strCategory;
|
|
|
|
wxString m_strProjectName;
|
2010-06-23 21:44:31 +00:00
|
|
|
wxString m_strArrivalTime;
|
2010-06-25 23:34:38 +00:00
|
|
|
double m_dArrivalTime;
|
2010-06-23 16:59:35 +00:00
|
|
|
};
|
2010-05-11 19:10:29 +00:00
|
|
|
|
2010-06-23 16:59:35 +00:00
|
|
|
|
|
|
|
#ifndef __WXMAC__
|
|
|
|
class CNoticeListCtrlAccessible : public wxWindowAccessible
|
2010-05-11 19:10:29 +00:00
|
|
|
#else
|
2010-06-23 16:59:35 +00:00
|
|
|
class CNoticeListCtrlAccessible
|
2010-05-11 19:10:29 +00:00
|
|
|
#endif
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2010-06-23 16:59:35 +00:00
|
|
|
#ifndef __WXMAC__
|
|
|
|
CNoticeListCtrlAccessible(wxWindow* win): wxWindowAccessible(win) {}
|
2010-05-11 19:10:29 +00:00
|
|
|
#else
|
2010-06-23 16:59:35 +00:00
|
|
|
CNoticeListCtrlAccessible(wxWindow* win);
|
|
|
|
virtual ~CNoticeListCtrlAccessible();
|
2010-05-11 19:10:29 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
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);
|
|
|
|
#ifndef __WXMAC__
|
|
|
|
virtual wxAccStatus Navigate(wxNavDir navDir, int fromId, int* toId, wxAccessible** toObject);
|
|
|
|
virtual wxAccStatus GetDefaultAction(int childId, wxString* actionName);
|
|
|
|
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);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __WXMAC__
|
|
|
|
wxWindow *mp_win;
|
|
|
|
HIViewRef m_listView;
|
|
|
|
EventHandlerRef m_plistAccessibilityEventHandlerRef;
|
|
|
|
|
|
|
|
wxWindow *GetWindow() { return mp_win; }
|
|
|
|
void SetupMacAccessibilitySupport();
|
|
|
|
void RemoveMacAccessibilitySupport();
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2010-06-23 16:59:35 +00:00
|
|
|
* CNoticeListCtrl class declaration
|
2010-05-11 19:10:29 +00:00
|
|
|
*/
|
|
|
|
|
2010-06-23 16:59:35 +00:00
|
|
|
class CNoticeListCtrl: public wxHtmlListBox
|
2010-05-11 19:10:29 +00:00
|
|
|
{
|
2010-06-23 16:59:35 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS( CNoticeListCtrl )
|
2010-05-11 19:10:29 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
|
|
|
|
public:
|
|
|
|
/// Constructors
|
2010-06-23 16:59:35 +00:00
|
|
|
CNoticeListCtrl( );
|
|
|
|
CNoticeListCtrl( wxWindow* parent );
|
2010-05-11 19:10:29 +00:00
|
|
|
#ifdef __WXMAC__
|
2010-06-23 16:59:35 +00:00
|
|
|
~CNoticeListCtrl();
|
2010-05-11 19:10:29 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/// Creation
|
|
|
|
bool Create( wxWindow* parent );
|
|
|
|
|
2010-06-23 16:59:35 +00:00
|
|
|
////@begin CNoticeListCtrl event handler declarations
|
2010-05-11 19:10:29 +00:00
|
|
|
|
|
|
|
void OnSelected( wxCommandEvent& event );
|
|
|
|
void OnDClicked( wxCommandEvent& event );
|
2010-06-23 16:59:35 +00:00
|
|
|
void OnClicked( wxHtmlCellEvent& event );
|
2010-05-11 19:10:29 +00:00
|
|
|
void OnLinkClicked( wxHtmlLinkEvent& event );
|
|
|
|
|
2010-06-23 16:59:35 +00:00
|
|
|
////@end CNoticeListCtrl event handler declarations
|
2010-05-11 19:10:29 +00:00
|
|
|
|
|
|
|
virtual wxString OnGetItem(size_t i) const;
|
|
|
|
|
|
|
|
/// Methods
|
2010-06-23 16:59:35 +00:00
|
|
|
bool Add(
|
2010-06-23 21:44:31 +00:00
|
|
|
int iSeqNo,
|
|
|
|
wxString strProjectName,
|
|
|
|
wxString strURL,
|
|
|
|
wxString strTitle,
|
|
|
|
wxString strDescription,
|
|
|
|
wxString strCategory,
|
2010-06-25 23:34:38 +00:00
|
|
|
wxString strArrivalTime,
|
|
|
|
double dArrivalTime
|
2010-05-11 19:10:29 +00:00
|
|
|
);
|
|
|
|
|
2010-06-25 15:30:20 +00:00
|
|
|
bool Update(
|
|
|
|
int iSeqNo,
|
2010-06-25 23:34:38 +00:00
|
|
|
wxString strArrivalTime,
|
|
|
|
double dArrivalTime
|
2010-06-25 15:30:20 +00:00
|
|
|
);
|
|
|
|
|
2010-06-25 15:53:28 +00:00
|
|
|
bool UpdateUI();
|
|
|
|
|
2010-06-25 15:30:20 +00:00
|
|
|
bool Exists( int iSeqNo );
|
2010-06-23 21:44:31 +00:00
|
|
|
|
2010-06-25 15:30:20 +00:00
|
|
|
bool Sort();
|
2010-06-23 21:44:31 +00:00
|
|
|
|
2010-06-23 16:59:35 +00:00
|
|
|
CNoticeListItem* GetItem(
|
2010-05-11 19:10:29 +00:00
|
|
|
int iIndex
|
|
|
|
);
|
|
|
|
|
|
|
|
wxCoord GetTotalClientHeight();
|
|
|
|
|
|
|
|
private:
|
2010-06-23 16:59:35 +00:00
|
|
|
std::vector<CNoticeListItem*> m_Items;
|
2010-05-11 19:10:29 +00:00
|
|
|
|
|
|
|
#ifdef __WXMAC__
|
2010-06-23 16:59:35 +00:00
|
|
|
CNoticeListCtrlAccessible* m_accessible;
|
2010-05-11 19:10:29 +00:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2010-06-23 16:59:35 +00:00
|
|
|
* NoticeListCtrlEvent class declaration
|
2010-05-11 19:10:29 +00:00
|
|
|
*/
|
|
|
|
|
2010-06-23 16:59:35 +00:00
|
|
|
class NoticeListCtrlEvent : public wxNotifyEvent
|
2010-05-11 19:10:29 +00:00
|
|
|
{
|
|
|
|
public:
|
2010-06-23 16:59:35 +00:00
|
|
|
NoticeListCtrlEvent( wxEventType evtType = wxEVT_NULL, int iSeqNo = 0, wxString strURL = wxEmptyString ) :
|
2010-05-11 19:10:29 +00:00
|
|
|
wxNotifyEvent( evtType, wxID_ANY )
|
|
|
|
{
|
2010-06-23 16:59:35 +00:00
|
|
|
m_iSeqNo = iSeqNo;
|
2010-05-11 19:10:29 +00:00
|
|
|
m_strURL = strURL;
|
|
|
|
}
|
|
|
|
|
2010-06-23 16:59:35 +00:00
|
|
|
int GetSeqNo() { return m_iSeqNo; };
|
2010-05-11 19:10:29 +00:00
|
|
|
wxString GetURL() { return m_strURL; };
|
|
|
|
|
2010-06-23 16:59:35 +00:00
|
|
|
virtual wxNotifyEvent* Clone() const { return new NoticeListCtrlEvent(*this); }
|
2010-05-11 19:10:29 +00:00
|
|
|
|
|
|
|
private:
|
2010-06-23 16:59:35 +00:00
|
|
|
int m_iSeqNo;
|
2010-05-11 19:10:29 +00:00
|
|
|
wxString m_strURL;
|
|
|
|
|
2010-06-23 16:59:35 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(NoticeListCtrlEvent)
|
2010-05-11 19:10:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// macros for handling ProjectListCtrlEvent
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
BEGIN_DECLARE_EVENT_TYPES()
|
2010-06-23 16:59:35 +00:00
|
|
|
DECLARE_EVENT_TYPE( wxEVT_NOTICELIST_ITEM_CHANGE, 100000 )
|
|
|
|
DECLARE_EVENT_TYPE( wxEVT_NOTICELIST_ITEM_DISPLAY, 100001 )
|
2010-05-11 19:10:29 +00:00
|
|
|
END_DECLARE_EVENT_TYPES()
|
|
|
|
|
2010-06-23 16:59:35 +00:00
|
|
|
typedef void (wxEvtHandler::*NoticeListCtrlEventFunction)(NoticeListCtrlEvent&);
|
2010-05-11 19:10:29 +00:00
|
|
|
|
2010-06-23 16:59:35 +00:00
|
|
|
#define NoticeListCtrlEventHandler(func) \
|
|
|
|
(wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(NoticeListCtrlEventFunction, &func)
|
2010-05-11 19:10:29 +00:00
|
|
|
|
2010-06-23 16:59:35 +00:00
|
|
|
#define wx__DECLARE_NOTICELISTEVT(evt, fn) \
|
|
|
|
wx__DECLARE_EVT0(wxEVT_NOTICELIST_ ## evt, NoticeListCtrlEventHandler(fn))
|
2010-05-11 19:10:29 +00:00
|
|
|
|
2010-06-23 16:59:35 +00:00
|
|
|
#define EVT_NOTICELIST_ITEM_CHANGE(fn) wx__DECLARE_NOTICELISTEVT(ITEM_CHANGE, fn)
|
|
|
|
#define EVT_NOTICELIST_ITEM_DISPLAY(fn) wx__DECLARE_NOTICELISTEVT(ITEM_DISPLAY, fn)
|
2010-05-11 19:10:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
#endif // _NOTICELISTCTRL_H_
|