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