]> Creatis software - creaMaracasVisu.git/commitdiff
#2516 creaMaracasVisu Feature New Normal - creaPanelButtonContainer ListPanel with...
authorespinosa <espinosa@creatis.insa-lyon.fr>
Mon, 26 Jan 2015 22:38:26 +0000 (23:38 +0100)
committerespinosa <espinosa@creatis.insa-lyon.fr>
Mon, 26 Jan 2015 22:38:26 +0000 (23:38 +0100)
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.cxx

index 5de552c2ff816d48b423f769209fda1f4c9b92f2..1ec058def25b119870de2f4ff80268cd75381b22 100644 (file)
@@ -32,25 +32,39 @@ namespace creaButtonContainer
        namespace view
        {
                // ----------------------------------------------------------------------------------
-               ListWx::ListWx( wxWindow* parent, wxWindowID id,ItemsMap iMap , TFunctor* functor ): wxListCtrl(parent,id)
+               ListWx::ListWx( wxWindow* parent, wxWindowID id,ItemsMap iMap , TFunctor* functor ):
+                               wxPanel(parent,id)
                {
 
                        std::cout<< "MLER | ListWx::ListWx()" << std::endl;
                        this->m_itemsMap = iMap;
 
                        this->functor = functor;
-                       int i = 0;
+
+                       wxFlexGridSizer* sizer = new wxFlexGridSizer(1);
+                       sizer->Add( new  wxStaticText(this,-1, _("Lista")));
+                       sizer->AddGrowableCol(0);
+                       this->SetSizer(sizer);
+
+                       listBox = new wxListBox(this,-1);
+
+                       std::cout << "is ListBox"<< listBox->GetId()<< std::endl;
+               //      this->Connect( -1,wxEVT_COMMAND_CHOICE_SELECTED,
+                       //              (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&))(&ListWx::ListEvent) );
+                       this->Connect(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED,
+                                     wxCommandEventHandler(ListWx::ListEvent));
+
                        for (ItemsMap::iterator it=this->m_itemsMap.begin(); it!=this->m_itemsMap.end(); ++it)
                        {
 
                                std::string key = it->first;
-                               long index = this->InsertItem(i, wxString(key.c_str(), wxConvUTF8));
 
-                               std::cout << "index" << index << std::endl;
-                               this->Connect( -1, wxEVT_COMMAND_LIST_ITEM_SELECTED,
-                                                wxListEventHandler(ListWx::ListEvent) );
-                               i++;
+                               listBox->Append( wxString(key.c_str(), wxConvUTF8));
+
                        }
+                       sizer->Add(listBox,1,wxGROW);
+
+
                }
 
                // ----------------------------------------------------------------------------------
@@ -59,14 +73,22 @@ namespace creaButtonContainer
                }
 
                void
