]> Creatis software - crea.git/blob - lib/creaDevManagerLib/wxCDMMainHelpDialog.cpp
Feature #1711 CreaDevManager application implementation
[crea.git] / lib / creaDevManagerLib / wxCDMMainHelpDialog.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  * wxCDMMainHelpDialog.cpp
31  *
32  *  Created on: 7/1/2013
33  *      Author: Daniel Felipe Gonzalez Obando
34  */
35
36 #include "wxCDMMainHelpDialog.h"
37
38 #include "creaDevManagerIds.h"
39
40 BEGIN_EVENT_TABLE(wxCDMMainHelpDialog, wxDialog)
41 EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMMainHelpDialog::OnFinish)
42 EVT_BUTTON(ID_BUTTON_NEWPROJECT, wxCDMMainHelpDialog::OnNewProject)
43 EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMMainHelpDialog::OnOpenProject)
44 EVT_CHECKBOX(ID_CHECKBOX_DISABLE_HELP, wxCDMMainHelpDialog::OnDisableHelp)
45 END_EVENT_TABLE()
46
47 wxCDMMainHelpDialog::wxCDMMainHelpDialog(
48     wxWindow* parent,
49     wxCDMMainDescriptionPanel* mainDescription,
50     wxWindowID id,
51     const wxString& caption,
52     const wxPoint& position,
53     const wxSize& size,
54     long style
55 )
56 {
57   wxCDMMainHelpDialog::Create(parent, id, caption, position, size, style);
58   this->mainDescription = mainDescription;
59 }
60
61 wxCDMMainHelpDialog::~wxCDMMainHelpDialog()
62 {
63 }
64
65 bool wxCDMMainHelpDialog::Create(
66     wxWindow* parent,
67     wxWindowID id,
68     const wxString& caption,
69     const wxPoint& position,
70     const wxSize& size,
71     long int style
72 )
73 {
74   wxDialog::Create(parent, id, caption, position, size, style);
75
76   this->CreateControls();
77
78   return TRUE;
79 }
80
81 void wxCDMMainHelpDialog::CreateControls()
82 {
83
84   wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL);
85
86
87   wxStaticText* title = new wxStaticText(this, wxID_ANY, wxT("Welcome to the Crea Development Manager"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);//new wxRichTextCtrl(this,wxID_ANY, wxString("Create a new project"), wxDefaultPosition, wxDefaultSize, wxRE_READONLY);
88   v_sizer1->Add(title, 0, wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL, 5);
89
90   wxStaticText* instruction = new wxStaticText(
91       this,
92       wxID_ANY,
93       crea::std2wx(
94           "This application was made to help you in the creation process of Crea projects. This help dialogs will explain what "
95           "each part of the program does and will give you tips to get your project up and running in no time. You can disable "
96           "them by checking the \"Disable Help\" option, or you can also enable or disable them at any time checking the \"Help "
97           "Dialogs\" option in the Help menu.\n To begin working on your projects you can either create a new project or open an "
98           "already existing project.\n"),
99           wxDefaultPosition,
100           wxDefaultSize,
101           wxALIGN_LEFT
102   );
103   v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5);
104
105 //  wxFlexGridSizer* formItems = new wxFlexGridSizer(1,2,9,15);
106 //
107 //  wxButton* createPackageBtn = new wxButton(this, ID_BUTTON_NEWPROJECT, wxT("New Project"));
108 //  wxButton* editCMakeBtn= new wxButton(this, ID_BUTTON_OPENPROJECT, wxT("Open Project"));
109 //
110 //  formItems->Add(createPackageBtn, 1, wxALIGN_CENTER);
111 //  formItems->Add(editCMakeBtn, 1, wxALIGN_CENTER);
112 //
113 //  formItems->AddGrowableCol(0,1);
114 //  formItems->AddGrowableCol(1,1);
115 //
116 //  v_sizer1->Add(formItems, 1, wxEXPAND | wxALL, 15);
117
118   v_sizer1->Add(new wxCheckBox(this, ID_CHECKBOX_DISABLE_HELP, wxT("&Disable help")), 0, wxALIGN_RIGHT | wxRIGHT, 10);
119
120   v_sizer1->Add(new wxButton(this, ID_BUTTON_CANCEL, wxT("Close")), 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 30);
121
122   SetSizer(v_sizer1);
123   //v_sizer1->RecalcSizes();
124 }
125
126 void wxCDMMainHelpDialog::OnFinish(wxCommandEvent& event)
127 {
128   this->EndDialog(wxID_CANCEL);
129 }
130
131 void wxCDMMainHelpDialog::OnNewProject(wxCommandEvent& event)
132 {
133   wxPostEvent(this->GetParent(), event);
134   event.Skip();
135
136   this->EndDialog(wxID_OK);
137 }
138
139 void wxCDMMainHelpDialog::OnOpenProject(wxCommandEvent& event)
140 {
141   wxPostEvent(this->GetParent(), event);
142     event.Skip();
143
144   this->EndDialog(wxID_OK);
145 }
146
147 void wxCDMMainHelpDialog::OnDisableHelp(wxCommandEvent& event)
148 {
149   wxPostEvent(this->GetParent(), event);
150 }