X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=src%2Fbackgroundmgr.h;h=225a78eb073537bd1b367efe15e7eb30606c0377;hp=d3f49a1304541b6f26361559ffe82f3e9865f3b2;hb=f13a8c004b8f182b42d9e4df2bcd7c7f030bf1ad;hpb=7df269f65639c1a862a58649c48331824029128a diff --git a/src/backgroundmgr.h b/src/backgroundmgr.h index d3f49a1..225a78e 100644 --- a/src/backgroundmgr.h +++ b/src/backgroundmgr.h @@ -7,9 +7,7 @@ ** Date Started: February 2001 ** ** This is part of the CTSim program -** Copyright (C) 1983-2001 Kevin Rosenberg -** -** $Id: backgroundmgr.h,v 1.3 2001/02/23 02:06:02 kevin Exp $ +** Copyright (C) 1983-2009 Kevin Rosenberg ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -42,63 +40,83 @@ #include "views.h" #include "threadrecon.h" -#include +#include -#if defined(HAVE_CONFIG_H) -#include "config.h" -#endif +#ifdef HAVE_WXTHREADS class BackgroundManagerCanvas; +class BackgroundManagerTask; + -#if CTSIM_MDI -//class BackgroundManager : public wxMDIChildFrame -//#else class BackgroundManager : public wxMiniFrame -#endif { private: + DECLARE_DYNAMIC_CLASS(BackgroundManager) wxCriticalSection m_criticalSection; BackgroundManagerCanvas* m_pCanvas; int m_iNumTasks; - typedef std::vector TaskContainer; - typedef std::vector GaugeContainer; - typedef std::vector StringContainer; - typedef std::vector PositionContainer; - typedef std::vector LabelContainer; - TaskContainer m_vecpBackgroundTasks; - GaugeContainer m_vecpGauges; - StringContainer m_vecpNames; - PositionContainer m_vecpPositions; - LabelContainer m_vecpLabels; + typedef std::list TaskContainer; + TaskContainer m_vecpTasks; + + void resizeWindow(); + BackgroundManagerTask* lookupTask (BackgroundSupervisor* pSupervisor); + BackgroundManagerTask* lookupTask (int iButtonID); + + static int s_iNextButtonID; + wxSize m_sizeGauge; wxSize m_sizeLabel; wxSize m_sizeCell; wxSize m_sizeBorder; - - void resizeWindow(); + wxSize m_sizeCellSpacing; + wxSize m_sizeButton; public: BackgroundManager (); + ~BackgroundManager(); - wxGauge* addTask (BackgroundTask* pTask, int iNumUnits, const char* const pszTaskName); - void taskDone (BackgroundTask* pTask); - bool isCancelling (BackgroundTask* pTask); - - TaskContainer& getTasks() { return m_vecpBackgroundTasks;} - GaugeContainer& getGauges() { return m_vecpGauges;} - StringContainer& getNames() { return m_vecpNames;} - PositionContainer& getPositions() { return m_vecpPositions;} - LabelContainer& getLabels() { return m_vecpLabels;} - + void OnAddTask (wxCommandEvent& event); + void OnRemoveTask (wxCommandEvent& event); + void OnUnitTick (wxCommandEvent& event); void OnCloseWindow(wxCloseEvent& event); - + void OnCancelButton(wxCommandEvent& event); + DECLARE_EVENT_TABLE() }; +class BackgroundSupervisor; +class BackgroundManagerTask { +private: + BackgroundSupervisor* m_pSupervisor; + const std::string m_strName; + const int m_iPosition; + wxGauge* m_pGauge; + wxStaticText* m_pLabel; + wxButton* m_pButton; + const int m_iButtonID; + +public: + BackgroundManagerTask (BackgroundSupervisor* pSupervisor, const char* const pszName, int iPos, + wxGauge* pGauge, wxStaticText* pLabel, wxButton* pButton, int iButtonID) + : m_pSupervisor(pSupervisor), m_strName(pszName), m_iPosition(iPos), m_pGauge(pGauge), + m_pLabel(pLabel), m_pButton(pButton), m_iButtonID(iButtonID) + {} + + int position() const {return m_iPosition;} + const std::string& name() const {return m_strName;} + BackgroundSupervisor* supervisor() {return m_pSupervisor;} + + wxGauge* gauge() {return m_pGauge;} + wxStaticText* label() {return m_pLabel;} + wxButton* button() {return m_pButton;} + int buttonID() const {return m_iButtonID;} +}; + + class BackgroundManagerCanvas : public wxPanel { private: DECLARE_DYNAMIC_CLASS(BackgroundManagerCanvas) @@ -107,11 +125,10 @@ private: public: BackgroundManagerCanvas (BackgroundManager* pBkgdMgr = NULL); - void OnPaint (wxPaintEvent& event); - DECLARE_EVENT_TABLE() }; +#endif // HAVE_WXTHREADS #endif // _BACKGROUNDMGR_H