creaContours_lib
wxInstantChooserPanel.h
Go to the documentation of this file.
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 
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 
83 
84  //------------------------------------------------------------------------------------------------------------
85  // Creational and initialization methods
86  //------------------------------------------------------------------------------------------------------------
87 
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 
123  void setInstant(std::map<std::string,int>* _actualInstant );
124 
125  void getInstant(std::vector<int> & choiceInstant);
126 
127  void getInstantData(std::map<std::string,int> & choiceInstantData);
128 
129  std::map<std::string,int>* getInstantData();
130 
131  void setResolutionRangeWithLasUpdate();
132 
133  void refreshConceptLabels();
134 
135  void setConfiguration(std::string aConfiguration);
136 
137  std::string getConfiguration();
138 
139  void setResolutionOverAll( bool condition );
140 
141  bool getIfResolutionOverAll();
142 
143  void setConceptValue( std::string theConceptName, int theValue );
144 
145  int getConceptValue( std::string theConceptName );
146 
147  ConceptDataWrap * getConceptDataOf( std::string theConceptName );
148 
149  bool getIfConceptCheckedAt( std::string theConceptName, int atChecksPosition );
150 
151  void onChangeInstant( wxCommandEvent& event );
152 
153  void addConcepts(std::vector<std::string> conceptNameVect,std::vector<int> conceptSizeVect);
154 
155  private:
156  //------------------------------------------------------------------------------------------------------------
157  // Private methods
158  //------------------------------------------------------------------------------------------------------------
159  void initializeResolutionSlider();
160 
161  void changeResolutionAtConceptControl( wxConceptControl * theConceptToUpdate );
162 
163  void setVerticalMaxSelectedNums( std::string groupMaxVertNums );
164 
165  //------------------------------------------------------------------------------------------------------------
166  // Attributtes
167  //------------------------------------------------------------------------------------------------------------
168 
169  std::vector<wxConceptControl *> * _concepts;
170 
172 
173  wxSlider * _resolutionSlider;
174 
175  wxFlexGridSizer * _outSizer;
176 
178 
180 
181  std::map<std::string,int>* _actualInstant;
182 
183  std::vector<int> _verticalMaxSelected;
184 
185  wxEvtHandler * _eventHandler;
186 
187  std::string _configuration;
188 
189 
190  //DECLARE_CLASS(wxInstantChooserPanel)
191  // any class wishing to process wxWindows events must use this macro
192  //DECLARE_EVENT_TABLE()
193 
194 };
195 
196 #endif