]> Creatis software - crea.git/blob - lib/creaDevManagerLib/wxCDMMainDescriptionPanel.cpp
41daf68640a7484c386aba72f6255635b0e75b87
[crea.git] / lib / creaDevManagerLib / wxCDMMainDescriptionPanel.cpp
1 /*
2 # ---------------------------------------------------------------------
3 #
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
5 #                        pour la Sant�)
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
9 #
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.
16 #
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
21 #  liability. 
22 #
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 # ------------------------------------------------------------------------ 
26  */
27
28
29 /*
30  * wxCDMMainPanel.cpp
31  *
32  *  Created on: 13/11/2012
33  *      Author: Daniel Felipe Gonzalez Obando
34  */
35
36 #include "wxCDMMainDescriptionPanel.h"
37
38 #include "wxCDMMainFrame.h"
39
40 #include "wxCDMMainHelpDialog.h"
41
42 #include "creaDevManagerIds.h"
43 #include "images/CIcon64.xpm"
44
45 BEGIN_EVENT_TABLE(wxCDMMainDescriptionPanel, wxPanel)
46 EVT_MENU(ID_MENU_NEW_PROJECT, wxCDMMainDescriptionPanel::OnBtnNewProject)
47 EVT_MENU(ID_MENU_OPEN_PROJECT, wxCDMMainDescriptionPanel::OnBtnOpenProject)
48
49 END_EVENT_TABLE()
50
51 wxCDMMainDescriptionPanel::wxCDMMainDescriptionPanel(
52     wxWindow* parent,
53     wxWindowID id,
54     const wxString& caption,
55     const wxPoint& pos,
56     const wxSize& size,
57     long style
58 )
59 {
60   wxCDMMainDescriptionPanel::Create(parent, id, caption, pos, size, style);
61 }
62
63 wxCDMMainDescriptionPanel::~wxCDMMainDescriptionPanel()
64 {
65 }
66
67 bool wxCDMMainDescriptionPanel::Create(
68     wxWindow* parent,
69     wxWindowID id,
70     const wxString& caption,
71     const wxPoint& pos,
72     const wxSize& size,
73     long style
74 )
75 {
76   wxPanel::Create(parent, id, pos, size, style);
77   //to scroll
78   this->FitInside(); // ask the sizer about the needed size
79   this->SetScrollRate(5, 5);
80
81   CreateControls();
82   return TRUE;
83 }
84
85 void wxCDMMainDescriptionPanel::CreateControls()
86 {
87   wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
88
89   //Header
90   wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL);
91   {
92     //Image
93     headerSizer->Add(new wxStaticBitmap(this, -1, wxBitmap(CIcon64)),0, wxALIGN_CENTER, 0);
94     wxBoxSizer* textSizer = new wxBoxSizer(wxVERTICAL);
95     //Title
96     textSizer->Add(new wxStaticText(this, -1, _("Welcome")),0, wxALIGN_LEFT, 0);
97     //Application Name
98     textSizer->Add(new wxStaticText(this, -1, crea::std2wx("Crea Development Manager")),0, wxALIGN_LEFT, 0);
99     headerSizer->Add(textSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
100   }
101   sizer->Add(headerSizer, 0, wxALIGN_CENTER | wxUP, 10);
102
103   //Actions
104   wxStaticBoxSizer* actionsBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&Actions"));
105   actionsBox->GetStaticBox()->SetToolTip(wxT("Create a new crea project or open an existing one selection any of the available actions."));
106   wxPanel* actionsPanel = new wxPanel(this);
107   wxBoxSizer* actionsPanelSizer = new wxBoxSizer(wxHORIZONTAL);
108
109   wxButton* newProjectbt = new wxButton(actionsPanel, ID_BUTTON_NEWPROJECT, _T("New Project"));
110   newProjectbt->SetToolTip(wxT("Create a new crea project."));
111   actionsPanelSizer->Add(newProjectbt, 0, wxRIGHT | wxLEFT, 20);
112   wxButton* openProjectbt = new wxButton(actionsPanel, ID_BUTTON_OPENPROJECT, _T("Open Project (source/binaries)"));
113   openProjectbt->SetToolTip(wxT("Open an existing crea project from its binaries or its sources."));
114   actionsPanelSizer->Add(openProjectbt, 0, wxRIGHT | wxLEFT, 20);
115
116   actionsPanel->SetSizer(actionsPanelSizer);
117   actionsPanelSizer->Fit(actionsPanel);
118   actionsBox->Add(actionsPanel, 0, wxALIGN_CENTER | wxALL, 10);
119   sizer -> Add(actionsBox, 0, wxEXPAND | wxALL, 20);
120
121   //Asign sizer
122   sizer->SetSizeHints(this);
123   SetSizer(sizer);
124
125   if(((wxCDMMainFrame*)this->GetParent())->isHelp())
126     {
127       wxDialog* helpDialog = new wxCDMMainHelpDialog(this->GetParent(), this, wxID_ANY);
128       helpDialog->Show(true);
129     }
130
131 }
132
133 void wxCDMMainDescriptionPanel::OnBtnNewProject(wxCommandEvent& event)
134 {
135   event.Skip();
136 }
137
138 void wxCDMMainDescriptionPanel::OnBtnOpenProject(wxCommandEvent& event)
139 {
140   event.Skip();
141 }
142