]> Creatis software - creaMaracasVisu.git/blob
3d71e1a85b13e6195a9f48236df4a79806e909c0
[creaMaracasVisu.git] /
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 buttonContainerSettings.h
28  * @brief This contains the ButtonContainerSettings class.
29  * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
30  * @date  2011-06-02
31  */
32
33 #ifndef BUTTONCONTAINERSETTINGS_H_
34 #define BUTTONCONTAINERSETTINGS_H_
35
36 #include <wx/panel.h>
37 #include <wx/bitmap.h>
38 #include <wx/listctrl.h>
39
40 #include <list>
41 #include <map>
42 #include <vector>
43 #include <iostream>
44
45 #include "structBCPSettings.h"
46 #include "containerSettings.h"
47 #include "functor.h"
48
49 /*!     @namespace <creaPanelButtonContainer>
50  *      @brief Contains the creaPanelButtonContainer library included in creaMaracasVisu.
51  */
52 namespace creaPanelButtonContainer
53 {
54         /*! @class ButtonContainerSettings buttonContainerSettings.h "buttonContainerSettings.h"
55          *      @brief This class contains the settings of the buttons.
56          */
57         class ButtonContainerSettings
58         {
59                 public:
60                         //typedef definition.
61                         // ----------------------------------------------------------------------------------
62                         /*!     @typedef std::string* StringType;
63                          *      @brief Defines the StringType type.
64                          */
65                         typedef std::string StringType;
66                         // ----------------------------------------------------------------------------------
67                         /*!     typedef creaButtonContainer::model::TFunctor TFunctor;
68                          *      @brief Defines the TFunctor type.
69                          */
70                         typedef creaButtonContainer::model::TFunctor TFunctor;
71                         // ----------------------------------------------------------------------------------
72                         /*!     @typedef creaButtonContainer::model::ContainerSettings ButtonGroupSettings;
73                          *      @brief Defines the ButtonGroupSettings type.
74                          */
75                         typedef creaButtonContainer::model::ContainerSettings ButtonGroupSettings;
76                         // ----------------------------------------------------------------------------------
77                         /*!     @typedef wxPanel* PanelButton;
78                          *      @brief Defines the PanelButton type.
79                          */
80                         typedef wxPanel* PanelButton;
81                         // ----------------------------------------------------------------------------------
82                         /*!     @typedef std::pair< std::string, PanelButton > ActionButton;
83                          *      @brief Defines the ActionButton type.
84                          *      First is the button name, Second FunctionEventType
85                          */
86                         typedef std::pair<std::string, PanelButton> ActionButton;
87
88                         // ----------------------------------------------------------------------------------
89                         /*!     @typedef std::pair< std::string, wxBitmap > ButtonInfo;
90                          *      @brief Defines the ButtonInfo type.
91                          *      First is the ButtonName, Second is the ImageIcon
92                          */
93                         typedef std::pair<std::string, wxBitmap> ButtonInfo;
94
95                         // ----------------------------------------------------------------------------------
96                         /*!     @typedef std::pair< ButtonInfo*, ActionButton* > ButtonPair;
97                          *      @brief Defines the ButtonPair type.
98                          */
99                         typedef std::pair<ButtonInfo*, ActionButton*> ButtonPair;
100                         // ----------------------------------------------------------------------------------
101                         /*!     @typedef std::list< std::string > KeyMapList;
102                          *      @brief Defines the KeyMapList type.
103                          */
104                         typedef std::list<std::string> KeyMapList;
105
106                         // ----------------------------------------------------------------------------------
107                         /*!     @typedef std::list< ButtonPair* > ButtonList;
108                          *      @brief Defines the ButtonList type.
109                          */
110                         typedef std::list<ButtonPair*> ButtonList;
111
112                         // ----------------------------------------------------------------------------------
113                         /*!     @typedef std::map< std::string, ButtonList > ButtonGroupMap;
114                          *      @brief Defines the ButtonGroupMap type.
115                          */
116                         typedef std::map<std::string, ButtonList> ButtonGroupMap;
117                         // ----------------------------------------------------------------------------------
118                         /*!     @typedef std::vector< BCPSettingsStruct* > BCStructVectorType;
119                          *      @brief Defines the BCStructVectorType type.
120                          */
121                         typedef std::vector<BCPSettingsStruct*> BCStructVectorType;
122                         //end typedef definition
123
124                         //MLER
125                         typedef std::pair<std::string, wxPanel*> ListAction;
126                         typedef std::vector<ListAction> ItemsVector;
127                         //MLER
128
129                         // ----------------------------------------------------------------------------------
130
131                 public:
132                         // ----------------------------------------------------------------------------------
133                         /*! @fn ButtonContainerSettings( );
134                          *      @brief This is the default constructor.
135                          */
136                         ButtonContainerSettings();
137                         // ----------------------------------------------------------------------------------
138                         /*! @fn virtual ~ButtonContainerSettings( );
139                          *      @brief This is the destructor.
140                          */
141                         virtual
142                         ~ButtonContainerSettings();
143
144                         // ----------------------------------------------------------------------------------
145                         /*! @fn ButtonGroupMap GetButtonGroupContainer( );
146                          *      @brief This method returns ButtonGroupMap with all buttons.
147                          * @return
148                          */
149                         ButtonGroupMap
150                         GetButtonGroupContainer();
151                         // ----------------------------------------------------------------------------------
152                         /*! @fn KeyMapList GetGroupNameList( );
153                          *      @brief This method returns a KeyMapsList with the name of the groups.
154                          * @return
155                          */
156                         KeyMapList
157                         GetGroupNameList();
158                         // ----------------------------------------------------------------------------------
159                         /*! @fn PanelButton GetPanelButton( const std::string &buttonName );
160                          *      @brief This method returns the panel of a button.
161                          *      @param buttonName
162                          *      @exception std::bad_alloc
163                          *      @return
164                          */
165                         PanelButton
166                         GetPanelButton(const std::string &buttonName);
167                         // ----------------------------------------------------------------------------------
168                         /*! @fn ButtonGroupSettings* GetButtonGroupSettings( TFunctor* functor );
169                          *      @brief this method return the settings the generic settings for creaButtonContainer.
170                          * @param functor The function to be called in the action button.
171                          * @exception std::bad_alloc
172                          * @return
173                          */
174                         ButtonGroupSettings*
175                         GetButtonGroupSettings(TFunctor* functor);
176                         // ----------------------------------------------------------------------------------
177                         /*! @fn void SetButtonGroupContainer( ButtonGroupMap bGroupContainer );
178                          *      @brief This method sets the button group container.
179                          * @param bGroupContainer
180                          */
181
182                         // ----------------------------------------------------------------------------------
183                         ButtonGroupSettings*
184                         GetListGroupSettings();
185
186                         // ----------------------------------------------------------------------------------
187
188                         void
189                         SetButtonGroupContainer(ButtonGroupMap bGroupContainer);
190                         // ----------------------------------------------------------------------------------
191                         /*! @fn void SetGroupNameList( KeyMapList gNameList );
192                          *      @brief this method sets the groupName list
193                          * @param gNameList
194                          */
195                         void
196                         SetGroupNameList(KeyMapList gNameList);
197
198                         // ----------------------------------------------------------------------------------
199                         /*! @fn void AddButton( const std::string &groupName, const std::string &buttonName,
200                          const std::string &iconpath, const std::string &buttonDescription,
201                          PanelButton panel );
202                          * @brief This method adds a new button into a group of buttons.
203                          * @param groupName The button groupName
204                          * @param buttonName The buttonName
205                          * @param iconpath The path of the icon
206                          * @param buttonDescription The button tooltip
207                          * @param panel The panel to be called when the button is clicked
208                          * @exception std::bad_alloc
209                          */
210                         void
211                         AddButton(const std::string &groupName, const std::string &buttonName,
212                                         const wxBitmap &icon, const std::string &buttonDescription,
213                                         PanelButton panel);
214
215                         // ----------------------------------------------------------------------------------
216                         /*! @fn void AddButton( BCPSettingsStruct* info );
217                          * @brief This method adds a new button into a group of buttons.
218                          * @param info The pointer to BCPSettingsStruct.
219                          * @exception std::bad_alloc
220                          */
221                         void
222                         AddButton(BCPSettingsStruct* info);
223
224                         // ----------------------------------------------------------------------------------
225                         /*! @fn void AddButtons( BCStructVectorType infoList );
226                          * @brief This method adds new buttons into the container.
227                          * @param infoList The BCStructVectorType
228                          * @exception std::bad_alloc
229                          */
230                         void
231                         InitModel(BCStructVectorType infoList, int type);
232                         // ----------------------------------------------------------------------------------
233                         //MLER
234                         void
235                         AddItems(BCPSettingsStruct* info);
236                         // ----------------------------------------------------------------------------------
237                         ItemsVector
238                         GetItemsVector();
239
240                         wxPanel*
241                         GetPanelList(const StringType &buttonName);
242
243                         //MLER
244                         // ----------------------------------------------------------------------------------
245                 private:
246                         ButtonGroupMap m_ButtonGroupContainer; //!<This is the map with the groups of buttons.
247                         KeyMapList m_GroupNameList; //!<This is a container with the name of the groups.
248
249                         //MLER
250                         ItemsVector m_ItemsVector; //!<This is the vector containing a pair of each item name and its wxPanel.
251
252         };
253 } //ecapseman
254 #endif /* BUTTONCONTAINERSETTINGS_H_ */