]> Creatis software - crea.git/blob - lib/creaDevManagerLib/wxCDMMainDescriptionPanel.cpp
d7f10aed26ef61fd6f3bebf402ecca8a7744247c
[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   CreateControls();
78   return TRUE;
79 }
80
81 void wxCDMMainDescriptionPanel::CreateControls()
82 {
83   wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
84
85   //Header
86   wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL);
87   {
88     //Image
89     headerSizer->Add(new wxStaticBitmap(this, -1, wxBitmap(CIcon64)),0, wxALIGN_CENTER, 0);
90     wxBoxSizer* textSizer = new wxBoxSizer(wxVERTICAL);
91     //Title
92     textSizer->Add(new wxStaticText(this, -1, _("Welcome")),0, wxALIGN_LEFT, 0);
93     //Application Name
94     textSizer->Add(new wxStaticText(this, -1, crea::std2wx("Crea Development Manager")),0, wxALIGN_LEFT, 0);
95     headerSizer->Add(textSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
96   }
97   sizer->Add(headerSizer, 0, wxALIGN_CENTER | wxUP, 10);
98
99   //Actions
100   wxStaticBoxSizer* actionsBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&Actions"));
101   actionsBox->GetStaticBox()->SetToolTip(wxT("Create a new crea project or open an existing one selection any of the available actions."));
102   wxPanel* actionsPanel = new wxPanel(this);
103   wxBoxSizer* actionsPanelSizer = new wxBoxSizer(wxHORIZONTAL);
104
105   wxButton* newProjectbt = new wxButton(actionsPanel, ID_BUTTON_NEWPROJECT, _T("New Project"));
106   newProjectbt->SetToolTip(wxT("Create a new crea project."));
107   actionsPanelSizer->Add(newProjectbt, 0, wxRIGHT | wxLEFT, 20);
108   wxButton* openProjectbt = new wxButton(actionsPanel, ID_BUTTON_OPENPROJECT, _T("Open Project (source/binaries)"));
109   openProjectbt->SetToolTip(wxT("Open an existing crea project from its binaries or its sources."));
110   actionsPanelSizer->Add(openProjectbt, 0, wxRIGHT | wxLEFT, 20);
111
112   actionsPanel->SetSizer(actionsPanelSizer);
113   actionsPanelSizer->Fit(actionsPanel);
114   actionsBox->Add(actionsPanel, 0, wxALIGN_CENTER | wxALL, 10);
115   sizer -> Add(actionsBox, 0, wxEXPAND | wxALL, 20);
116
117   //Asign sizer
118   sizer->SetSizeHints(this);
119   SetSizer(sizer);
120
121   if(((wxCDMMainFrame*)this->GetParent())->isHelp())
122     {
123       wxDialog* helpDialog = new wxCDMMainHelpDialog(this->GetParent(), this, wxID_ANY);
124       helpDialog->Show(true);
125     }
126
127 }
128
129 void wxCDMMainDescriptionPanel::OnBtnNewProject(wxCommandEvent& event)
130 {
131   event.Skip();
132 }
133
134 void wxCDMMainDescriptionPanel::OnBtnOpenProject(wxCommandEvent& event)
135 {
136   event.Skip();
137 }
138