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