]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/comboBox.h
#2620 creaMaracasVisu Feature New Normal - creaPanelButtonContainer New wxWidget...
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / creaButtonContainer / view / comboBox.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 /*!
27  * @file listWx.h
28  * @brief This contains the ListWx class.
29  * @author Monica ESPINOSA (espinosa[AT]creatis.insa-lyon.fr)
30  * @date  2015-01-02
31  */
32
33 #ifndef COMBOBOX_H
34 #define COMBOBOX_H
35
36 //#include <wx/bmpbuttn.h>
37 #include <wx/panel.h>
38 #include <wx/string.h>
39 #include <wx/combobox.h>
40 #include <wx/wx.h>
41 #include <wx/event.h>
42
43 #include <string>
44 #include <vector>
45 #include <utility>
46
47 #include "functor.h"
48 #include "system.h"
49
50 /*!     @namespace <creaButtonContainer>
51  *      @brief Contains the creaButtonContainer library included in creaMaracasVisu.
52  */
53 namespace creaButtonContainer
54 {
55         /*! @namespace <creaButtonContainer::view>
56          *      @brief Contains the implementation of the view in creaButtonContainer library.
57          *      @see <a href="http://en.wikipedia.org/wiki/Model-view-controller">MVC Software Architecture</a>
58          */
59         namespace view
60         {
61                 /*! @class ListWx listWx.h "listWx.h"
62                  *      @brief This class contains the list in the panel.
63                  *  @details This class contains the information of a list, it derives from wxPanel.
64                  *  @see <a href="http://docs.wxwidgets.org/stable/wx_wxpanel.html">wxPanel</a>
65                  */
66                 class ComboBox: public wxPanel
67                 {
68                         public:
69                                 //typedef definition.
70                                 // ----------------------------------------------------------------------------------
71                                 /*!     typedef creaButtonContainer::model::TFunctor TFunctor;
72                                  *      @brief Defines the TFunctor type.
73                                  */
74                                 typedef creaButtonContainer::model::TFunctor TFunctor;
75                                 // ----------------------------------------------------------------------------------
76                                 /*!     @typedef std::pair<std::string, wxPanel*> ListAction;
77                                  *      @brief Defines the ListAction type.
78                                  *      First is the button name(item list), Second FunctionEventType
79                                  */
80                                 typedef std::pair<std::string, wxPanel*> ListAction;
81                                 // ----------------------------------------------------------------------------------
82                                 /*!     @typedef std::vector<ListAction> ItemsVector;
83                                  *      @brief Defines the Items Vector type.
84                                  */
85                                 typedef std::vector<ListAction> ItemsVector;
86                                 // ----------------------------------------------------------------------------------
87                                 //end of typedef definition.
88
89                         public:
90                                 // ----------------------------------------------------------------------------------
91                                 /*! @fn ListWx( wxWindow* parent, wxWindowID id, ItemsVector iVector,
92                                  TFunctor* functor );
93                                  *      @brief This is the parameterized constructor.
94                                  *      @param parent The wxWindow pointer to parent.
95                                  *      @param id The wxID of the button.
96                                  *      @param ItemsVector //The items Vector (name, wxPanel).
97                                  *      @param TFunctor //The functor of items list.
98                                  */
99                                 ComboBox(wxWindow* parent, wxWindowID id, ItemsVector iVector,
100                                                 TFunctor* functor);
101                                 // ----------------------------------------------------------------------------------
102                                 /*! @fn ListWx( wxWindow* parent, wxWindowID id, TFunctor* functor );
103                                  *      @brief This is the parameterized constructor.
104                                  *      @param parent The wxWindow pointer to parent.
105                                  *      @param id The wxID of the button.
106                                  *      @param TFunctor //The functor of items list.
107                                  */
108                                 ComboBox(wxWindow* parent, wxWindowID id, TFunctor* functor);
109                                 // ----------------------------------------------------------------------------------
110                                 /*! @fn virtual ~Button( );
111                                  *      @brief This is the destructor.
112                                  */
113                                 virtual
114                                 ~ComboBox();
115                                 // ----------------------------------------------------------------------------------
116                                 /*! @fn void OnListEvent( wxCommandEvent& event );
117                                  *  @brief This method calls the functor when
118                                  *  an item of list is clicked.
119                                  *      @param event
120                                  */
121                                 void
122                                 OnComboBoxEvent(wxCommandEvent& event);
123                                 // ----------------------------------------------------------------------------------
124                                 /*! @fn void SetFunctorEnabled( wxCommandEvent& event );
125                                  *  @brief This method set the state of Functor (enable or disable)
126                                  *      @param enabled
127                                  */
128                                 void
129                                 SetFunctorEnabled(const bool& enabled);
130                                 // ----------------------------------------------------------------------------------
131                                 /*! @fn bool OnListEvent( wxCommandEvent& event );
132                                  *  @brief This method ask the state of functor.
133                                  *      @return
134                                  */
135                                 bool
136                                 IsFunctorEnabled() const;
137                                 // ----------------------------------------------------------------------------------
138                                 /*! @fn wxListBox* GetListBox() const;
139                                  *      @brief This method returns the wxlistBox.
140                                  *      @exception std::bad_alloc
141                                  *      @return wxListBox
142                                  */
143                                 wxComboBox*
144                                 GetComboBox() const;
145                                 // ----------------------------------------------------------------------------------
146
147                         private:
148
149                                 wxComboBox* m_ComboBox;                         //!< This is the Items List.
150                                 TFunctor* m_Functor;                            //!< This is the functor.
151                                 bool m_FunctorEnabled;                          //!< Disable or Enable Functor.
152
153                 };
154         } //ecapseman
155 } //ecapseman
156
157 #endif // COMBOBOX_H