]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSuperposition.cxx
*** empty log message ***
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / wxMaracasSuperposition.cxx
1 /*=========================================================================
2
3   Program:   wxMaracas
4   Module:    $RCSfile: wxMaracasSuperposition.cxx,v $
5   Language:  C++
6   Date:      $Date: 2009/06/03 13:47:07 $
7   Version:   $Revision: 1.3 $
8
9   Copyright: (c) 2002, 2003
10   License:
11
12      This software is distributed WITHOUT ANY WARRANTY; without even
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14      PURPOSE.  See the above copyright notice for more information.
15
16 =========================================================================*/
17
18 #include "wxMaracasSuperposition.h"
19 #include "creaWx.h"
20 #include "vtkMetaImageReader.h"
21 #include "wx/artprov.h"
22
23
24
25 wxMaracasSuperposition* wxMaracasSuperposition::instance=NULL;
26
27 wxMaracasSuperposition::wxMaracasSuperposition( wxWindow* parent, std::vector<vtkImageData*> imgs): wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize)
28 {       
29         m_mgr.SetManagedWindow(this);
30         
31         _superposition1 = NULL;
32         _superposition2 = NULL;
33         _superposition3 = NULL; 
34         
35         _images = imgs;
36         
37         // set up default notebook style
38         m_notebook_style =wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER;
39         m_notebook_theme = 0;
40         _notebook = this->createNotebook();
41         
42         createPanels();
43         configurePanels();
44 }
45
46 wxMaracasSuperposition::~wxMaracasSuperposition()
47 {
48         _notebook->Destroy();
49         m_mgr.UnInit(); 
50 }
51
52 wxMaracasSuperposition* wxMaracasSuperposition :: getInstance ( wxWindow* parent, std::vector<vtkImageData*> imgs)
53 {
54                 if(instance == NULL)
55                 {
56                         instance = new wxMaracasSuperposition(parent, imgs);
57                 }
58                 return instance;
59 }
60         
61 wxMaracasSuperposition* wxMaracasSuperposition :: getInstance()
62 {
63         return instance;
64 }
65
66 //------------------------------------------------------------------------------------------------------------
67 // Creational and initialization methods using WxAui
68 //------------------------------------------------------------------------------------------------------------
69
70 wxAuiNotebook * wxMaracasSuperposition :: createNotebook()
71 {
72         wxSize client_size = GetClientSize();
73         wxAuiNotebook* noteBook = new wxAuiNotebook(this, -1, wxPoint(client_size.x, client_size.y), wxSize(430,200), m_notebook_style);
74         wxBitmap page_bmp = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
75
76         return noteBook;
77 }
78
79 void wxMaracasSuperposition :: configurePanels()
80 {
81         if( _superposition1!=NULL )
82         {
83                 _notebook->AddPage( _superposition1, wxT("       Superoposition 1       ") );           
84                 m_mgr.Update();
85         }
86
87         if( _superposition2!=NULL )
88         {
89                 _notebook->AddPage( _superposition2, wxT("       Superoposition 2       ") );
90                 m_mgr.Update();
91         }
92         
93         if( _superposition3!=NULL )
94         {
95                 _notebook->AddPage( _superposition3, wxT("       Superoposition 3       ") );
96                 m_mgr.Update();
97         }
98         
99
100         m_mgr.AddPane(_notebook, wxAuiPaneInfo().Name(wxT("notebook_content")).CenterPane().PaneBorder(false));
101         m_mgr.Update();
102  
103         SetMinSize(wxSize(300,300));
104         m_mgr.Update();
105 }
106
107 void wxMaracasSuperposition :: createPanels()
108 {
109         if( _superposition1==NULL )
110         {
111                 createSuperpositionPanel(1);
112         }
113         
114         else if( _superposition1!=NULL )
115         {
116                 
117         }
118
119         if( _superposition2==NULL )
120         {
121                 createSuperpositionPanel(2);
122         }
123         
124         else if( _superposition2!=NULL )
125         {
126                 
127         }
128         
129         if( _superposition3==NULL )
130         {
131                 createSuperpositionPanel(3);
132         }
133         
134         else if( _superposition3!=NULL )
135         {
136                 
137         }       
138 }
139         
140 void wxMaracasSuperposition :: createSuperpositionPanel(int type)
141 {
142         if (type=1)
143         {
144                 _superposition1 = new wxMaracasSuperpositionPanel ( _images, _notebook );
145         }
146         if (type=2)
147         {
148                 _superposition2 = new wxMaracasSuperpositionPanel ( _images, _notebook );
149         }
150         if (type=3)
151         {
152                 _superposition3 = new wxMaracasSuperpositionPanel ( _images, _notebook );
153         }
154 }
155
156 void wxMaracasSuperposition :: changeImages(std::vector<vtkImageData*> imgs)
157 {
158         _images = imgs;
159         
160         createPanels();
161         configurePanels();
162 }
163
164 std::vector<vtkImageData*> wxMaracasSuperposition :: getImages( )
165 {
166                 return _images;
167 }