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-05-17 22:15:10 +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-04-10 09:11:03 +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-05-17 22:15:10 +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.,
|
|
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2004-05-17 22:15:10 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-04-11 04:37:10 +00:00
|
|
|
#ifndef _MAINFRAME_H_
|
|
|
|
#define _MAINFRAME_H_
|
|
|
|
|
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma interface "MainFrame.cpp"
|
|
|
|
#endif
|
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2005-03-10 05:07:01 +00:00
|
|
|
class CStatusBar : public wxStatusBar
|
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS(CStatusBar)
|
|
|
|
|
|
|
|
public:
|
|
|
|
CStatusBar();
|
|
|
|
CStatusBar(wxWindow *parent);
|
|
|
|
~CStatusBar();
|
|
|
|
|
|
|
|
void OnSize(wxSizeEvent& event);
|
|
|
|
|
|
|
|
wxStaticBitmap* m_pbmpConnected;
|
|
|
|
wxStaticText* m_ptxtConnected;
|
|
|
|
wxStaticBitmap* m_pbmpDisconnect;
|
|
|
|
wxStaticText* m_ptxtDisconnect;
|
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
2005-04-08 04:23:37 +00:00
|
|
|
class CMainFrameEvent;
|
2005-06-17 04:53:35 +00:00
|
|
|
class CMainFrameAlertEvent;
|
2005-03-10 05:07:01 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
class CMainFrame : public wxFrame
|
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS(CMainFrame)
|
|
|
|
|
|
|
|
public:
|
|
|
|
CMainFrame();
|
|
|
|
CMainFrame(wxString strTitle);
|
|
|
|
|
|
|
|
~CMainFrame(void);
|
|
|
|
|
2004-10-24 07:38:38 +00:00
|
|
|
void OnHide( wxCommandEvent& event );
|
|
|
|
void OnActivitySelection( wxCommandEvent& event );
|
|
|
|
void OnNetworkSelection( wxCommandEvent& event );
|
2004-10-27 23:19:50 +00:00
|
|
|
void OnRunBenchmarks( wxCommandEvent& event );
|
2004-10-28 07:03:06 +00:00
|
|
|
void OnSelectComputer( wxCommandEvent& event );
|
2004-10-21 14:29:59 +00:00
|
|
|
void OnExit( wxCommandEvent& event );
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2005-06-17 04:53:35 +00:00
|
|
|
void OnToolsManageAccounts( wxCommandEvent& event );
|
2004-10-21 14:29:59 +00:00
|
|
|
void OnToolsOptions( wxCommandEvent& event );
|
2005-05-05 06:07:14 +00:00
|
|
|
|
2005-06-21 17:21:16 +00:00
|
|
|
void OnHelp( wxHelpEvent& event );
|
2005-06-17 04:53:35 +00:00
|
|
|
void OnHelpBOINCManager( wxCommandEvent& event );
|
2005-05-05 06:07:14 +00:00
|
|
|
void OnHelpBOINCWebsite( wxCommandEvent& event );
|
|
|
|
void OnHelpAbout( wxCommandEvent& event );
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-10-24 07:38:38 +00:00
|
|
|
void OnClose( wxCloseEvent& event );
|
2004-12-02 07:43:47 +00:00
|
|
|
|
2005-03-07 23:52:28 +00:00
|
|
|
void OnRefreshState( wxTimerEvent& event );
|
2004-10-28 22:51:38 +00:00
|
|
|
void OnFrameRender( wxTimerEvent& event );
|
2004-10-21 14:29:59 +00:00
|
|
|
void OnListPanelRender( wxTimerEvent& event );
|
2005-04-10 02:24:08 +00:00
|
|
|
void OnDocumentPoll( wxTimerEvent& event );
|
2004-12-10 20:46:43 +00:00
|
|
|
|
|
|
|
void OnNotebookSelectionChanged( wxNotebookEvent& event );
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2005-06-17 04:53:35 +00:00
|
|
|
void OnAlert( CMainFrameAlertEvent& event );
|
|
|
|
void OnInitialized( CMainFrameEvent& event );
|
|
|
|
void OnRefreshView( CMainFrameEvent& event );
|
2005-04-08 04:23:37 +00:00
|
|
|
void OnConnect( CMainFrameEvent& event );
|
|
|
|
|
2005-04-08 06:24:58 +00:00
|
|
|
void UpdateStatusText( const wxChar* szStatus );
|
|
|
|
|
2005-05-24 21:26:49 +00:00
|
|
|
void FireInitialize();
|
2005-06-17 04:53:35 +00:00
|
|
|
void FireRefreshView();
|
2005-04-08 04:23:37 +00:00
|
|
|
void FireConnect();
|
2005-04-08 06:24:58 +00:00
|
|
|
|
2005-06-24 10:49:42 +00:00
|
|
|
void ShowAlert( const wxString title, const wxString message, const int style, const bool notification_only = false );
|
2005-04-08 06:24:58 +00:00
|
|
|
void ExecuteBrowserLink( const wxString& strLink );
|
2005-04-08 04:23:37 +00:00
|
|
|
|
2005-07-06 05:16:53 +00:00
|
|
|
#ifdef __WXMAC__
|
|
|
|
bool Show( bool show = true );
|
|
|
|
#endif
|
|
|
|
|
2005-08-25 22:00:39 +00:00
|
|
|
wxTimer* m_pRefreshStateTimer;
|
|
|
|
wxTimer* m_pFrameRenderTimer;
|
|
|
|
wxTimer* m_pFrameListPanelRenderTimer;
|
|
|
|
wxTimer* m_pDocumentPollTimer;
|
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
wxMenuBar* m_pMenubar;
|
|
|
|
wxNotebook* m_pNotebook;
|
2005-03-10 05:07:01 +00:00
|
|
|
CStatusBar* m_pStatusbar;
|
2005-06-28 15:55:59 +00:00
|
|
|
#ifdef __WXMSW__
|
2005-07-08 06:30:25 +00:00
|
|
|
wxDynamicLibrary m_WININET;
|
2005-06-24 10:49:42 +00:00
|
|
|
wxDialUpManager* m_pDialupManager;
|
2005-06-28 15:55:59 +00:00
|
|
|
#endif
|
2004-10-28 22:51:38 +00:00
|
|
|
wxString m_strBaseTitle;
|
2004-10-28 07:03:06 +00:00
|
|
|
|
2005-06-29 05:21:47 +00:00
|
|
|
int m_iSelectedLanguage;
|
|
|
|
int m_iReminderFrequency;
|
|
|
|
|
|
|
|
int m_iNetworkConnectionType;
|
|
|
|
wxString m_strNetworkDialupConnectionName;
|
|
|
|
bool m_bNetworkDialupPromptCredentials;
|
|
|
|
|
2005-03-30 09:24:31 +00:00
|
|
|
wxArrayString m_aSelectedComputerMRU;
|
2005-02-07 04:47:18 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
bool CreateMenu();
|
|
|
|
bool DeleteMenu();
|
|
|
|
|
|
|
|
bool CreateNotebook();
|
2004-05-27 06:17:58 +00:00
|
|
|
template < class T >
|
|
|
|
bool CreateNotebookPage( T pwndNewNotebookPage );
|
2004-04-10 09:11:03 +00:00
|
|
|
bool DeleteNotebook();
|
|
|
|
|
|
|
|
bool CreateStatusbar();
|
|
|
|
bool DeleteStatusbar();
|
|
|
|
|
2004-05-21 06:27:15 +00:00
|
|
|
bool SaveState();
|
|
|
|
bool RestoreState();
|
2004-05-27 06:17:58 +00:00
|
|
|
|
2005-04-08 04:23:37 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2005-03-31 23:54:12 +00:00
|
|
|
|
2005-04-08 04:23:37 +00:00
|
|
|
class CMainFrameEvent : public wxEvent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CMainFrameEvent(wxEventType evtType, CMainFrame *frame)
|
|
|
|
: wxEvent(-1, evtType)
|
|
|
|
{
|
|
|
|
SetEventObject(frame);
|
|
|
|
}
|
2004-10-26 01:59:44 +00:00
|
|
|
|
2005-04-08 04:23:37 +00:00
|
|
|
virtual wxEvent *Clone() const { return new CMainFrameEvent(*this); }
|
2004-04-10 09:11:03 +00:00
|
|
|
};
|
2004-04-11 04:37:10 +00:00
|
|
|
|
|
|
|
|
2005-06-17 04:53:35 +00:00
|
|
|
class CMainFrameAlertEvent : public wxEvent
|
|
|
|
{
|
|
|
|
public:
|
2005-06-24 10:49:42 +00:00
|
|
|
CMainFrameAlertEvent(wxEventType evtType, CMainFrame *frame, wxString title, wxString message, int style, bool notification_only)
|
2005-07-07 22:26:49 +00:00
|
|
|
: wxEvent(-1, evtType), m_title(title), m_message(message), m_style(style), m_notification_only(notification_only)
|
2005-06-17 04:53:35 +00:00
|
|
|
{
|
|
|
|
SetEventObject(frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
CMainFrameAlertEvent(const CMainFrameAlertEvent& event)
|
|
|
|
: wxEvent(event)
|
|
|
|
{
|
2005-07-07 22:26:49 +00:00
|
|
|
m_title = event.m_title;
|
|
|
|
m_message = event.m_message;
|
|
|
|
m_style = event.m_style;
|
|
|
|
m_notification_only = event.m_notification_only;
|
2005-06-17 04:53:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual wxEvent *Clone() const { return new CMainFrameAlertEvent(*this); }
|
|
|
|
|
2005-07-07 22:26:49 +00:00
|
|
|
wxString m_title;
|
|
|
|
wxString m_message;
|
|
|
|
int m_style;
|
|
|
|
bool m_notification_only;
|
2005-06-17 04:53:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-04-08 04:23:37 +00:00
|
|
|
BEGIN_DECLARE_EVENT_TYPES()
|
2005-06-17 04:53:35 +00:00
|
|
|
DECLARE_EVENT_TYPE( wxEVT_MAINFRAME_ALERT, 10000 )
|
|
|
|
DECLARE_EVENT_TYPE( wxEVT_MAINFRAME_CONNECT, 10001 )
|
|
|
|
DECLARE_EVENT_TYPE( wxEVT_MAINFRAME_INITIALIZED, 10004 )
|
|
|
|
DECLARE_EVENT_TYPE( wxEVT_MAINFRAME_REFRESHVIEW, 10005 )
|
2005-04-08 04:23:37 +00:00
|
|
|
END_DECLARE_EVENT_TYPES()
|
|
|
|
|
2005-06-17 04:53:35 +00:00
|
|
|
#define EVT_MAINFRAME_ALERT(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_MAINFRAME_ALERT, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
|
2005-04-08 04:23:37 +00:00
|
|
|
#define EVT_MAINFRAME_CONNECT(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_MAINFRAME_CONNECT, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
|
|
|
|
#define EVT_MAINFRAME_INITIALIZED(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_MAINFRAME_INITIALIZED, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
|
|
|
|
#define EVT_MAINFRAME_REFRESH(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_MAINFRAME_REFRESHVIEW, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
|
|
|
|
|
|
|
|
|
2004-04-11 05:09:18 +00:00
|
|
|
#endif
|
|
|
|
|