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