]> Creatis software - bbtk.git/commitdiff
PackageBrowser dragAndDrop action
authorRicardo Corredor <Ricardo.Corredor@creatis.insa-lyon.fr>
Thu, 25 Mar 2010 15:24:50 +0000 (15:24 +0000)
committerRicardo Corredor <Ricardo.Corredor@creatis.insa-lyon.fr>
Thu, 25 Mar 2010 15:24:50 +0000 (15:24 +0000)
kernel/src/bbtkWxGUIPackageBrowser2.cxx
kernel/src/bbtkWxGUIPackageBrowser2.h

index 1593d3d320f29c7fde35f1ea6173e65391472c4d..d929e54c1546af76ac87f2c352a6eb5e4c3d3314 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkWxGUIPackageBrowser2.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/06/08 14:50:04 $
-  Version:   $Revision: 1.13 $
+  Date:      $Date: 2010/03/25 15:24:50 $
+  Version:   $Revision: 1.14 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -244,6 +244,31 @@ namespace bbtk
 
   void WxGUIBlackBoxList::OnBeginDrag(wxListEvent& event)
   {
+         std::cout<<"RaC DRAG TABLE"<<std::endl;
+         wxString text = this->GetItemText(event.GetIndex());
+         wxListItem info;
+         info.m_itemId = event.m_itemIndex;
+         info.m_col = 0;
+         info.m_mask = wxLIST_MASK_DATA;
+         if ( GetItem(info) )
+         {
+                 // TO DO : STORE SMART PTR ?
+                 BlackBoxDescriptor* d = (BlackBoxDescriptor*)(info.GetData());
+                 if (d!=0)
+                 {
+                         //mUser->WxGUIBlackBoxListUserOnSelected(d);
+                         text = d->GetAuthor();
+                 }
+         }
+         else
+         {
+                 wxFAIL_MSG(wxT("wxListCtrl::GetItem() failed"));
+         }
+
+
+         wxTextDataObject tdo(wxString::Format("%s %d",text,123456));
+         wxDropSource tds(tdo, this);
+         tds.DoDragDrop();
     //    const wxPoint& pt = event.m_pointDrag;
 
     //wxLogMessage( wxT("OnBeginDrag at (%d, %d), item %ld."),
@@ -937,12 +962,24 @@ namespace bbtk
   void WxGUIPackageBrowser2::WxGUIBlackBoxListUserOnSelected
   ( BlackBoxDescriptor* d)
   {
+       //RaC
+       _actualSelected=d;
+
     mBoxInfo->UpdateInfo(d);
     std::string title = d->GetPackage()->GetName()+"::"+d->GetTypeName();
     m_mgr.GetPane(mBoxInfo).Caption(std2wx(title));
     m_mgr.Update();
   }
   
+  //================================================================
+
+  //================================================================
+  BlackBoxDescriptor* WxGUIPackageBrowser2::GetActualSelected()
+  {
+         return _actualSelected;
+  }
+
+
   //================================================================
 
   //================================================================
@@ -977,6 +1014,7 @@ namespace bbtk
     mFactory = F;
     RebuildList();
   }  
+
   //================================================================
 
   //================================================================
index edf43412bfcd65762cfdee7793c856dd177b8533..42bbe978b0977d591fb51be827af8e15031c4284 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkWxGUIPackageBrowser2.h,v $
   Language:  C++
-  Date:      $Date: 2008/10/17 08:18:15 $
-  Version:   $Revision: 1.6 $
+  Date:      $Date: 2010/03/25 15:24:50 $
+  Version:   $Revision: 1.7 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -57,6 +57,9 @@
 #include "bbtkInterpreter.h"
 #include <wx/aui/aui.h>
 
+//Drag and drop
+#include <wx/dnd.h>
+#include <wx/dataobj.h>
 #include "wx/listctrl.h"
 // not all ports have support for EVT_CONTEXT_MENU yet, don't define
 // USE_CONTEXT_MENU for those which don't
@@ -207,6 +210,9 @@ private:
  
     // User callback when a box is selected in the list 
     void WxGUIBlackBoxListUserOnSelected( BlackBoxDescriptor* );
+       
+       //RaC   
+       BlackBoxDescriptor* GetActualSelected();
 
   private:
     wxAuiManager m_mgr;
@@ -229,6 +235,9 @@ private:
     wxCheckBox* mShowAdaptorsFilter;
     wxCheckBox* mShowGUIsFilter;
 
+       //RaC
+       BlackBoxDescriptor *_actualSelected;
+
    DECLARE_EVENT_TABLE()  
   };
   //================================================================