]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasSuperposition.cxx
6bb119fcd5021c5c94f39ce4479cc372192fc2be
[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/08 12:35:29 $
7   Version:   $Revision: 1.5 $
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         instance = NULL;
50         m_mgr.UnInit();
51 }
52
53 wxMaracasSuperposition* wxMaracasSuperposition :: getInstance ( wxWindow* parent, std::vector<vtkImageData*> imgs)
54 {
55                 if(instance == NULL)
56                 {
57                         instance = new wxMaracasSuperposition(parent, imgs);
58                 }
59                 return instance;
60 }
61         
62 wxMaracasSuperposition* wxMaracasSuperposition :: getInstance()
63 {
64         return instance;
65 }
66
67 //------------------------------------------------------------------------------------------------------------
68 // Creational and initialization methods using WxAui
69 //------------------------------------------------------------------------------------------------------------
70
71 wxAuiNotebook * wxMaracasSuperposition :: createNotebook()
72 {
73         wxSize client_size = GetClientSize();
74         wxAuiNotebook* noteBook = new wxAuiNotebook(this, -1, wxPoint(client_size.x, client_size.y), wxSize(430,200), m_notebook_style);
75         wxBitmap page_bmp = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
76
77         return noteBook;
78 }
79
80 void wxMaracasSuperposition :: configurePanels()
81 {
82         if( _superposition1!=NULL )
83         {
84                 _notebook->AddPage( _superposition1, wxT("       Superoposition 1       ") );           
85                 m_mgr.Update();
86         }
87
88         if( _superposition2!=NULL )
89         {
90                 _notebook->AddPage( _superposition2, wxT("       Superoposition 2       ") );
91                 m_mgr.Update();
92         }
93         
94         if( _superposition3!=NULL )
95         {
96                 _notebook->AddPage( _superposition3, wxT("       Superoposition 3       ") );
97                 m_mgr.Update();
98         }
99         
100
101         m_mgr.AddPane(_notebook, wxAuiPaneInfo().Name(wxT("notebook_content")).CenterPane().PaneBorder(false));
102         m_mgr.Update();
103  
104         SetMinSize(wxSize(300,300));
105         m_mgr.Update();
106 }
107
108 void wxMaracasSuperposition :: createPanels()
109 {
110         if( _superposition1==NULL )
111         {
112                 _superposition1 = new wxMaracasSuperpositionPanel ( _images, 1, _notebook );
113         }
114         
115         else if( _superposition1!=NULL )
116         {
117                 
118         }
119
120         if( _superposition2==NULL )
121         {
122                 _superposition2 = new wxMaracasSuperpositionPanel ( _images, 2, _notebook );
123         }
124         
125         else if( _superposition2!=NULL )
126         {
127                 
128         }
129         
130         if( _superposition3==NULL )
131         {
132                 _superposition3 = new wxMaracasSuperpositionPanel ( _images, 3, _notebook );
133         }
134         
135         else if( _superposition3!=NULL )
136         {
137                 
138         }       
139 }
140
141
142 void wxMaracasSuperposition :: changeImages(std::vector<vtkImageData*> imgs)
143 {
144         _images = imgs;
145         
146         createPanels();
147         configurePanels();
148 }
149
150 std::vector<vtkImageData*> wxMaracasSuperposition :: getImages( )
151 {
152                 return _images;
153 }