]> Creatis software - bbtk.git/blob - kernel/src/bbtkWxGUIPackageBrowser2.cxx
#3127 BBTK Feature New Normal - branch changeWx28to30 compilation with wxWidgets3
[bbtk.git] / kernel / src / bbtkWxGUIPackageBrowser2.cxx
1 /*
2  # ---------------------------------------------------------------------
3  #
4  # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5  #                        pour la SantÈ)
6  # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7  # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8  # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9  #
10  #  This software is governed by the CeCILL-B license under French law and
11  #  abiding by the rules of distribution of free software. You can  use,
12  #  modify and/ or redistribute the software under the terms of the CeCILL-B
13  #  license as circulated by CEA, CNRS and INRIA at the following URL
14  #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15  #  or in the file LICENSE.txt.
16  #
17  #  As a counterpart to the access to the source code and  rights to copy,
18  #  modify and redistribute granted by the license, users are provided only
19  #  with a limited warranty  and the software's author,  the holder of the
20  #  economic rights,  and the successive licensors  have only  limited
21  #  liability.
22  #
23  #  The fact that you are presently reading this means that you have had
24  #  knowledge of the CeCILL-B license and that you accept its terms.
25  # ------------------------------------------------------------------------ */
26
27
28 /*=========================================================================
29   Program:   bbtk
30   Module:    $RCSfile: bbtkWxGUIPackageBrowser2.cxx,v $
31   Language:  C++
32   Date:      $Date: 2012/11/16 08:49:01 $
33   Version:   $Revision: 1.27 $
34 =========================================================================*/
35
36
37
38 /* \brief Short description in one line
39  *
40  * Long description which
41  * can span multiple lines
42  */
43
44 /**
45  * \file
46  * \brief
47  */
48 /**
49  * \class bbtk::
50  * \brief
51  */
52
53
54 #ifdef _USE_WXWIDGETS_
55
56 #define CHECKBOXVIEW 1
57
58 #include "bbtkWxGUIPackageBrowser2.h"
59 //#include "ThirdParty/wx/treemultictrl/wxTreeMultiCtrl.h"
60 #include "bbtkInterpreter.h"
61 #include "bbtkBlackBoxInputDescriptor.h"
62 #include "bbtkBlackBoxOutputDescriptor.h"
63 #include "bbtkWxBlackBox.h"
64 //#include "wx/grid.h"
65 //#include <wx/statline.h>
66
67 #include "creaWx.h"
68
69 #define LIST_CTRL 1000
70
71
72 namespace bbtk
73 {
74
75   BEGIN_EVENT_TABLE(WxGUIBlackBoxList, wxListCtrl)
76     EVT_LIST_BEGIN_DRAG(LIST_CTRL, WxGUIBlackBoxList::OnBeginDrag)
77     EVT_LIST_BEGIN_RDRAG(LIST_CTRL, WxGUIBlackBoxList::OnBeginRDrag)
78     EVT_LIST_BEGIN_LABEL_EDIT(LIST_CTRL, WxGUIBlackBoxList::OnBeginLabelEdit)
79     EVT_LIST_END_LABEL_EDIT(LIST_CTRL, WxGUIBlackBoxList::OnEndLabelEdit)
80     EVT_LIST_DELETE_ITEM(LIST_CTRL, WxGUIBlackBoxList::OnDeleteItem)
81     EVT_LIST_DELETE_ALL_ITEMS(LIST_CTRL, WxGUIBlackBoxList::OnDeleteAllItems)
82 #if WXWIN_COMPATIBILITY_2_4
83     EVT_LIST_GET_INFO(LIST_CTRL, WxGUIBlackBoxList::OnGetInfo)
84     EVT_LIST_SET_INFO(LIST_CTRL, WxGUIBlackBoxList::OnSetInfo)
85 #endif
86     EVT_LIST_ITEM_SELECTED(LIST_CTRL, WxGUIBlackBoxList::OnSelected)
87     EVT_LIST_ITEM_DESELECTED(LIST_CTRL, WxGUIBlackBoxList::OnDeselected)
88     EVT_LIST_KEY_DOWN(LIST_CTRL, WxGUIBlackBoxList::OnListKeyDown)
89     EVT_LIST_ITEM_ACTIVATED(LIST_CTRL, WxGUIBlackBoxList::OnActivated)
90     EVT_LIST_ITEM_FOCUSED(LIST_CTRL, WxGUIBlackBoxList::OnFocused)
91
92     EVT_LIST_COL_CLICK(LIST_CTRL, WxGUIBlackBoxList::OnColClick)
93     EVT_LIST_COL_RIGHT_CLICK(LIST_CTRL, WxGUIBlackBoxList::OnColRightClick)
94     EVT_LIST_COL_BEGIN_DRAG(LIST_CTRL, WxGUIBlackBoxList::OnColBeginDrag)
95     EVT_LIST_COL_DRAGGING(LIST_CTRL, WxGUIBlackBoxList::OnColDragging)
96     EVT_LIST_COL_END_DRAG(LIST_CTRL, WxGUIBlackBoxList::OnColEndDrag)
97
98     EVT_LIST_CACHE_HINT(LIST_CTRL, WxGUIBlackBoxList::OnCacheHint)
99
100 #if USE_CONTEXT_MENU
101     EVT_CONTEXT_MENU(WxGUIBlackBoxList::OnContextMenu)
102 #endif
103     EVT_CHAR(WxGUIBlackBoxList::OnChar)
104
105     EVT_RIGHT_DOWN(WxGUIBlackBoxList::OnRightClick)
106     END_EVENT_TABLE()
107
108 int wxCALLBACK MyCompareFunction(long item1, long item2, long WXUNUSED(sortData))
109 {
110     // inverse the order
111     if (item1 < item2)
112         {
113         return -1;
114         }
115     if (item1 > item2)
116         {
117         return 1;
118         }
119     return 0;
120 }
121
122   // WxGUIBlackBoxList
123   WxGUIBlackBoxList::WxGUIBlackBoxList(wxWindow *parent,
124                                  const wxWindowID id,
125                                  const wxPoint& pos,
126                                  const wxSize& size,
127                                  long style)
128     : wxListCtrl(parent, id, pos, size, style),
129       mUser(0),
130       m_attr(*wxBLUE, *wxLIGHT_GREY, wxNullFont)
131   {
132 #ifdef __POCKETPC__
133     EnableContextMenu();
134 #endif
135   }
136
137   void WxGUIBlackBoxList::Insert(BlackBoxDescriptor::Pointer d)
138   {
139     if (GetColumnCount()!=3)
140       {
141         InsertColumn( 0, _("Package"),
142                       wxLIST_FORMAT_LEFT, 90  );
143         InsertColumn( 1, _("Box"),
144                       wxLIST_FORMAT_LEFT, 150 );
145         InsertColumn( 2, _("Description"),
146                       wxLIST_FORMAT_LEFT, 500  );
147       }
148
149     wxListItem kNewItem;
150     kNewItem.SetAlign(wxLIST_FORMAT_LEFT);
151
152     int nID = this->GetItemCount();
153     kNewItem.SetId(nID);
154     kNewItem.SetMask(wxLIST_MASK_DATA);
155     // TO DO : STORE SMART POINTER ?
156     kNewItem.SetData(d.get());
157     //    BlackBoxDescriptor::Pointer* d2 = (BlackBoxDescriptor::Pointer*)kNewItem.GetData();
158     //    std::cout << "Descr = "<<d<<" = "<<d2<<std::endl;
159     this->InsertItem(kNewItem);
160     this->SetItem(nID, 0, std2wx(d->GetPackage()->GetName()) );
161     this->SetItem(nID, 1, std2wx(d->GetTypeName()) );
162     this->SetItem(nID, 2, std2wx(d->GetDescription()) );
163
164     /*
165       if (nID % 2)
166       {
167       kNewItem.SetBackgroundColour(wxColour(192,192,192));
168       this->SetItem(kNewItem);
169       }
170     */
171   }
172
173
174   void WxGUIBlackBoxList::OnCacheHint(wxListEvent& event)
175   {
176     //wxLogMessage( wxT("OnCacheHint: cache items %ld..%ld"),
177     //                  event.GetCacheFrom(), event.GetCacheTo() );
178   }
179
180   void WxGUIBlackBoxList::SetColumnImage(int col, int image)
181   {
182     /*
183       wxListItem item;
184       item.SetMask(wxLIST_MASK_IMAGE);
185       item.SetImage(image);
186       SetColumn(col, item);
187     */
188   }
189
190   void WxGUIBlackBoxList::OnColClick(wxListEvent& event)
191   {
192     int col = event.GetColumn();
193
194     // set or unset image
195     static bool x = false;
196     x = !x;
197     SetColumnImage(col, x ? 0 : -1);
198
199     //    wxLogMessage( wxT("OnColumnClick at %d."), col );
200   }
201
202   void WxGUIBlackBoxList::OnColRightClick(wxListEvent& event)
203   {
204     int col = event.GetColumn();
205     if ( col != -1 )
206       {
207         SetColumnImage(col, -1);
208       }
209
210     // Show popupmenu at position
211     wxMenu menu(wxT("Test"));
212     menu.Append(-1, _T("&About"));
213     PopupMenu(&menu, event.GetPoint());
214
215     //wxLogMessage( wxT("OnColumnRightClick at %d."), event.GetColumn() );
216   }
217
218   void WxGUIBlackBoxList::LogColEvent(const wxListEvent& event, const wxChar *name)
219   {
220     //    const int col = event.GetColumn();
221
222     /*
223       wxLogMessage(wxT("%s: column %d (width = %d or %d)."),
224       name,
225       col,
226       event.GetItem().GetWidth(),
227       GetColumnWidth(col));
228     */
229   }
230
231   void WxGUIBlackBoxList::OnColBeginDrag(wxListEvent& event)
232   {
233     LogColEvent( event, wxT("OnColBeginDrag") );
234     /*
235       if ( event.GetColumn() == 0 )
236       {
237       //wxLogMessage(_T("Resizing this column shouldn't work."));
238
239       event.Veto();
240       }
241     */
242   }
243
244   void WxGUIBlackBoxList::OnColDragging(wxListEvent& event)
245   {
246     LogColEvent( event, wxT("OnColDragging") );
247   }
248
249   void WxGUIBlackBoxList::OnColEndDrag(wxListEvent& event)
250   {
251     LogColEvent( event, wxT("OnColEndDrag") );
252   }
253
254   void WxGUIBlackBoxList::OnBeginDrag(wxListEvent& event)
255   {
256           std::cout<<"RaC DRAG TABLE"<<std::endl;
257
258           wxString text(this->GetItemText(event.GetIndex()));
259           wxListItem info;
260           info.m_itemId = event.m_itemIndex;
261           info.m_col = 0;
262           info.m_mask = wxLIST_MASK_DATA;
263           wxString sendtext(_T(""));
264           if ( GetItem(info) )
265           {
266                   // TO DO : STORE SMART PTR ?
267                   BlackBoxDescriptor* d = (BlackBoxDescriptor*)(info.GetData());
268                   if (d!=0)
269                   {
270                       //DFGO -> To identify it is a box
271                       sendtext += crea::std2wx("box:");
272                       sendtext += crea::std2wx(d->GetFullTypeName());
273                   }
274           }
275           else
276           {
277                   wxFAIL_MSG(wxT("wxListCtrl::GetItem() failed"));
278           }
279
280           wxTextDataObject tdo(sendtext);
281           wxDropSource tds(tdo, this);
282           tds.DoDragDrop();
283
284     //    const wxPoint& pt = event.m_pointDrag;
285
286     //wxLogMessage( wxT("OnBeginDrag at (%d, %d), item %ld."),
287     //          pt.x, pt.y, HitTest(pt, flags) );
288   }
289
290   void WxGUIBlackBoxList::OnBeginRDrag(wxListEvent& event)
291   {
292     //wxLogMessage( wxT("OnBeginRDrag at %d,%d."),
293     //        event.m_pointDrag.x, event.m_pointDrag.y );
294   }
295
296   void WxGUIBlackBoxList::OnBeginLabelEdit(wxListEvent& event)
297   {
298     //wxLogMessage( wxT("OnBeginLabelEdit: %s"), event.m_item.m_text.c_str());
299   }
300
301   void WxGUIBlackBoxList::OnEndLabelEdit(wxListEvent& event)
302   {
303     //wxLogMessage( wxT("OnEndLabelEdit: %s"),
304     //        event.IsEditCancelled() ? _T("[cancelled]")
305     //                                      : event.m_item.m_text.c_str());
306   }
307
308   void WxGUIBlackBoxList::OnDeleteItem(wxListEvent& event)
309   {
310     LogEvent(event, _T("OnDeleteItem"));
311     std::cout << "cannot del"<<std::endl;
312     event.Veto();
313     //wxLogMessage( wxT("Number of items when delete event is sent: %d"), GetItemCount() );
314   }
315
316   void WxGUIBlackBoxList::OnDeleteAllItems(wxListEvent& event)
317   {
318     LogEvent(event, _T("OnDeleteAllItems"));
319     event.Veto();
320   }
321
322 #if WXWIN_COMPATIBILITY_2_4
323   void WxGUIBlackBoxList::OnGetInfo(wxListEvent& event)
324   {
325     wxString msg;
326
327     msg << _T("OnGetInfo (") << event.m_item.m_itemId << _T(", ") << event.m_item.m_col << _T(")");
328     if ( event.m_item.m_mask & wxLIST_MASK_STATE )
329       msg << _T(" wxLIST_MASK_STATE");
330     if ( event.m_item.m_mask & wxLIST_MASK_TEXT )
331       msg << _T(" wxLIST_MASK_TEXT");
332     if ( event.m_item.m_mask & wxLIST_MASK_IMAGE )
333       msg << _T(" wxLIST_MASK_IMAGE");
334     if ( event.m_item.m_mask & wxLIST_MASK_DATA )
335       msg << _T(" wxLIST_MASK_DATA");
336     if ( event.m_item.m_mask & wxLIST_SET_ITEM )
337       msg << _T(" wxLIST_SET_ITEM");
338     if ( event.m_item.m_mask & wxLIST_MASK_WIDTH )
339       msg << _T(" wxLIST_MASK_WIDTH");
340     if ( event.m_item.m_mask & wxLIST_MASK_FORMAT )
341       msg << _T(" wxLIST_MASK_WIDTH");
342
343     if ( event.m_item.m_mask & wxLIST_MASK_TEXT )
344       {
345         event.m_item.m_text = _T("My callback text");
346       }
347
348     //wxLogMessage(msg);
349   }
350
351   void WxGUIBlackBoxList::OnSetInfo(wxListEvent& event)
352   {
353     LogEvent(event, _T("OnSetInfo"));
354   }
355 #endif
356
357   void WxGUIBlackBoxList::OnSelected(wxListEvent& event)
358   {
359     if (mUser==0) return;
360
361     wxListItem info;
362     info.m_itemId = event.m_itemIndex;
363     info.m_col = 0;
364     info.m_mask = wxLIST_MASK_DATA;
365     if ( GetItem(info) )
366       {
367         // TO DO : STORE SMART PTR ?
368         BlackBoxDescriptor* d = (BlackBoxDescriptor*)(info.GetData());
369         if (d!=0) mUser->WxGUIBlackBoxListUserOnSelected(d);
370       }
371     else
372       {
373         wxFAIL_MSG(wxT("wxListCtrl::GetItem() failed"));
374       }
375   }
376
377   void WxGUIBlackBoxList::OnDeselected(wxListEvent& event)
378   {
379     LogEvent(event, _T("OnDeselected"));
380   }
381
382   void WxGUIBlackBoxList::OnActivated(wxListEvent& event)
383   {
384     LogEvent(event, _T("OnActivated"));
385   }
386
387   void WxGUIBlackBoxList::OnFocused(wxListEvent& event)
388   {
389     LogEvent(event, _T("OnFocused"));
390
391     event.Skip();
392   }
393
394   void WxGUIBlackBoxList::OnListKeyDown(wxListEvent& event)
395   {
396     long item;
397
398     switch ( event.GetKeyCode() )
399       {
400       case 'c': // colorize
401       case 'C':
402         {
403           wxListItem info;
404           info.m_itemId = event.GetIndex();
405           if ( info.m_itemId == -1 )
406             {
407               // no item
408               break;
409             }
410
411           GetItem(info);
412
413           wxListItemAttr *attr = info.GetAttributes();
414           if ( !attr || !attr->HasTextColour() )
415             {
416               info.SetTextColour(*wxCYAN);
417
418               SetItem(info);
419
420               RefreshItem(info.m_itemId);
421             }
422         }
423         break;
424
425       case 'n': // next
426       case 'N':
427         item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED);
428         if ( item++ == GetItemCount() - 1 )
429           {
430             item = 0;
431           }
432
433         //wxLogMessage(_T("Focusing item %ld"), item);
434
435         SetItemState(item, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED);
436         EnsureVisible(item);
437         break;
438
439       case 'r': // show bounding Rect
440       case 'R':
441         {
442           item = event.GetIndex();
443           wxRect r;
444           if ( !GetItemRect(item, r) )
445             {
446               //wxLogError(_T("Failed to retrieve rect of item %ld"), item);
447               break;
448             }
449
450           //wxLogMessage(_T("Bounding rect of item %ld is (%d, %d)-(%d, %d)"),
451           //   item, r.x, r.y, r.x + r.width, r.y + r.height);
452         }
453         break;
454
455       case WXK_DELETE:
456         item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
457         /*
458           while ( item != -1 )
459           {
460           DeleteItem(item);
461
462           //wxLogMessage(_T("Item %ld deleted"), item);
463
464           // -1 because the indices were shifted by DeleteItem()
465           item = GetNextItem(item - 1,
466           wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
467           }
468         */
469         break;
470
471       case WXK_INSERT:
472         if ( GetWindowStyle() & wxLC_REPORT )
473           {
474             if ( GetWindowStyle() & wxLC_VIRTUAL )
475               {
476                 SetItemCount(GetItemCount() + 1);
477               }
478             else // !virtual
479               {
480                 //InsertItemInReportView(event.GetIndex());
481               }
482           }
483         //else: fall through
484
485       default:
486         LogEvent(event, _T("OnListKeyDown"));
487
488         event.Skip();
489       }
490   }
491
492   void WxGUIBlackBoxList::OnChar(wxKeyEvent& event)
493   {
494     //wxLogMessage(_T("Got char event."));
495
496     switch ( event.GetKeyCode() )
497       {
498       case 'n':
499       case 'N':
500       case 'c':
501       case 'C':
502         // these are the keys we process ourselves
503         break;
504
505       default:
506         event.Skip();
507       }
508   }
509
510   void WxGUIBlackBoxList::OnRightClick(wxMouseEvent& event)
511   {
512     if ( !event.ControlDown() )
513       {
514         event.Skip();
515         return;
516       }
517
518     int flags;
519     long subitem;
520     //    long item =
521     HitTest(event.GetPosition(), flags, &subitem);
522
523     wxString where;
524     switch ( flags )
525       {
526       case wxLIST_HITTEST_ABOVE:       where = _T("above");           break;
527       case wxLIST_HITTEST_BELOW:       where = _T("below");           break;
528       case wxLIST_HITTEST_NOWHERE:     where = _T("nowhere near");    break;
529       case wxLIST_HITTEST_ONITEMICON:  where = _T("on icon of");      break;
530       case wxLIST_HITTEST_ONITEMLABEL: where = _T("on label of");     break;
531       case wxLIST_HITTEST_ONITEMRIGHT: where = _T("right on");        break;
532       case wxLIST_HITTEST_TOLEFT:      where = _T("to the left of");  break;
533       case wxLIST_HITTEST_TORIGHT:     where = _T("to the right of"); break;
534       default: where = _T("not clear exactly where on");              break;
535       }
536
537     //wxLogMessage(_T("Right double click %s item %ld, subitem %ld"),
538     //             where.c_str(), item, subitem);
539   }
540
541   void WxGUIBlackBoxList::LogEvent(const wxListEvent& event, const wxChar *eventName)
542   {
543     //wxLogMessage(_T("Item %ld: %s (item text = %s, data = %ld)"),
544     //            event.GetIndex(), eventName,
545     //              event.GetText().c_str(), event.GetData());
546   }
547
548   wxString WxGUIBlackBoxList::OnGetItemText(long item, long column) const
549   {
550     /*
551       if ( GetItemCount() == WXSIZEOF(SMALL_VIRTUAL_VIEW_ITEMS) )
552       {
553       return SMALL_VIRTUAL_VIEW_ITEMS[item][column];
554       }
555       else
556       {
557     */
558     return wxString::Format(_T("Column %ld of item %ld"), column, item);
559     //  }
560   }
561
562   int WxGUIBlackBoxList::OnGetItemColumnImage(long item, long column) const
563   {
564     if (!column)
565       return 0;
566
567     if (!(item %3) && column == 1)
568       return 0;
569
570     return -1;
571   }
572
573   wxListItemAttr *WxGUIBlackBoxList::OnGetItemAttr(long item) const
574   {
575     return item % 2 ? NULL : (wxListItemAttr *)&m_attr;
576   }
577
578
579 #if USE_CONTEXT_MENU
580   void WxGUIBlackBoxList::OnContextMenu(wxContextMenuEvent& event)
581   {
582     wxPoint point = event.GetPosition();
583     // If from keyboard
584     if (point.x == -1 && point.y == -1) {
585       wxSize size = GetSize();
586       point.x = size.x / 2;
587       point.y = size.y / 2;
588     } else {
589       point = ScreenToClient(point);
590     }
591     ShowContextMenu(point);
592   }
593 #endif
594
595   void WxGUIBlackBoxList::ShowContextMenu(const wxPoint& pos)
596   {
597     wxMenu menu;
598
599     menu.Append(wxID_ABOUT, _T("&About"));
600     menu.AppendSeparator();
601     menu.Append(wxID_EXIT, _T("E&xit"));
602
603     PopupMenu(&menu, pos.x, pos.y);
604   }
605   //================================================================
606
607
608
609   //================================================================
610   WxGUIBlackBoxInfo::WxGUIBlackBoxInfo(wxWindow* parent)
611     :
612     wxPanel(parent, -1),
613     mDescriptor()
614   {
615     wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
616
617     //    mName = new wxStaticText(this,-1,_T(""));
618     //    sizer->Add(mName,0,wxGROW);
619     mDescription = new wxStaticText(this,-1,_T(""));
620     sizer->Add(mDescription,0,wxGROW);
621     mAuthor = new wxStaticText(this,-1,_T(""));
622     sizer->Add(mAuthor,0,wxGROW);
623     mCategory = new wxStaticText(this,-1,_T(""));
624     sizer->Add(mCategory,0,wxGROW);
625
626     wxBoxSizer *inputs =
627       new wxStaticBoxSizer
628       ( new wxStaticBox(this, wxID_ANY, _T("Inputs")), wxVERTICAL );
629     mInputList = new wxListCtrl(this, -1,
630                                 wxDefaultPosition,
631                                 wxDefaultSize,
632                                 wxLC_REPORT //wxLC_LIST
633                                 | wxSUNKEN_BORDER);
634
635     inputs->Add(mInputList,1,wxGROW);
636     sizer->Add(inputs,1,wxGROW);
637
638     wxBoxSizer *outputs =
639       new wxStaticBoxSizer
640       ( new wxStaticBox(this, wxID_ANY, _T("Outputs")), wxVERTICAL );
641     mOutputList = new wxListCtrl(this, -1,
642                                  wxDefaultPosition,
643                                  wxDefaultSize,
644                                  wxLC_REPORT //wxLC_LIST
645                                  | wxSUNKEN_BORDER);
646
647     outputs->Add(mOutputList,1,wxGROW);
648     sizer->Add(outputs,1,wxGROW);
649
650     SetSizer(sizer);
651     SetAutoLayout(true);
652     Layout();
653   }
654   //================================================================
655
656
657   //================================================================
658   void WxGUIBlackBoxInfo::UpdateInfo(BlackBoxDescriptor* descr)
659   {
660
661     //    mName->SetLabel(std2wx(descr->GetTypeName()));
662     mDescription->SetLabel(std2wx(descr->GetDescription()));
663     mAuthor->SetLabel(std2wx(descr->GetAuthor()));
664     mCategory->SetLabel(std2wx(descr->GetCategory()));
665
666     mInputList->ClearAll();
667     mInputList->InsertColumn( 0, _("Name"),
668                                wxLIST_FORMAT_LEFT, 80  );
669     mInputList->InsertColumn( 1, _("Type"),
670                                wxLIST_FORMAT_LEFT, 100 );
671     mInputList->InsertColumn( 2, _("Nature"),
672                                wxLIST_FORMAT_LEFT, 100  );
673     mInputList->InsertColumn( 3, _("Description"),
674                                wxLIST_FORMAT_LEFT, 500  );
675
676     mOutputList->ClearAll();
677     mOutputList->InsertColumn( 0, _("Name"),
678                                wxLIST_FORMAT_LEFT, 80  );
679     mOutputList->InsertColumn( 1, _("Type"),
680                                wxLIST_FORMAT_LEFT, 100 );
681     mOutputList->InsertColumn( 2, _("Nature"),
682                                wxLIST_FORMAT_LEFT, 100  );
683     mOutputList->InsertColumn( 3, _("Description"),
684                                wxLIST_FORMAT_LEFT, 500  );
685
686
687     std::vector<BlackBoxInputOutputDescriptor*> user_defined;
688     std::vector<BlackBoxInputOutputDescriptor*> ubb_defined;
689     std::vector<BlackBoxInputOutputDescriptor*> wxbb_defined;
690
691     const BlackBoxDescriptor::InputDescriptorMapType& imap =
692       descr->GetInputDescriptorMap();
693     BlackBoxDescriptor::InputDescriptorMapType::const_iterator in;
694     for ( in = imap.begin();  in != imap.end(); ++in )
695       {
696         int iotype = 0;
697         if (in->second->GetCreatorTypeInfo() ==
698             typeid(AtomicBlackBoxDescriptor))
699           {
700             iotype = 1;
701           }
702         else if (in->second->GetCreatorTypeInfo() ==
703                  typeid(WxBlackBoxDescriptor))
704           {
705             iotype = 2;
706           }
707         if (iotype==0) user_defined.push_back(in->second);
708         else if (iotype==1) ubb_defined.push_back(in->second);
709         else if (iotype==2) wxbb_defined.push_back(in->second);
710
711       }
712
713     std::vector<BlackBoxInputOutputDescriptor*>::iterator hi;
714     for (hi=user_defined.begin();hi!=user_defined.end();++hi)
715       {
716         InsertInputOutput(mInputList,*hi);
717       }
718     for (hi=wxbb_defined.begin();hi!=wxbb_defined.end();++hi)
719       {
720         InsertInputOutput(mInputList,*hi);
721       }
722     for (hi=ubb_defined.begin();hi!=ubb_defined.end();++hi)
723       {
724         InsertInputOutput(mInputList,*hi);
725       }
726
727     // Outputs
728     user_defined.clear();
729     ubb_defined.clear();
730     wxbb_defined.clear();
731     const BlackBoxDescriptor::OutputDescriptorMapType& omap =
732       descr->GetOutputDescriptorMap();
733     BlackBoxDescriptor::OutputDescriptorMapType::const_iterator out;
734     for ( out = omap.begin();  out != omap.end(); ++out )
735       {
736         int iotype = 0;
737         if (out->second->GetCreatorTypeInfo() ==
738             typeid(AtomicBlackBoxDescriptor))
739           {
740             iotype = 1;
741           }
742         else if (out->second->GetCreatorTypeInfo() ==
743                  typeid(WxBlackBoxDescriptor))
744           {
745             iotype = 2;
746           }
747
748         if (iotype==0) user_defined.push_back(out->second);
749         else if (iotype==1) ubb_defined.push_back(out->second);
750         else if (iotype==2) wxbb_defined.push_back(out->second);
751
752       }
753     for (hi=user_defined.begin();hi!=user_defined.end();++hi)
754       {
755         InsertInputOutput(mOutputList,*hi);
756       }
757     for (hi=wxbb_defined.begin();hi!=wxbb_defined.end();++hi)
758       {
759         InsertInputOutput(mOutputList,*hi);
760       }
761     for (hi=ubb_defined.begin();hi!=ubb_defined.end();++hi)
762       {
763         InsertInputOutput(mOutputList,*hi);
764       }
765   }
766   //================================================================
767
768
769   //================================================================
770   void WxGUIBlackBoxInfo::InsertInputOutput(wxListCtrl* l,
771                                             BlackBoxInputOutputDescriptor* d)
772   {
773     wxListItem kNewItem;
774     kNewItem.SetAlign(wxLIST_FORMAT_LEFT);
775     int nID = l->GetItemCount();
776     //    std::cout << nID << std::endl;
777     kNewItem.SetId(nID);
778     //    kNewItem.SetMask(wxLIST_MASK_DATA);
779     //    kNewItem.SetData(d);
780     l->InsertItem(kNewItem);
781     l->SetItem(nID, 0, std2wx(d->GetName()) );
782     l->SetItem(nID, 1, std2wx(d->GetTypeName()) );
783     l->SetItem(nID, 2, std2wx(d->GetNature()) );
784     l->SetItem(nID, 3, std2wx(d->GetDescription()) );
785   }
786   //================================================================
787
788   //================================================================
789   WxGUIBlackBoxInfo::~WxGUIBlackBoxInfo()
790   {
791   }
792   //================================================================
793
794
795  enum
796     {
797       id_f1,
798       id_f2,
799       id_f3,
800       id_f4,
801       id_f5,
802       id_f6,
803       id_f7,
804       id_f8,
805       id_fc1,
806       id_fc2,
807       id_fc3
808     };
809
810   //================================================================
811   WxGUIPackageBrowser2::WxGUIPackageBrowser2( wxWindow *parent,
812                                               WxGUIPackageBrowser2User* user )
813     : wxPanel(parent, -1),
814       mUser(user),
815       mInterpreter()
816   {
817     _actualSelected=NULL;
818     m_mgr.SetManagedWindow(this);
819
820     //    wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
821     mBoxList = new WxGUIBlackBoxList(this, LIST_CTRL,
822                                      wxDefaultPosition,
823                                      wxDefaultSize,
824                                      wxLC_REPORT //wxLC_LIST
825                                      | wxSUNKEN_BORDER);
826     mBoxList->SetUser(this);
827     mBoxList->SetBackgroundColour(*wxWHITE);
828
829
830 // JGRR & CM DISABLED CLOSE BUTTON
831     m_mgr.AddPane(mBoxList,
832                   wxAuiPaneInfo().Name(wxT("BoxList"))
833                   .Caption(wxT("Black Boxes"))
834                   .MinimizeButton(true)
835                   .MaximizeButton(true)
836                   .Center()
837                   .MinSize(wxSize(100,100))
838                   .CloseButton(false)
839                   );
840     //    sizer->Add(mBoxList,5,wxGROW);
841
842     mBoxInfo = new WxGUIBlackBoxInfo(this);
843     //    sizer->Add(mBoxInfo,3,wxGROW);
844
845 // JGRR & CM DISABLED CLOSE BUTTON
846     m_mgr.AddPane(mBoxInfo,
847                   wxAuiPaneInfo().Name(wxT("Box"))
848                   .Caption(wxT(""))
849                   .MinimizeButton(true)
850                   .MaximizeButton(true)
851                   .Bottom()
852                   .MinSize(wxSize(100,200))
853                   .CloseButton(false)
854                   );
855
856     wxPanel* filters = new wxPanel(this,-1);
857     wxBoxSizer *fsizer = new wxBoxSizer(wxVERTICAL );
858     wxBoxSizer *fpack =
859       new wxStaticBoxSizer
860       ( new wxStaticBox(filters, wxID_ANY, _T("Package")), wxHORIZONTAL );
861     mPackageFilter = new wxTextCtrl(filters,id_f1,_T(""),
862                                     wxDefaultPosition,
863                                     wxDefaultSize,
864                                     wxTE_PROCESS_ENTER);
865     fpack->Add(mPackageFilter,1,wxGROW);
866     fsizer->Add(fpack,0,wxGROW);
867     wxBoxSizer *fname =
868       new wxStaticBoxSizer
869       ( new wxStaticBox(filters, wxID_ANY, _T("Name")), wxHORIZONTAL );
870     mNameFilter = new wxTextCtrl(filters,id_f2,_T(""),
871                                     wxDefaultPosition,
872                                     wxDefaultSize,
873                                     wxTE_PROCESS_ENTER);
874     fname->Add(mNameFilter,1,wxGROW);
875     fsizer->Add(fname,0,wxGROW);
876     wxBoxSizer *fdescr =
877       new wxStaticBoxSizer
878       ( new wxStaticBox(filters, wxID_ANY, _T("Description")), wxHORIZONTAL );
879     mDescriptionFilter = new wxTextCtrl(filters,id_f3,_T(""),
880                                     wxDefaultPosition,
881                                     wxDefaultSize,
882                                     wxTE_PROCESS_ENTER);
883     fdescr->Add(mDescriptionFilter,1,wxGROW);
884     fsizer->Add(fdescr,0,wxGROW);
885     wxBoxSizer *fcat =
886       new wxStaticBoxSizer
887       ( new wxStaticBox(filters, wxID_ANY, _T("Category")), wxHORIZONTAL );
888     mCategoryFilter = new wxTextCtrl(filters,id_f4,_T(""),
889                                     wxDefaultPosition,
890                                     wxDefaultSize,
891                                     wxTE_PROCESS_ENTER);
892     fcat->Add(mCategoryFilter,1,wxGROW);
893     fsizer->Add(fcat,0,wxGROW);
894     wxBoxSizer *fintype =
895       new wxStaticBoxSizer
896       ( new wxStaticBox(filters, wxID_ANY, _T("Input type")), wxHORIZONTAL );
897     mInputTypeFilter = new wxTextCtrl(filters,id_f5,_T(""),
898                                     wxDefaultPosition,
899                                     wxDefaultSize,
900                                     wxTE_PROCESS_ENTER);
901     fintype->Add(mInputTypeFilter,1,wxGROW);
902     fsizer->Add(fintype,0,wxGROW);
903     wxBoxSizer *fouttype =
904       new wxStaticBoxSizer
905       ( new wxStaticBox(filters, wxID_ANY, _T("Output type")), wxHORIZONTAL );
906     mOutputTypeFilter = new wxTextCtrl(filters,id_f6,_T(""),
907                                     wxDefaultPosition,
908                                     wxDefaultSize,
909                                     wxTE_PROCESS_ENTER);
910     fouttype->Add(mOutputTypeFilter,1,wxGROW);
911     fsizer->Add(fouttype,0,wxGROW);
912     wxBoxSizer *finnat =
913       new wxStaticBoxSizer
914       ( new wxStaticBox(filters, wxID_ANY, _T("Input nature")),wxHORIZONTAL );
915     mInputNatureFilter = new wxTextCtrl(filters,id_f7,_T(""),
916                                         wxDefaultPosition,
917                                         wxDefaultSize,
918                                         wxTE_PROCESS_ENTER);
919     finnat->Add(mInputNatureFilter,1,wxGROW);
920     fsizer->Add(finnat,0,wxGROW);
921     wxBoxSizer *foutnat =
922       new wxStaticBoxSizer
923       ( new wxStaticBox(filters, wxID_ANY,_T("Output nature")),wxHORIZONTAL );
924     mOutputNatureFilter = new wxTextCtrl(filters,id_f8,_T(""),
925                                         wxDefaultPosition,
926                                         wxDefaultSize,
927                                         wxTE_PROCESS_ENTER);
928     foutnat->Add(mOutputNatureFilter,1,wxGROW);
929     fsizer->Add(foutnat,0,wxGROW);
930
931     mShowWidgetsFilter = new wxCheckBox(filters,id_fc1,_T("Show widgets"));
932     mShowWidgetsFilter->SetValue(true);
933     fsizer->Add(mShowWidgetsFilter,0,wxGROW);
934
935     mShowAdaptorsFilter = new wxCheckBox(filters,id_fc2,_T("Show adaptors"));
936     mShowAdaptorsFilter->SetValue(false);
937     fsizer->Add(mShowAdaptorsFilter,0,wxGROW);
938
939     mShowGUIsFilter = new wxCheckBox(filters,id_fc3,_T("Show GUIs"));
940     mShowGUIsFilter->SetValue(false);
941     fsizer->Add(mShowGUIsFilter,0,wxGROW);
942
943     filters->SetSizer(fsizer);
944
945 // JGRR & CM DISABLED CLOSE BUTTON
946     m_mgr.AddPane(filters,
947                   wxAuiPaneInfo().Name(wxT("Filter"))
948                   .Caption(wxT("Filter"))
949                   .MinimizeButton(true)
950                   .MaximizeButton(true)
951                   .Left()
952                   .MinSize(wxSize(100,100)) 
953                   .CloseButton(false)
954 );
955
956     //    sizer->Add(fsizer,1,wxGROW);
957     m_mgr.Update();
958
959     //    SetSizer(sizer);
960     SetAutoLayout(true);
961     Layout();
962
963   }
964   //================================================================
965
966         Factory::Pointer WxGUIPackageBrowser2::GetFactory()
967   {
968     return mFactory;
969   }
970
971   //================================================================
972
973
974   //================================================================
975   void WxGUIPackageBrowser2::OnFilter(wxCommandEvent&)
976   {
977     RebuildList();
978   }
979   //================================================================
980
981   //================================================================
982   // User callback when a box is selected in the list
983   void WxGUIPackageBrowser2::WxGUIBlackBoxListUserOnSelected
984   ( BlackBoxDescriptor* d)
985   {
986         //RaC
987         _actualSelected=d;
988
989     mBoxInfo->UpdateInfo(d);
990     std::string title = d->GetPackage()->GetName()+"::"+d->GetTypeName();
991     m_mgr.GetPane(mBoxInfo).Caption(std2wx(title));
992     m_mgr.Update();
993   }
994
995   //================================================================
996
997   //================================================================
998   BlackBoxDescriptor* WxGUIPackageBrowser2::GetActualSelected()
999   {
1000           return _actualSelected;
1001   }
1002
1003   //================================================================
1004
1005   //================================================================
1006   WxGUIPackageBrowser2::~WxGUIPackageBrowser2()
1007   {
1008     mFactory.reset();
1009     mInterpreter.reset();
1010     //    Object::PrintObjectListInfo("");
1011     m_mgr.UnInit();
1012   }
1013   //================================================================
1014
1015   //================================================================
1016   void WxGUIPackageBrowser2::IncludeAll()
1017   {
1018     if (!mInterpreter) mInterpreter =bbtk::Interpreter::New();
1019     mInterpreter->SetCommandLine(true);
1020     std::stringstream* buf = new std::stringstream;
1021     *buf << "exec freeze_no_error" << std::endl;
1022     *buf << "message max 0" << std::endl;
1023     *buf << "include *" << std::endl;
1024     mInterpreter->InterpretBuffer(buf);
1025
1026     Factory::Pointer F = mInterpreter->GetExecuter()->GetFactory();
1027     BuildFromFactory(F);
1028   }
1029   //================================================================
1030
1031   //================================================================
1032   void WxGUIPackageBrowser2::BuildFromFactory(Factory::Pointer F)
1033   {
1034     mFactory = F;
1035     RebuildList();
1036   }
1037
1038   //================================================================
1039
1040   //================================================================
1041   void WxGUIPackageBrowser2::RebuildList()
1042   {
1043     mBoxList->Hide();
1044     mBoxList->ClearAll();
1045
1046     const Factory::PackageMapType& M = mFactory->GetPackageMap();
1047     Factory::PackageMapType::const_iterator i;
1048     for (i=M.begin();i!=M.end();++i)
1049     {
1050         Package::Pointer P = i->second;
1051         if (P->GetName() == "user") continue;
1052
1053         Package::DescriptorMapType::iterator j;
1054         for (j=P->GetDescriptorMap().begin();
1055              j!=P->GetDescriptorMap().end();
1056              ++j)
1057         {
1058             //      std::cout << "Insert "<<j->second->GetTypeName()<<std::endl;
1059             if (IsVisible(j->second))
1060               mBoxList->Insert(j->second);
1061         }// for Descriptor
1062     }// for package
1063     mBoxList->Show();
1064   }
1065   //================================================================
1066
1067  bool WxGUIPackageBrowser2::findnpos(const std::string &strA, const std::string &strB )
1068  {
1069     if ((strB=="") || (strA=="") )
1070     {
1071         return false;
1072     }
1073
1074     bool ok=false;
1075     int i,size;
1076     std::string strAA=strA;
1077     std::string strBB=strB;
1078
1079
1080     size=strAA.length();
1081     for (i=0;i<size;i++)
1082     {
1083         if ((strAA[i]>='A')&&(strAA[i]<='Z'))
1084         {
1085             strAA[i]=strAA[i]+32;
1086         }
1087     }
1088
1089     size=strBB.length();
1090     for (i=0;i<size;i++)
1091     {
1092         if ((strBB[i]>='A')&&(strBB[i]<='Z'))
1093         {
1094             strBB[i]=strBB[i]+32;
1095         }
1096     }
1097
1098
1099      if ( strAA.find(strBB) == std::string::npos )
1100      {
1101          ok=true;
1102      }
1103
1104      return ok;
1105  }
1106
1107   //================================================================
1108   bool WxGUIPackageBrowser2::IsVisible(BlackBoxDescriptor::Pointer d)
1109   {
1110     //    std::cout << "   '" << wx2std(mPackageFilter->GetValue())<<"'"<<std::endl;
1111     //    std::cout << "vs '" << d->GetPackage()->GetName() << "'"<<std::endl;
1112     if ((!mShowAdaptorsFilter->IsChecked())&&
1113         ((d->GetKind()==BlackBoxDescriptor::ADAPTOR)||
1114          (d->GetKind()==BlackBoxDescriptor::DEFAULT_ADAPTOR)))
1115     {
1116         return false;
1117     }
1118
1119     if ((!mShowGUIsFilter->IsChecked())&&
1120         ((d->GetKind()==BlackBoxDescriptor::GUI)||
1121          (d->GetKind()==BlackBoxDescriptor::DEFAULT_GUI)))
1122     {
1123         return false;
1124     }
1125
1126 //EED    if (d->GetPackage()->GetName().find( wx2std(mPackageFilter->GetValue()) ) == std::string::npos )
1127     if ( findnpos(d->GetPackage()->GetName(),wx2std(mPackageFilter->GetValue())) == true )
1128     {
1129         return false;
1130     }
1131
1132 //EED    if (d->GetTypeName().find( wx2std(mNameFilter->GetValue()) ) == std::string::npos )
1133     if ( findnpos(d->GetTypeName(),wx2std(mNameFilter->GetValue())) == true )
1134     {
1135         return false;
1136     }
1137
1138 //EED    if (d->GetDescription().find( wx2std(mDescriptionFilter->GetValue()) ) == std::string::npos )
1139     if ( findnpos(d->GetDescription(),wx2std(mDescriptionFilter->GetValue())) == true )
1140     {
1141         return false;
1142     }
1143
1144 //EED    if (d->GetCategory().find( wx2std(mCategoryFilter->GetValue()) ) == std::string::npos )
1145     if ( findnpos(d->GetCategory(),wx2std(mCategoryFilter->GetValue())) == true )
1146     {
1147         return false;
1148     }
1149
1150     if (!mShowWidgetsFilter->IsChecked())
1151     {
1152         bool found = false;
1153         const BlackBoxDescriptor::OutputDescriptorMapType& imap = d->GetOutputDescriptorMap();
1154         BlackBoxDescriptor::OutputDescriptorMapType::const_iterator in;
1155         for ( in = imap.begin();  in != imap.end(); ++in )
1156         {
1157             if (in->second->GetName() == "Widget" )
1158             {
1159                 found = true;
1160                 break;
1161             }
1162         }
1163         if (found)
1164         {
1165             return false;
1166         }
1167     }
1168
1169     if (mInputTypeFilter->GetValue().size()>0)
1170     {
1171         std::string s = wx2std(mInputTypeFilter->GetValue());
1172         bool found = false;
1173         const BlackBoxDescriptor::InputDescriptorMapType& imap = d->GetInputDescriptorMap();
1174         BlackBoxDescriptor::InputDescriptorMapType::const_iterator in;
1175         for ( in = imap.begin();  in != imap.end(); ++in )
1176         {
1177 //EED           if (in->second->GetTypeName().find(s)!=std::string::npos)
1178                 if ( findnpos( in->second->GetTypeName() , s ) == true )
1179             {
1180                 found = true;
1181                 break;
1182             }
1183         }
1184         if (!found)
1185         {
1186             return false;
1187         }
1188      }
1189
1190     if (mOutputTypeFilter->GetValue().size()>0)
1191     {
1192         std::string s = wx2std(mOutputTypeFilter->GetValue());
1193         bool found = false;
1194         const BlackBoxDescriptor::OutputDescriptorMapType& imap = d->GetOutputDescriptorMap();
1195         BlackBoxDescriptor::OutputDescriptorMapType::const_iterator in;
1196         for ( in = imap.begin();  in != imap.end(); ++in )
1197         {
1198  //EED      if (in->second->GetTypeName().find(s)!=std::string::npos)
1199             if ( findnpos( in->second->GetTypeName() , s ) == true )
1200             {
1201                 found = true;
1202                 break;
1203             }
1204         }
1205         if (!found)
1206         {
1207             return false;
1208         }
1209      }
1210
1211     if (mInputNatureFilter->GetValue().size()>0)
1212     {
1213         std::string s = wx2std(mInputNatureFilter->GetValue());
1214         bool found = false;
1215         const BlackBoxDescriptor::InputDescriptorMapType& imap = d->GetInputDescriptorMap();
1216         BlackBoxDescriptor::InputDescriptorMapType::const_iterator in;
1217         for ( in = imap.begin();  in != imap.end(); ++in )
1218         {
1219 //EED            if (in->second->GetNature().find(s)!=std::string::npos)
1220             if ( findnpos( in->second->GetNature() , s ) == true )
1221             {
1222                 found = true;
1223                 break;
1224             }
1225         }
1226         if (!found)
1227         {
1228             return false;
1229         }
1230      }
1231
1232     if (mOutputNatureFilter->GetValue().size()>0)
1233     {
1234         std::string s = wx2std(mOutputNatureFilter->GetValue());
1235         bool found = false;
1236         const BlackBoxDescriptor::OutputDescriptorMapType& imap = d->GetOutputDescriptorMap();
1237         BlackBoxDescriptor::OutputDescriptorMapType::const_iterator in;
1238         for ( in = imap.begin();  in != imap.end(); ++in )
1239         {
1240 //EED            if (in->second->GetNature().find(s)!=std::string::npos)
1241             if ( findnpos( in->second->GetNature() , s ) == true )
1242             {
1243                 found = true;
1244                 break;
1245             }
1246         }
1247         if (!found)
1248         {
1249             return false;
1250         }
1251      }
1252
1253     return true;
1254
1255   }
1256   //========================================================================
1257
1258   //========================================================================
1259   BEGIN_EVENT_TABLE(WxGUIPackageBrowser2, wxPanel)
1260 //EED    EVT_TEXT_ENTER(id_f1, WxGUIPackageBrowser2::OnFilter )
1261 //EED    EVT_TEXT_ENTER(id_f2, WxGUIPackageBrowser2::OnFilter )
1262 //EED    EVT_TEXT_ENTER(id_f3, WxGUIPackageBrowser2::OnFilter )
1263 //EED    EVT_TEXT_ENTER(id_f4, WxGUIPackageBrowser2::OnFilter )
1264 //EED    EVT_TEXT_ENTER(id_f5, WxGUIPackageBrowser2::OnFilter )
1265 //EED    EVT_TEXT_ENTER(id_f6, WxGUIPackageBrowser2::OnFilter )
1266 //EED    EVT_TEXT_ENTER(id_f7, WxGUIPackageBrowser2::OnFilter )
1267 //EED    EVT_TEXT_ENTER(id_f8, WxGUIPackageBrowser2::OnFilter )
1268
1269     EVT_TEXT(id_f1, WxGUIPackageBrowser2::OnFilter )
1270     EVT_TEXT(id_f2, WxGUIPackageBrowser2::OnFilter )
1271     EVT_TEXT(id_f3, WxGUIPackageBrowser2::OnFilter )
1272     EVT_TEXT(id_f4, WxGUIPackageBrowser2::OnFilter )
1273     EVT_TEXT(id_f5, WxGUIPackageBrowser2::OnFilter )
1274     EVT_TEXT(id_f6, WxGUIPackageBrowser2::OnFilter )
1275     EVT_TEXT(id_f7, WxGUIPackageBrowser2::OnFilter )
1276     EVT_TEXT(id_f8, WxGUIPackageBrowser2::OnFilter )
1277
1278     EVT_CHECKBOX( id_fc1, WxGUIPackageBrowser2::OnFilter )
1279     EVT_CHECKBOX( id_fc2, WxGUIPackageBrowser2::OnFilter )
1280     EVT_CHECKBOX( id_fc3, WxGUIPackageBrowser2::OnFilter )
1281     END_EVENT_TABLE()
1282   //========================================================================
1283
1284
1285
1286   //================================================================
1287   WxGUIPackageBrowser2Window::WxGUIPackageBrowser2Window( wxWindow *parent,
1288                                                           wxString title,
1289                                                           wxSize size)
1290       : wxFrame((wxFrame *)parent, -1, title, wxDefaultPosition, size)
1291   {
1292     wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
1293
1294     mBrowser = new WxGUIPackageBrowser2(this);
1295     mBrowser->IncludeAll();
1296     sizer->Add(mBrowser,1,wxGROW);
1297
1298     //    WxGUICommand* com = new WxGUICommand(this,this);
1299     //    sizer->Add(com);
1300
1301     SetSizer(sizer);
1302
1303      // Creates the parent window of all bbtk windows as a child of this
1304 //    Wx::CreateTopWindow(this);
1305     // Add the method OnWxSignal as a Wx::Signal observer
1306     //bbtkAddWxSignalObserver(WxGUIPackageBrowser2Window::OnWxSignal);
1307
1308     SetAutoLayout(true);
1309     Layout();
1310   }
1311   //================================================================
1312
1313   //================================================================
1314   WxGUIPackageBrowser2Window::~WxGUIPackageBrowser2Window()
1315   {
1316   }
1317   //================================================================
1318
1319 } // namespace bbtk
1320
1321
1322 #endif //_USE_WXWIDGETS_