2008-08-06 18:36:30 +00:00
|
|
|
// This file is part of BOINC.
|
2005-01-20 23:22:22 +00:00
|
|
|
// http://boinc.berkeley.edu
|
2008-08-06 18:36:30 +00:00
|
|
|
// Copyright (C) 2008 University of California
|
2004-10-23 07:13:18 +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.
|
2004-10-23 07:13:18 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
2005-01-20 23:22:22 +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.
|
2004-10-23 07:13:18 +00:00
|
|
|
//
|
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/>.
|
2004-10-23 07:13:18 +00:00
|
|
|
|
2004-11-02 04:44:24 +00:00
|
|
|
#ifndef _BOINCTASKBAR_H_
|
|
|
|
#define _BOINCTASKBAR_H_
|
2004-10-23 07:13:18 +00:00
|
|
|
|
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
2004-11-02 04:44:24 +00:00
|
|
|
#pragma interface "BOINCTaskBar.cpp"
|
2004-10-23 07:13:18 +00:00
|
|
|
#endif
|
|
|
|
|
2005-03-25 12:23:30 +00:00
|
|
|
|
2010-02-06 07:43:09 +00:00
|
|
|
#if defined(__WXMSW__)
|
2004-11-02 10:14:41 +00:00
|
|
|
#include "msw/taskbarex.h"
|
2010-02-06 07:43:09 +00:00
|
|
|
#elif defined(__WXGTK__)
|
|
|
|
#include "gtk/taskbarex.h"
|
2004-11-02 10:14:41 +00:00
|
|
|
#else
|
2006-11-22 09:51:59 +00:00
|
|
|
#define wxTaskBarIconEx wxTaskBarIcon
|
|
|
|
#define wxTaskBarIconExEvent wxTaskBarIconEvent
|
2004-11-02 10:14:41 +00:00
|
|
|
#endif
|
2004-10-23 07:13:18 +00:00
|
|
|
|
2006-10-30 03:41:32 +00:00
|
|
|
class CTaskbarEvent;
|
|
|
|
|
2005-04-10 19:01:23 +00:00
|
|
|
class CTaskBarIcon : public wxTaskBarIconEx {
|
2004-10-23 07:13:18 +00:00
|
|
|
public:
|
2006-07-05 21:35:59 +00:00
|
|
|
CTaskBarIcon(wxString title, wxIcon* icon, wxIcon* iconDisconnected, wxIcon* iconSnooze);
|
2004-10-23 07:13:18 +00:00
|
|
|
~CTaskBarIcon();
|
|
|
|
|
2006-02-02 19:53:16 +00:00
|
|
|
void OnOpenWebsite(wxCommandEvent& event);
|
2005-04-10 19:01:23 +00:00
|
|
|
void OnOpen(wxCommandEvent& event);
|
2006-11-22 09:51:59 +00:00
|
|
|
void OnSuspendResume(wxCommandEvent& event);
|
2009-12-11 00:08:28 +00:00
|
|
|
void OnSuspendResumeGPU(wxCommandEvent& event);
|
2005-04-10 19:01:23 +00:00
|
|
|
void OnAbout(wxCommandEvent& event);
|
|
|
|
void OnExit(wxCommandEvent& event);
|
2004-10-24 07:38:38 +00:00
|
|
|
|
2005-04-10 19:01:23 +00:00
|
|
|
void OnIdle(wxIdleEvent& event);
|
|
|
|
void OnClose(wxCloseEvent& event);
|
2008-10-14 03:28:34 +00:00
|
|
|
void OnRefresh(CTaskbarEvent& event);
|
2006-11-22 09:51:59 +00:00
|
|
|
void OnReloadSkin(CTaskbarEvent& event);
|
2004-10-23 23:40:11 +00:00
|
|
|
|
2009-12-18 22:44:10 +00:00
|
|
|
void OnNotificationClick(wxTaskBarIconExEvent& event);
|
2010-07-22 20:55:39 +00:00
|
|
|
void OnNotificationTimeout(wxTaskBarIconExEvent& event);
|
2010-10-18 19:21:46 +00:00
|
|
|
void OnAppRestore(wxTaskBarIconExEvent& event);
|
2009-12-18 22:44:10 +00:00
|
|
|
void OnShutdown(wxTaskBarIconExEvent& event);
|
2005-04-10 19:01:23 +00:00
|
|
|
void OnLButtonDClick(wxTaskBarIconEvent& event);
|
|
|
|
void OnRButtonDown(wxTaskBarIconEvent& event);
|
|
|
|
void OnRButtonUp(wxTaskBarIconEvent& event);
|
2004-11-23 07:45:11 +00:00
|
|
|
|
2006-10-30 03:41:32 +00:00
|
|
|
void FireReloadSkin();
|
|
|
|
|
2005-03-25 12:23:30 +00:00
|
|
|
wxMenu *BuildContextMenu();
|
|
|
|
void AdjustMenuItems(wxMenu* menu);
|
|
|
|
|
2010-02-10 20:01:42 +00:00
|
|
|
#ifdef __WXMAC__
|
2010-04-01 11:09:33 +00:00
|
|
|
private:
|
|
|
|
NMRecPtr m_pNotificationRequest;
|
|
|
|
|
|
|
|
void MacRequestUserAttention();
|
|
|
|
void MacCancelUserAttentionRequest();
|
2012-03-31 12:34:43 +00:00
|
|
|
bool SetMacTaskBarIcon(const wxIcon& icon);
|
|
|
|
|
2010-04-01 11:09:33 +00:00
|
|
|
public:
|
2005-03-25 12:23:30 +00:00
|
|
|
wxMenu *CreatePopupMenu();
|
2010-02-09 02:47:38 +00:00
|
|
|
bool SetIcon(const wxIcon& icon, const wxString& message = wxEmptyString);
|
2005-03-25 12:23:30 +00:00
|
|
|
|
2006-03-23 20:23:22 +00:00
|
|
|
inline bool IsBalloonsSupported() {
|
2005-03-25 12:23:30 +00:00
|
|
|
return false;
|
|
|
|
}
|
2010-03-30 01:15:30 +00:00
|
|
|
|
|
|
|
#define BALLOONTYPE_INFO 0
|
2010-03-29 17:20:12 +00:00
|
|
|
|
|
|
|
bool SetBalloon(
|
|
|
|
const wxIcon& icon,
|
|
|
|
const wxString title = wxEmptyString,
|
|
|
|
const wxString message = wxEmptyString,
|
|
|
|
unsigned int iconballoon = BALLOONTYPE_INFO
|
|
|
|
) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QueueBalloon(
|
|
|
|
const wxIcon& icon,
|
|
|
|
const wxString title = wxEmptyString,
|
|
|
|
const wxString message = wxEmptyString,
|
|
|
|
unsigned int iconballoon = BALLOONTYPE_INFO
|
|
|
|
) {
|
|
|
|
return false;
|
|
|
|
}
|
2005-03-25 12:23:30 +00:00
|
|
|
#endif
|
|
|
|
|
2012-01-27 13:02:35 +00:00
|
|
|
wxIcon m_iconTaskBarNormal;
|
|
|
|
wxIcon m_iconTaskBarDisconnected;
|
|
|
|
wxIcon m_iconTaskBarSnooze;
|
2010-03-30 01:15:30 +00:00
|
|
|
|
2012-01-27 13:02:35 +00:00
|
|
|
wxIcon m_iconCurrentIcon;
|
2010-02-11 05:57:36 +00:00
|
|
|
|
2012-01-27 13:02:35 +00:00
|
|
|
bool m_bTaskbarInitiatedShutdown;
|
2005-06-24 10:49:42 +00:00
|
|
|
|
|
|
|
private:
|
2012-01-27 13:02:35 +00:00
|
|
|
bool m_bMouseButtonPressed;
|
|
|
|
wxMenuItem* m_SnoozeMenuItem;
|
|
|
|
wxMenuItem* m_SnoozeGPUMenuItem;
|
2004-11-23 07:45:11 +00:00
|
|
|
|
2012-01-27 13:02:35 +00:00
|
|
|
wxDateTime m_dtLastNotificationAlertExecuted;
|
|
|
|
int m_iLastNotificationUnreadMessageCount;
|
2006-02-21 21:38:55 +00:00
|
|
|
|
2012-01-27 13:02:35 +00:00
|
|
|
void ResetTaskBar();
|
|
|
|
void DisplayContextMenu();
|
2004-10-23 07:13:18 +00:00
|
|
|
|
2012-01-27 13:02:35 +00:00
|
|
|
void UpdateTaskbarStatus();
|
|
|
|
void UpdateNoticeStatus();
|
2010-03-29 17:20:12 +00:00
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
2004-10-23 07:13:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-10-30 03:41:32 +00:00
|
|
|
class CTaskbarEvent : public wxEvent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CTaskbarEvent(wxEventType evtType, CTaskBarIcon *taskbar)
|
|
|
|
: wxEvent(-1, evtType)
|
|
|
|
{
|
|
|
|
SetEventObject(taskbar);
|
|
|
|
}
|
|
|
|
|
|
|
|
CTaskbarEvent(wxEventType evtType, CTaskBarIcon *taskbar, wxString message)
|
|
|
|
: wxEvent(-1, evtType), m_message(message)
|
|
|
|
{
|
|
|
|
SetEventObject(taskbar);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual wxEvent *Clone() const { return new CTaskbarEvent(*this); }
|
|
|
|
|
|
|
|
wxString m_message;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_DECLARE_EVENT_TYPES()
|
|
|
|
DECLARE_EVENT_TYPE( wxEVT_TASKBAR_RELOADSKIN, 10100 )
|
2008-10-14 03:28:34 +00:00
|
|
|
DECLARE_EVENT_TYPE( wxEVT_TASKBAR_REFRESH, 10101 )
|
2006-10-30 03:41:32 +00:00
|
|
|
END_DECLARE_EVENT_TYPES()
|
|
|
|
|
|
|
|
#define EVT_TASKBAR_RELOADSKIN(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_RELOADSKIN, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
|
2008-10-14 03:28:34 +00:00
|
|
|
#define EVT_TASKBAR_REFRESH(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_REFRESH, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
|
2006-10-30 03:41:32 +00:00
|
|
|
|
|
|
|
|
2004-10-23 07:13:18 +00:00
|
|
|
#endif
|
|
|
|
|