-               ListWx::ListEvent( wxListEvent& event )
+               ListWx::ListEvent( wxCommandEvent& event )
                {
                        try
                        {
                                std::cout<< "MLER | ListWx::ListEvent( wxListEvent& event )" << std::endl;
 
-                               wxString itemNom = event.GetItem().GetText();
+                       //      wxString itemNom = this->GetString(this->GetSelection());
+
+                       //      std::string itemNomC = std::string(itemNom.mb_str());
+
+                               //this->functor->Call(itemNomC);
+
+                               int iSelection;
+                               iSelection = listBox->GetSelection();
 
+                               wxString itemNom = listBox->GetString(iSelection);
                                std::string itemNomC = std::string(itemNom.mb_str());
 
                                this->functor->Call(itemNomC);
index 7f3054929d6a33d90cfa422ee88330a56844c9b4..7f0478ae9b28607aaa490e62860004435b41b192 100644 (file)
 #include <wx/image.h>
 #include <wx/string.h>
 #include <wx/bitmap.h>
-#include <wx/listctrl.h>
+//#include <wx/listctrl.h>
+#include <wx/control.h>
+#include <wx/choice.h>
+#include <wx/listbox.h>
 #include <wx/wx.h>
 
 
@@ -49,7 +52,7 @@ namespace creaButtonContainer
        namespace view
        {
 
-               class ListWx : public wxListCtrl
+               class ListWx : public wxPanel
                {
                        public:
 
@@ -69,11 +72,15 @@ namespace creaButtonContainer
                                GetID( );
 
                                void
-                               ListEvent( wxListEvent& event );
+                               ListEvent( wxCommandEvent& event );
                                // ----------------------------------------------------------------------------------
                        private:
                                ItemsMap m_itemsMap; //! <The pair with the button information.
                                TFunctor* functor;
+                               //wxPanel* panel;
+                               wxListBox* listBox;
+                               wxFlexGridSizer* sizer;
+
 
                };
        }//ecapseman
index bb00f7dff81a165f03ff055861531a7f3b23adad..ccd01c5ca943e9d41eb31f18551eca187c6dc119 100644 (file)
@@ -127,7 +127,8 @@ namespace creaPanelButtonContainer
                         */
 
                        typedef std::map< std::string, wxPanel* > ItemsMap;
-               public:
+
+                       public:
                        // ----------------------------------------------------------------------------------
                        /*! @fn ButtonContainerSettings( );
                         *      @brief This is the default constructor.
index 7139fd1deca8434f54bf58ec5e217d4f8b3efdf7..d7212643309df2ef6e71cfefff67d49e74eab739 100644 (file)
@@ -50,7 +50,7 @@ namespace creaPanelButtonContainer
                std::cout<< "MLER | creaPanelButtonContainer:: PanelButtonContainer() " << std::endl;
 
                this->m_ButtonContainerSettings = bcSettings;
-               this->m_ButtonPanel = new wxPanel( this );
+
 
                //Class that manages the event!!!
        //EED 20/01/2012
@@ -61,33 +61,33 @@ namespace creaPanelButtonContainer
                TConcreteFunctor* lFunctor = new TConcreteFunctor( this, &PanelButtonContainer::GenericListEvent );
                //MLER
 
-               this->m_ListPanel = new wxPanel(this);
+               //Using AuiManager to Manage the Panels
+               this->m_AuiManager = new wxAuiManager( this, wxAUI_MGR_DEFAULT );
+
 
                if(type == 0)
                {
+                       this->m_ButtonPanel = new wxPanel( this );
                        std::cout << "tipo 0; new ButtonContainerPanel"<<std::endl;
                        this->m_ButtonContainerPanel = new ButtonContainerPanel( this, this->m_ButtonContainerSettings->GetButtonGroupSettings( functor ),type );
+
+                       this->m_AuiManager->AddPane( this->m_ButtonContainerPanel,wxAuiPaneInfo( ).Name( _T("ButtonContainerPanel") ).Caption(_("ButtonContainerPanel") ). CaptionVisible( true ).CloseButton(false ).Center( ).Resizable( true ) );
+                       this->m_AuiManager->AddPane(this->m_ButtonPanel, wxAuiPaneInfo( ).Name( _T("ButtonPanel") ).Caption( _("ButtonPanel") ). CaptionVisible(true ).CloseButton( false ).Bottom( ).Resizable( true ) );
                }
                else if( type == 1)
                {
+                       this->m_ListPanel = new wxPanel(this);
                        std::cout << "tipo 1; new LIstWx"<<std::endl;
-                       this->mylist = new ListWx(this->m_ListPanel, -1,this->m_ButtonContainerSettings->GetItemsMap(), lFunctor);
+                       this->mylist = new ListWx(this, -1,this->m_ButtonContainerSettings->GetItemsMap(), lFunctor);
+
+                       this->m_AuiManager->AddPane( this->mylist,wxAuiPaneInfo( ).Name( _T("ListContainerPanel") ).Caption(_("ListContainerPanel") ). CaptionVisible( true ).CloseButton(false ).Center( ).Resizable( true ) );
+                       this->m_AuiManager->AddPane(this->m_ListPanel, wxAuiPaneInfo( ).Name( _T("ListPanel") ).Caption( _("ListPanel") ). CaptionVisible(true ).CloseButton( false ).Bottom( ).Resizable( true ) );
                }//MLER
 
 
-               //Using AuiManager to Manage the Panels
-               this->m_AuiManager = new wxAuiManager( this, wxAUI_MGR_DEFAULT );
+               //CartoButtonPanel Management
 
-               if(type == 0)
-                       this->m_AuiManager->AddPane(this->m_ButtonContainerPanel, wxAuiPaneInfo( ).Name( _T("ButtonPanel") ).Caption( _("Panel") ). CaptionVisible(true ).CloseButton( false ).Bottom( ).Resizable( true ) );
-               else if(type == 1)
-                       this->m_AuiManager->AddPane(this->m_ListPanel, wxAuiPaneInfo( ).Name( _T("ListPanel") ).Caption( _("Panel") ). CaptionVisible(true ).CloseButton( false ).Bottom( ).Resizable( true ) );
 
-               //CartoButtonPanel Management
-               if(type == 0)
-                       this->m_AuiManager->AddPane( this->m_ButtonContainerPanel,wxAuiPaneInfo( ).Name( _T("ButtonPanel") ).Caption(_("ListPanel") ). CaptionVisible( false ).CloseButton(false ).Center( ).Resizable( true ) );
-               else if(type ==1)
-                       {this->m_AuiManager->AddPane( this->m_ListPanel,wxAuiPaneInfo( ).Name( _T("ListPanel") ).Caption(_("ListPanel") ). CaptionVisible( false ).CloseButton(false ).Center( ).Resizable( true ) );}
                this->m_AuiManager->Update( );
        }
        // ----------------------------------------------------------------------------------