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(
)
{
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->lib = lib;
CreateControls();
return TRUE;
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 < (int)(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->lib->GetName())), 0, wxALIGN_CENTER, 0);
+
sizer->Add(linksSizer, 0, wxALIGN_CENTER | wxALL, 5);
//Header
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);
wxButton* createLibrarybt = new wxButton(actionsPanel, ID_BUTTON_CREATE_LIBRARY, _T("A. Create Library"));
createLibrarybt->SetToolTip(wxT("Create a new library for this project."));
actionsGridSizer->Add(createLibrarybt, 1, wxALL | wxEXPAND, 5);
- wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("B. Edit CMakeLists File"));
+ 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 Lib's CMakeLists.txt file."));
editCMakebt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibDescriptionPanel::OnCMakeMouseEnter,NULL,this);
editCMakebt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibDescriptionPanel::OnCMakeMouseExit,NULL,this);
actionsGridSizer->Add(editCMakebt, 1, wxALL | wxEXPAND, 5);
- wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("C. Open Libraries Folder"));
+ wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("Open Libraries Folder"));
openFolderbt->SetToolTip(wxT("Open the lib folder in the file explorer."));
actionsGridSizer->Add(openFolderbt, 1, wxALL | wxEXPAND, 5);
}
}
+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;