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