]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.cxx
#2502 creaMaracasVisu Feature New Normal - alternation between containers: button...
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / creaButtonContainer / view / listWx.cxx
index 5e670e74cb4b1f1dffc804d6fa46c8cfd7089353..f64ab47bcc5d3a4a62628a410149eeacad316b36 100644 (file)
 #  knowledge of the CeCILL-B license and that you accept its terms.
 # ------------------------------------------------------------------------ */
 
+
 #include "listWx.h"
 
 namespace creaButtonContainer
 {
        namespace view
        {
-               ListWx::ListWx(wxWindow* parent, ItemsList items)
+               // ----------------------------------------------------------------------------------
+               ListWx::ListWx( wxWindow* parent, long id, ButtonPair* pair )
                {
-                       wxListCtrl* lstCtrl = new wxListCtrl (parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxLC_REPORT);
-
-                       this->m_items                   = items;
-                       lstCtrl->InsertItem(0,(*items.front()).GetText());
+                       this->m_ButtonPair                      = pair;
+                       StringType wXbuttonName         = this->m_ButtonPair->first->first;
+                       BitmapType wXicon               = this->m_ButtonPair->first->second;
+                       StringType wXdescription        = this->m_ButtonPair->second->first;
+                       wxString buttonName( wXbuttonName.c_str( ), wxConvUTF8 );
+                       wxString description( wXdescription.c_str( ), wxConvUTF8 );
+                       //creating the button.
+                       /*this->Create( parent, id,
+                                       wXicon,
+                           wxDefaultPosition, wxDefaultSize,wxBU_AUTODRAW, wxDefaultValidator,
+                           buttonName );*/
+                       this->Create( parent, id,
+                                                   wxDefaultPosition, wxDefaultSize,wxLC_LIST, wxDefaultValidator,
+                                                   buttonName );
+                       this->SetToolTip( description );
                }
 
-               //-------------------------------------------------------
-
-               tList::~tList( )
+               // ----------------------------------------------------------------------------------
+               ListWx::~ListWx( )
                {
                }
 
-               //-------------------------------------------------------
-
-               ItemsList getItems() const
+               // ----------------------------------------------------------------------------------
+               StringType
+               ListWx::GetButtonName( )
                {
-                       return m_items;
+                       return ( this->m_ButtonPair->first->first );
                }
 
-               void setItems(ItemsList items)
+               // ----------------------------------------------------------------------------------
+               BitmapType
+               ListWx::GetIcon( )
                {
-                       m_items = items;
+                       return ( this->m_ButtonPair->first->second );
                }
 
+               // ----------------------------------------------------------------------------------
+               /*StringType
+               Button::GetIconPath( )
+               {
+                       return ( this->m_ButtonPair->first->second );
+               }*/
 
+               // ----------------------------------------------------------------------------------
+               StringType
+               ListWx::GetDescription( )
+               {
+                       return ( this->m_ButtonPair->second->first );
+               }
 
-       }
-
-}
+               // ----------------------------------------------------------------------------------
+               void
+               ListWx::Execute( )
+               {
+                       try
+                       {
+                               TFunctor* vTable[ ] =
+                               { this->m_ButtonPair->second->second };
+                               vTable[ 0 ]->Call( this->m_ButtonPair->first->first );
+                       }//yrt
+                       catch ( const std::exception& e )
+                       {
+                               std::cerr << "Button::Execute( ) exception: " << e.what( ) << std::endl;
+                       }//hctac
+               }
+       // ----------------------------------------------------------------------------------
+       }//ecapseman
+}//ecapseman