1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
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
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.
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
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 # ------------------------------------------------------------------------ */
27 * @file buttonContainerSettings.h
28 * @brief This contains the ButtonContainerSettings class.
29 * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
33 #ifndef BUTTONCONTAINERSETTINGS_H_
34 #define BUTTONCONTAINERSETTINGS_H_
37 #include <wx/bitmap.h>
38 #include <wx/listctrl.h>
45 #include "structBCPSettings.h"
46 #include "containerSettings.h"
49 /*! @namespace <creaPanelButtonContainer>
50 * @brief Contains the creaPanelButtonContainer library included in creaMaracasVisu.
52 namespace creaPanelButtonContainer
54 /*! @class ButtonContainerSettings buttonContainerSettings.h "buttonContainerSettings.h"
55 * @brief This class contains the settings of the buttons.
57 class ButtonContainerSettings
61 // ----------------------------------------------------------------------------------
62 /*! @typedef std::string* StringType;
63 * @brief Defines the StringType type.
65 typedef std::string StringType;
66 // ----------------------------------------------------------------------------------
67 /*! typedef creaButtonContainer::model::TFunctor TFunctor;
68 * @brief Defines the TFunctor type.
70 typedef creaButtonContainer::model::TFunctor TFunctor;
71 // ----------------------------------------------------------------------------------
72 /*! @typedef creaButtonContainer::model::ContainerSettings ButtonGroupSettings;
73 * @brief Defines the ButtonGroupSettings type.
75 typedef creaButtonContainer::model::ContainerSettings ButtonGroupSettings;
76 // ----------------------------------------------------------------------------------
77 /*! @typedef wxPanel* PanelButton;
78 * @brief Defines the PanelButton type.
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
86 typedef std::pair<std::string, PanelButton> ActionButton;
88 // ----------------------------------------------------------------------------------
89 /*! @typedef std::pair< std::string, wxBitmap > ButtonInfo;
90 * @brief Defines the ButtonInfo type.
91 * First is the ButtonName, Second is the ImageIcon
93 typedef std::pair<std::string, wxBitmap> ButtonInfo;
95 // ----------------------------------------------------------------------------------
96 /*! @typedef std::pair< ButtonInfo*, ActionButton* > ButtonPair;
97 * @brief Defines the ButtonPair type.
99 typedef std::pair<ButtonInfo*, ActionButton*> ButtonPair;
100 // ----------------------------------------------------------------------------------
101 /*! @typedef std::list< std::string > KeyMapList;
102 * @brief Defines the KeyMapList type.
104 typedef std::list<std::string> KeyMapList;
106 // ----------------------------------------------------------------------------------
107 /*! @typedef std::list< ButtonPair* > ButtonList;
108 * @brief Defines the ButtonList type.
110 typedef std::list<ButtonPair*> ButtonList;
112 // ----------------------------------------------------------------------------------
113 /*! @typedef std::map< std::string, ButtonList > ButtonGroupMap;
114 * @brief Defines the ButtonGroupMap type.
116 typedef std::map<std::string, ButtonList> ButtonGroupMap;
117 // ----------------------------------------------------------------------------------
118 /*! @typedef std::vector< BCPSettingsStruct* > BCStructVectorType;
119 * @brief Defines the BCStructVectorType type.
121 typedef std::vector<BCPSettingsStruct*> BCStructVectorType;
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
128 typedef std::pair<std::string, wxPanel*> ListAction;
129 // ----------------------------------------------------------------------------------
130 /*! @typedef std::vector<ListAction> ItemsVector;
131 * @brief Defines the Items Vector type.
133 typedef std::vector<ListAction> ItemsVector;
135 //end typedef definition
136 // ----------------------------------------------------------------------------------
139 // ----------------------------------------------------------------------------------
140 /*! @fn ButtonContainerSettings( );
141 * @brief This is the default constructor.
143 ButtonContainerSettings();
144 // ----------------------------------------------------------------------------------
145 /*! @fn virtual ~ButtonContainerSettings( );
146 * @brief This is the destructor.
149 ~ButtonContainerSettings();
151 // ----------------------------------------------------------------------------------
152 /*! @fn ButtonGroupMap GetButtonGroupContainer( );
153 * @brief This method returns ButtonGroupMap with all buttons.
157 GetButtonGroupContainer();
158 // ----------------------------------------------------------------------------------
159 /*! @fn KeyMapList GetGroupNameList( );
160 * @brief This method returns a KeyMapsList with the name of the groups.
165 // ----------------------------------------------------------------------------------
166 /*! @fn PanelButton GetPanelButton( const std::string &buttonName );
167 * @brief This method returns the panel of a button.
169 * @exception std::bad_alloc
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
182 GetButtonGroupSettings(TFunctor* functor);
183 // ----------------------------------------------------------------------------------
184 /*! @fn void SetButtonGroupContainer( ButtonGroupMap bGroupContainer );
185 * @brief This method sets the button group container.
186 * @param bGroupContainer
188 // ----------------------------------------------------------------------------------
190 SetButtonGroupContainer(ButtonGroupMap bGroupContainer);
191 // ----------------------------------------------------------------------------------
192 /*! @fn void SetGroupNameList( KeyMapList gNameList );
193 * @brief this method sets the groupName list
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,
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
211 AddButton(const std::string &groupName, const std::string &buttonName,
212 const wxBitmap &icon, const std::string &buttonDescription,
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
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
230 InitModel(BCStructVectorType infoList, int type);
231 // ----------------------------------------------------------------------------------
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
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
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
257 GetPanelList(const StringType &buttonName);
259 // ----------------------------------------------------------------------------------
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.
265 ItemsVector m_ItemsVector; //!<This is the vector containing a pair of each item name and its wxPanel.
269 #endif /* BUTTONCONTAINERSETTINGS_H_ */