]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkWxGUIPackageBrowser2.cxx
clean code
[bbtk.git] / kernel / src / bbtkWxGUIPackageBrowser2.cxx
index 21fc26d2e584a6a39bd9453a682bb83572a31f10..e87ffcbd5f890e574693e1ffddc2af31b4060618 100644 (file)
@@ -133,7 +133,7 @@ int wxCALLBACK MyCompareFunction(long item1, long item2, long WXUNUSED(sortData)
     EnableContextMenu();
 #endif
   }
-
+  
   void WxGUIBlackBoxList::Insert(BlackBoxDescriptor::Pointer d)
   {
     if (GetColumnCount()!=3)
@@ -170,6 +170,7 @@ int wxCALLBACK MyCompareFunction(long item1, long item2, long WXUNUSED(sortData)
     */
   }
 
+  
 
   void WxGUIBlackBoxList::OnCacheHint(wxListEvent& event)
   {
@@ -270,16 +271,19 @@ int wxCALLBACK MyCompareFunction(long item1, long item2, long WXUNUSED(sortData)
                      //DFGO -> To identify it is a box
                      sendtext += crea::std2wx("box:");
                      sendtext += crea::std2wx(d->GetFullTypeName());
+                     sendtext += _T("<EndEED>");
+              printf("EED WxGUIBlackBoxList::OnBeginDrag <%s>%d  <%s>%d\n",
+                     (const char*)sendtext.mb_str(),sendtext.Len() ,  d->GetFullTypeName().c_str() , d->GetFullTypeName().length() );
                  }
-         }
-         else
-         {
+         } else {
                  wxFAIL_MSG(wxT("wxListCtrl::GetItem() failed"));
          }
 
          wxTextDataObject tdo(sendtext);
+      printf("EED WxGUIBlackBoxList::OnBeginDrag <%s>\n",(const char*) tdo.GetText().mb_str() );
+
          wxDropSource tds(tdo, this);
-         tds.DoDragDrop();
+         tds.DoDragDrop( );
 
     //    const wxPoint& pt = event.m_pointDrag;
 
@@ -609,6 +613,7 @@ int wxCALLBACK MyCompareFunction(long item1, long item2, long WXUNUSED(sortData)
   //================================================================
   WxGUIBlackBoxInfo::WxGUIBlackBoxInfo(wxWindow* parent)
     :
+//    wxPanel(parent, -1,wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE),
     wxPanel(parent, -1),
     mDescriptor()
   {
@@ -623,9 +628,7 @@ int wxCALLBACK MyCompareFunction(long item1, long item2, long WXUNUSED(sortData)
     mCategory = new wxStaticText(this,-1,_T(""));
     sizer->Add(mCategory,0,wxGROW);
 
-    wxBoxSizer *inputs =
-      new wxStaticBoxSizer
-      ( new wxStaticBox(this, wxID_ANY, _T("Inputs")), wxVERTICAL );
+    wxBoxSizer *inputs = new wxStaticBoxSizer ( new wxStaticBox(this, wxID_ANY, _T("Inputs")), wxVERTICAL );
     mInputList = new wxListCtrl(this, -1,
                                wxDefaultPosition,
                                wxDefaultSize,
@@ -635,24 +638,35 @@ int wxCALLBACK MyCompareFunction(long item1, long item2, long WXUNUSED(sortData)
     inputs->Add(mInputList,1,wxGROW);
     sizer->Add(inputs,1,wxGROW);
 
-    wxBoxSizer *outputs =
-      new wxStaticBoxSizer
-      ( new wxStaticBox(this, wxID_ANY, _T("Outputs")), wxVERTICAL );
+    wxBoxSizer *outputs = new wxStaticBoxSizer ( new wxStaticBox(this, wxID_ANY, _T("Outputs")), wxVERTICAL );
     mOutputList = new wxListCtrl(this, -1,
                                 wxDefaultPosition,
                                 wxDefaultSize,
                                 wxLC_REPORT //wxLC_LIST
-                                | wxSUNKEN_BORDER);
+                                | wxBORDER_SUNKEN);
+//                              | wxFULL_REPAINT_ON_RESIZE | wxVSCROLL);
 
     outputs->Add(mOutputList,1,wxGROW);
     sizer->Add(outputs,1,wxGROW);
 
     SetSizer(sizer);
+//     sizer->FitInside(this); 
+       Connect( this->GetId(),   wxEVT_ERASE_BACKGROUND , (wxObjectEventFunction)   (void (WxGUIBlackBoxInfo::*)(wxEvent&))    &WxGUIBlackBoxInfo::OnEraseBackGround ); 
+
+       
     SetAutoLayout(true);
     Layout();
   }
   //================================================================
 
+  
+      void WxGUIBlackBoxInfo::OnEraseBackGround( wxEvent& )
+         {
+               mInputList->ClearBackground();
+               mOutputList->ClearBackground();
+         }
+
+
 
   //================================================================
   void WxGUIBlackBoxInfo::UpdateInfo(BlackBoxDescriptor* descr)
@@ -807,6 +821,17 @@ int wxCALLBACK MyCompareFunction(long item1, long item2, long WXUNUSED(sortData)
       id_fc3
     };
 
+  //================================================================
+  void WxGUIPackageBrowser2::OnEraseBackGround( wxEvent& )
+  {
+       mBoxList->ClearBackground();
+       ClearBackground();
+       Refresh();
+//     Update();
+  }
+  //================================================================
+    
+       
   //================================================================
   WxGUIPackageBrowser2::WxGUIPackageBrowser2( wxWindow *parent,
                                              WxGUIPackageBrowser2User* user )
@@ -824,8 +849,8 @@ int wxCALLBACK MyCompareFunction(long item1, long item2, long WXUNUSED(sortData)
                                     wxLC_REPORT //wxLC_LIST
                                     | wxSUNKEN_BORDER);
     mBoxList->SetUser(this);
-    mBoxList->SetBackgroundColour(*wxWHITE);
 
+       Connect( GetId(),   wxEVT_SIZE , (wxObjectEventFunction)   (void (WxGUIPackageBrowser2::*)(wxEvent&))    &WxGUIPackageBrowser2::OnEraseBackGround ); 
 
 // JGRR & CM DISABLED CLOSE BUTTON
     m_mgr.AddPane(mBoxList,
@@ -961,8 +986,9 @@ int wxCALLBACK MyCompareFunction(long item1, long item2, long WXUNUSED(sortData)
     Layout();
 
   }
-  //================================================================
+  
 
+  //================================================================
        Factory::Pointer WxGUIPackageBrowser2::GetFactory()
   {
     return mFactory;
@@ -1040,9 +1066,9 @@ int wxCALLBACK MyCompareFunction(long item1, long item2, long WXUNUSED(sortData)
   //================================================================
   void WxGUIPackageBrowser2::RebuildList()
   {
-    mBoxList->Hide();
+//    mBoxList->Hide();
     mBoxList->ClearAll();
-
+    mBoxList->ClearBackground();
     const Factory::PackageMapType& M = mFactory->GetPackageMap();
     Factory::PackageMapType::const_iterator i;
     for (i=M.begin();i!=M.end();++i)