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