]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/wxCDMFileDescriptionPanel.cpp
Feature #1711 CreaDevManager application implementation
[crea.git] / lib / creaDevManagerLib / wxCDMFileDescriptionPanel.cpp
index dad7ea8fa1f2a4d5ef3877c4f639aeded552c979..81768a97aaaded19ee78ee99074362f539c84998 100644 (file)
@@ -75,6 +75,10 @@ bool wxCDMFileDescriptionPanel::Create(
 )
 {
   wxPanel::Create(parent, id, pos, size, style);
+  // this part makes the scrollbars show up
+  this->FitInside(); // ask the sizer about the needed size
+  this->SetScrollRate(5, 5);
+
   this->file = file;
   CreateControls();
   return TRUE;
@@ -87,16 +91,17 @@ void wxCDMFileDescriptionPanel::CreateControls()
   //Links to return
   wxBoxSizer *linksSizer = new wxBoxSizer(wxHORIZONTAL);
   std::vector<modelCDMIProjectTreeNode*> parents = this->file->GetParents();
-  for (int i = 0; i < parents.size(); i++)
+  for (int i = 0; i < (int)(parents.size()); i++)
     {
-      wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath()));
+      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);
+      returnLnk->SetWindowStyle(wxNO_BORDER);
       returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + "."));
       linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5);
-      if (i < parents.size()-1)
-        {
-          linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0);
-        }
+      linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0);
     }
+
+  linksSizer->Add(new wxStaticText(this, wxID_ANY, crea::std2wx(this->file->GetName())), 0, wxALIGN_CENTER, 0);
+
   sizer->Add(linksSizer, 0, wxALIGN_CENTER | wxALL, 5);
 
   //Header
@@ -123,16 +128,16 @@ void wxCDMFileDescriptionPanel::CreateControls()
   wxStaticText *pLength = new wxStaticText(propertiesPanel, -1, wxT("File Size"));
 
   wxStaticText* pLocationtc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->file->GetPath()));
-  pLocationtc->SetMaxSize(wxSize(350,-1));
+  pLocationtc->SetMaxSize(wxSize(300,-1));
   int lgth = this->file->GetLength();
   std::stringstream ss;
   ss << lgth / 1024;
   std::string lgths = ss.str() + " KB";
   wxStaticText* pLengthtc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(lgths));
 
-  propertiesGridSizer->Add(pLocation, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+  propertiesGridSizer->Add(pLocation, 0, wxALIGN_RIGHT | wxALIGN_TOP);
   propertiesGridSizer->Add(pLocationtc, 1, wxEXPAND);
-  propertiesGridSizer->Add(pLength, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+  propertiesGridSizer->Add(pLength, 0, wxALIGN_RIGHT | wxALIGN_TOP);
   propertiesGridSizer->Add(pLengthtc, 1, wxEXPAND);
 
   propertiesGridSizer->AddGrowableCol(1,1);
@@ -178,12 +183,12 @@ void wxCDMFileDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event)
   std::vector<modelCDMIProjectTreeNode*> parents = this->file->GetParents();
   std::string parentURL = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL());
   //std::cout << parentURL << std::endl;
-  for (int i = 0; i < parents.size(); i++)
+  for (int i = 0; i < (int)(parents.size()); i++)
     {
       if (parents[i]->GetPath() == parentURL)
         {
           wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
-          newEvent->SetInt(parents[i]->GetId());
+          newEvent->SetClientData(parents[i]);
           newEvent->SetId(0);
           wxPostEvent(this->GetParent(), *newEvent);
         }