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-2009 Kevin Rosenberg
12 ** This program is free software; you can redistribute it and/or modify
13 ** it under the terms of the GNU General Public License (version 2) as
14 ** published by the Free Software Foundation.
16 ** This program is distributed in the hope that it will be useful,
17 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ** GNU General Public License for more details.
21 ** You should have received a copy of the GNU General Public License
22 ** along with this program; if not, write to the Free Software
23 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 ******************************************************************************/
26 #ifndef _BACKGROUND_MGR_H
29 #include "wx/wxprec.h"
34 #include "wx/minifram.h"
41 #include "threadrecon.h"
47 class BackgroundManagerCanvas;
48 class BackgroundManagerTask;
51 class BackgroundManager : public wxMiniFrame
55 DECLARE_DYNAMIC_CLASS(BackgroundManager)
57 wxCriticalSection m_criticalSection;
58 BackgroundManagerCanvas* m_pCanvas;
61 typedef std::list<BackgroundManagerTask*> TaskContainer;
62 TaskContainer m_vecpTasks;
65 BackgroundManagerTask* lookupTask (BackgroundSupervisor* pSupervisor);
66 BackgroundManagerTask* lookupTask (int iButtonID);
68 static int s_iNextButtonID;
74 wxSize m_sizeCellSpacing;
81 void OnAddTask (wxCommandEvent& event);
82 void OnRemoveTask (wxCommandEvent& event);
83 void OnUnitTick (wxCommandEvent& event);
84 void OnCloseWindow(wxCloseEvent& event);
85 void OnCancelButton(wxCommandEvent& event);
91 class BackgroundSupervisor;
92 class BackgroundManagerTask {
94 BackgroundSupervisor* m_pSupervisor;
95 const std::string m_strName;
96 const int m_iPosition;
98 wxStaticText* m_pLabel;
100 const int m_iButtonID;
103 BackgroundManagerTask (BackgroundSupervisor* pSupervisor, const char* const pszName, int iPos,
104 wxGauge* pGauge, wxStaticText* pLabel, wxButton* pButton, int iButtonID)
105 : m_pSupervisor(pSupervisor), m_strName(pszName), m_iPosition(iPos), m_pGauge(pGauge),
106 m_pLabel(pLabel), m_pButton(pButton), m_iButtonID(iButtonID)
109 int position() const {return m_iPosition;}
110 const std::string& name() const {return m_strName;}
111 BackgroundSupervisor* supervisor() {return m_pSupervisor;}
113 wxGauge* gauge() {return m_pGauge;}
114 wxStaticText* label() {return m_pLabel;}
115 wxButton* button() {return m_pButton;}
116 int buttonID() const {return m_iButtonID;}
120 class BackgroundManagerCanvas : public wxPanel {
122 DECLARE_DYNAMIC_CLASS(BackgroundManagerCanvas)
123 BackgroundManager* m_pBackgroundManager;
126 BackgroundManagerCanvas (BackgroundManager* pBkgdMgr = NULL);
128 DECLARE_EVENT_TABLE()
131 #endif // HAVE_WXTHREADS
133 #endif // _BACKGROUNDMGR_H