namespace view
{
ListConfigDialog::ListConfigDialog(wxWindow* parent, wxWindowID id,
- const wxString& title, ListWx* modelList, ListWx* currentList)
- : wxDialog(parent, id, title)
+ const wxString& title, ListWx* modelList, ListWx* currentList) :
+ wxDialog(parent, id, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE)
{
- std::cout << "MLER | ListConfigPanel::ListConfigPanel()" << std::endl;
-
this->m_OriginalListWx = modelList;
this->m_OriginalListWx->Reparent(this);
this->m_OriginalListWx->Show(true);
this->m_OriginalListWx->SetFunctorEnabled(false);
- //this->m_OriginalListWx->FillList();
this->m_CurrentListWx = currentList;
this->m_CurrentListWx->Reparent(this);
this->m_CurrentListWx->SetFunctorEnabled(false);
this->m_CurrentListWx->Show(true);
- //this->m_CurrentListWx->FillList();
-
- wxFlexGridSizer* sizer = new wxFlexGridSizer(2, 1, 0, 0);
- this->SetSizer(sizer);
-
- wxBoxSizer* sizerUp = new wxBoxSizer(wxHORIZONTAL);
-
- sizerUp->Add(this->m_OriginalListWx, 0, wxEXPAND);
- //========
-
- wxPanel* panel2 = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize,
- wxTAB_TRAVERSAL, _T("Panel 2"));
- wxBoxSizer* sizerList2 = new wxBoxSizer(wxVERTICAL);
-
- buttonAdd = new wxButton(panel2, 1, _(">"), wxDefaultPosition,
- wxDefaultSize, 0, wxDefaultValidator, _T("Add"));
- sizerList2->Add(buttonAdd, 0, wxEXPAND);
-
- buttonDel = new wxButton(panel2, 2, _("<"), wxDefaultPosition,
- wxDefaultSize, 0, wxDefaultValidator, _T("Delete"));
- sizerList2->Add(buttonDel, 0, wxEXPAND);
-
- panel2->SetSizer(sizerList2);
- sizerList2->Fit(panel2);
- sizerList2->SetSizeHints(panel2);
-
- sizerUp->Add(panel2, 0, wxEXPAND);
-
- //========
-
- sizerUp->Add(this->m_CurrentListWx, 0, wxEXPAND);
-
- //=======
- wxPanel* panel5 = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize,
- wxTAB_TRAVERSAL, _T("Panel 5"));
- wxBoxSizer* sizerList4 = new wxBoxSizer(wxVERTICAL);
-
- upButton = new wxButton(panel5, 3, _("/\\"), wxDefaultPosition,
- wxDefaultSize, 0, wxDefaultValidator, _T("upButton"));
- sizerList4->Add(upButton, 0, wxEXPAND);
-
- downButton = new wxButton(panel5, 4, _("V"), wxDefaultPosition,
- wxDefaultSize, 0, wxDefaultValidator, _T("downButton"));
- sizerList4->Add(downButton, 0, wxEXPAND);
- panel5->SetSizer(sizerList4);
- sizerList4->Fit(panel5);
- sizerList4->SetSizeHints(panel5);
- sizerUp->Add(panel5, 0, wxEXPAND);
+ wxGridBagSizer* dialogSizer = new wxGridBagSizer(0, 0);
+ dialogSizer->AddGrowableCol(0);
+ dialogSizer->AddGrowableRow(0);
+
+ //Top Sizer
+ wxGridBagSizer* topSizer = new wxGridBagSizer(0, 0);
+ topSizer->AddGrowableCol(0);
+ topSizer->AddGrowableCol(2);
+ topSizer->AddGrowableRow(0);
+ topSizer->Add(this->m_OriginalListWx, wxGBPosition(0, 0), wxDefaultSpan,
+ wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL
+ | wxALIGN_CENTER_VERTICAL, 5);
+ wxBoxSizer* boxSizer1 = new wxBoxSizer(wxVERTICAL);
+ this->m_AddButton = new wxBitmapButton(this, 1, wxNullBitmap,
+ wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW, wxDefaultValidator,
+ _T(">"));
+ boxSizer1->Add(this->m_AddButton, 1,
+ wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
+ this->m_RemoveButton = new wxBitmapButton(this, 2, wxNullBitmap,
+ wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW, wxDefaultValidator,
+ _T("<"));
+ boxSizer1->Add(this->m_RemoveButton, 1,
+ wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
+ topSizer->Add(boxSizer1, wxGBPosition(0, 1), wxDefaultSpan,
+ wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
+
+ topSizer->Add(this->m_CurrentListWx, wxGBPosition(0, 2), wxDefaultSpan,
+ wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL
+ | wxALIGN_CENTER_VERTICAL, 5);
+ wxBoxSizer* boxSizer2 = new wxBoxSizer(wxVERTICAL);
+ this->m_UpButton = new wxBitmapButton(this, 3, wxNullBitmap,
+ wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW, wxDefaultValidator,
+ _T("+"));
+ boxSizer2->Add(this->m_UpButton, 1,
+ wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
+ this->m_RemoveButton = new wxBitmapButton(this, 4, wxNullBitmap,
+ wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW, wxDefaultValidator,
+ _T("-"));
+ boxSizer2->Add(this->m_RemoveButton, 1,
+ wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
+ topSizer->Add(boxSizer2, wxGBPosition(0, 3), wxDefaultSpan,
+ wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
+ dialogSizer->Add(topSizer, wxGBPosition(0, 0), wxDefaultSpan,
+ wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL
+ | wxALIGN_CENTER_VERTICAL, 5);
+
+ wxBoxSizer* bottomSizer = new wxBoxSizer(wxHORIZONTAL);
+ bottomSizer->Add(0, 0, 1,
+ wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
+ this->m_CancelButton = new wxButton(this, 5, _("Cancel"),
+ wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator,
+ _T("Cancel"));
+ bottomSizer->Add(this->m_CancelButton, 1,
+ wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
+ this->m_OkButton = new wxButton(this, 6, _("Ok"), wxDefaultPosition,
+ wxDefaultSize, 0, wxDefaultValidator, _T("Ok"));
+ bottomSizer->Add(this->m_OkButton, 1,
+ wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
+ bottomSizer->Add(0, 0, 1,
+ wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
+ dialogSizer->Add(bottomSizer, wxGBPosition(1, 0), wxDefaultSpan,
+ wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
+ this->SetSizer(dialogSizer);
+ dialogSizer->Fit(this);
+ dialogSizer->SetSizeHints(this);
- //========
- wxBoxSizer* sizerBotones = new wxBoxSizer(wxHORIZONTAL);
- wxPanel* panel4 = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize,
- wxTAB_TRAVERSAL, _T("Panel 4"));
-
- okButton = new wxButton(panel4, 5, _("Ok"), wxPoint(0, 8), wxDefaultSize,
- 0, wxDefaultValidator, _T("Ok"));
- cancelButton = new wxButton(panel4, 6, _("Cancel"), wxPoint(88, 8),
- wxDefaultSize, 0, wxDefaultValidator, _T("Cancel"));
-
- sizerBotones->Add(panel4, 0, wxEXPAND);
-
- sizer->Add(sizerUp, 0, wxEXPAND);
- sizer->Add(sizerBotones, 1, wxALL | wxALIGN_CENTER_HORIZONTAL);
//---------------------------------------------------------------------------------------------
- // Manejo de Eventos
-
- //Evento Cancel
- Connect(6, wxEVT_COMMAND_BUTTON_CLICKED,
- (wxObjectEventFunction) & ListConfigDialog::OnCancel);
-
- //EventoSeleccionarLista
- //Connect(wxEVT_COMMAND_LISTBOX_SELECTED,wxCommandEventHandler(ListConfigPanel::ListItemEvent));
-
- //EventoAdd
+ // Events
+ //Add
Connect(1, wxEVT_COMMAND_BUTTON_CLICKED,
- (wxObjectEventFunction) & ListConfigDialog::OnAdd);
+ (wxObjectEventFunction) &ListConfigDialog::OnAdd);
- //EventoOk
- Connect(5, wxEVT_COMMAND_BUTTON_CLICKED,
- (wxObjectEventFunction) & ListConfigDialog::OnOk);
-
- //EventoDelete
+ //Remove
Connect(2, wxEVT_COMMAND_BUTTON_CLICKED,
- (wxObjectEventFunction) & ListConfigDialog::OnDelete);
+ (wxObjectEventFunction) &ListConfigDialog::OnDelete);
- //EventoUp
+ //Up
Connect(3, wxEVT_COMMAND_BUTTON_CLICKED,
- (wxObjectEventFunction) & ListConfigDialog::OnMoveUp);
+ (wxObjectEventFunction) &ListConfigDialog::OnMoveUp);
- //EventoUp
+ //Down
Connect(4, wxEVT_COMMAND_BUTTON_CLICKED,
- (wxObjectEventFunction) & ListConfigDialog::OnMoveDown);
+ (wxObjectEventFunction) &ListConfigDialog::OnMoveDown);
+
+ //Cancel
+ Connect(5, wxEVT_COMMAND_BUTTON_CLICKED,
+ (wxObjectEventFunction) &ListConfigDialog::OnCancel);
+
+ //Ok
+ Connect(6, wxEVT_COMMAND_BUTTON_CLICKED,
+ (wxObjectEventFunction) &ListConfigDialog::OnOk);
}
void ListConfigDialog::OnAdd(wxCommandEvent& event)
{
wxString itSelect = m_OriginalListWx->GetListBox()->GetStringSelection();
- int v;
std::cout << "Count = " << this->m_CurrentListWx->GetListBox()->GetCount()
<< std::endl;
if (!itSelect.IsEmpty())
# knowledge of the CeCILL-B license and that you accept its terms.
# ------------------------------------------------------------------------ */
+/*!
+ * @file listConfigDialog.h
+ * @brief This contains the ListConfigDialog class.
+ * @author Monica ESPINOSA (espinosa[AT]creatis.insa-lyon.fr)
+ * @date 2015-01-02
+ */
+
#ifndef LISTCONFIGDIALOG_H
#define LISTCONFIGDIALOG_H
#include <wx/panel.h>
#include <wx/sizer.h>
+#include <wx/gbsizer.h>
#include <wx/wx.h>
+#include <wx/bmpbuttn.h>
#include <string>
#include <vector>
#include "functor.h"
#include "listWx.h"
+/*! @namespace <creaButtonContainer>
+ * @brief Contains the creaButtonContainer library included in creaMaracasVisu.
+ */
namespace creaButtonContainer
{
-
+ /*! @namespace <creaButtonContainer::view>
+ * @brief Contains the implementation of the view in creaButtonContainer library.
+ * @see <a href="http://en.wikipedia.org/wiki/Model-view-controller">MVC Software Architecture</a>
+ */
namespace view
{
-
+ /*! @class ListConfigDialog listConfigDialog.h "listConfigDialog.h"
+ * @brief This class contains the list in the wxDialog.
+ * @details This class contains the information of a Dialog with the lists, it derives from wxDialog.
+ * @see <a href="http://docs.wxwidgets.org/trunk/classwx_dialog.html">wxDialog</a>
+ */
class ListConfigDialog: public wxDialog
{
public:
-
+ //typedef definition.
+ // ----------------------------------------------------------------------------------
+ /*! typedef creaButtonContainer::model::TFunctor TFunctor;
+ * @brief Defines the TFunctor type.
+ */
typedef creaButtonContainer::model::TFunctor TFunctor;
+ /*! typedef creaButtonContainer::view::ListWx ListWx;
+ * @brief Defines the List Panel.
+ */
typedef creaButtonContainer::view::ListWx ListWx;
-
+ // ----------------------------------------------------------------------------------
+ //end of typedef definition.
public:
-
+ // ----------------------------------------------------------------------------------
+ /*! @fn ListConfigDialog( wxWindow* parent, wxWindowID id,const wxString& title,
+ ListWx* modelList, ListWx* currentList );
+ * @brief This is the parameterized constructor.
+ * @param parent The wxWindow pointer to parent.
+ * @param id The wxID of the button.
+ * @param title //The title wxDialog.
+ * @param modelList //The list is filled with the elements of model.
+ * @param currentList //The list is filled with the events.
+ */
ListConfigDialog(wxWindow* parent, wxWindowID id, const wxString& title,
ListWx* modelList, ListWx* currentList);
+ // ----------------------------------------------------------------------------------
+ /*! @fn virtual ~Button( );
+ * @brief This is the destructor.
+ */
+ virtual
~ListConfigDialog();
-
+ // ----------------------------------------------------------------------------------
+ /*! @fn void OnAdd( wxCommandEvent& event );
+ * @brief This method add an item to current list.
+ * @param event
+ */
void
OnAdd(wxCommandEvent& event);
+ // ----------------------------------------------------------------------------------
+ /*! @fn void OnDelete( wxCommandEvent& event );
+ * @brief This method remove an item of current list.
+ * @param event
+ */
void
OnDelete(wxCommandEvent& event);
+ // ----------------------------------------------------------------------------------
+ /*! @fn void OnMoveUp( wxCommandEvent& event );
+ * @brief This method move up an item of current list.
+ * @param event
+ */
void
OnMoveUp(wxCommandEvent& event);
+ // ----------------------------------------------------------------------------------
+ /*! @fn void OnMoveDown( wxCommandEvent& event );
+ * @brief This method move down an item of current list.
+ * @param event
+ */
void
OnMoveDown(wxCommandEvent& event);
+ // ----------------------------------------------------------------------------------
+ /*! @fn void OnOk( wxCommandEvent& event );
+ * @brief This method confirm the changes of current list.
+ * @param event
+ */
void
OnOk(wxCommandEvent& event);
+ // ----------------------------------------------------------------------------------
+ /*! @fn void OnCancel( wxCommandEvent& event );
+ * @brief This method discard the changes of current list.
+ * @param event
+ */
void
OnCancel(wxCommandEvent& event);
+ // ----------------------------------------------------------------------------------
private:
- //todo change it to wxBitmap
- wxButton* buttonAdd;
- wxButton* buttonDel;
- wxButton* okButton;
- wxButton* cancelButton;
- wxButton* upButton;
- wxButton* downButton;
- //
- ListWx* m_OriginalListWx; // Original list
- ListWx* m_CurrentListWx; //Configurable list
+
+ wxBitmapButton* m_AddButton; //!< ">" Add button.
+ wxBitmapButton* m_RemoveButton; //!< "<" Remove button.
+ wxButton* m_OkButton; //!< "Ok" Remove button.
+ wxButton* m_CancelButton; //!< "Cancel" Remove button.
+ wxBitmapButton* m_UpButton; //!< "/\" Remove button.
+ wxBitmapButton* m_DownButton; //!< "\/" Remove button.
+
+ ListWx* m_OriginalListWx; //!< The Original list.
+ ListWx* m_CurrentListWx; //!<The Configurable list.
};
}
}
this->m_FunctorEnabled = true;
this->Connect(wxEVT_COMMAND_LISTBOX_SELECTED,
- wxCommandEventHandler(ListWx::ListEvent));
+ wxCommandEventHandler(ListWx::OnListEvent));
if (!iVector.empty())
{
this->m_FunctorEnabled = true;
this->Connect(wxEVT_COMMAND_LISTBOX_SELECTED,
- wxCommandEventHandler(ListWx::ListEvent));
+ wxCommandEventHandler(ListWx::OnListEvent));
sizer->Add(this->m_ListBox, 1, wxGROW);
// ----------------------------------------------------------------------------------
- void ListWx::ListEvent(wxCommandEvent& event)
+ void ListWx::OnListEvent(wxCommandEvent& event)
{
if (!this->IsFunctorEnabled())
return;
{
try
{
- std::cout << "MLER | ListWx::ListEvent( wxListEvent& event )"
+ std::cout << "MLER | ListWx::OnListEvent( wxListEvent& event )"
<< std::endl;
int iSelection;
# knowledge of the CeCILL-B license and that you accept its terms.
# ------------------------------------------------------------------------ */
+/*!
+ * @file listWx.h
+ * @brief This contains the ListWx class.
+ * @author Monica ESPINOSA (espinosa[AT]creatis.insa-lyon.fr)
+ * @date 2015-01-02
+ */
+
#ifndef LISTWX_H
#define LISTWX_H
#include "functor.h"
#include "system.h"
+/*! @namespace <creaButtonContainer>
+ * @brief Contains the creaButtonContainer library included in creaMaracasVisu.
+ */
namespace creaButtonContainer
{
-
+ /*! @namespace <creaButtonContainer::view>
+ * @brief Contains the implementation of the view in creaButtonContainer library.
+ * @see <a href="http://en.wikipedia.org/wiki/Model-view-controller">MVC Software Architecture</a>
+ */
namespace view
{
-
+ /*! @class ListWx listWx.h "listWx.h"
+ * @brief This class contains the list in the panel.
+ * @details This class contains the information of a list, it derives from wxPanel.
+ * @see <a href="http://docs.wxwidgets.org/stable/wx_wxpanel.html">wxPanel</a>
+ */
class ListWx: public wxPanel
{
public:
-
+ //typedef definition.
+ // ----------------------------------------------------------------------------------
+ /*! typedef creaButtonContainer::model::TFunctor TFunctor;
+ * @brief Defines the TFunctor type.
+ */
typedef creaButtonContainer::model::TFunctor TFunctor;
+ // ----------------------------------------------------------------------------------
+ /*! @typedef std::pair<std::string, wxPanel*> ListAction;
+ * @brief Defines the ListAction type.
+ * First is the button name(item list), Second FunctionEventType
+ */
typedef std::pair<std::string, wxPanel*> ListAction;
+ // ----------------------------------------------------------------------------------
+ /*! @typedef std::vector<ListAction> ItemsVector;
+ * @brief Defines the Items Vector type.
+ */
typedef std::vector<ListAction> ItemsVector;
+ // ----------------------------------------------------------------------------------
+ //end of typedef definition.
public:
-
+ // ----------------------------------------------------------------------------------
+ /*! @fn ListWx( wxWindow* parent, wxWindowID id, ItemsVector iVector,
+ TFunctor* functor );
+ * @brief This is the parameterized constructor.
+ * @param parent The wxWindow pointer to parent.
+ * @param id The wxID of the button.
+ * @param ItemsVector //The items Vector (name, wxPanel).
+ * @param TFunctor //The functor of items list.
+ */
ListWx(wxWindow* parent, wxWindowID id, ItemsVector iVector,
TFunctor* functor);
+ // ----------------------------------------------------------------------------------
+ /*! @fn ListWx( wxWindow* parent, wxWindowID id, TFunctor* functor );
+ * @brief This is the parameterized constructor.
+ * @param parent The wxWindow pointer to parent.
+ * @param id The wxID of the button.
+ * @param TFunctor //The functor of items list.
+ */
ListWx(wxWindow* parent, wxWindowID id, TFunctor* functor);
-
+ // ----------------------------------------------------------------------------------
+ /*! @fn virtual ~Button( );
+ * @brief This is the destructor.
+ */
virtual
~ListWx();
-
+ // ----------------------------------------------------------------------------------
+ /*! @fn void OnListEvent( wxCommandEvent& event );
+ * @brief This method calls the functor when
+ * an item of list is clicked.
+ * @param event
+ */
void
- ListEvent(wxCommandEvent& event);
-
+ OnListEvent(wxCommandEvent& event);
+ // ----------------------------------------------------------------------------------
+ /*! @fn void SetFunctorEnabled( wxCommandEvent& event );
+ * @brief This method set the state of Functor (enable or disable)
+ * @param enabled
+ */
void
SetFunctorEnabled(const bool& enabled);
-
+ // ----------------------------------------------------------------------------------
+ /*! @fn bool OnListEvent( wxCommandEvent& event );
+ * @brief This method ask the state of functor.
+ * @return
+ */
bool
IsFunctorEnabled() const;
-
+ // ----------------------------------------------------------------------------------
+ /*! @fn wxListBox* GetListBox() const;
+ * @brief This method returns the wxlistBox.
+ * @exception std::bad_alloc
+ * @return wxListBox
+ */
wxListBox*
GetListBox() const;
-
+ // ----------------------------------------------------------------------------------
private:
- wxListBox* m_ListBox;
-
- TFunctor* m_Functor;
- bool m_FunctorEnabled;
+ wxListBox* m_ListBox; //!< This is the Items List.
+ TFunctor* m_Functor; //!< This is the functor.
+ bool m_FunctorEnabled; //!< Disable or Enable Functor.
};
} //ecapseman
* @brief Defines the BCStructVectorType type.
*/
typedef std::vector<BCPSettingsStruct*> BCStructVectorType;
- //end typedef definition
-
//MLER
+ // ----------------------------------------------------------------------------------
+ /*! @typedef std::pair<std::string, wxPanel*> ListAction;
+ * @brief Defines the ListAction type.
+ * First is the button name(item list), Second FunctionEventType
+ */
typedef std::pair<std::string, wxPanel*> ListAction;
+ // ----------------------------------------------------------------------------------
+ /*! @typedef std::vector<ListAction> ItemsVector;
+ * @brief Defines the Items Vector type.
+ */
typedef std::vector<ListAction> ItemsVector;
//MLER
-
+ //end typedef definition
// ----------------------------------------------------------------------------------
public:
* @brief This method sets the button group container.
* @param bGroupContainer
*/
-
// ----------------------------------------------------------------------------------
- ButtonGroupSettings*
- GetListGroupSettings();
-
- // ----------------------------------------------------------------------------------
-
void
SetButtonGroupContainer(ButtonGroupMap bGroupContainer);
// ----------------------------------------------------------------------------------
*/
void
SetGroupNameList(KeyMapList gNameList);
-
// ----------------------------------------------------------------------------------
/*! @fn void AddButton( const std::string &groupName, const std::string &buttonName,
const std::string &iconpath, const std::string &buttonDescription,
AddButton(const std::string &groupName, const std::string &buttonName,
const wxBitmap &icon, const std::string &buttonDescription,
PanelButton panel);
-
// ----------------------------------------------------------------------------------
/*! @fn void AddButton( BCPSettingsStruct* info );
* @brief This method adds a new button into a group of buttons.
*/
void
AddButton(BCPSettingsStruct* info);
-
// ----------------------------------------------------------------------------------
- /*! @fn void AddButtons( BCStructVectorType infoList );
- * @brief This method adds new buttons into the container.
+ /*! @fn void InitModel( BCStructVectorType infoList, int type );
+ * @brief This method adds new buttons or items into the container (Depends type).
* @param infoList The BCStructVectorType
+ * @param type If 1:Buttons 2:List 3:Configurable List
* @exception std::bad_alloc
*/
void
InitModel(BCStructVectorType infoList, int type);
// ----------------------------------------------------------------------------------
//MLER
+ /*! @fn void AddItems( BCPSettingsStruct* info );
+ * @brief This method adds a new item into a list.
+ * @param info The pointer to BCPSettingsStruct.
+ * @exception std::bad_alloc
+ */
void
AddItems(BCPSettingsStruct* info);
// ----------------------------------------------------------------------------------
+ /*! @fn PanelButton GetPanelList( const std::string &buttonName );
+ * @brief This method returns the panel of a list.
+ * @param buttonName (item element)
+ * @exception std::bad_alloc
+ * @return
+ */
ItemsVector
GetItemsVector();
-
+ // ----------------------------------------------------------------------------------
+ /*! @fn PanelButton GetPanelList( const std::string &buttonName );
+ * @brief This method returns the panel of a list.
+ * @param buttonName (item element)
+ * @exception std::bad_alloc
+ * @return
+ */
wxPanel*
GetPanelList(const StringType &buttonName);
-
//MLER
// ----------------------------------------------------------------------------------
private:
//(*EventTable(ButtonContainerPanel)
//*)
- END_EVENT_TABLE()
+ END_EVENT_TABLE ()
// ----------------------------------------------------------------------------------
- typedef creaButtonContainer::model::TConcreteFunctor< PanelButtonContainer > TConcreteFunctor;
+ typedef creaButtonContainer::model::TConcreteFunctor<PanelButtonContainer> TConcreteFunctor;
// ----------------------------------------------------------------------------------
PanelButtonContainer::PanelButtonContainer(wxWindow* parent,
ButtonContainerSettings* bcSettings, int type)
this->m_ButtonContainerSettings = bcSettings;
//Using AuiManager to Manage the Panels
- this->m_AuiManager = new wxAuiManager(this, wxAUI_MGR_DEFAULT);
+ this->m_AuiManager = new wxAuiManager(this,
+ wxAUI_MGR_DEFAULT | wxFULL_REPAINT_ON_RESIZE);
if (type == 0)
{
}
else if (type == 1)
{
+ //MLER
TConcreteFunctor* lFunctor = new TConcreteFunctor(this,
&PanelButtonContainer::GenericListEvent);
this->m_PanelUp = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize,
wxTAB_TRAVERSAL, _T("ListConfigContainerPanel"));
- wxBoxSizer* mainSizer = new wxBoxSizer(wxHORIZONTAL);
+ wxGridBagSizer* mainSizer = new wxGridBagSizer(0, 0);
+ mainSizer->AddGrowableCol(1);
+ mainSizer->AddGrowableRow(0);
//=======
- wxBoxSizer* listSizer = new wxBoxSizer(wxVERTICAL);
-
//Original List
this->m_ListWxPanel = new ListWx(this->m_PanelUp, -1,
this->m_ButtonContainerSettings->GetItemsVector(), lFunctor);
this->m_ListWxPanel->Show(false);
//Configurable list
this->m_CurrentWxPanel = new ListWx(this->m_PanelUp, -1, lFunctor);
- listSizer->Add(this->m_CurrentWxPanel, 0, wxEXPAND);
- listSizer->Add(this->m_ListWxPanel, 0, wxEXPAND);
- mainSizer->Add(listSizer, 0, wxEXPAND | wxALL, 7);
- //=======
- //todo change button to bitmap
- wxBoxSizer* buttonSizer = new wxBoxSizer(wxVERTICAL);
+ mainSizer->Add(this->m_ListWxPanel, wxGBPosition(0, 0), wxDefaultSpan,
+ wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL
+ | wxALIGN_CENTER_VERTICAL, 5);
+ mainSizer->Add(this->m_CurrentWxPanel, wxGBPosition(0, 1), wxDefaultSpan,
+ wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL
+ | wxALIGN_CENTER_VERTICAL, 5);
+
+ this->m_ConfigButton = new wxBitmapButton(this->m_PanelUp, -1,
+ wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW,
+ wxDefaultValidator, _T("Config"));
- this->m_ConfigButton = new wxButton(this->m_PanelUp, -1, _("Configurar"), wxDefaultPosition,
- wxDefaultSize, 0, wxDefaultValidator, _("Configurar"));
+ mainSizer->Add(this->m_ConfigButton, wxGBPosition(1, 2), wxDefaultSpan,
+ wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
- buttonSizer->Add(this->m_ConfigButton, 0, wxEXPAND);
- mainSizer->Add(buttonSizer, 0, wxEXPAND | wxALL, 14);
//=======
this->m_PanelUp->SetSizer(mainSizer);
+ mainSizer->Fit(this->m_PanelUp);
+ mainSizer->SetSizeHints(this->m_PanelUp);
//Bottom Panel
this->m_AuiManager->AddPane(this->m_EventPanel,
false).Center().Resizable(true));
this->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
- wxCommandEventHandler(PanelButtonContainer::OnConfigButton));
+ wxCommandEventHandler(PanelButtonContainer::OnConfigButton));
}
- //MLER
+ //End MLER
this->m_AuiManager->Update();
}
}
// ----------------------------------------------------------------------------------
- void
- PanelButtonContainer::OnConfigButton ( wxCommandEvent& event )
- {
+ void PanelButtonContainer::OnConfigButton(wxCommandEvent& event)
+ {
- this->m_ListConfigDialog = new ListConfigDialog(this,-1,_("Config"), this->m_ListWxPanel, this->m_CurrentWxPanel);
+ this->m_ListConfigDialog = new ListConfigDialog(this, -1, _("Config"),
+ this->m_ListWxPanel, this->m_CurrentWxPanel);
- std::cout<< "Button Event"<<std::endl;
+ std::cout << "Button Event" << std::endl;
- this->m_ListConfigDialog->ShowModal();//Show Dialog
- this->m_CurrentWxPanel->Reparent(this->m_PanelUp);
- this->m_CurrentWxPanel->Show(true);
- this->m_CurrentWxPanel->SetFunctorEnabled(true);
- this->m_CurrentWxPanel->Update();
- this->m_AuiManager->Update( );
- this->m_EventPanel->Show(false);
- }
- // ----------------------------------------------------------------------------------
+ this->m_ListConfigDialog->ShowModal(); //Show Dialog
+ this->m_CurrentWxPanel->Reparent(this->m_PanelUp);
+ this->m_CurrentWxPanel->Show(true);
+ this->m_CurrentWxPanel->SetFunctorEnabled(true);
+ this->m_CurrentWxPanel->Update();
+ this->m_ListWxPanel->Show(false);
+ this->m_EventPanel->Show(false);
+ this->m_AuiManager->Update();
+ }
+ //End MLER
+// ----------------------------------------------------------------------------------
}//ecapseman
#include <wx/aui/aui.h>
#include <string>
#include <wx/gdicmn.h>
+#include <wx/gbsizer.h>
+#include <wx/bmpbuttn.h>
#include "listConfigDialog.h"
#include "containerSettings.h"
//MLER
/*! typedef creaButtonContainer::view::ListWx ListWx;
* @brief Defines a ListWx for (Configurable) List Container.
- * This class inherits from wxPanel and contains a wxListBox
+ * This class inherits from wxPanel and contains a wxListBox.
*/
typedef creaButtonContainer::view::ListWx ListWx;
/*! typedef creaPanelButtonContainer::ListConfigDialog ListConfigDialog;
- * @brief Defines a ListConfigPanel to configure
+ * @brief Defines a ListConfigPanel to configure.
+ * This class inherits from wxDialog and contains the wxListBox and wxButton.
*/
typedef creaButtonContainer::view::ListConfigDialog ListConfigDialog;
- //End MLER
-
// ----------------------------------------------------------------------------------
- //end of typedef definition.
+ //End MLER
+ //end of typedef definition.
public:
// ----------------------------------------------------------------------------------
/*! @fn PanelButtonContainer( wxWindow* parent, ButtonContainerSettings* bcSettings );
~PanelButtonContainer();
// ----------------------------------------------------------------------------------
/*! @fn void UpdatePanel( const std::string &buttonName );
- * @brief This method Updates the m_ButtonPanel to a panel
+ * @brief This method Updates the m_EventPanel to a panel
* of the clicked button in creaButtonContainer.
* @param buttonName
*/
UpdatePanel(const std::string &buttonName);
// ----------------------------------------------------------------------------------
/*! @fn void GenericButtonEvent( const std::string &buttonName );
- * @brief This method is the function that calls the panels contained in the buttons
+ * @brief This method is the function that calls the panels contained in the buttons.
* (in creaButtonContainer is the function contained in the functors to be called back.
* @param buttonName The name of the button
*/
GenericButtonEvent(const std::string &buttonName);
// ----------------------------------------------------------------------------------
//MLER
+ /*! @fn void GenericListEvent( const std::string &buttonName );
+ * @brief This method is the function that calls the panels contained in the items list.
+ * (in creaButtonContainer is the function contained in the functors to be called back.
+ * @param buttonName The name of the button (item list)
+ */
void
GenericListEvent(const std::string &buttonName);
-
+ // ----------------------------------------------------------------------------------
+ /*! @fn void UpdateListPanel( const std::string &buttonName );
+ * @brief This method Updates the m_EventPanel to a panel
+ * of the clicked an item in creaButtonContainer.
+ * @param buttonName The name of the button (item list)
+ */
void
UpdateListPanel(const std::string &buttonName);
+ // ----------------------------------------------------------------------------------
+ /*! @fn void OnConfigButton( wxCommandEvent& event );
+ * @brief This method calls the wxDialog when
+ * the config button is clicked.
+ * @param event
+ */
void
OnConfigButton(wxCommandEvent& event);
-
+ //End MLER
// ----------------------------------------------------------------------------------
private:
//Settings
ButtonContainerSettings* m_ButtonContainerSettings; //!<This is the buttonContainer settings.
+
//Panel
- ButtonContainerPanel* m_ButtonContainerPanel; //!<This is the panel with de buttons (creaButtonContainer)
+ ButtonContainerPanel* m_ButtonContainerPanel; //!<This is the panel with of buttons (creaButtonContainer)
wxAuiManager* m_AuiManager; //!<The AUI Manager for the panels.
wxPanel* m_EventPanel; //!<This is the panel used to contain the panels of the buttons. (it changes with the buttonAction)
//MLER
- ListWx* m_ListWxPanel;
- ListConfigDialog* m_ListConfigDialog;
- //
- wxPanel* m_PanelUp;
- ListWx* m_CurrentWxPanel;
- //todo change to bitmap
- wxButton* m_ConfigButton;DECLARE_EVENT_TABLE()
+ ListWx* m_ListWxPanel;//!<This panel contains the list of the elements.
+ ListConfigDialog* m_ListConfigDialog;//!<This wxDialog shows the list of the elements and allows modifications.
+
+ wxPanel* m_PanelUp;//!<This panel contains the list of the elements empty,full and the config button.
+ ListWx* m_CurrentWxPanel;//!<This panel contains the final list of the elements .
+
+ wxBitmapButton* m_ConfigButton;//!< "Config" Settings button.
+ //End MLER
+
+ DECLARE_EVENT_TABLE()
//!<Event Table declaration.
};
} //ecapseman