2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------
29 * wxCDMFolderDescriptionPanel.cpp
31 * Created on: Nov 27, 2012
32 * Author: Daniel Felipe Gonzalez Obando
35 #include "wxCDMFolderDescriptionPanel.h"
37 #include "wxCDMMainFrame.h"
39 #include "creaDevManagerIds.h"
40 #include "images/FdIcon64.xpm"
42 BEGIN_EVENT_TABLE(wxCDMFolderDescriptionPanel, wxPanel)
43 EVT_BUTTON(ID_BUTTON_PREV, wxCDMFolderDescriptionPanel::OnBtnReturn)
44 EVT_MENU(ID_BUTTON_OPEN_FOLDER, wxCDMFolderDescriptionPanel::OnBtnOpenInExplorer)
45 EVT_MENU(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMFolderDescriptionPanel::OnBtnEditCMakeLists)
48 wxCDMFolderDescriptionPanel::wxCDMFolderDescriptionPanel(
50 modelCDMFolder* folder,
52 const wxString& caption,
58 wxCDMFolderDescriptionPanel::Create(parent, folder, id, caption, pos, size, style);
61 wxCDMFolderDescriptionPanel::~wxCDMFolderDescriptionPanel()
65 bool wxCDMFolderDescriptionPanel::Create(
67 modelCDMFolder* folder,
69 const wxString& caption,
75 wxPanel::Create(parent, id, pos, size, style);
76 this->folder = folder;
81 void wxCDMFolderDescriptionPanel::CreateControls()
83 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
86 wxButton* returnbt = new wxButton(this, ID_BUTTON_PREV, wxT("Return to project"));
87 returnbt->SetToolTip(wxT("Return to the active project description."));
88 sizer->Add(returnbt, 0, wxALIGN_CENTER | wxALL, 5);
91 sizer->Add(new wxStaticText(this, -1, _("Folder")),0, wxALIGN_CENTER, 0);
94 sizer->Add(new wxStaticBitmap(this, -1, wxBitmap(FdIcon64)),0, wxALIGN_CENTER, 0);
97 sizer->Add(new wxStaticText(this, -1, crea::std2wx(this->folder->GetName())),0, wxALIGN_CENTER, 0);
100 wxStaticBoxSizer* actionsBox = new wxStaticBoxSizer(wxHORIZONTAL, this, wxT("&Actions"));
101 wxPanel* actionsPanel = new wxPanel(this);
102 wxBoxSizer* actionsPanelSizer = new wxBoxSizer(wxHORIZONTAL);
104 wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("Open in File Explorer"));
105 openFolderbt->SetToolTip(wxT("Open this folder in the file explorer."));
106 actionsPanelSizer->Add(openFolderbt, 0, wxALL, 5);
108 if(this->folder->HasCMakeLists())
110 wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File"));
111 editCMakebt->SetToolTip(wxT("Open the CMakeLists.txt file in this folder with the default text editor."));
112 actionsPanelSizer->Add(editCMakebt, 0, wxALL, 5);
115 actionsPanel->SetSizer(actionsPanelSizer);
116 actionsPanelSizer->Fit(actionsPanel);
117 actionsBox->Add(actionsPanel, 0, wxEXPAND);
118 sizer -> Add(actionsBox, 0, wxEXPAND | wxALL, 10);
122 sizer->SetSizeHints(this);
125 void wxCDMFolderDescriptionPanel::OnBtnReturn(wxCommandEvent& event)
127 wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
128 newEvent->SetInt(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetId());
130 wxPostEvent(this->GetParent(), *newEvent);
133 void wxCDMFolderDescriptionPanel::OnBtnOpenInExplorer(wxCommandEvent& event)
135 //TODO: implement method
136 std::cerr << "Event OnBtnOpenInExplorer not implemented" << std::endl;
140 void wxCDMFolderDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event)
142 //TODO: implement method
143 std::cerr << "Event OnBtnEditCMakeLists not implemented" << std::endl;