]> Creatis software - crea.git/blob - lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.cpp
Feature #1711 CreaDevManager application implementation
[crea.git] / lib / creaDevManagerLib / wxCDMLibraryDescriptionPanel.cpp
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  * wxCDMLibraryDescriptionPanel.cpp
30  *
31  *  Created on: Nov 27, 2012
32  *      Author: Daniel Felipe Gonzalez Obando
33  */
34
35 #include "wxCDMLibraryDescriptionPanel.h"
36
37 #include "CDMUtilities.h"
38 #include "wxCDMMainFrame.h"
39
40 #include "wxCDMLibraryHelpDialog.h"
41
42 #include "creaDevManagerIds.h"
43 #include "images/LIcon64.xpm"
44
45 BEGIN_EVENT_TABLE(wxCDMLibraryDescriptionPanel, wxPanel)
46 EVT_HYPERLINK(ID_BUTTON_PREV, wxCDMLibraryDescriptionPanel::OnBtnReturn)
47 EVT_BUTTON(ID_BUTTON_SET_NAME, wxCDMLibraryDescriptionPanel::OnBtnSetExeName)
48 EVT_BUTTON(ID_BUTTON_CREATE_CLASS, wxCDMLibraryDescriptionPanel::OnBtnCreateClass)
49 EVT_BUTTON(ID_BUTTON_CREATE_FOLDER, wxCDMLibraryDescriptionPanel::OnBtnCreateFolder)
50 EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMLibraryDescriptionPanel::OnBtnEditCMakeLists)
51 EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMLibraryDescriptionPanel::OnBtnOpenFolder)
52 EVT_CHECKBOX(ID_CHECK_INCLUDE_3RDLIBRARY, wxCDMLibraryDescriptionPanel::On3rdLibraryChBChange)
53 EVT_CHECKBOX(ID_CHECK_INCLUDE_LIBRARY, wxCDMLibraryDescriptionPanel::OnLibraryChBChange)
54 END_EVENT_TABLE()
55
56 wxCDMLibraryDescriptionPanel::wxCDMLibraryDescriptionPanel(
57     wxWindow* parent,
58     modelCDMLibrary* library,
59     wxWindowID id,
60     const wxString& caption,
61     const wxPoint& pos,
62     const wxSize& size,
63     long style
64 )
65 {
66   wxCDMLibraryDescriptionPanel::Create(parent, library, id, caption, pos, size, style);
67 }
68
69 wxCDMLibraryDescriptionPanel::~wxCDMLibraryDescriptionPanel()
70 {
71 }
72
73 bool wxCDMLibraryDescriptionPanel::Create(
74     wxWindow* parent,
75     modelCDMLibrary* library,
76     wxWindowID id,
77     const wxString& caption,
78     const wxPoint& pos,
79     const wxSize& size,
80     long style
81 )
82 {
83   wxPanel::Create(parent, id, pos, size, style);
84   this->library = library;
85   CreateControls();
86   // this part makes the scrollbars show up
87   this->FitInside(); // ask the sizer about the needed size
88   this->SetScrollRate(5, 5);
89   return TRUE;
90 }
91
92 void wxCDMLibraryDescriptionPanel::CreateControls()
93 {
94   wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
95
96   //Links to return
97   wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL);
98   std::vector<modelCDMIProjectTreeNode*> parents = this->library->GetParents();
99   for (int i = 0; i < (int)(parents.size()); i++)
100     {
101       wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
102       returnLnk->SetWindowStyle(wxNO_BORDER);
103           returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + "."));
104       linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5);
105       linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0);
106     }
107
108   linksSizer->Add(new wxStaticText(this, wxID_ANY, crea::std2wx(this->library->GetName())), 0, wxALIGN_CENTER, 0);
109
110   sizer->Add(linksSizer, 0, wxALIGN_CENTER | wxALL, 5);
111
112   //Header
113   wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL);
114   {
115     //Image
116     headerSizer->Add(new wxStaticBitmap(this, -1, wxBitmap(LIcon64)),0, wxALIGN_CENTER, 0);
117     wxBoxSizer* textSizer = new wxBoxSizer(wxVERTICAL);
118     //Title
119     textSizer->Add(new wxStaticText(this, -1, _("Library")),0, wxALIGN_LEFT, 0);
120     //Library Name
121     textSizer->Add(new wxStaticText(this, -1, crea::std2wx(this->library->GetName())),0, wxALIGN_LEFT, 0);
122     headerSizer->Add(textSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
123   }
124   sizer->Add(headerSizer, 0, wxALIGN_CENTER);
125
126   /*//Properties
127   wxStaticBoxSizer* propertiesBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&Properties"));
128   wxPanel* propertiesPanel = new wxPanel(this);
129   wxBoxSizer* propertiesPanelSizer = new wxBoxSizer(wxVERTICAL);
130
131   wxFlexGridSizer* propertiesGridSizer = new wxFlexGridSizer(4, 2, 9, 15);
132
133   wxStaticText *pMainFile = new wxStaticText(propertiesPanel, -1, wxT("Library Name"));
134   wxBoxSizer* pMainFilesz = new wxBoxSizer(wxHORIZONTAL);
135   this->libraryNametc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->library->GetNameLibrary()));
136   wxButton* pMainFilebt = new wxButton(propertiesPanel, ID_BUTTON_SET_NAME, wxT("Set"));
137   pMainFilebt->SetToolTip(wxT("Set the name of the library for the project."));
138   pMainFilesz->Add(this->libraryNametc, 0, wxALIGN_CENTER_VERTICAL, 0);
139   pMainFilesz->Add(pMainFilebt, 0, wxALIGN_CENTER | wxLEFT, 10);
140
141   propertiesGridSizer->Add(pMainFile, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
142   propertiesGridSizer->Add(pMainFilesz, 1, wxEXPAND);
143
144   propertiesGridSizer->AddGrowableCol(1,1);
145
146   propertiesPanelSizer->Add(propertiesGridSizer, 0, wxEXPAND);
147   propertiesPanel->SetSizer(propertiesPanelSizer);
148   propertiesPanelSizer->Fit(propertiesPanel);
149   propertiesBox->Add(propertiesPanel, 0, wxEXPAND);
150   sizer->Add(propertiesBox, 0, wxEXPAND | wxALL, 10);
151    */
152
153   //Includes
154   wxStaticBoxSizer* includesBox = new wxStaticBoxSizer(wxHORIZONTAL, this, wxT("&Used Libraries"));
155   includesBox->SetMinSize(250,250);
156   wxScrolledWindow* includesPanel = new wxScrolledWindow(this);
157   wxBoxSizer* includesPanelSizer = new wxBoxSizer(wxVERTICAL);
158
159   //Third Party Libraries
160   wxStaticText* Title1 = new wxStaticText(includesPanel, wxID_ANY, wxT("Third Party Libraries:"));
161   wxFont font = Title1->GetFont();
162   font.SetWeight(wxFONTWEIGHT_BOLD);
163   Title1->SetFont(font);
164   includesPanelSizer->Add(Title1, 0, wxEXPAND);
165
166   //inclusion data
167   std::map<std::string, bool> inclusions = this->library->Get3rdPartyLibraries();
168   //includesGrid Sizer
169   wxFlexGridSizer* includesGridSizer = new wxFlexGridSizer(inclusions.size()+1, 2, 0, 5);
170
171   wxStaticText* ChBTitle = new wxStaticText(
172       includesPanel,
173       wxID_ANY,
174       wxT("Included"),
175       wxDefaultPosition,
176       wxDefaultSize,
177       wxALIGN_CENTER
178     );
179   wxStaticText* LNmTitle = new wxStaticText(
180       includesPanel,
181       wxID_ANY,
182       wxT("Library Name"),
183       wxDefaultPosition,
184       wxDefaultSize,
185       wxALIGN_LEFT
186     );
187
188   includesGridSizer->Add(ChBTitle, 1, wxEXPAND);
189   includesGridSizer->Add(LNmTitle, 1, wxEXPAND);
190
191   for (std::map<std::string, bool>::iterator it = inclusions.begin(); it != inclusions.end(); ++it) {
192     wxCheckBox* ChBIncl = new wxCheckBox(
193         includesPanel, ID_CHECK_INCLUDE_3RDLIBRARY, wxT(""), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT
194       );
195     ChBIncl->SetToolTip(crea::std2wx("When this box is checked the " + it->first + " library is included in the project configuration for this library."));
196     ChBIncl->SetName(crea::std2wx(it->first));
197     ChBIncl->SetValue(it->second);
198     includesGridSizer->Add(ChBIncl, 1, wxEXPAND);
199
200     wxStaticText* LNmIncl = new wxStaticText(includesPanel, wxID_ANY, crea::std2wx(it->first));
201     includesGridSizer->Add(LNmIncl, 1, wxEXPAND);
202   }
203
204   includesGridSizer->AddGrowableCol(1,1);
205
206   includesPanelSizer->Add(includesGridSizer, 0, wxEXPAND | wxLEFT, 5);
207
208   //Custom Libraries
209   wxStaticText* Title2 = new wxStaticText(includesPanel, wxID_ANY, wxT("Custom Libraries:"));
210   font = Title2->GetFont();
211   font.SetWeight(wxFONTWEIGHT_BOLD);
212   Title2->SetFont(font);
213   includesPanelSizer->Add(Title2, 0, wxEXPAND);
214
215   //inclusion data
216   std::map<std::string, bool> inclusionsLibs = this->library->GetCustomLibraries();
217   //includesGrid Sizer
218   wxFlexGridSizer* includesLibGridSizer = new wxFlexGridSizer(inclusionsLibs.size()+1, 2, 0, 5);
219
220   wxStaticText* ChBTitle1 = new wxStaticText(
221       includesPanel,
222       wxID_ANY,
223       wxT("Included"),
224       wxDefaultPosition,
225       wxDefaultSize,
226       wxALIGN_CENTER
227     );
228   wxStaticText* LNmTitle1 = new wxStaticText(
229       includesPanel,
230       wxID_ANY,
231       wxT("Library Name"),
232       wxDefaultPosition,
233       wxDefaultSize,
234       wxALIGN_LEFT
235     );
236
237   includesLibGridSizer->Add(ChBTitle1, 1, wxEXPAND);
238   includesLibGridSizer->Add(LNmTitle1, 1, wxEXPAND);
239
240   for (std::map<std::string, bool>::iterator it = inclusionsLibs.begin(); it != inclusionsLibs.end(); ++it) {
241     wxCheckBox* ChBIncl = new wxCheckBox(
242         includesPanel, ID_CHECK_INCLUDE_LIBRARY, wxT(""), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT
243       );
244     ChBIncl->SetToolTip(crea::std2wx("When this box is checked the " + it->first + " custom library is included in the project configuration for this library."));
245     ChBIncl->SetName(crea::std2wx(it->first));
246     ChBIncl->SetValue(it->second);
247     includesLibGridSizer->Add(ChBIncl, 1, wxEXPAND);
248
249     wxStaticText* LNmIncl = new wxStaticText(includesPanel, wxID_ANY, crea::std2wx(it->first));
250     includesLibGridSizer->Add(LNmIncl, 1, wxEXPAND);
251   }
252
253   includesLibGridSizer->AddGrowableCol(1,1);
254
255   includesPanelSizer->Add(includesLibGridSizer, 0, wxEXPAND | wxLEFT, 5);
256
257   includesPanel->SetSizer(includesPanelSizer);
258   includesPanelSizer->Fit(includesPanel);
259
260   includesPanel->FitInside();
261   includesPanel->SetScrollRate(5,5);
262
263   includesBox->Add(includesPanel, 1, wxEXPAND);
264   sizer -> Add(includesBox, 0, wxALL | wxEXPAND, 10);
265
266
267
268   //Actions
269   wxStaticBoxSizer* actionsBox = new wxStaticBoxSizer(wxHORIZONTAL, this, wxT("&Actions"));
270   wxPanel* actionsPanel = new wxPanel(this);
271   wxBoxSizer* actionsPanelSizer = new wxBoxSizer(wxHORIZONTAL);
272
273   //actionsGrid Sizer
274   wxFlexGridSizer* actionsGridSizer = new wxFlexGridSizer(2, 2, 9, 15);
275
276   wxButton* createClassbt = new wxButton(actionsPanel, ID_BUTTON_CREATE_CLASS, _T("A. Create Class"));
277   createClassbt->SetToolTip(wxT("Create a new class for this library."));
278   actionsGridSizer->Add(createClassbt, 1, wxALL | wxEXPAND, 5);
279   wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("B. Open Library Folder"));
280   openFolderbt->SetToolTip(wxT("Open the library folder in the file explorer."));
281   actionsGridSizer->Add(openFolderbt, 1, wxALL | wxEXPAND, 5);
282   wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File"));
283   editCMakebt->SetToolTip(wxT("Edit the CMakeLists.txt of this library in the default text editor."));
284   editCMakebt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibraryDescriptionPanel::OnCMakeMouseEnter,NULL,this);
285   editCMakebt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibraryDescriptionPanel::OnCMakeMouseExit,NULL,this);
286   actionsGridSizer->Add(editCMakebt, 1, wxALL | wxEXPAND, 5);
287   wxButton* createFolderbt = new wxButton(actionsPanel, ID_BUTTON_CREATE_FOLDER, _T("Create Folder"));
288   createFolderbt->SetToolTip(wxT("Create a new folder for this library."));
289   actionsGridSizer->Add(createFolderbt, 1, wxALL | wxEXPAND, 5);
290
291   actionsGridSizer->AddGrowableCol(0,1);
292   actionsGridSizer->AddGrowableCol(1,1);
293
294   actionsPanelSizer->Add(actionsGridSizer, 1, wxEXPAND, 0);
295   actionsPanel->SetSizer(actionsPanelSizer);
296   actionsPanelSizer->Fit(actionsPanel);
297   actionsBox->Add(actionsPanel, 1, wxEXPAND);
298   sizer -> Add(actionsBox, 0, wxALL | wxEXPAND, 10);
299
300   //Assign sizer
301   SetSizer(sizer);
302   sizer->SetSizeHints(this);
303
304   if (((wxCDMMainFrame*)this->GetParent())->isHelp())
305     {
306       wxCDMLibraryHelpDialog* helpDialog = new wxCDMLibraryHelpDialog(this->GetParent(), this->library, wxID_ANY);
307       helpDialog->Show(true);
308     }
309 }
310
311 void wxCDMLibraryDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event)
312 {
313   std::vector<modelCDMIProjectTreeNode*> parents = this->library->GetParents();
314     std::string parentURL = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL());
315     //std::cout << parentURL << std::endl;
316     for (int i = 0; i < (int)(parents.size()); i++)
317       {
318         if (parents[i]->GetPath() == parentURL)
319           {
320             wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
321             newEvent->SetClientData(parents[i]);
322             newEvent->SetId(0);
323             wxPostEvent(this->GetParent(), *newEvent);
324           }
325       }
326 }
327
328 void wxCDMLibraryDescriptionPanel::OnBtnSetExeName(wxCommandEvent& event)
329 {
330   //get name
331   wxString versionWx = wxGetTextFromUser(
332       wxT("Enter the new executable name"),
333       wxT("Change Library Name - creaDevManager"),
334       crea::std2wx(this->library->GetNameLibrary())
335   );
336   //check name
337   std::vector<std::string> parts;
338   CDMUtilities::splitter::split(parts, crea::wx2std(versionWx), " .", CDMUtilities::splitter::no_empties);
339   if(parts.size() > 0)
340     {
341       std::string* result;
342       if(!this->library->SetNameLibrary(crea::wx2std(versionWx), result))
343         wxMessageBox(crea::std2wx(*result),_T("Change Library Name - Error!"),wxOK | wxICON_ERROR);
344     }
345   else
346     {
347       wxMessageBox(crea::std2wx("No name specified"),_T("Set Library Name - Error!"),wxOK | wxICON_ERROR);
348     }
349   this->libraryNametc->SetLabel(crea::std2wx(this->library->GetNameLibrary()));
350 }
351
352 void wxCDMLibraryDescriptionPanel::On3rdLibraryChBChange(wxCommandEvent& event)
353 {
354   if(this->library->Set3rdPartyLibrary(crea::wx2std(((wxCheckBox*)event.GetEventObject())->GetName()), ((wxCheckBox*)event.GetEventObject())->GetValue()))
355     ((wxCheckBox*)event.GetEventObject())->SetValue(((wxCheckBox*)event.GetEventObject())->GetValue());
356   else
357     ((wxCheckBox*)event.GetEventObject())->SetValue(!((wxCheckBox*)event.GetEventObject())->GetValue());
358 }
359
360 void wxCDMLibraryDescriptionPanel::OnLibraryChBChange(wxCommandEvent& event)
361 {
362   if(this->library->SetCustomLibrary(crea::wx2std(((wxCheckBox*)event.GetEventObject())->GetName()), ((wxCheckBox*)event.GetEventObject())->GetValue()))
363       ((wxCheckBox*)event.GetEventObject())->SetValue(((wxCheckBox*)event.GetEventObject())->GetValue());
364     else
365       ((wxCheckBox*)event.GetEventObject())->SetValue(!((wxCheckBox*)event.GetEventObject())->GetValue());
366 }
367
368 void wxCDMLibraryDescriptionPanel::OnBtnCreateClass(wxCommandEvent& event)
369 {
370   //get class name from user
371   wxTextEntryDialog* newClassDlg = new wxTextEntryDialog(
372       this,
373       wxT("Please enter the new class name."),
374       wxT("New Class - creaDevManager"),
375       wxT(""),
376       wxOK | wxCANCEL
377   );
378
379   if (newClassDlg->ShowModal() == wxID_OK)
380     {
381       std::string className = crea::wx2std(newClassDlg->GetValue());
382       //check class name
383       if(className.size() > 0)
384         {
385           if(!this->library->CreateClass(className))
386             wxMessageBox(crea::std2wx("Something has gone wrong with the creation of the class."),_T("New Class - Error!"),wxOK | wxICON_ERROR);
387
388           ((wxCDMMainFrame*)this->GetParent())->RefreshProject();
389
390           wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
391           newEvent->SetId(0);
392           newEvent->SetClientData(this->library);
393           wxPostEvent(this->GetParent(), *newEvent);
394
395           wxMessageBox(crea::std2wx("The class has been created successfully."),_T("New Class - Success"),wxOK | wxICON_INFORMATION);
396         }
397       else
398         {
399           wxMessageBox(crea::std2wx("The new class name cannot be empty."),_T("New Class - Error!"),wxOK | wxICON_ERROR);
400         }
401     }
402 }
403
404 void wxCDMLibraryDescriptionPanel::OnBtnCreateFolder(wxCommandEvent& event)
405 {
406   //get name
407   wxString folderName = wxGetTextFromUser(
408       wxT("Enter the name of the new folder:"),
409       wxT("Create Folder - creaDevManager")
410   );
411   //check name
412   std::vector<std::string> parts;
413   CDMUtilities::splitter::split(parts, crea::wx2std(folderName), " /\\\"", CDMUtilities::splitter::no_empties);
414   if(parts.size() > 0)
415     {
416       std::string* result;
417       modelCDMFolder* folderC = this->library->CreateFolder(crea::wx2std(folderName), result);
418       if(folderC == NULL)
419         {
420           wxMessageBox(crea::std2wx(*result),_T("Create Folder - Error!"),wxOK | wxICON_ERROR);
421           return;
422         }
423       ((wxCDMMainFrame*)this->GetParent())->RefreshProject();
424       wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
425       newEvent->SetClientData(folderC);
426       wxPostEvent(this->GetParent(), *newEvent);
427       wxMessageBox(crea::std2wx("The folder was successfully created"),_T("Create Folder - Success"),wxOK | wxICON_INFORMATION);
428     }
429   else
430     {
431       wxMessageBox(crea::std2wx("No name specified"),_T("Create Folder - Error!"),wxOK | wxICON_ERROR);
432     }
433 }
434
435 void wxCDMLibraryDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event)
436 {
437   std::string* result;
438   if(!this->library->OpenCMakeListsFile(result))
439     wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
440
441   wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
442
443   if(this->library->GetCMakeLists() != NULL)
444     {
445       newEvent->SetClientData(this->library->GetCMakeLists());
446       newEvent->SetId(0);
447       wxPostEvent(this->GetParent(), *newEvent);
448     }
449
450   event.Skip();
451 }
452
453 void wxCDMLibraryDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event)
454 {
455   std::string* result;
456   if(!this->library->OpenInFileExplorer(result))
457     wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR);
458 }
459
460 void wxCDMLibraryDescriptionPanel::OnCMakeMouseEnter(wxMouseEvent& event)
461 {
462   wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED);
463
464   if(this->library->GetCMakeLists() != NULL)
465     {
466       newEvent->SetClientData(this->library->GetCMakeLists());
467       newEvent->SetId(0);
468       wxPostEvent(this->GetParent(), *newEvent);
469     }
470   event.Skip();
471 }
472
473 void wxCDMLibraryDescriptionPanel::OnCMakeMouseExit(wxMouseEvent& event)
474 {
475   wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
476
477   if(this->library->GetCMakeLists() != NULL)
478     {
479       newEvent->SetClientData(this->library->GetCMakeLists());
480       newEvent->SetId(0);
481       wxPostEvent(this->GetParent(), *newEvent);
482     }
483   event.Skip();
484 }