r574: no message
[ctsim.git] / src / backgroundmgr.h
1 /*****************************************************************************
2 ** FILE IDENTIFICATION
3 **
4 **   Name:          backgroundmgr.h
5 **   Purpose:       Header file for background manager
6 **   Programmer:    Kevin Rosenberg
7 **   Date Started:  February 2001
8 **
9 **  This is part of the CTSim program
10 **  Copyright (C) 1983-2001 Kevin Rosenberg
11 **
12 **  $Id: backgroundmgr.h,v 1.3 2001/02/23 02:06:02 kevin Exp $
13 **
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.
17 **
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.
22 **
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 ******************************************************************************/
27
28 #ifndef _BACKGROUND_MGR_H
29
30
31 #include "wx/wxprec.h"
32
33 #ifndef WX_PRECOMP
34 #include "wx/wx.h"
35 #endif
36 #include "wx/minifram.h"
37 #include "wx/gauge.h"
38
39 #include "ct.h"
40 #include "ctsim.h"
41 #include "docs.h"
42 #include "views.h"
43 #include "threadrecon.h"
44
45 #include <vector>
46
47 #if defined(HAVE_CONFIG_H)
48 #include "config.h"
49 #endif
50
51 class BackgroundManagerCanvas;
52
53 #if CTSIM_MDI
54 //class BackgroundManager : public wxMDIChildFrame
55 //#else
56 class BackgroundManager : public wxMiniFrame
57 #endif
58 {
59 private:
60   DECLARE_DYNAMIC_CLASS(BackgroundManager)
61
62   wxCriticalSection m_criticalSection;
63   BackgroundManagerCanvas* m_pCanvas;
64   int m_iNumTasks;
65
66   typedef std::vector<BackgroundTask*> TaskContainer;
67   typedef std::vector<wxGauge*>  GaugeContainer;
68   typedef std::vector<std::string*> StringContainer;
69   typedef std::vector<int> PositionContainer;
70   typedef std::vector<wxStaticText*>  LabelContainer;
71   TaskContainer m_vecpBackgroundTasks;
72   GaugeContainer m_vecpGauges;
73   StringContainer m_vecpNames;
74   PositionContainer m_vecpPositions;
75   LabelContainer m_vecpLabels;
76   wxSize m_sizeGauge;
77   wxSize m_sizeLabel;
78   wxSize m_sizeCell;
79   wxSize m_sizeBorder;
80
81   void resizeWindow();
82
83 public:
84   BackgroundManager ();
85
86   wxGauge* addTask (BackgroundTask* pTask, int iNumUnits, const char* const pszTaskName);
87   void taskDone (BackgroundTask* pTask);
88   bool isCancelling (BackgroundTask* pTask);
89
90   TaskContainer& getTasks() { return m_vecpBackgroundTasks;}
91   GaugeContainer& getGauges() { return m_vecpGauges;}
92   StringContainer& getNames() { return m_vecpNames;}
93   PositionContainer& getPositions() { return m_vecpPositions;}
94   LabelContainer& getLabels() { return m_vecpLabels;}
95
96   void OnCloseWindow(wxCloseEvent& event);
97   
98   DECLARE_EVENT_TABLE()
99 };
100
101
102 class BackgroundManagerCanvas : public wxPanel {
103 private:
104   DECLARE_DYNAMIC_CLASS(BackgroundManagerCanvas)
105   BackgroundManager* m_pBackgroundManager;
106
107 public:
108   BackgroundManagerCanvas (BackgroundManager* pBkgdMgr = NULL);
109
110   void OnPaint (wxPaintEvent& event);
111
112   DECLARE_EVENT_TABLE()
113 };
114
115
116 #endif // _BACKGROUNDMGR_H
117