]> Creatis software - creaMaracasVisu.git/blob
92391e1b719048c460f5eef967af7a75aede9e43
[creaMaracasVisu.git] /
1 /*!
2  * @file buttonContainerSettings.h
3  * @brief This contains the ButtonContainerSettings class.
4  * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
5  * @date  2011-06-02
6  */
7
8 #ifndef BUTTONCONTAINERSETTINGS_H_
9 #define BUTTONCONTAINERSETTINGS_H_
10
11 #include <wx/panel.h>
12
13 #include <list>
14 #include <map>
15 #include <vector>
16 #include <iostream>
17
18 #include "structBCPSettings.h"
19 #include "containerSettings.h"
20 #include "functor.h"
21
22 /*!     @namespace <creaPanelButtonContainer>
23  *      @brief Contains the creaPanelButtonContainer library included in creaMaracasVisu.
24  */
25 namespace creaPanelButtonContainer
26 {
27         /*! @class ButtonContainerSettings buttonContainerSettings.h "buttonContainerSettings.h"
28          *      @brief This class contains the settings of the buttons.
29          */
30         class ButtonContainerSettings
31         {
32                 public:
33                         //typedef definition.
34                         // ----------------------------------------------------------------------------------
35                         /*!     @typedef std::string* StringType;
36                          *      @brief Defines the StringType type.
37                          */
38                         typedef std::string StringType;
39                         // ----------------------------------------------------------------------------------
40                         /*!     typedef creaButtonContainer::model::TFunctor TFunctor;
41                          *      @brief Defines the TFunctor type.
42                          */
43                         typedef creaButtonContainer::model::TFunctor TFunctor;
44                         // ----------------------------------------------------------------------------------
45                         /*!     @typedef creaButtonContainer::model::ContainerSettings ButtonGroupSettings;
46                          *      @brief Defines the ButtonGroupSettings type.
47                          */
48                         typedef creaButtonContainer::model::ContainerSettings ButtonGroupSettings;
49                         // ----------------------------------------------------------------------------------
50                         /*!     @typedef wxPanel* PanelButton;
51                          *      @brief Defines the PanelButton type.
52                          */
53                         typedef wxPanel* PanelButton;
54                         // ----------------------------------------------------------------------------------
55                         /*!     @typedef std::pair< std::string, PanelButton > ActionButton;
56                          *      @brief Defines the ActionButton type.
57                          *      First is the button description, Second FunctionEventType
58                          */
59                         typedef std::pair< std::string, PanelButton > ActionButton;
60                         // ----------------------------------------------------------------------------------
61                         /*!     @typedef std::pair< std::string, std::string > ButtonInfo;
62                          *      @brief Defines the ButtonInfo type.
63                          *      First is the ButtonName, Second is the ImageIconPath
64                          */
65                         typedef std::pair< std::string, std::string > ButtonInfo;
66                         // ----------------------------------------------------------------------------------
67                         /*!     @typedef std::pair< ButtonInfo*, ActionButton* > ButtonPair;
68                          *      @brief Defines the ButtonPair type.
69                          */
70                         typedef std::pair< ButtonInfo*, ActionButton* > ButtonPair;
71                         // ----------------------------------------------------------------------------------
72                         /*!     @typedef std::list< std::string > KeyMapList;
73                          *      @brief Defines the KeyMapList type.
74                          */
75                         typedef std::list< std::string > KeyMapList;
76                         // ----------------------------------------------------------------------------------
77                         /*!     @typedef std::list< ButtonPair* > ButtonList;
78                          *      @brief Defines the ButtonList type.
79                          */
80                         typedef std::list< ButtonPair* > ButtonList;
81                         // ----------------------------------------------------------------------------------
82                         /*!     @typedef std::map< std::string, ButtonList > ButtonGroupMap;
83                          *      @brief Defines the ButtonGroupMap type.
84                          */
85                         typedef std::map< std::string, ButtonList > ButtonGroupMap;
86                         // ----------------------------------------------------------------------------------
87                         /*!     @typedef std::vector< BCPSettingsStruct* > BCStructVectorType;
88                          *      @brief Defines the BCStructVectorType type.
89                          */
90                         typedef std::vector< BCPSettingsStruct* > BCStructVectorType;
91                         //end typedef definition
92                         // ----------------------------------------------------------------------------------
93                         /*! @class ButtonContainerSettings buttonContainerSettings.h "buttonContainerSettings.h"
94                          *      @brief This class contains the settings of the button container.
95                          */
96                 public:
97                         // ----------------------------------------------------------------------------------
98                         /*! @fn ButtonContainerSettings( );
99                          *      @brief This is the default constructor.
100                          */
101                         ButtonContainerSettings( );
102                         // ----------------------------------------------------------------------------------
103                         /*! @fn virtual ~ButtonContainerSettings( );
104                          *      @brief This is the destructor.
105                          */
106                         virtual
107                         ~ButtonContainerSettings( );
108                         // ----------------------------------------------------------------------------------
109                         /*! @fn ButtonGroupMap GetButtonGroupContainer( );
110                          *      @brief This method returns ButtonGroupMap with all buttons.
111                          * @return
112                          */
113                         ButtonGroupMap
114                         GetButtonGroupContainer( );
115                         // ----------------------------------------------------------------------------------
116                         /*! @fn KeyMapList GetGroupNameList( );
117                          *      @brief This method returns a KeyMapsList with the name of the groups.
118                          * @return
119                          */
120                         KeyMapList
121                         GetGroupNameList( );
122                         // ----------------------------------------------------------------------------------
123                         /*! @fn PanelButton GetPanelButton( const std::string &buttonName );
124                          *      @brief This method returns the panel of a button.
125                          *      @param buttonName
126                          *      @exception std::bad_alloc
127                          *      @return
128                          */
129                         PanelButton
130                         GetPanelButton( const std::string &buttonName );
131                         // ----------------------------------------------------------------------------------
132                         /*! @fn ButtonGroupSettings* GetButtonGroupSettings( TFunctor* functor );
133                          *      @brief this method return the settings the generic settings for creaButtonContainer.
134                          * @param functor The function to be called in the action button.
135                          * @exception std::bad_alloc
136                          * @return
137                          */
138                         ButtonGroupSettings*
139                         GetButtonGroupSettings( TFunctor* functor );
140                         // ----------------------------------------------------------------------------------
141                         /*! @fn void SetButtonGroupContainer( ButtonGroupMap bGroupContainer );
142                          *      @brief This method sets the button group container.
143                          * @param bGroupContainer
144                          */
145                         void
146                         SetButtonGroupContainer( ButtonGroupMap bGroupContainer );
147                         // ----------------------------------------------------------------------------------
148                         /*! @fn void SetGroupNameList( KeyMapList gNameList );
149                          *      @brief this method sets the groupName list
150                          * @param gNameList
151                          */
152                         void
153                         SetGroupNameList( KeyMapList gNameList );
154                         // ----------------------------------------------------------------------------------
155                         /*! @fn void AddButton( const std::string &groupName, const std::string &buttonName,
156                          const std::string &iconpath, const std::string &buttonDescription,
157                          PanelButton panel );
158                          * @brief This method adds a new button into a group of buttons.
159                          * @param groupName The button groupName
160                          * @param buttonName The buttonName
161                          * @param iconpath The path of the icon
162                          * @param buttonDescription The button tooltip
163                          * @param panel The panel to be called when the button is clicked
164                          * @exception std::bad_alloc
165                          */
166                         void
167                         AddButton( const std::string &groupName, const std::string &buttonName,
168                             const std::string &iconpath, const std::string &buttonDescription,
169                             PanelButton panel );
170                         // ----------------------------------------------------------------------------------
171                         /*! @fn void AddButton( BCPSettingsStruct* info );
172                          * @brief This method adds a new button into a group of buttons.
173                          * @param info The pointer to BCPSettingsStruct.
174                          * @exception std::bad_alloc
175                          */
176                         void
177                         AddButton( BCPSettingsStruct* info );
178                         // ----------------------------------------------------------------------------------
179                         /*! @fn void AddButtons( BCStructVectorType infoList );
180                          * @brief This method adds new buttons into the container.
181                          * @param infoList The BCStructVectorType
182                          * @exception std::bad_alloc
183                          */
184                         void
185                         AddButtons( BCStructVectorType infoList );
186                         // ----------------------------------------------------------------------------------
187                 private:
188                         ButtonGroupMap m_ButtonGroupContainer; //!<This is the map with the groups of buttons.
189                         KeyMapList m_GroupNameList; //!<This is a container with the name of the groups.
190         };
191 }//ecapseman
192 #endif /* BUTTONCONTAINERSETTINGS_H_ */