1 /*****************************************************************************
4 ** Name: backgroundmgr.h
5 ** Purpose: Header file for background manager
6 ** Programmer: Kevin Rosenberg
7 ** Date Started: February 2001
9 ** This is part of the CTSim program
10 ** Copyright (C) 1983-2001 Kevin Rosenberg
12 ** $Id: backgroundmgr.h,v 1.10 2001/03/09 18:50:46 kevin Exp $
14 ** This program is free software; you can redistribute it and/or modify
15 ** it under the terms of the GNU General Public License (version 2) as
16 ** published by the Free Software Foundation.
18 ** This program is distributed in the hope that it will be useful,
19 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ** GNU General Public License for more details.
23 ** You should have received a copy of the GNU General Public License
24 ** along with this program; if not, write to the Free Software
25 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 ******************************************************************************/
28 #ifndef _BACKGROUND_MGR_H
31 #include "wx/wxprec.h"
36 #include "wx/minifram.h"
43 #include "threadrecon.h"
49 class BackgroundManagerCanvas;
50 class BackgroundManagerTask;
53 class BackgroundManager : public wxMiniFrame
57 DECLARE_DYNAMIC_CLASS(BackgroundManager)
59 wxCriticalSection m_criticalSection;
60 BackgroundManagerCanvas* m_pCanvas;
63 typedef std::list<BackgroundManagerTask*> TaskContainer;
64 TaskContainer m_vecpTasks;
67 BackgroundManagerTask* lookupTask (BackgroundSupervisor* pSupervisor);
73 wxSize m_sizeCellSpacing;
80 void OnAddTask (wxCommandEvent& event);
81 void OnRemoveTask (wxCommandEvent& event);
82 void OnUnitTick (wxCommandEvent& event);
83 void OnCloseWindow(wxCloseEvent& event);
84 void OnCancelButton(wxCommandEvent& event);
90 class BackgroundSupervisor;
91 class BackgroundManagerTask {
93 const BackgroundSupervisor* m_pSupervisor;
94 const std::string m_strName;
95 const int m_iPosition;
97 wxStaticText* m_pLabel;
101 BackgroundManagerTask (BackgroundSupervisor* pSupervisor, const char* const pszName, int iPos,
102 wxGauge* pGauge, wxStaticText* pLabel, wxButton* pButton)
103 : m_pSupervisor(pSupervisor), m_strName(pszName), m_iPosition(iPos), m_pGauge(pGauge), m_pLabel(pLabel), m_pButton(pButton)
106 int position() const {return m_iPosition;}
107 const std::string& name() const {return m_strName;}
108 const BackgroundSupervisor* supervisor() const {return m_pSupervisor;}
110 wxGauge* gauge() {return m_pGauge;}
111 wxStaticText* label() {return m_pLabel;}
112 wxButton* button() {return m_pButton;}
116 class BackgroundManagerCanvas : public wxPanel {
118 DECLARE_DYNAMIC_CLASS(BackgroundManagerCanvas)
119 BackgroundManager* m_pBackgroundManager;
122 BackgroundManagerCanvas (BackgroundManager* pBkgdMgr = NULL);
124 DECLARE_EVENT_TABLE()
127 #endif // HAVE_WXTHREADS
129 #endif // _BACKGROUNDMGR_H