]> Creatis software - creaContours.git/blob - lib/Interface_ManagerContour_NDimensions/wxInstantChooserPanel.h
#3381 Clean Code Segmentation VTK
[creaContours.git] / lib / Interface_ManagerContour_NDimensions / wxInstantChooserPanel.h
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 #ifndef __wxInstantChooserPanel_h_INCLUDED_H__
27 #define __wxInstantChooserPanel_h_INCLUDED_H__
28
29
30 // -----------------------------------------------------------------------------------------------------------
31 // WX headers inclusion.
32 // For compilers that support precompilation, includes <wx/wx.h>.
33 // -----------------------------------------------------------------------------------------------------------
34
35 #include <wx/wxprec.h>
36 #ifdef __BORLANDC__
37 #pragma hdrstop
38 #endif
39 #ifndef WX_PRECOMP
40 #include <wx/wx.h>
41 #endif
42
43
44 //------------------------------------------------------------------------------------------------------------
45 // Includes
46 //------------------------------------------------------------------------------------------------------------
47 #include <iostream>
48 #include <string>
49 #include <vector>
50 #include  "wxConceptControl.h"
51 #include <map>
52 #include "ConceptDataWrap.h"
53 #include <wx/event.h>
54 //------------------------------------------------------------------------------------------------------------
55 // Events declaration
56 //------------------------------------------------------------------------------------------------------------
57
58 BEGIN_DECLARE_EVENT_TYPES()
59         DECLARE_EVENT_TYPE(wxINSTANT_CHOOSER_CHANGE,400)
60 END_DECLARE_EVENT_TYPES()
61
62
63 /** file wxInstantChooserPanel.h */
64
65
66 //------------------------------------------------------------------------------------------------------------
67 // Class definition
68 //------------------------------------------------------------------------------------------------------------
69
70 class wxInstantChooserPanel : public wxPanel {
71
72         public:
73
74         //------------------------------------------------------------------------------------------------------------
75         // Constructors & Destructors
76         //------------------------------------------------------------------------------------------------------------
77         
78         wxInstantChooserPanel (wxWindow * parent, std::string title, bool theOrientation, bool resolutionALL = false, std::string configurationElem="", std::string groupConfig = "");
79
80         wxInstantChooserPanel (wxWindow * parent,wxWindowID id ,std::string title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, bool theOrientation=true, std::string configurationElem="", std::string groupConfig = "");
81
82         ~wxInstantChooserPanel();
83
84         //------------------------------------------------------------------------------------------------------------
85         // Creational and initialization methods
86         //------------------------------------------------------------------------------------------------------------
87         
88         /**
89         * Adds a concept to the instant managment. PRE: The concept doesn't exists in the included _concepts.
90         * @param aConceptName 
91         * @param minV
92         * @param maxV
93         * @param actualV
94         */
95         void addConcept(std::string aConceptName, int minV, int maxV, int actualV);
96
97         void setWxEventHandler( wxEvtHandler * theEventHandler );
98
99         //------------------------------------------------------------------------------------------------------------
100         // Methods for capturing events
101         //------------------------------------------------------------------------------------------------------------
102         void onResolutionSlider( wxScrollEvent& event );
103
104         void onCheckBoxClicked( wxCommandEvent& event );
105
106         void onConceptRelease( wxCommandEvent& event );
107         //------------------------------------------------------------------------------------------------------------
108         //  Methods for sending events
109         //------------------------------------------------------------------------------------------------------------
110
111         //------------------------------------------------------------------------------------------------------------
112         //  Attributes getters and setters
113         //------------------------------------------------------------------------------------------------------------
114         
115         ConceptDataWrap * getLastConceptData();
116
117         //------------------------------------------------------------------------------------------------------------
118         //  Other functional methods
119         //------------------------------------------------------------------------------------------------------------
120         
121         void setInstant(std::vector<int> choiceInstant);
122         void setInstant(std::map<std::string,int>* _actualInstant );
123         void getInstant(std::vector<int> & choiceInstant);
124         void getInstantData(std::map<std::string,int> & choiceInstantData);
125         std::map<std::string,int>* getInstantData();
126         void setResolutionRangeWithLasUpdate();
127         void refreshConceptLabels();
128         void setConfiguration(std::string aConfiguration);
129         std::string getConfiguration();
130         void setResolutionOverAll( bool condition );
131         bool getIfResolutionOverAll();
132         void setConceptValue( std::string theConceptName, int theValue );
133         int getConceptValue( std::string theConceptName );
134         ConceptDataWrap * getConceptDataOf( std::string theConceptName );
135         bool getIfConceptCheckedAt( std::string theConceptName, int atChecksPosition );
136         void onChangeInstant( wxCommandEvent& event );
137         void addConcepts(std::vector<std::string> conceptNameVect,std::vector<int> conceptSizeVect);
138
139         private:
140         //------------------------------------------------------------------------------------------------------------
141         //  Private methods
142         //------------------------------------------------------------------------------------------------------------
143         void initializeResolutionSlider();
144         void changeResolutionAtConceptControl( wxConceptControl * theConceptToUpdate );
145         void setVerticalMaxSelectedNums( std::string groupMaxVertNums );
146
147         //------------------------------------------------------------------------------------------------------------
148         // Attributtes
149         //------------------------------------------------------------------------------------------------------------
150
151         std::vector<wxConceptControl *> *_concepts;
152         wxConceptControl                                *_lastConceptUpdated;
153         wxSlider                                                *_resolutionSlider;
154         wxFlexGridSizer                                 *_outSizer;
155         bool                                                    _orientation;
156         bool                                                    _resolutionOverALL;
157         std::map<std::string,int>               *_actualInstant;
158         std::vector<int>                                _verticalMaxSelected;
159         wxEvtHandler                                    *_eventHandler;
160         std::string                                     _configuration;
161     
162         //DECLARE_CLASS(wxInstantChooserPanel)
163         // any class wishing to process wxWindows events must use this macro
164         //DECLARE_EVENT_TABLE()
165 };
166 #endif