]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.cpp
Feature #1711
[crea.git] / lib / creaDevManagerLib / wxCDMFolderDescriptionPanel.cpp
index 00e10ed938e5f005b2d843c9c07b57e157be5e05..d27bca0afc60ed4be7b8266add082839c5957a88 100644 (file)
 
 #include "wxCDMFolderDescriptionPanel.h"
 
+#include "wxCDMMainFrame.h"
+
 #include "creaDevManagerIds.h"
 #include "images/FdIcon64.xpm"
 
 BEGIN_EVENT_TABLE(wxCDMFolderDescriptionPanel, wxPanel)
+EVT_BUTTON(ID_BUTTON_PREV, wxCDMFolderDescriptionPanel::OnBtnReturn)
 EVT_MENU(ID_BUTTON_OPEN_FOLDER, wxCDMFolderDescriptionPanel::OnBtnOpenInExplorer)
 EVT_MENU(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMFolderDescriptionPanel::OnBtnEditCMakeLists)
 END_EVENT_TABLE()
@@ -79,33 +82,54 @@ void wxCDMFolderDescriptionPanel::CreateControls()
 {
   wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
 
-  //Welcome
+  //Link to return
+  wxButton* returnbt = new wxButton(this, ID_BUTTON_PREV, wxT("Return to project"));
+  returnbt->SetToolTip(wxT("Return to the active project description."));
+  sizer->Add(returnbt, 0, wxALIGN_CENTER | wxALL, 5);
+
+  //Title
   sizer->Add(new wxStaticText(this, -1, _("Folder")),0, wxALIGN_CENTER, 0);
 
   //Image
   sizer->Add(new wxStaticBitmap(this, -1, wxBitmap(FdIcon64)),0, wxALIGN_CENTER, 0);
 
-  //Welcome
+  //Folder Name
   sizer->Add(new wxStaticText(this, -1, crea::std2wx(this->folder->GetName())),0, wxALIGN_CENTER, 0);
 
   //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(wxHORIZONTAL, this, wxT("&Actions"));
+  wxPanel* actionsPanel = new wxPanel(this);
+  wxBoxSizer* actionsPanelSizer = new wxBoxSizer(wxHORIZONTAL);
+
+  wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("Open in File Explorer"));
+  openFolderbt->SetToolTip(wxT("Open this folder in the file explorer."));
+  actionsPanelSizer->Add(openFolderbt, 0, wxALL, 5);
 
-  actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_OPEN_FOLDER, _T("Open in File Explorer")), 0, wxEXPAND | wxRIGHT | wxLEFT, 20);
   if(this->folder->HasCMakeLists())
     {
-      actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File")), 0, wxEXPAND | wxRIGHT | wxLEFT, 20);
+      wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File"));
+      editCMakebt->SetToolTip(wxT("Open the CMakeLists.txt file in this folder with the default text editor."));
+      actionsPanelSizer->Add(editCMakebt, 0, wxALL, 5);
     }
 
-  //Assign sizer
-  actionsBoxInnerSizer->SetSizeHints(this);
+  actionsPanel->SetSizer(actionsPanelSizer);
+  actionsPanelSizer->Fit(actionsPanel);
+  actionsBox->Add(actionsPanel, 0, wxEXPAND);
+  sizer -> Add(actionsBox, 0, wxEXPAND | wxALL, 10);
 
+  //Assign sizer
   SetSizer(sizer);
   sizer->SetSizeHints(this);
 }
 
+void wxCDMFolderDescriptionPanel::OnBtnReturn(wxCommandEvent& event)
+{
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
+  newEvent->SetInt(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetId());
+  newEvent->SetId(0);
+  wxPostEvent(this->GetParent(), *newEvent);
+}
+
 void wxCDMFolderDescriptionPanel::OnBtnOpenInExplorer(wxCommandEvent& event)
 {
   //TODO: implement method