X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=kernel%2Fsrc%2FbbtkWxGUIPackageBrowser2.cxx;h=29b5b83819e7f79827322495b23527c5f85a77ef;hb=2eafa50a2864f03b51480ef194f6ddfbc26b8264;hp=bc5b5253bffcbc0d811f8e824bcaedc755544c4b;hpb=c2cb9b0a71afbe9207d34554b05fc3651fcf7098;p=bbtk.git diff --git a/kernel/src/bbtkWxGUIPackageBrowser2.cxx b/kernel/src/bbtkWxGUIPackageBrowser2.cxx index bc5b525..29b5b83 100644 --- a/kernel/src/bbtkWxGUIPackageBrowser2.cxx +++ b/kernel/src/bbtkWxGUIPackageBrowser2.cxx @@ -105,16 +105,19 @@ namespace bbtk EVT_RIGHT_DOWN(WxGUIBlackBoxList::OnRightClick) END_EVENT_TABLE() - int wxCALLBACK MyCompareFunction(long item1, long item2, long WXUNUSED(sortData)) - { +int wxCALLBACK MyCompareFunction(long item1, long item2, long WXUNUSED(sortData)) +{ // inverse the order if (item1 < item2) - return -1; + { + return -1; + } if (item1 > item2) - return 1; - + { + return 1; + } return 0; - } +} // WxGUIBlackBoxList WxGUIBlackBoxList::WxGUIBlackBoxList(wxWindow *parent, @@ -130,7 +133,7 @@ namespace bbtk EnableContextMenu(); #endif } - + void WxGUIBlackBoxList::Insert(BlackBoxDescriptor::Pointer d) { if (GetColumnCount()!=3) @@ -167,6 +170,7 @@ namespace bbtk */ } + void WxGUIBlackBoxList::OnCacheHint(wxListEvent& event) { @@ -257,7 +261,7 @@ namespace bbtk info.m_itemId = event.m_itemIndex; info.m_col = 0; info.m_mask = wxLIST_MASK_DATA; - wxString sendtext(_T("")); + wxString sendtext(_T("")); if ( GetItem(info) ) { // TO DO : STORE SMART PTR ? @@ -267,16 +271,19 @@ namespace bbtk //DFGO -> To identify it is a box sendtext += crea::std2wx("box:"); sendtext += crea::std2wx(d->GetFullTypeName()); + sendtext += _T(""); +// 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; @@ -606,6 +613,7 @@ namespace bbtk //================================================================ WxGUIBlackBoxInfo::WxGUIBlackBoxInfo(wxWindow* parent) : +// wxPanel(parent, -1,wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE), wxPanel(parent, -1), mDescriptor() { @@ -620,9 +628,7 @@ namespace bbtk 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, @@ -632,24 +638,35 @@ namespace bbtk 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) @@ -804,6 +821,17 @@ namespace bbtk id_fc3 }; + //================================================================ + void WxGUIPackageBrowser2::OnEraseBackGround( wxEvent& ) + { + mBoxList->ClearBackground(); + ClearBackground(); + Refresh(); +// Update(); + } + //================================================================ + + //================================================================ WxGUIPackageBrowser2::WxGUIPackageBrowser2( wxWindow *parent, WxGUIPackageBrowser2User* user ) @@ -821,8 +849,8 @@ namespace bbtk 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, @@ -958,8 +986,9 @@ namespace bbtk Layout(); } - //================================================================ + + //================================================================ Factory::Pointer WxGUIPackageBrowser2::GetFactory() { return mFactory; @@ -1037,9 +1066,9 @@ namespace bbtk //================================================================ 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) @@ -1070,8 +1099,8 @@ namespace bbtk bool ok=false; int i,size; - std::string strAA=strA; - std::string strBB=strB; + std::string strAA = strA; + std::string strBB = strB; size=strAA.length(); @@ -1252,6 +1281,15 @@ namespace bbtk } //======================================================================== + +std::string WxGUIPackageBrowser2::GetNameFilter() +{ + std::string s = wx2std( mNameFilter->GetValue() ); + return s; +} + + + //======================================================================== BEGIN_EVENT_TABLE(WxGUIPackageBrowser2, wxPanel) //EED EVT_TEXT_ENTER(id_f1, WxGUIPackageBrowser2::OnFilter ) @@ -1313,6 +1351,7 @@ namespace bbtk } //================================================================ + } // namespace bbtk