#include <bbtkWxGUIPackageBrowser2.h>
Public Member Functions | |
WxGUIPackageBrowser2 (wxWindow *parent, WxGUIPackageBrowser2User *user=0) | |
~WxGUIPackageBrowser2 () | |
void | IncludeAll () |
void | BuildFromFactory (Factory::Pointer f) |
void | RebuildList () |
bool | IsVisible (BlackBoxDescriptor::Pointer d) |
void | OnFilter (wxCommandEvent &) |
void | WxGUIBlackBoxListUserOnSelected (BlackBoxDescriptor *) |
Private Attributes | |
wxAuiManager | m_mgr |
WxGUIPackageBrowser2User * | mUser |
Interpreter::Pointer | mInterpreter |
Factory::Pointer | mFactory |
WxGUIBlackBoxList * | mBoxList |
WxGUIBlackBoxInfo * | mBoxInfo |
wxTextCtrl * | mPackageFilter |
wxTextCtrl * | mNameFilter |
wxTextCtrl * | mDescriptionFilter |
wxTextCtrl * | mCategoryFilter |
wxTextCtrl * | mInputTypeFilter |
wxTextCtrl * | mOutputTypeFilter |
wxTextCtrl * | mInputNatureFilter |
wxTextCtrl * | mOutputNatureFilter |
wxCheckBox * | mShowWidgetsFilter |
wxCheckBox * | mShowAdaptorsFilter |
wxCheckBox * | mShowGUIsFilter |
Definition at line 193 of file bbtkWxGUIPackageBrowser2.h.
bbtk::WxGUIPackageBrowser2::WxGUIPackageBrowser2 | ( | wxWindow * | parent, | |
WxGUIPackageBrowser2User * | user = 0 | |||
) |
Definition at line 778 of file bbtkWxGUIPackageBrowser2.cxx.
References _T, bbtk::id_f1, bbtk::id_f2, bbtk::id_f3, bbtk::id_f4, bbtk::id_f5, bbtk::id_f6, bbtk::id_f7, bbtk::id_f8, bbtk::id_fc1, bbtk::id_fc2, bbtk::id_fc3, LIST_CTRL, m_mgr, mBoxInfo, mBoxList, mCategoryFilter, mDescriptionFilter, mInputNatureFilter, mInputTypeFilter, mNameFilter, mOutputNatureFilter, mOutputTypeFilter, mPackageFilter, mShowAdaptorsFilter, mShowGUIsFilter, mShowWidgetsFilter, and bbtk::WxGUIBlackBoxList::SetUser().
00780 : wxPanel(parent, -1), 00781 mUser(user), 00782 mInterpreter() 00783 { 00784 m_mgr.SetManagedWindow(this); 00785 00786 // wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); 00787 mBoxList = new WxGUIBlackBoxList(this, LIST_CTRL, 00788 wxDefaultPosition, 00789 wxDefaultSize, 00790 wxLC_REPORT //wxLC_LIST 00791 | wxSUNKEN_BORDER); 00792 mBoxList->SetUser(this); 00793 mBoxList->SetBackgroundColour(*wxWHITE); 00794 00795 m_mgr.AddPane(mBoxList, 00796 wxAuiPaneInfo().Name(wxT("BoxList")) 00797 .Caption(wxT("Black Boxes")) 00798 .MinimizeButton(true) 00799 .MaximizeButton(true) 00800 .Center() 00801 .MinSize(wxSize(100,100)) 00802 ); 00803 // sizer->Add(mBoxList,5,wxGROW); 00804 00805 mBoxInfo = new WxGUIBlackBoxInfo(this); 00806 // sizer->Add(mBoxInfo,3,wxGROW); 00807 00808 m_mgr.AddPane(mBoxInfo, 00809 wxAuiPaneInfo().Name(wxT("Box")) 00810 .Caption(wxT("")) 00811 .MinimizeButton(true) 00812 .MaximizeButton(true) 00813 .Bottom() 00814 .MinSize(wxSize(100,300)) 00815 ); 00816 00817 00818 wxPanel* filters = new wxPanel(this,-1); 00819 wxBoxSizer *fsizer = new wxBoxSizer(wxVERTICAL ); 00820 wxBoxSizer *fpack = 00821 new wxStaticBoxSizer 00822 ( new wxStaticBox(filters, wxID_ANY, _T("Package")), wxHORIZONTAL ); 00823 mPackageFilter = new wxTextCtrl(filters,id_f1,_T(""), 00824 wxDefaultPosition, 00825 wxDefaultSize, 00826 wxTE_PROCESS_ENTER); 00827 fpack->Add(mPackageFilter,1,wxGROW); 00828 fsizer->Add(fpack,0,wxGROW); 00829 wxBoxSizer *fname = 00830 new wxStaticBoxSizer 00831 ( new wxStaticBox(filters, wxID_ANY, _T("Name")), wxHORIZONTAL ); 00832 mNameFilter = new wxTextCtrl(filters,id_f2,_T(""), 00833 wxDefaultPosition, 00834 wxDefaultSize, 00835 wxTE_PROCESS_ENTER); 00836 fname->Add(mNameFilter,1,wxGROW); 00837 fsizer->Add(fname,0,wxGROW); 00838 wxBoxSizer *fdescr = 00839 new wxStaticBoxSizer 00840 ( new wxStaticBox(filters, wxID_ANY, _T("Description")), wxHORIZONTAL ); 00841 mDescriptionFilter = new wxTextCtrl(filters,id_f3,_T(""), 00842 wxDefaultPosition, 00843 wxDefaultSize, 00844 wxTE_PROCESS_ENTER); 00845 fdescr->Add(mDescriptionFilter,1,wxGROW); 00846 fsizer->Add(fdescr,0,wxGROW); 00847 wxBoxSizer *fcat = 00848 new wxStaticBoxSizer 00849 ( new wxStaticBox(filters, wxID_ANY, _T("Category")), wxHORIZONTAL ); 00850 mCategoryFilter = new wxTextCtrl(filters,id_f4,_T(""), 00851 wxDefaultPosition, 00852 wxDefaultSize, 00853 wxTE_PROCESS_ENTER); 00854 fcat->Add(mCategoryFilter,1,wxGROW); 00855 fsizer->Add(fcat,0,wxGROW); 00856 wxBoxSizer *fintype = 00857 new wxStaticBoxSizer 00858 ( new wxStaticBox(filters, wxID_ANY, _T("Input type")), wxHORIZONTAL ); 00859 mInputTypeFilter = new wxTextCtrl(filters,id_f5,_T(""), 00860 wxDefaultPosition, 00861 wxDefaultSize, 00862 wxTE_PROCESS_ENTER); 00863 fintype->Add(mInputTypeFilter,1,wxGROW); 00864 fsizer->Add(fintype,0,wxGROW); 00865 wxBoxSizer *fouttype = 00866 new wxStaticBoxSizer 00867 ( new wxStaticBox(filters, wxID_ANY, _T("Output type")), wxHORIZONTAL ); 00868 mOutputTypeFilter = new wxTextCtrl(filters,id_f6,_T(""), 00869 wxDefaultPosition, 00870 wxDefaultSize, 00871 wxTE_PROCESS_ENTER); 00872 fouttype->Add(mOutputTypeFilter,1,wxGROW); 00873 fsizer->Add(fouttype,0,wxGROW); 00874 wxBoxSizer *finnat = 00875 new wxStaticBoxSizer 00876 ( new wxStaticBox(filters, wxID_ANY, _T("Input nature")),wxHORIZONTAL ); 00877 mInputNatureFilter = new wxTextCtrl(filters,id_f7,_T(""), 00878 wxDefaultPosition, 00879 wxDefaultSize, 00880 wxTE_PROCESS_ENTER); 00881 finnat->Add(mInputNatureFilter,1,wxGROW); 00882 fsizer->Add(finnat,0,wxGROW); 00883 wxBoxSizer *foutnat = 00884 new wxStaticBoxSizer 00885 ( new wxStaticBox(filters, wxID_ANY,_T("Output nature")),wxHORIZONTAL ); 00886 mOutputNatureFilter = new wxTextCtrl(filters,id_f8,_T(""), 00887 wxDefaultPosition, 00888 wxDefaultSize, 00889 wxTE_PROCESS_ENTER); 00890 foutnat->Add(mOutputNatureFilter,1,wxGROW); 00891 fsizer->Add(foutnat,0,wxGROW); 00892 00893 00894 mShowWidgetsFilter = new wxCheckBox(filters,id_fc1,_T("Show widgets")); 00895 mShowWidgetsFilter->SetValue(true); 00896 fsizer->Add(mShowWidgetsFilter,0,wxGROW); 00897 00898 mShowAdaptorsFilter = new wxCheckBox(filters,id_fc2,_T("Show adaptors")); 00899 mShowAdaptorsFilter->SetValue(false); 00900 fsizer->Add(mShowAdaptorsFilter,0,wxGROW); 00901 00902 mShowGUIsFilter = new wxCheckBox(filters,id_fc3,_T("Show GUIs")); 00903 mShowGUIsFilter->SetValue(false); 00904 fsizer->Add(mShowGUIsFilter,0,wxGROW); 00905 00906 filters->SetSizer(fsizer); 00907 00908 m_mgr.AddPane(filters, 00909 wxAuiPaneInfo().Name(wxT("Filter")) 00910 .Caption(wxT("Filter")) 00911 .MinimizeButton(true) 00912 .MaximizeButton(true) 00913 .Right() 00914 .MinSize(wxSize(100,100)) ); 00915 00916 00917 00918 // sizer->Add(fsizer,1,wxGROW); 00919 m_mgr.Update(); 00920 00921 // SetSizer(sizer); 00922 SetAutoLayout(true); 00923 Layout(); 00924 00925 }
bbtk::WxGUIPackageBrowser2::~WxGUIPackageBrowser2 | ( | ) |
Definition at line 949 of file bbtkWxGUIPackageBrowser2.cxx.
References m_mgr, mFactory, and mInterpreter.
00950 { 00951 mFactory.reset(); 00952 mInterpreter.reset(); 00953 // Object::PrintObjectListInfo(""); 00954 m_mgr.UnInit(); 00955 }
void bbtk::WxGUIPackageBrowser2::IncludeAll | ( | ) |
Definition at line 959 of file bbtkWxGUIPackageBrowser2.cxx.
References BuildFromFactory(), and mInterpreter.
Referenced by WxGUIHelp::WxGUIHelp().
00960 { 00961 if (!mInterpreter) mInterpreter =bbtk::Interpreter::New(); 00962 mInterpreter->SetCommandLine(true); 00963 std::stringstream* buf = new std::stringstream; 00964 *buf << "message max 0" << std::endl; 00965 *buf << "include *" << std::endl; 00966 mInterpreter->InterpretBuffer(buf); 00967 00968 Factory::Pointer F = mInterpreter->GetExecuter()->GetFactory(); 00969 BuildFromFactory(F); 00970 }
void bbtk::WxGUIPackageBrowser2::BuildFromFactory | ( | Factory::Pointer | f | ) |
Definition at line 974 of file bbtkWxGUIPackageBrowser2.cxx.
References mFactory, and RebuildList().
Referenced by IncludeAll().
00975 { 00976 mFactory = F; 00977 RebuildList(); 00978 }
void bbtk::WxGUIPackageBrowser2::RebuildList | ( | ) |
Definition at line 982 of file bbtkWxGUIPackageBrowser2.cxx.
References bbtk::i, bbtk::WxGUIBlackBoxList::Insert(), IsVisible(), mBoxList, and mFactory.
Referenced by BuildFromFactory(), and OnFilter().
00983 { 00984 mBoxList->Hide(); 00985 mBoxList->ClearAll(); 00986 00987 const Factory::PackageMapType& M = mFactory->GetPackageMap(); 00988 Factory::PackageMapType::const_iterator i; 00989 for (i=M.begin();i!=M.end();++i) 00990 { 00991 Package::Pointer P = i->second; 00992 if (P->GetName() == "user") continue; 00993 00994 Package::BlackBoxMapType::iterator j; 00995 for (j=P->GetBlackBoxMap().begin(); 00996 j!=P->GetBlackBoxMap().end(); 00997 ++j) 00998 { 00999 // std::cout << "Insert "<<j->second->GetTypeName()<<std::endl; 01000 if (IsVisible(j->second)) 01001 mBoxList->Insert(j->second); 01002 } 01003 } 01004 mBoxList->Show(); 01005 }
bool bbtk::WxGUIPackageBrowser2::IsVisible | ( | BlackBoxDescriptor::Pointer | d | ) |
Definition at line 1009 of file bbtkWxGUIPackageBrowser2.cxx.
References mCategoryFilter, mDescriptionFilter, mInputNatureFilter, mInputTypeFilter, mNameFilter, mOutputNatureFilter, mOutputTypeFilter, mPackageFilter, mShowAdaptorsFilter, mShowGUIsFilter, mShowWidgetsFilter, and bbtk::wx2std().
Referenced by RebuildList().
01010 { 01011 // std::cout << " '" << wx2std(mPackageFilter->GetValue())<<"'"<<std::endl; 01012 // std::cout << "vs '" << d->GetPackage()->GetName() << "'"<<std::endl; 01013 if ((!mShowAdaptorsFilter->IsChecked())&& 01014 ((d->GetKind()==BlackBoxDescriptor::ADAPTOR)|| 01015 (d->GetKind()==BlackBoxDescriptor::DEFAULT_ADAPTOR))) 01016 return false; 01017 if ((!mShowGUIsFilter->IsChecked())&& 01018 ((d->GetKind()==BlackBoxDescriptor::GUI)|| 01019 (d->GetKind()==BlackBoxDescriptor::DEFAULT_GUI))) 01020 return false; 01021 if (d->GetPackage()->GetName().find( wx2std(mPackageFilter->GetValue()) ) 01022 == std::string::npos ) return false; 01023 if (d->GetTypeName().find( wx2std(mNameFilter->GetValue()) ) 01024 == std::string::npos ) return false; 01025 if (d->GetDescription().find( wx2std(mDescriptionFilter->GetValue()) ) 01026 == std::string::npos ) return false; 01027 if (d->GetCategory().find( wx2std(mCategoryFilter->GetValue()) ) 01028 == std::string::npos ) return false; 01029 if (!mShowWidgetsFilter->IsChecked()) 01030 { 01031 bool found = false; 01032 const BlackBoxDescriptor::OutputDescriptorMapType& imap = 01033 d->GetOutputDescriptorMap(); 01034 BlackBoxDescriptor::OutputDescriptorMapType::const_iterator in; 01035 for ( in = imap.begin(); in != imap.end(); ++in ) 01036 { 01037 if (in->second->GetName() == "Widget" ) 01038 { 01039 found = true; 01040 break; 01041 } 01042 } 01043 if (found) return false; 01044 } 01045 if (mInputTypeFilter->GetValue().size()>0) 01046 { 01047 std::string s = wx2std(mInputTypeFilter->GetValue()); 01048 bool found = false; 01049 const BlackBoxDescriptor::InputDescriptorMapType& imap = 01050 d->GetInputDescriptorMap(); 01051 BlackBoxDescriptor::InputDescriptorMapType::const_iterator in; 01052 for ( in = imap.begin(); in != imap.end(); ++in ) 01053 { 01054 if (in->second->GetTypeName().find(s)!=std::string::npos) 01055 { 01056 found = true; 01057 break; 01058 } 01059 } 01060 if (!found) return false; 01061 } 01062 if (mOutputTypeFilter->GetValue().size()>0) 01063 { 01064 std::string s = wx2std(mOutputTypeFilter->GetValue()); 01065 bool found = false; 01066 const BlackBoxDescriptor::OutputDescriptorMapType& imap = 01067 d->GetOutputDescriptorMap(); 01068 BlackBoxDescriptor::OutputDescriptorMapType::const_iterator in; 01069 for ( in = imap.begin(); in != imap.end(); ++in ) 01070 { 01071 if (in->second->GetTypeName().find(s)!=std::string::npos) 01072 { 01073 found = true; 01074 break; 01075 } 01076 } 01077 if (!found) return false; 01078 } 01079 if (mInputNatureFilter->GetValue().size()>0) 01080 { 01081 std::string s = wx2std(mInputNatureFilter->GetValue()); 01082 bool found = false; 01083 const BlackBoxDescriptor::InputDescriptorMapType& imap = 01084 d->GetInputDescriptorMap(); 01085 BlackBoxDescriptor::InputDescriptorMapType::const_iterator in; 01086 for ( in = imap.begin(); in != imap.end(); ++in ) 01087 { 01088 if (in->second->GetNature().find(s)!=std::string::npos) 01089 { 01090 found = true; 01091 break; 01092 } 01093 } 01094 if (!found) return false; 01095 } 01096 if (mOutputNatureFilter->GetValue().size()>0) 01097 { 01098 std::string s = wx2std(mOutputNatureFilter->GetValue()); 01099 bool found = false; 01100 const BlackBoxDescriptor::OutputDescriptorMapType& imap = 01101 d->GetOutputDescriptorMap(); 01102 BlackBoxDescriptor::OutputDescriptorMapType::const_iterator in; 01103 for ( in = imap.begin(); in != imap.end(); ++in ) 01104 { 01105 if (in->second->GetNature().find(s)!=std::string::npos) 01106 { 01107 found = true; 01108 break; 01109 } 01110 } 01111 if (!found) return false; 01112 } 01113 01114 return true; 01115 }
void bbtk::WxGUIPackageBrowser2::OnFilter | ( | wxCommandEvent & | ) |
Definition at line 929 of file bbtkWxGUIPackageBrowser2.cxx.
References RebuildList().
00930 { 00931 RebuildList(); 00932 }
void bbtk::WxGUIPackageBrowser2::WxGUIBlackBoxListUserOnSelected | ( | BlackBoxDescriptor * | d | ) | [virtual] |
Reimplemented from bbtk::WxGUIBlackBoxListUser.
Definition at line 938 of file bbtkWxGUIPackageBrowser2.cxx.
References bbtk::BlackBoxDescriptor::GetPackage(), bbtk::BlackBoxDescriptor::GetTypeName(), m_mgr, mBoxInfo, bbtk::std2wx(), and bbtk::WxGUIBlackBoxInfo::UpdateInfo().
00939 { 00940 mBoxInfo->UpdateInfo(d); 00941 std::string title = d->GetPackage()->GetName()+"::"+d->GetTypeName(); 00942 m_mgr.GetPane(mBoxInfo).Caption(std2wx(title)); 00943 m_mgr.Update(); 00944 }
wxAuiManager bbtk::WxGUIPackageBrowser2::m_mgr [private] |
Definition at line 212 of file bbtkWxGUIPackageBrowser2.h.
Referenced by WxGUIBlackBoxListUserOnSelected(), WxGUIPackageBrowser2(), and ~WxGUIPackageBrowser2().
WxGUIPackageBrowser2User* bbtk::WxGUIPackageBrowser2::mUser [private] |
Definition at line 213 of file bbtkWxGUIPackageBrowser2.h.
Interpreter::Pointer bbtk::WxGUIPackageBrowser2::mInterpreter [private] |
Definition at line 214 of file bbtkWxGUIPackageBrowser2.h.
Referenced by IncludeAll(), and ~WxGUIPackageBrowser2().
Factory::Pointer bbtk::WxGUIPackageBrowser2::mFactory [private] |
Definition at line 215 of file bbtkWxGUIPackageBrowser2.h.
Referenced by BuildFromFactory(), RebuildList(), and ~WxGUIPackageBrowser2().
WxGUIBlackBoxList* bbtk::WxGUIPackageBrowser2::mBoxList [private] |
Definition at line 216 of file bbtkWxGUIPackageBrowser2.h.
Referenced by RebuildList(), and WxGUIPackageBrowser2().
WxGUIBlackBoxInfo* bbtk::WxGUIPackageBrowser2::mBoxInfo [private] |
Definition at line 217 of file bbtkWxGUIPackageBrowser2.h.
Referenced by WxGUIBlackBoxListUserOnSelected(), and WxGUIPackageBrowser2().
wxTextCtrl* bbtk::WxGUIPackageBrowser2::mPackageFilter [private] |
Definition at line 219 of file bbtkWxGUIPackageBrowser2.h.
Referenced by IsVisible(), and WxGUIPackageBrowser2().
wxTextCtrl* bbtk::WxGUIPackageBrowser2::mNameFilter [private] |
Definition at line 220 of file bbtkWxGUIPackageBrowser2.h.
Referenced by IsVisible(), and WxGUIPackageBrowser2().
wxTextCtrl* bbtk::WxGUIPackageBrowser2::mDescriptionFilter [private] |
Definition at line 221 of file bbtkWxGUIPackageBrowser2.h.
Referenced by IsVisible(), and WxGUIPackageBrowser2().
wxTextCtrl* bbtk::WxGUIPackageBrowser2::mCategoryFilter [private] |
Definition at line 222 of file bbtkWxGUIPackageBrowser2.h.
Referenced by IsVisible(), and WxGUIPackageBrowser2().
wxTextCtrl* bbtk::WxGUIPackageBrowser2::mInputTypeFilter [private] |
Definition at line 223 of file bbtkWxGUIPackageBrowser2.h.
Referenced by IsVisible(), and WxGUIPackageBrowser2().
wxTextCtrl* bbtk::WxGUIPackageBrowser2::mOutputTypeFilter [private] |
Definition at line 224 of file bbtkWxGUIPackageBrowser2.h.
Referenced by IsVisible(), and WxGUIPackageBrowser2().
wxTextCtrl* bbtk::WxGUIPackageBrowser2::mInputNatureFilter [private] |
Definition at line 225 of file bbtkWxGUIPackageBrowser2.h.
Referenced by IsVisible(), and WxGUIPackageBrowser2().
wxTextCtrl* bbtk::WxGUIPackageBrowser2::mOutputNatureFilter [private] |
Definition at line 226 of file bbtkWxGUIPackageBrowser2.h.
Referenced by IsVisible(), and WxGUIPackageBrowser2().
wxCheckBox* bbtk::WxGUIPackageBrowser2::mShowWidgetsFilter [private] |
Definition at line 228 of file bbtkWxGUIPackageBrowser2.h.
Referenced by IsVisible(), and WxGUIPackageBrowser2().
wxCheckBox* bbtk::WxGUIPackageBrowser2::mShowAdaptorsFilter [private] |
Definition at line 229 of file bbtkWxGUIPackageBrowser2.h.
Referenced by IsVisible(), and WxGUIPackageBrowser2().
wxCheckBox* bbtk::WxGUIPackageBrowser2::mShowGUIsFilter [private] |
Definition at line 230 of file bbtkWxGUIPackageBrowser2.h.
Referenced by IsVisible(), and WxGUIPackageBrowser2().