]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp
Feature #1711
[crea.git] / lib / creaDevManagerLib / wxCDMLibDescriptionPanel.cpp
index f6301907c46bd75488ef00d026f7671418728722..e7b1379c98e5f02593a3a1d4c8ac527bf1ebf313 100644 (file)
@@ -44,6 +44,7 @@ EVT_BUTTON(ID_BUTTON_PREV, wxCDMLibDescriptionPanel::OnBtnReturn)
 EVT_HYPERLINK(ID_LINK_SELECT_LIBRARY, wxCDMLibDescriptionPanel::OnLnkLibrarySelect)
 EVT_BUTTON(ID_BUTTON_CREATE_LIBRARY, wxCDMLibDescriptionPanel::OnBtnCreateLibrary)
 EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMLibDescriptionPanel::OnBtnEditCMakeLists)
+EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMLibDescriptionPanel::OnBtnOpenFolder)
 END_EVENT_TABLE()
 
 wxCDMLibDescriptionPanel::wxCDMLibDescriptionPanel(
@@ -95,33 +96,48 @@ void wxCDMLibDescriptionPanel::CreateControls()
   sizer->Add(new wxStaticBitmap(this, -1, wxBitmap(LbIcon64)),0, wxALIGN_CENTER, 0);
 
   //Libraries
-  wxStaticBox* propertiesBox = new wxStaticBox(this, -1, _T("&Available Libraries"));
-  wxStaticBoxSizer* propertiesBoxInnerSizer = new wxStaticBoxSizer(propertiesBox, wxVERTICAL);
+  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 the modify them."));
+  wxPanel* propertiesPanel = new wxPanel(this);
+  wxBoxSizer* propertiesPanelSizer = new wxBoxSizer(wxVERTICAL);
 
   std::vector<modelCDMLibrary*> libraries = this->lib->GetLibraries();
   for (int i = 0; i < libraries.size(); i++)
     {
-      wxHyperlinkCtrl* pLibrarylk = new wxHyperlinkCtrl(this,ID_LINK_SELECT_LIBRARY, crea::std2wx(libraries[i]->GetName().c_str()), crea::std2wx(libraries[i]->GetName().c_str()));
-      propertiesBoxInnerSizer -> Add(pLibrarylk, 0, wxALIGN_LEFT | wxALL, 5);
+      wxHyperlinkCtrl* pLibrarylk = new wxHyperlinkCtrl(propertiesPanel, ID_LINK_SELECT_LIBRARY, crea::std2wx(libraries[i]->GetName().c_str()), crea::std2wx(libraries[i]->GetName().c_str()));
+      std::string tt = "Name: " + libraries[i]->GetName() + "\n";
+      tt += "Location: " + libraries[i]->GetPath();
+      pLibrarylk->SetToolTip(crea::std2wx(tt.c_str()));
+      propertiesPanelSizer -> Add(pLibrarylk, 0, wxALIGN_LEFT | wxALL, 5);
     }
 
-  sizer -> Add(propertiesBoxInnerSizer, 0, wxEXPAND | wxALL, 10);
+  propertiesPanel->SetSizer(propertiesPanelSizer);
+  propertiesPanelSizer->Fit(propertiesPanel);
+  propertiesBox->Add(propertiesPanel, 0, wxALL, 5);
+  sizer -> Add(propertiesBox, 0, wxEXPAND | wxALL, 10);
 
   //Actions
-  wxStaticBox* actionsBox = new wxStaticBox(this, -1, _T("&Actions"));
-  wxStaticBoxSizer* actionsBoxInnerSizer = new wxStaticBoxSizer(actionsBox, wxVERTICAL);
-  sizer -> Add(actionsBoxInnerSizer, 1, wxEXPAND | wxALL, 20);
+  wxStaticBoxSizer* actionsBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&Actions"));
+  actionsBox->GetStaticBox()->SetToolTip(wxT("Create a new library or make any change to the lib's CMakeLists.txt file by selecting the desired action."));
+  wxPanel* actionsPanel = new wxPanel(this);
+  wxBoxSizer* actionsPanelSizer = new wxBoxSizer(wxHORIZONTAL);
 
-  wxButton* createLibrarybt = new wxButton(this, ID_BUTTON_CREATE_LIBRARY, _T("Create Library"));
+  wxButton* createLibrarybt = new wxButton(actionsPanel, ID_BUTTON_CREATE_LIBRARY, _T("Create Library"));
   createLibrarybt->SetToolTip(wxT("Create a new library for this project."));
-  actionsBoxInnerSizer->Add(createLibrarybt, 0, wxEXPAND | wxRIGHT | wxLEFT, 20);
-  wxButton* editCMakebt = new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File"));
+  actionsPanelSizer->Add(createLibrarybt, 0, wxALL, 5);
+  wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File"));
   editCMakebt->SetToolTip(wxT("Open the system default text editor to edit the CMakeLists.txt file."));
-  actionsBoxInnerSizer->Add(editCMakebt, 0, wxEXPAND | wxRIGHT | wxLEFT, 20);
+  actionsPanelSizer->Add(editCMakebt, 0, wxALL, 5);
+  wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("Open Libraries Folder"));
+  openFolderbt->SetToolTip(wxT("Open the lib folder in the file explorer."));
+  actionsPanelSizer->Add(openFolderbt, 0, wxALL, 5);
 
-  //Assign sizer
-  actionsBoxInnerSizer->SetSizeHints(this);
+  actionsPanel->SetSizer(actionsPanelSizer);
+  actionsPanelSizer->Fit(actionsPanel);
+  actionsBox->Add(actionsPanel, 0, wxALL, 5);
+  sizer -> Add(actionsBox, 0, wxEXPAND | wxALL, 10);
 
+  //Assign sizer
   SetSizer(sizer);
   sizer->SetSizeHints(this);
 }
@@ -193,3 +209,11 @@ void wxCDMLibDescriptionPanel::OnBtnReturn(wxCommandEvent& event)
   newEvent->SetId(0);
   wxPostEvent(this->GetParent(), *newEvent);
 }
+
+void
+wxCDMLibDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event)
+{
+  //TODO: implement method
+  std::cerr << "Event OnBtnOpenFolder not implemented" << std::endl;
+  event.Skip();
+}