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.,
|
|
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2004-09-21 01:30:29 +00:00
|
|
|
|
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma implementation "BOINCTaskCtrl.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "stdwx.h"
|
|
|
|
#include "BOINCBaseView.h"
|
|
|
|
#include "BOINCTaskCtrl.h"
|
|
|
|
|
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
IMPLEMENT_DYNAMIC_CLASS(CBOINCTaskCtrl, wxPanel)
|
2004-09-21 01:30:29 +00:00
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
CBOINCTaskCtrl::CBOINCTaskCtrl() {}
|
2004-09-21 01:30:29 +00:00
|
|
|
|
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
CBOINCTaskCtrl::CBOINCTaskCtrl(CBOINCBaseView* pView, wxWindowID iTaskWindowID, wxInt32 iTaskWindowFlags) :
|
2005-04-21 19:10:10 +00:00
|
|
|
wxPanel(pView, iTaskWindowID, wxDefaultPosition, wxSize(175, -1), iTaskWindowFlags)
|
2004-09-21 01:30:29 +00:00
|
|
|
{
|
2005-04-20 22:22:41 +00:00
|
|
|
m_pParent = pView;
|
|
|
|
m_pBoxSizer = NULL;
|
2004-09-21 01:30:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
CBOINCTaskCtrl::~CBOINCTaskCtrl() {}
|
2004-09-21 01:30:29 +00:00
|
|
|
|
|
|
|
|
2005-04-06 20:40:19 +00:00
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
wxInt32 CBOINCTaskCtrl::CreateTaskControls() {
|
|
|
|
unsigned int i;
|
|
|
|
unsigned int j;
|
2005-04-21 19:10:10 +00:00
|
|
|
wxInt32 iCurrentWidth = 0;
|
|
|
|
wxInt32 iFutureWidth = 0;
|
2005-04-20 22:22:41 +00:00
|
|
|
CTaskItemGroup* pGroup = NULL;
|
|
|
|
CTaskItem* pItem = NULL;
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
m_pBoxSizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
m_pBoxSizer->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
for (i=0; i < m_pParent->m_TaskGroups.size(); i++) {
|
|
|
|
pGroup = m_pParent->m_TaskGroups[i];
|
2004-12-23 03:36:51 +00:00
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
pGroup->m_pStaticBox = new wxStaticBox(this, wxID_ANY, pGroup->m_strName);
|
|
|
|
pGroup->m_pStaticBoxSizer = new wxStaticBoxSizer(pGroup->m_pStaticBox, wxVERTICAL);
|
2005-03-13 00:29:01 +00:00
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
for (j=0; j < pGroup->m_Tasks.size(); j++) {
|
|
|
|
pItem = pGroup->m_Tasks[j];
|
2005-03-13 00:29:01 +00:00
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
pItem->m_pButton = new wxButton;
|
2005-04-21 19:10:10 +00:00
|
|
|
pItem->m_pButton->Create(this, pItem->m_iEventID, pItem->m_strName, wxDefaultPosition, wxDefaultSize, 0);
|
2005-04-20 22:22:41 +00:00
|
|
|
pItem->m_pButton->SetToolTip(pItem->m_strDescription);
|
2005-04-21 19:10:10 +00:00
|
|
|
pGroup->m_pStaticBoxSizer->Add(pItem->m_pButton, 0, wxEXPAND|wxALL, 5);
|
2005-03-30 21:11:49 +00:00
|
|
|
}
|
2004-12-23 01:06:41 +00:00
|
|
|
|
2005-04-21 19:10:10 +00:00
|
|
|
m_pBoxSizer->Add(pGroup->m_pStaticBoxSizer, 0, wxEXPAND|wxALL, 5);
|
2005-04-20 22:22:41 +00:00
|
|
|
m_pBoxSizer->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
|
2004-12-23 01:06:41 +00:00
|
|
|
}
|
2004-09-22 21:53:07 +00:00
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
SetSizerAndFit(m_pBoxSizer);
|
2005-04-21 19:10:10 +00:00
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
return 0;
|
2004-09-21 01:30:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
bool CBOINCTaskCtrl::OnSaveState(wxConfigBase* pConfig) {
|
2005-04-06 20:40:19 +00:00
|
|
|
wxString strBaseConfigLocation = wxEmptyString;
|
|
|
|
|
|
|
|
wxASSERT(NULL != pConfig);
|
|
|
|
|
|
|
|
|
|
|
|
// Retrieve the base location to store configuration information
|
|
|
|
// Should be in the following form: "/Projects/"
|
|
|
|
strBaseConfigLocation = pConfig->GetPath() + wxT("/");
|
|
|
|
|
|
|
|
pConfig->SetPath(strBaseConfigLocation + wxT("TaskCtrl/"));
|
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
//WriteCustomization(pConfig);
|
2005-04-06 20:40:19 +00:00
|
|
|
|
|
|
|
pConfig->SetPath(strBaseConfigLocation);
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
bool CBOINCTaskCtrl::OnRestoreState(wxConfigBase* pConfig) {
|
2005-04-06 20:40:19 +00:00
|
|
|
wxString strBaseConfigLocation = wxEmptyString;
|
|
|
|
|
|
|
|
wxASSERT(NULL != pConfig);
|
|
|
|
|
|
|
|
|
|
|
|
// Retrieve the base location to store configuration information
|
|
|
|
// Should be in the following form: "/Projects/"
|
|
|
|
strBaseConfigLocation = pConfig->GetPath() + wxT("/");
|
|
|
|
|
|
|
|
pConfig->SetPath(strBaseConfigLocation + wxT("TaskCtrl/"));
|
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
//ReadCustomization(pConfig);
|
2005-04-06 20:40:19 +00:00
|
|
|
|
|
|
|
pConfig->SetPath(strBaseConfigLocation);
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-01-02 18:29:53 +00:00
|
|
|
const char *BOINC_RCSID_125ef3d14d = "$Id$";
|