3
* $Id: ipanelhistorial.h 3521 2011-03-16 14:54:22Z carlos $
6
* Copyright 2008-10 MetaEmotion S.L. All rights reserved.
7
* http://ginkgo-cadx.com
9
* This file is licensed under LGPL v3 license.
10
* See License.txt for details
19
#include <api/ievento.h>
20
#include <yasper/yasper.h>
21
#include <api/imodelointegracion.h>
22
#include <api/icontroladorhistorial.h>
24
#define ginkgoEVT_Core_HistorialSeleccionar 100
25
#define ginkgoEVT_Core_HistorialLayout 101
26
#define ginkgoEVT_Core_HistorialAbribleEliminado 102
27
#define ginkgoEVT_Core_HistorialRecargarHistorial 103
28
#define ginkgoEVT_Core_AddModeloHistorial 104
29
#define ginkgoEVT_Core_LimpiarHistorial 105
30
#define ginkgoEVT_Core_SetFocus 106
37
class ISeleccionableHistorial {
41
ISeleccionableHistorial(){
42
m_seleccionado = false;
44
~ISeleccionableHistorial(){
46
bool EstaSeleccionado()
48
return m_seleccionado;
50
virtual void Seleccionar(bool seleccionar, bool force=false) = 0;
54
class IAbribleHistorial {
67
virtual void Abrir(bool forzarEstudio = false) = 0;
68
virtual void AddVista(GNC::GCS::IVista* pVista) = 0;
69
virtual void VistaModificada(GNC::GCS::IVista* pVista) = 0;
70
virtual void VistaGuardada(GNC::GCS::IVista* pVista) = 0;
71
virtual void RemoveVista(GNC::GCS::IVista* pVista) = 0;
74
class INodoHistorial {
76
typedef std::map<std::string,GNC::GUI::INodoHistorial*> TMapaHijos;
77
INodoHistorial(INodoHistorial* pPadre,const std::string& clave)
86
INodoHistorial* GetParentNode()
91
bool Eliminar(INodoHistorial* pHijo)
93
TMapaHijos::iterator it = m_mapaHijos.find(pHijo->GetClave());
94
if(it != m_mapaHijos.end()){
95
m_mapaHijos.erase(it);
96
if(m_mapaHijos.size() == 0) {
103
virtual void Detach(wxWindow* pHijo) = 0;
104
virtual void Eliminar() = 0;
105
const std::string& GetClave()
109
bool HayNodosAbiertos()
111
IAbribleHistorial* pAbrible = dynamic_cast<IAbribleHistorial*>(this);
112
if (pAbrible != NULL)
114
if (pAbrible->EstaAbierto()) {
118
for(TMapaHijos::iterator it=m_mapaHijos.begin(); it!= m_mapaHijos.end(); it++) {
119
pAbrible = dynamic_cast<IAbribleHistorial*>((*it).second);
120
if (pAbrible != NULL)
122
if (pAbrible->EstaAbierto()) {
126
if ((*it).second->HayNodosAbiertos()) {
134
void EliminarNodosNoAbiertos() {
135
//se hace esto para evitar borrar elementos de un mapa que estamos recorriendo
136
std::list<GNC::GUI::INodoHistorial*> listaHijos;
138
for(TMapaHijos::iterator it=m_mapaHijos.begin(); it!= m_mapaHijos.end(); it++) {
139
listaHijos.push_back((*it).second);
142
for (std::list<GNC::GUI::INodoHistorial*>::iterator it = listaHijos.begin(); it != listaHijos.end(); ++it) {
143
IAbribleHistorial* pAbrible = dynamic_cast<IAbribleHistorial*>((*it));
144
if (pAbrible != NULL)
146
if (!pAbrible->EstaAbierto()) {
151
(*it)->EliminarNodosNoAbiertos();
156
TMapaHijos m_mapaHijos;
157
INodoHistorial* m_pPadre;
161
//eventos variados...
162
//evento de seleccion
164
class EventoSeleccionarHistorial: public GNC::GCS::Eventos::IEvento
167
EventoSeleccionarHistorial():GNC::GCS::Eventos::IEvento(ginkgoEVT_Core_HistorialSeleccionar)
169
m_Nombre = "SeleccionarHistorial";
170
m_pSeleccionable=NULL;
173
EventoSeleccionarHistorial(ISeleccionableHistorial* pSeleccionable ):GNC::GCS::Eventos::IEvento(ginkgoEVT_Core_HistorialSeleccionar)
175
m_pSeleccionable = pSeleccionable;
178
~EventoSeleccionarHistorial()
182
ISeleccionableHistorial* GetSeleccionable()
184
return m_pSeleccionable;
188
ISeleccionableHistorial* m_pSeleccionable;
191
class EventoLayoutHistorial: public GNC::GCS::Eventos::IEvento
195
EventoLayoutHistorial():GNC::GCS::Eventos::IEvento(ginkgoEVT_Core_HistorialLayout)
197
m_Nombre = "LayoutHistorial";
200
~EventoLayoutHistorial()
206
class EventoSetFocusHistorial: public GNC::GCS::Eventos::IEvento
210
EventoSetFocusHistorial():GNC::GCS::Eventos::IEvento(ginkgoEVT_Core_SetFocus)
212
m_Nombre = "SetFocusHistorial";
215
~EventoSetFocusHistorial()
221
class EventoAbribleEliminado: public GNC::GCS::Eventos::IEvento
224
EventoAbribleEliminado():GNC::GCS::Eventos::IEvento(ginkgoEVT_Core_HistorialAbribleEliminado)
226
m_Nombre = "SeleccionarHistorial";
229
EventoAbribleEliminado( const std::list<std::string>& UIDS ):GNC::GCS::Eventos::IEvento(ginkgoEVT_Core_HistorialAbribleEliminado)
234
~EventoAbribleEliminado()
238
const std::list<std::string>& GetUIDs() {
243
std::list<std::string> m_UIDS;
246
class EventoRecargarHistorial: public GNC::GCS::Eventos::IEvento
249
EventoRecargarHistorial():GNC::GCS::Eventos::IEvento(ginkgoEVT_Core_HistorialRecargarHistorial)
251
m_Nombre = "EventoRecargarHistorial";
254
~EventoRecargarHistorial()
262
class EventoAddModeloHistorial: public GNC::GCS::Eventos::IEvento
265
EventoAddModeloHistorial(GNC::GCS::IControladorHistorial::ListaModelosDCM* pListaModelos = NULL, bool abrirDespuesDeCargar = true, GnkPtr<GIL::IModeloIntegracion> pModeloIntegracion=NULL ):GNC::GCS::Eventos::IEvento(ginkgoEVT_Core_AddModeloHistorial)
267
m_pListaModelos = pListaModelos;
268
m_abrirDespuesDeCargar = abrirDespuesDeCargar;
269
m_pModeloIntegracion = pModeloIntegracion;
270
m_Nombre = "AddModeloHistorial";
273
~EventoAddModeloHistorial()
275
m_pListaModelos = NULL;
278
GNC::GCS::IControladorHistorial::ListaModelosDCM* GetListaModelos()
280
return m_pListaModelos;
283
bool GetAbrirDespuesDeCargar(){
284
return m_abrirDespuesDeCargar;
287
virtual void pushInfo(std::ostream& out) const {
292
GnkPtr<GIL::IModeloIntegracion> GetModeloIntegracion() {
293
return m_pModeloIntegracion;
297
bool m_abrirDespuesDeCargar;
298
GNC::GCS::IControladorHistorial::ListaModelosDCM* m_pListaModelos;
299
GnkPtr<GIL::IModeloIntegracion> m_pModeloIntegracion;
302
class EventoLimpiarHistorial: public GNC::GCS::Eventos::IEvento
306
EventoLimpiarHistorial():GNC::GCS::Eventos::IEvento(ginkgoEVT_Core_LimpiarHistorial)
308
m_Nombre = "LimpiarHistorial";
311
~EventoLimpiarHistorial()
318
class IPanelHistorial {
320
IPanelHistorial() { }
322
~IPanelHistorial() { }
324
// virtual void CargarDICOM( const std::vector<std::string>& rutas, bool abrirDespuesDeCargar )=0;
326
virtual void DICOMActivado( GNC::GCS::IVista* pVista )=0;
328
virtual void DICOMDesactivado( GNC::GCS::IVista* pVista )=0;