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);
+
+
}
// ----------------------------------------------------------------------------------
}
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);
#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>
namespace view
{
- class ListWx : public wxListCtrl
+ class ListWx : public wxPanel
{
public:
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
*/
typedef std::map< std::string, wxPanel* > ItemsMap;
- public:
+
+ public:
// ----------------------------------------------------------------------------------
/*! @fn ButtonContainerSettings( );
* @brief This is the default constructor.
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
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( );
}
// ----------------------------------------------------------------------------------