]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSuperposition.cxx
Support #1768 CREATIS Licence insertion
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / wxMaracasSuperposition.cxx
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 #  This software is governed by the CeCILL-B license under French law and
10 #  abiding by the rules of distribution of free software. You can  use,
11 #  modify and/ or redistribute the software under the terms of the CeCILL-B
12 #  license as circulated by CEA, CNRS and INRIA at the following URL
13 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 #  or in the file LICENSE.txt.
15 #
16 #  As a counterpart to the access to the source code and  rights to copy,
17 #  modify and redistribute granted by the license, users are provided only
18 #  with a limited warranty  and the software's author,  the holder of the
19 #  economic rights,  and the successive licensors  have only  limited
20 #  liability.
21 #
22 #  The fact that you are presently reading this means that you have had
23 #  knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
25
26 /*=========================================================================
27
28   Program:   wxMaracas
29   Module:    $RCSfile: wxMaracasSuperposition.cxx,v $
30   Language:  C++
31   Date:      $Date: 2012/11/15 14:14:35 $
32   Version:   $Revision: 1.6 $
33
34   Copyright: (c) 2002, 2003
35   License:
36
37      This software is distributed WITHOUT ANY WARRANTY; without even
38      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
39      PURPOSE.  See the above copyright notice for more information.
40
41 =========================================================================*/
42
43 #include "wxMaracasSuperposition.h"
44 #include "creaWx.h"
45 #include "vtkMetaImageReader.h"
46 #include "wx/artprov.h"
47
48
49
50 wxMaracasSuperposition* wxMaracasSuperposition::instance=NULL;
51
52 wxMaracasSuperposition::wxMaracasSuperposition( wxWindow* parent, std::vector<vtkImageData*> imgs): wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize)
53 {       
54         m_mgr.SetManagedWindow(this);
55         
56         _superposition1 = NULL;
57         _superposition2 = NULL;
58         _superposition3 = NULL; 
59         
60         _images = imgs;
61         
62         // set up default notebook style
63         m_notebook_style =wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER;
64         m_notebook_theme = 0;
65         _notebook = this->createNotebook();
66         
67         createPanels();
68         configurePanels();
69 }
70
71 wxMaracasSuperposition::~wxMaracasSuperposition()
72 {
73         _notebook->Destroy();
74         instance = NULL;
75         m_mgr.UnInit();
76 }
77
78 wxMaracasSuperposition* wxMaracasSuperposition :: getInstance ( wxWindow* parent, std::vector<vtkImageData*> imgs)
79 {
80                 if(instance == NULL)
81                 {
82                         instance = new wxMaracasSuperposition(parent, imgs);
83                 }
84                 return instance;
85 }
86         
87 wxMaracasSuperposition* wxMaracasSuperposition :: getInstance()
88 {
89         return instance;
90 }
91
92 //------------------------------------------------------------------------------------------------------------
93 // Creational and initialization methods using WxAui
94 //------------------------------------------------------------------------------------------------------------
95
96 wxAuiNotebook * wxMaracasSuperposition :: createNotebook()
97 {
98         wxSize client_size = GetClientSize();
99         wxAuiNotebook* noteBook = new wxAuiNotebook(this, -1, wxPoint(client_size.x, client_size.y), wxSize(430,200), m_notebook_style);
100         wxBitmap page_bmp = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
101
102         return noteBook;
103 }
104
105 void wxMaracasSuperposition :: configurePanels()
106 {
107         if( _superposition1!=NULL )
108         {
109                 _notebook->AddPage( _superposition1, wxT("       Superoposition 1       ") );           
110                 m_mgr.Update();
111         }
112
113         if( _superposition2!=NULL )
114         {
115                 _notebook->AddPage( _superposition2, wxT("       Superoposition 2       ") );
116                 m_mgr.Update();
117         }
118         
119         if( _superposition3!=NULL )
120         {
121                 _notebook->AddPage( _superposition3, wxT("       Superoposition 3       ") );
122                 m_mgr.Update();
123         }
124         
125
126         m_mgr.AddPane(_notebook, wxAuiPaneInfo().Name(wxT("notebook_content")).CenterPane().PaneBorder(false));
127         m_mgr.Update();
128  
129         SetMinSize(wxSize(300,300));
130         m_mgr.Update();
131 }
132
133 void wxMaracasSuperposition :: createPanels()
134 {
135         if( _superposition1==NULL )
136         {
137                 _superposition1 = new wxMaracasSuperpositionPanel ( _images, 1, _notebook );
138         }
139         
140         else if( _superposition1!=NULL )
141         {
142                 
143         }
144
145         if( _superposition2==NULL )
146         {
147                 _superposition2 = new wxMaracasSuperpositionPanel ( _images, 2, _notebook );
148         }
149         
150         else if( _superposition2!=NULL )
151         {
152                 
153         }
154         
155         if( _superposition3==NULL )
156         {
157                 _superposition3 = new wxMaracasSuperpositionPanel ( _images, 3, _notebook );
158         }
159         
160         else if( _superposition3!=NULL )
161         {
162                 
163         }       
164 }
165
166
167 void wxMaracasSuperposition :: changeImages(std::vector<vtkImageData*> imgs)
168 {
169         _images = imgs;
170         
171         createPanels();
172         configurePanels();
173 }
174
175 std::vector<vtkImageData*> wxMaracasSuperposition :: getImages( )
176 {
177                 return _images;
178 }