]> Creatis software - creaMaracasVisu.git/blob - appli/BasicViewer/main.cxx
#2507 creaMaracasVisu Feature New Normal - creaPanelButtonContainer ListPanel
[creaMaracasVisu.git] / appli / BasicViewer / main.cxx
1 /*
2 # ---------------------------------------------------------------------
3 #
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 #                        pour la Sant�)
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 #
10 #  This software is governed by the CeCILL-B license under French law and
11 #  abiding by the rules of distribution of free software. You can  use,
12 #  modify and/ or redistribute the software under the terms of the CeCILL-B
13 #  license as circulated by CEA, CNRS and INRIA at the following URL
14 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 #  or in the file LICENSE.txt.
16 #
17 #  As a counterpart to the access to the source code and  rights to copy,
18 #  modify and redistribute granted by the license, users are provided only
19 #  with a limited warranty  and the software's author,  the holder of the
20 #  economic rights,  and the successive licensors  have only  limited
21 #  liability.
22 #
23 #  The fact that you are presently reading this means that you have had
24 #  knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------ */
26
27 #include "wx/wx.h"
28 #include "wxMaracas_N_ViewersWidget.h"
29 #include "OpenImageDialog.h"
30 #include "vtkImageData.h"
31
32 #include <structBCPSettings.h>
33 #include <buttonContainerSettings.h>
34 #include <creaPanelButtonContainer.h>
35
36 class MyApp:public wxApp
37 {
38 public:
39         virtual bool OnInit();
40 };
41
42 class MyFrame:public wxFrame
43 {
44 public:
45
46         MyFrame(const wxString& title);
47
48         void OnQuit(wxCommandEvent& event);
49         void OnOpen(wxCommandEvent& event);
50         void OnAbout(wxCommandEvent& event);
51         //void SimpleSliderDialog();
52
53 private:
54
55         //bbwx::Slider::Pointer mSlider;
56 //      bbcreaMaracasVisu::bbmaracasVisuViewerNV::Pointer viewer;
57         vtkImageData* image;
58         wxWindow* viewer;
59         DECLARE_EVENT_TABLE()
60
61 };
62
63 DECLARE_APP(MyApp)
64
65 IMPLEMENT_APP(MyApp)
66
67 bool MyApp::OnInit()
68 {
69         MyFrame *frame = new MyFrame(wxT("CREATIS basic"));
70
71         const int width = 600;
72
73         const int height = 250;
74
75         frame->SetSize(width,height);
76
77         frame->Show(true);
78
79         return true;
80 }
81
82 BEGIN_EVENT_TABLE(MyFrame,wxFrame)
83         EVT_MENU(wxID_ABOUT,MyFrame::OnAbout)
84         EVT_MENU(wxID_OPEN,MyFrame::OnOpen)
85         EVT_MENU(wxID_EXIT,MyFrame::OnQuit)
86 END_EVENT_TABLE()
87
88
89 void MyFrame::OnOpen(wxCommandEvent& event)
90 {
91         //wxMessageBox(wxT("You clicked the open option"));
92
93                         creaMaracasVisuKernel::OpenImageDialog *diag = new creaMaracasVisuKernel::OpenImageDialog(true);
94                          wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
95
96                         if(diag->getImageData() != NULL){
97                                 std::vector<int>* vectype;
98                                 vectype = new std::vector<int>();
99                                 vectype->push_back(5);
100                                 vectype->push_back(0);
101                                 viewer = new wxMaracas_N_ViewersWidget(this,diag->getImageData(), vectype);
102                         sizer->Add(viewer,1,wxGROW);
103                           SetSizer(sizer);
104                         }
105 }
106
107 void MyFrame::OnAbout(wxCommandEvent& event)
108 {
109         
110 }
111
112 void MyFrame::OnQuit(wxCommandEvent& event)
113 {
114         Close();
115 }
116
117 MyFrame::MyFrame(const wxString& title):wxFrame(NULL,wxID_ANY,title)
118 {
119
120         
121         // viewer = bbcreaMaracasVisu::bbmaracasVisuViewerNV::New("Viewer");
122         //mSlider = bbwx::Slider::New("slider");
123         //mSlider->bbUserCreateWidget(this);
124
125
126         //sizer->Add(mSlider->bbGetOutputWidget(),1,wxGROW);
127
128
129
130         wxMenu *fileMenu = new wxMenu;
131
132         wxMenu *helpMenu = new wxMenu;
133
134         helpMenu->Append(wxID_ABOUT,wxT("&About...\tF1"),wxT("Show about dialog"));
135
136         fileMenu->Append(wxID_OPEN,wxT("&O&pen\tAlt-O"),wxT("Open Files"));
137         fileMenu->Append(wxID_EXIT,wxT("&E&xit\tAlt-X"),wxT("Quit"));
138
139
140         wxMenuBar *menuBar = new wxMenuBar();
141         menuBar->Append(fileMenu,wxT("&File"));
142         menuBar->Append(helpMenu,wxT("&Help"));
143
144         SetMenuBar(menuBar);
145
146          // SetAutoLayout(true);
147         /*CreateStatusBar(2);
148         SetStatusText(wxT("CREATIS"));*/
149 }
150