std::string tt = "Name: " + libraries[i]->GetName() + "\n";
tt += "Location: " + libraries[i]->GetPath();
pLibrarylk->SetToolTip(crea::std2wx(tt.c_str()));
+ 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, wxALIGN_LEFT | wxALL, 5);
}
std::cerr << "Event OnBtnOpenFolder not implemented" << std::endl;
event.Skip();
}
+
+void wxCDMLibDescriptionPanel::OnMouseEnter(wxMouseEvent& event)
+{
+ wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
+ std::string LibName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL());
+ int lbId = 0;
+ std::vector<modelCDMLibrary*> libraries = this->lib->GetLibraries();
+ for (int i = 0; i < libraries.size(); i++)
+ {
+ if(libraries[i]->GetName() == LibName)
+ {
+ lbId = libraries[i]->GetId();
+ break;
+ }
+ }
+ newEvent->SetInt(lbId);
+ newEvent->SetId(0);
+ wxPostEvent(this->GetParent(), *newEvent);
+ event.Skip();
+}
+
+void wxCDMLibDescriptionPanel::OnMouseExit(wxMouseEvent& event)
+{
+ wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+ std::string LibName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL());
+ int lbId = 0;
+ std::vector<modelCDMLibrary*> libraries = this->lib->GetLibraries();
+ for (int i = 0; i < libraries.size(); i++)
+ {
+ if(libraries[i]->GetName() == LibName)
+ {
+ lbId = libraries[i]->GetId();
+ break;
+ }
+ }
+ newEvent->SetInt(lbId);
+ newEvent->SetId(0);
+ wxPostEvent(this->GetParent(), *newEvent);
+ event.Skip();
+}
void OnBtnReturn(wxCommandEvent& event);
void OnBtnOpenFolder(wxCommandEvent& event);
+ void OnMouseEnter(wxMouseEvent& event);
+ void OnMouseExit(wxMouseEvent& event);
+
};
#endif /* WXCDMLIBDESCRIPTIONPANEL_H_ */
EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMMainFrame::OnMenuOpenProject)
EVT_TREE_SEL_CHANGING(ID_TREE_PROJECTS, wxCDMMainFrame::OnTreeSelectionChanged)
EVT_COMMAND(wxID_ANY, wxEVT_DISPLAY_CHANGED, wxCDMMainFrame::OnCreationComplete)
+EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LIST_ITEM_SELECTED, wxCDMMainFrame::OnElementSelected)
+EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxCDMMainFrame::OnElementDeselected)
END_EVENT_TABLE()
wxCDMMainFrame::wxCDMMainFrame(
case 0:
//select out old one to generate selection event
this->tree_Projects->SelectItem(event.GetInt(), true);
+ this->tree_Projects->Expand(event.GetInt());
break;
case 1:
wxPanel* description = NULL;
if(event.GetString() == wxT("manage_packages"))
{
this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
+ this->tree_Projects->Expand(this->model->GetProject()->GetId());
description = new wxCDMPackageManagerPanel(
this,
this->model->GetProject(),
else if(event.GetString() == wxT("manage_libraries"))
{
this->tree_Projects->SelectItem(this->model->GetProject()->GetLib()->GetId(), true);
+ this->tree_Projects->Expand(this->model->GetProject()->GetLib()->GetId());
break;
}
else if(event.GetString() == wxT("manage_applications"))
{
this->tree_Projects->SelectItem(this->model->GetProject()->GetAppli()->GetId(), true);
+ this->tree_Projects->Expand(this->model->GetProject()->GetAppli()->GetId());
break;
}
}
event.Skip();
}
+
+void wxCDMMainFrame::OnElementSelected(wxCommandEvent& event)
+{
+ //std::cout << "element " << event.GetInt() << std::endl;
+ this->tree_Projects->SetItemBold(event.GetInt(), true);
+ this->tree_Projects->SetItemTextColour(event.GetInt(), wxColour(0,0,255));
+ this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE);
+ auiManager.Update();
+}
+
+void wxCDMMainFrame::OnElementDeselected(wxCommandEvent& event)
+{
+ this->tree_Projects->SetItemBold(event.GetInt(), false);
+ this->tree_Projects->SetItemTextColour(event.GetInt(), wxColour(0,0,0));
+ this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE);
+ auiManager.Update();
+}
//PropertiesPanel
void OnCreationComplete(wxCommandEvent& event);
+
+ //Element higlighted
+ void OnElementSelected(wxCommandEvent& event);
+ void OnElementDeselected(wxCommandEvent& event);
};
#endif
std::string tt = "Author: " + packages[i]->GetAuthors() + "\nDescription: " + packages[i]->GetDescription();
pPackagelk->SetToolTip(crea::std2wx(tt));
propertiesPanelSizer -> Add(pPackagelk, 0, wxALIGN_LEFT | wxALL, 5);
+ pPackagelk->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageManagerPanel::OnMouseEnter,NULL,this);
+ pPackagelk->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageManagerPanel::OnMouseExit,NULL,this);
}
propertiesPanel->SetSizer(propertiesPanelSizer);
event.Skip();
}
+void wxCDMPackageManagerPanel::OnMouseEnter(wxMouseEvent& event)
+{
+ wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
+ std::string PkgName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL());
+ int pkgId = 0;
+ std::vector<modelCDMPackage*> packages = this->project->GetPackages();
+ for (int i = 0; i < packages.size(); i++)
+ {
+ if(packages[i]->GetName() == PkgName)
+ {
+ pkgId = packages[i]->GetId();
+ break;
+ }
+ }
+ newEvent->SetInt(pkgId);
+ newEvent->SetId(0);
+ wxPostEvent(this->GetParent(), *newEvent);
+ event.Skip();
+}
+
+void wxCDMPackageManagerPanel::OnMouseExit(wxMouseEvent& event)
+{
+ wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+ std::string PkgName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL());
+ int pkgId = 0;
+ std::vector<modelCDMPackage*> packages = this->project->GetPackages();
+ project->GetPackages();
+ for (int i = 0; i < packages.size(); i++)
+ {
+ if(packages[i]->GetName() == PkgName)
+ {
+ pkgId = packages[i]->GetId();
+ break;
+ }
+ }
+ newEvent->SetInt(pkgId);
+ newEvent->SetId(0);
+ wxPostEvent(this->GetParent(), *newEvent);
+ event.Skip();
+}
+
#include <creaWx.h>
#include <wx/panel.h>
#include <wx/hyperlink.h>
+#include <wx/event.h>
#include "modelCDMProject.h"
void OnBtnCreatePackage(wxCommandEvent& event);
void OnBtnEditCMakeLists(wxCommandEvent& event);
+ void OnMouseEnter(wxMouseEvent& event);
+ void OnMouseExit(wxMouseEvent& event);
};
#endif /* WXCDMPACKAGEMANAGERPANEL_H_ */