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