]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp
Feature #1711 CreaDevManager application implementation
[crea.git] / lib / creaDevManagerLib / wxCDMLibDescriptionPanel.cpp
index d31dd06395c3b77557cd0b29570fa4ccb6137ee0..cc635285c15fa9d6b082e7e862a7b06abc5f8b31 100644 (file)
@@ -47,6 +47,7 @@ EVT_HYPERLINK(ID_LINK_SELECT_LIBRARY, wxCDMLibDescriptionPanel::OnLnkLibrarySele
 EVT_BUTTON(ID_BUTTON_CREATE_LIBRARY, wxCDMLibDescriptionPanel::OnBtnCreateLibrary)
 EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMLibDescriptionPanel::OnBtnEditCMakeLists)
 EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMLibDescriptionPanel::OnBtnOpenFolder)
+EVT_CHECKBOX(ID_CHECK_INCLUDE_LIBRARY, wxCDMLibDescriptionPanel::OnChBLibraryChange)
 END_EVENT_TABLE()
 
 wxCDMLibDescriptionPanel::wxCDMLibDescriptionPanel(
@@ -118,23 +119,47 @@ void wxCDMLibDescriptionPanel::CreateControls()
   wxStaticBoxSizer* propertiesBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("A&vailable Libraries"));
   propertiesBox->GetStaticBox()->SetToolTip(wxT("Select any of the available libraries to see its details or modify them."));
   wxPanel* propertiesPanel = new wxPanel(this);
-  wxBoxSizer* propertiesPanelSizer = new wxBoxSizer(wxVERTICAL);
 
   std::vector<modelCDMLibrary*> libraries = this->lib->GetLibraries();
+  wxFlexGridSizer* propertiesGridSizer = new wxFlexGridSizer(libraries.size()+1, 3, 9, 5);
+
+  wxStaticText* ChBTitle = new wxStaticText(propertiesPanel, wxID_ANY, wxT("Include in\nCMake"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE_HORIZONTAL);
+  wxStaticText* LkTitle = new wxStaticText(propertiesPanel, wxID_ANY, wxT("Library Name"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE_HORIZONTAL);
+  wxStaticText* HlpTitle = new wxStaticText(propertiesPanel, wxID_ANY, wxT("Help"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE_HORIZONTAL);
+
+  propertiesGridSizer -> Add(ChBTitle, 0, wxEXPAND | wxALL, 5);
+  propertiesGridSizer -> Add(LkTitle,  0, wxEXPAND | wxALL, 5);
+  propertiesGridSizer -> Add(HlpTitle, 0, wxEXPAND | wxALL, 5);
+
   for (int i = 0; i < (int)(libraries.size()); i++)
     {
-               wxHyperlinkCtrl* pLibrarylk = new wxHyperlinkCtrl(propertiesPanel, ID_LINK_SELECT_LIBRARY, crea::std2wx(libraries[i]->GetName().c_str()), crea::std2wx(libraries[i]->GetName().c_str()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
+      //checkbox for cmake inclusion
+      wxCheckBox* pLibraryChB = new wxCheckBox(propertiesPanel, ID_CHECK_INCLUDE_LIBRARY, wxT(""), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
+      pLibraryChB->SetName(crea::std2wx(libraries[i]->GetName()));
+      std::string tt = "if this box is checked the the " + libraries[i]->GetName() + " library is included in the project compilation.";
+      pLibraryChB->SetToolTip(crea::std2wx(tt));
+      pLibraryChB->SetValue(this->lib->IsLibraryIncluded(libraries[i]->GetName()));
+      propertiesGridSizer -> Add(pLibraryChB, 0, wxEXPAND | wxALIGN_CENTER);
+
+      //link to library with description
+      wxHyperlinkCtrl* pLibrarylk = new wxHyperlinkCtrl(propertiesPanel, ID_LINK_SELECT_LIBRARY, crea::std2wx(libraries[i]->GetName().c_str()), crea::std2wx(libraries[i]->GetName().c_str()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
       pLibrarylk->SetWindowStyle(wxALIGN_LEFT | wxNO_BORDER);
-      std::string tt = "Name: " + libraries[i]->GetName() + "\n";
+      tt = "Name: " + libraries[i]->GetName() + "\n";
       tt += "Location: " + libraries[i]->GetPath();
-      pLibrarylk->SetToolTip(crea::std2wx(tt.c_str()));
+      pLibrarylk->SetToolTip(crea::std2wx(tt));
       pLibrarylk->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibDescriptionPanel::OnMouseEnter,NULL,this);
       pLibrarylk->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibDescriptionPanel::OnMouseExit,NULL,this);
-      propertiesPanelSizer -> Add(pLibrarylk, 0, wxEXPAND | wxALL, 5);
+      propertiesGridSizer -> Add(pLibrarylk, 0, wxEXPAND);
+
+      //help icon
+      wxButton* pLibraryHlp = new wxButton(propertiesPanel, wxID_ANY, wxT("?"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
+      propertiesGridSizer -> Add(pLibraryHlp, 0, wxEXPAND | wxALIGN_CENTER);
     }
 
-  propertiesPanel->SetSizer(propertiesPanelSizer);
-  propertiesPanelSizer->Fit(propertiesPanel);
+  propertiesGridSizer->AddGrowableCol(1,1);
+
+  propertiesPanel->SetSizer(propertiesGridSizer);
+  propertiesGridSizer->Fit(propertiesPanel);
   propertiesBox->Add(propertiesPanel, 1, wxALL | wxEXPAND, 5);
   sizer -> Add(propertiesBox, 0, wxEXPAND | wxALL, 10);
 
@@ -229,6 +254,14 @@ void wxCDMLibDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event)
     }
 }
 
+void wxCDMLibDescriptionPanel::OnChBLibraryChange(wxCommandEvent& event)
+{
+  this->lib->SetLibraryInclude(
+      crea::wx2std(((wxCheckBox*)event.GetEventObject())->GetName()),
+      ((wxCheckBox*)event.GetEventObject())->GetValue()
+    );
+}
+
 void wxCDMLibDescriptionPanel::OnLnkLibrarySelect(wxHyperlinkEvent& event)
 {
   modelCDMLibrary* theLibrary = NULL;