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.11 2001/03/09 21:31:51 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);
68 BackgroundManagerTask* lookupTask (int iButtonID);
70 static int s_iNextButtonID;
76 wxSize m_sizeCellSpacing;
83 void OnAddTask (wxCommandEvent& event);
84 void OnRemoveTask (wxCommandEvent& event);
85 void OnUnitTick (wxCommandEvent& event);
86 void OnCloseWindow(wxCloseEvent& event);
87 void OnCancelButton(wxCommandEvent& event);
93 class BackgroundSupervisor;
94 class BackgroundManagerTask {
96 BackgroundSupervisor* m_pSupervisor;
97 const std::string m_strName;
98 const int m_iPosition;
100 wxStaticText* m_pLabel;
102 const int m_iButtonID;
105 BackgroundManagerTask (BackgroundSupervisor* pSupervisor, const char* const pszName, int iPos,
106 wxGauge* pGauge, wxStaticText* pLabel, wxButton* pButton, int iButtonID)
107 : m_pSupervisor(pSupervisor), m_strName(pszName), m_iPosition(iPos), m_pGauge(pGauge),
108 m_pLabel(pLabel), m_pButton(pButton), m_iButtonID(iButtonID)
111 int position() const {return m_iPosition;}
112 const std::string& name() const {return m_strName;}
113 BackgroundSupervisor* supervisor() {return m_pSupervisor;}
115 wxGauge* gauge() {return m_pGauge;}
116 wxStaticText* label() {return m_pLabel;}
117 wxButton* button() {return m_pButton;}
118 int buttonID() const {return m_iButtonID;}
122 class BackgroundManagerCanvas : public wxPanel {
124 DECLARE_DYNAMIC_CLASS(BackgroundManagerCanvas)
125 BackgroundManager* m_pBackgroundManager;
128 BackgroundManagerCanvas (BackgroundManager* pBkgdMgr = NULL);
130 DECLARE_EVENT_TABLE()
133 #endif // HAVE_WXTHREADS
135 #endif // _BACKGROUNDMGR_H