From 5bcbe43584902af3a90cfbd1a886a9c8434f236e Mon Sep 17 00:00:00 2001 From: espinosa Date: Mon, 2 Feb 2015 02:11:16 +0100 Subject: [PATCH] #2516 creaMaracasVisu Feature New Normal - creaPanelButtonContainer ListPanel with events 2 --- .../view/listConfigDialog.cxx | 173 +++++++++--------- .../view/listConfigDialog.h | 103 +++++++++-- .../creaButtonContainer/view/listWx.cxx | 8 +- .../widgets/creaButtonContainer/view/listWx.h | 97 ++++++++-- .../buttonContainerSettings.h | 47 +++-- .../creaPanelButtonContainer.cxx | 72 ++++---- .../creaPanelButtonContainer.h | 56 ++++-- 7 files changed, 367 insertions(+), 189 deletions(-) diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listConfigDialog.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listConfigDialog.cxx index 2aa24d1..d1b1776 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listConfigDialog.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listConfigDialog.cxx @@ -31,115 +31,111 @@ namespace creaButtonContainer 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); } @@ -151,7 +147,6 @@ namespace creaButtonContainer 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()) diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listConfigDialog.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listConfigDialog.h index d45403a..f878bd6 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listConfigDialog.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listConfigDialog.h @@ -23,12 +23,21 @@ # 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 #include +#include #include +#include #include #include @@ -36,49 +45,111 @@ #include "functor.h" #include "listWx.h" +/*! @namespace + * @brief Contains the creaButtonContainer library included in creaMaracasVisu. + */ namespace creaButtonContainer { - + /*! @namespace + * @brief Contains the implementation of the view in creaButtonContainer library. + * @see MVC Software Architecture + */ 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 wxDialog + */ 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; //!m_FunctorEnabled = true; this->Connect(wxEVT_COMMAND_LISTBOX_SELECTED, - wxCommandEventHandler(ListWx::ListEvent)); + wxCommandEventHandler(ListWx::OnListEvent)); if (!iVector.empty()) { @@ -76,7 +76,7 @@ namespace creaButtonContainer this->m_FunctorEnabled = true; this->Connect(wxEVT_COMMAND_LISTBOX_SELECTED, - wxCommandEventHandler(ListWx::ListEvent)); + wxCommandEventHandler(ListWx::OnListEvent)); sizer->Add(this->m_ListBox, 1, wxGROW); @@ -90,7 +90,7 @@ namespace creaButtonContainer // ---------------------------------------------------------------------------------- - void ListWx::ListEvent(wxCommandEvent& event) + void ListWx::OnListEvent(wxCommandEvent& event) { if (!this->IsFunctorEnabled()) return; @@ -98,7 +98,7 @@ namespace creaButtonContainer { try { - std::cout << "MLER | ListWx::ListEvent( wxListEvent& event )" + std::cout << "MLER | ListWx::OnListEvent( wxListEvent& event )" << std::endl; int iSelection; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.h index e2ea60e..9eb6235 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.h @@ -23,6 +23,13 @@ # 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 @@ -40,48 +47,108 @@ #include "functor.h" #include "system.h" +/*! @namespace + * @brief Contains the creaButtonContainer library included in creaMaracasVisu. + */ namespace creaButtonContainer { - + /*! @namespace + * @brief Contains the implementation of the view in creaButtonContainer library. + * @see MVC Software Architecture + */ 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 wxPanel + */ 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 ListAction; + * @brief Defines the ListAction type. + * First is the button name(item list), Second FunctionEventType + */ typedef std::pair ListAction; + // ---------------------------------------------------------------------------------- + /*! @typedef std::vector ItemsVector; + * @brief Defines the Items Vector type. + */ typedef std::vector 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 diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.h index 3d71e1a..80528a2 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.h @@ -119,13 +119,20 @@ namespace creaPanelButtonContainer * @brief Defines the BCStructVectorType type. */ typedef std::vector BCStructVectorType; - //end typedef definition - //MLER + // ---------------------------------------------------------------------------------- + /*! @typedef std::pair ListAction; + * @brief Defines the ListAction type. + * First is the button name(item list), Second FunctionEventType + */ typedef std::pair ListAction; + // ---------------------------------------------------------------------------------- + /*! @typedef std::vector ItemsVector; + * @brief Defines the Items Vector type. + */ typedef std::vector ItemsVector; //MLER - + //end typedef definition // ---------------------------------------------------------------------------------- public: @@ -178,13 +185,7 @@ namespace creaPanelButtonContainer * @brief This method sets the button group container. * @param bGroupContainer */ - // ---------------------------------------------------------------------------------- - ButtonGroupSettings* - GetListGroupSettings(); - - // ---------------------------------------------------------------------------------- - void SetButtonGroupContainer(ButtonGroupMap bGroupContainer); // ---------------------------------------------------------------------------------- @@ -194,7 +195,6 @@ namespace creaPanelButtonContainer */ void SetGroupNameList(KeyMapList gNameList); - // ---------------------------------------------------------------------------------- /*! @fn void AddButton( const std::string &groupName, const std::string &buttonName, const std::string &iconpath, const std::string &buttonDescription, @@ -211,7 +211,6 @@ namespace creaPanelButtonContainer 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. @@ -220,26 +219,42 @@ namespace creaPanelButtonContainer */ 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: diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.cxx index a7a0fc1..b23fe4b 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.cxx @@ -39,9 +39,9 @@ namespace creaPanelButtonContainer //(*EventTable(ButtonContainerPanel) //*) - END_EVENT_TABLE() + END_EVENT_TABLE () // ---------------------------------------------------------------------------------- - typedef creaButtonContainer::model::TConcreteFunctor< PanelButtonContainer > TConcreteFunctor; + typedef creaButtonContainer::model::TConcreteFunctor TConcreteFunctor; // ---------------------------------------------------------------------------------- PanelButtonContainer::PanelButtonContainer(wxWindow* parent, ButtonContainerSettings* bcSettings, int type) @@ -51,7 +51,8 @@ namespace creaPanelButtonContainer 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) { @@ -76,6 +77,7 @@ namespace creaPanelButtonContainer } else if (type == 1) { + //MLER TConcreteFunctor* lFunctor = new TConcreteFunctor(this, &PanelButtonContainer::GenericListEvent); @@ -105,33 +107,37 @@ namespace creaPanelButtonContainer 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, @@ -145,11 +151,11 @@ namespace creaPanelButtonContainer false).Center().Resizable(true)); this->Connect(wxEVT_COMMAND_BUTTON_CLICKED, - wxCommandEventHandler(PanelButtonContainer::OnConfigButton)); + wxCommandEventHandler(PanelButtonContainer::OnConfigButton)); } - //MLER + //End MLER this->m_AuiManager->Update(); } @@ -228,23 +234,25 @@ namespace creaPanelButtonContainer } // ---------------------------------------------------------------------------------- - 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"<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 diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.h index 096cedd..b0cb014 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.h @@ -37,6 +37,8 @@ #include #include #include +#include +#include #include "listConfigDialog.h" #include "containerSettings.h" @@ -71,17 +73,17 @@ namespace creaPanelButtonContainer //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 ); @@ -99,7 +101,7 @@ namespace creaPanelButtonContainer ~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 */ @@ -107,7 +109,7 @@ namespace creaPanelButtonContainer 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 */ @@ -115,31 +117,51 @@ namespace creaPanelButtonContainer 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; //!