]> Creatis software - creaMaracasVisu.git/blob
80528a24488ef2a1eb1fbfaacb815ef8475de26e
[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                         //MLER
123                         // ----------------------------------------------------------------------------------
124                         /*!     @typedef std::pair<std::string, wxPanel*> ListAction;
125                          *      @brief Defines the ListAction type.
126                          *      First is the button name(item list), Second FunctionEventType
127                          */
128                         typedef std::pair<std::string, wxPanel*> ListAction;
129                         // ----------------------------------------------------------------------------------
130                         /*!     @typedef std::vector<ListAction> ItemsVector;
131                          *      @brief Defines the Items Vector type.
132                          */
133                         typedef std::vector<ListAction> ItemsVector;
134                         //MLER
135                         //end typedef definition
136                         // ----------------------------------------------------------------------------------
137
138                 public:
139                         // ----------------------------------------------------------------------------------
140                         /*! @fn ButtonContainerSettings( );
141                          *      @brief This is the default constructor.
142                          */
143                         ButtonContainerSettings();
144                         // ----------------------------------------------------------------------------------
145                         /*! @fn virtual ~ButtonContainerSettings( );
146                          *      @brief This is the destructor.
147                          */
148                         virtual
149                         ~ButtonContainerSettings();
150
151                         // ----------------------------------------------------------------------------------
152                         /*! @fn ButtonGroupMap GetButtonGroupContainer( );
153                          *      @brief This method returns ButtonGroupMap with all buttons.
154                          * @return
155                          */
156                         ButtonGroupMap
157                         GetButtonGroupContainer();
158                         // ----------------------------------------------------------------------------------
159                         /*! @fn KeyMapList GetGroupNameList( );
160                          *      @brief This method returns a KeyMapsList with the name of the groups.
161                          * @return
162                          */
163                         KeyMapList
164                         GetGroupNameList();
165                         // ----------------------------------------------------------------------------------
166                         /*! @fn PanelButton GetPanelButton( const std::string &buttonName );
167                          *      @brief This method returns the panel of a button.
168                          *      @param buttonName
169                          *      @exception std::bad_alloc
170                          *      @return
171                          */
172                         PanelButton
173                         GetPanelButton(const std::string &buttonName);
174                         // ----------------------------------------------------------------------------------
175                         /*! @fn ButtonGroupSettings* GetButtonGroupSettings( TFunctor* functor );
176                          *      @brief this method return the settings the generic settings for creaButtonContainer.
177                          * @param functor The function to be called in the action button.
178                          * @exception std::bad_alloc
179                          * @return
180                          */
181                         ButtonGroupSettings*
182                         GetButtonGroupSettings(TFunctor* functor);
183                         // ----------------------------------------------------------------------------------
184                         /*! @fn void SetButtonGroupContainer( ButtonGroupMap bGroupContainer );
185                          *      @brief This method sets the button group container.
186                          * @param bGroupContainer
187                          */
188                         // ----------------------------------------------------------------------------------
189                         void
190                         SetButtonGroupContainer(ButtonGroupMap bGroupContainer);
191                         // ----------------------------------------------------------------------------------
192                         /*! @fn void SetGroupNameList( KeyMapList gNameList );
193                          *      @brief this method sets the groupName list
194                          * @param gNameList
195                          */
196                         void
197                         SetGroupNameList(KeyMapList gNameList);
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                         /*! @fn void AddButton( BCPSettingsStruct* info );
216                          * @brief This method adds a new button into a group of buttons.
217                          * @param info The pointer to BCPSettingsStruct.
218                          * @exception std::bad_alloc
219                          */
220                         void
221                         AddButton(BCPSettingsStruct* info);
222                         // ----------------------------------------------------------------------------------
223                         /*! @fn void InitModel( BCStructVectorType infoList, int type );
224                          * @brief This method adds new buttons or items into the container (Depends type).
225                          * @param infoList The BCStructVectorType
226                          * @param type If 1:Buttons 2:List 3:Configurable List
227                          * @exception std::bad_alloc
228                          */
229                         void
230                         InitModel(BCStructVectorType infoList, int type);
231                         // ----------------------------------------------------------------------------------
232                         //MLER
233                         /*! @fn void AddItems( BCPSettingsStruct* info );
234                          * @brief This method adds a new item into a list.
235                          * @param info The pointer to BCPSettingsStruct.
236                          * @exception std::bad_alloc
237                          */
238                         void
239                         AddItems(BCPSettingsStruct* info);
240                         // ----------------------------------------------------------------------------------
241                         /*! @fn PanelButton GetPanelList( const std::string &buttonName );
242                          *      @brief This method returns the panel of a list.
243                          *      @param buttonName (item element)
244                          *      @exception std::bad_alloc
245                          *      @return
246                          */
247                         ItemsVector
248                         GetItemsVector();
249                         // ----------------------------------------------------------------------------------
250                         /*! @fn PanelButton GetPanelList( const std::string &buttonName );
251                          *      @brief This method returns the panel of a list.
252                          *      @param buttonName (item element)
253                          *      @exception std::bad_alloc
254                          *      @return
255                          */
256                         wxPanel*
257                         GetPanelList(const StringType &buttonName);
258                         //MLER
259                         // ----------------------------------------------------------------------------------
260                 private:
261                         ButtonGroupMap m_ButtonGroupContainer; //!<This is the map with the groups of buttons.
262                         KeyMapList m_GroupNameList; //!<This is a container with the name of the groups.
263
264                         //MLER
265                         ItemsVector m_ItemsVector; //!<This is the vector containing a pair of each item name and its wxPanel.
266
267         };
268 } //ecapseman
269 #endif /* BUTTONCONTAINERSETTINGS_H_ */