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