1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
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
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.
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
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 # ------------------------------------------------------------------------ */
28 * @brief This contains the ListWx class.
29 * @author Monica ESPINOSA (espinosa[AT]creatis.insa-lyon.fr)
36 //#include <wx/bmpbuttn.h>
38 #include <wx/string.h>
39 #include <wx/listbox.h>
50 /*! @namespace <creaButtonContainer>
51 * @brief Contains the creaButtonContainer library included in creaMaracasVisu.
53 namespace creaButtonContainer
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>
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>
66 class ListWx: public wxPanel
70 // ----------------------------------------------------------------------------------
71 /*! typedef creaButtonContainer::model::TFunctor TFunctor;
72 * @brief Defines the TFunctor type.
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
80 typedef std::pair<std::string, wxPanel*> ListAction;
81 // ----------------------------------------------------------------------------------
82 /*! @typedef std::vector<ListAction> ItemsVector;
83 * @brief Defines the Items Vector type.
85 typedef std::vector<ListAction> ItemsVector;
86 // ----------------------------------------------------------------------------------
87 //end of typedef definition.
90 // ----------------------------------------------------------------------------------
91 /*! @fn ListWx( wxWindow* parent, wxWindowID id, ItemsVector iVector,
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.
99 ListWx(wxWindow* parent, wxWindowID id, ItemsVector iVector,
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.
108 ListWx(wxWindow* parent, wxWindowID id, TFunctor* functor);
109 // ----------------------------------------------------------------------------------
110 /*! @fn virtual ~Button( );
111 * @brief This is the destructor.
115 // ----------------------------------------------------------------------------------
116 /*! @fn void OnListEvent( wxCommandEvent& event );
117 * @brief This method calls the functor when
118 * an item of list is clicked.
122 OnListEvent(wxCommandEvent& event);
123 // ----------------------------------------------------------------------------------
124 /*! @fn void SetFunctorEnabled( wxCommandEvent& event );
125 * @brief This method set the state of Functor (enable or disable)
129 SetFunctorEnabled(const bool& enabled);
130 // ----------------------------------------------------------------------------------
131 /*! @fn bool OnListEvent( wxCommandEvent& event );
132 * @brief This method ask the state of functor.
136 IsFunctorEnabled() const;
137 // ----------------------------------------------------------------------------------
138 /*! @fn wxListBox* GetListBox() const;
139 * @brief This method returns the wxlistBox.
140 * @exception std::bad_alloc
145 // ----------------------------------------------------------------------------------
149 wxListBox* m_ListBox; //!< This is the Items List.
150 TFunctor* m_Functor; //!< This is the functor.
151 bool m_FunctorEnabled; //!< Disable or Enable Functor.