MRPT  1.9.9
CAboutBox_wx.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include "gui-precomp.h" // Precompiled headers
11 
12 #if MRPT_HAS_WXWIDGETS
13 
14 #include "CAboutBox_wx.h"
15 
16 //(*InternalHeaders(CAboutBox)
17 #include <wx/artprov.h>
18 #include <wx/bitmap.h>
19 #include <wx/font.h>
20 #include <wx/image.h>
21 #include <wx/intl.h>
22 #include <wx/string.h>
23 //*)
24 
25 #include <mrpt/gui/CMyRedirector.h>
26 #include <mrpt/gui/WxUtils.h> //
27 
28 // For CV_VERSION
29 #include <mrpt/config.h>
30 
31 #include <mrpt/system/os.h>
32 
33 using namespace mrpt;
34 using namespace mrpt::system;
35 using namespace std;
36 
37 //(*IdInit(CAboutBox)
38 const long CAboutBox::ID_STATICTEXT1 = wxNewId();
39 const long CAboutBox::ID_STATICTEXT2 = wxNewId();
40 const long CAboutBox::ID_STATICBITMAP1 = wxNewId();
41 const long CAboutBox::ID_STATICLINE1 = wxNewId();
42 const long CAboutBox::ID_TEXTCTRL1 = wxNewId();
43 const long CAboutBox::ID_TEXTCTRL2 = wxNewId();
44 const long CAboutBox::ID_TEXTCTRL3 = wxNewId();
45 const long CAboutBox::ID_NOTEBOOK1 = wxNewId();
46 const long CAboutBox::ID_BUTTON1 = wxNewId();
47 //*)
48 
49 BEGIN_EVENT_TABLE(CAboutBox, wxDialog)
50 //(*EventTable(CAboutBox)
51 //*)
52 END_EVENT_TABLE()
53 
55  wxWindow* parent, const std::string& appName,
56  const std::string& additionalInfo, const bool showStandardInfo)
57  : CAboutBoxBase(appName, additionalInfo, showStandardInfo)
58 {
59  const wxWindowID id = -1;
60  //(*Initialize(CAboutBox)
61  wxFlexGridSizer* FlexGridSizer2;
62 
63  Create(
64  parent, id, _("About box..."), wxDefaultPosition, wxDefaultSize,
65  wxDEFAULT_DIALOG_STYLE | wxCLOSE_BOX, _T("id"));
66  SetClientSize(wxSize(636, 375));
67  FlexGridSizer1 = new wxFlexGridSizer(0, 1, 0, 0);
68  FlexGridSizer1->AddGrowableCol(0);
69  FlexGridSizer4 = new wxFlexGridSizer(0, 2, 0, 0);
70  FlexGridSizer4->AddGrowableCol(1);
71  FlexGridSizer4->AddGrowableRow(0);
72  FlexGridSizer2 = new wxFlexGridSizer(2, 1, 0, 0);
73  FlexGridSizer2->AddGrowableCol(0);
74  FlexGridSizer2->AddGrowableRow(0);
75  FlexGridSizer2->AddGrowableRow(1);
76  lbProgName = new wxStaticText(
77  this, ID_STATICTEXT1, _("Title"), wxDefaultPosition, wxDefaultSize, 0,
78  _T("ID_STATICTEXT1"));
79  wxFont lbProgNameFont(
80  22, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false,
81  _T("Times New Roman"), wxFONTENCODING_DEFAULT);
82  lbProgName->SetFont(lbProgNameFont);
83  FlexGridSizer2->Add(
84  lbProgName, 1, wxALL | wxALIGN_BOTTOM | wxALIGN_CENTER_HORIZONTAL, 5);
85  lbBuild = new wxStaticText(
86  this, ID_STATICTEXT2, _("Label"), wxDefaultPosition, wxDefaultSize, 0,
87  _T("ID_STATICTEXT2"));
88  FlexGridSizer2->Add(
89  lbBuild, 1, wxALL | wxALIGN_TOP | wxALIGN_CENTER_HORIZONTAL, 5);
90  FlexGridSizer4->Add(
91  FlexGridSizer2, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 0);
92  StaticBitmap1 = new wxStaticBitmap(
93  this, ID_STATICBITMAP1,
94  wxArtProvider::GetBitmap(
95  wxART_MAKE_ART_ID_FROM_STR(_T("IMG_MRPT_LOGO")), wxART_OTHER),
96  wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICBITMAP1"));
97  FlexGridSizer4->Add(
98  StaticBitmap1, 1,
99  wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
100  FlexGridSizer1->Add(
101  FlexGridSizer4, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 1);
102  StaticLine1 = new wxStaticLine(
103  this, ID_STATICLINE1, wxPoint(3, 86), wxSize(627, 2), wxLI_HORIZONTAL,
104  _T("ID_STATICLINE1"));
105  FlexGridSizer1->Add(
106  StaticLine1, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
107  Notebook1 = new wxNotebook(
108  this, ID_NOTEBOOK1, wxPoint(6, 91), wxSize(625, 250), 0,
109  _T("ID_NOTEBOOK1"));
110  lbInfo = new wxTextCtrl(
111  Notebook1, ID_TEXTCTRL1, wxEmptyString, wxPoint(4, 24),
112  wxSize(545, 250), wxTE_MULTILINE | wxTE_READONLY | wxTE_AUTO_URL,
113  wxDefaultValidator, _T("ID_TEXTCTRL1"));
114  wxFont lbInfoFont(
115  10, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false,
116  _T("Courier New"), wxFONTENCODING_DEFAULT);
117  lbInfo->SetFont(lbInfoFont);
118  lbLicense = new wxTextCtrl(
119  Notebook1, ID_TEXTCTRL2, _(""), wxDefaultPosition, wxDefaultSize,
120  wxTE_MULTILINE | wxTE_READONLY | wxTE_AUTO_URL, wxDefaultValidator,
121  _T("ID_TEXTCTRL2"));
122  wxFont lbLicenseFont(
123  10, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false,
124  _T("Courier New"), wxFONTENCODING_DEFAULT);
125  lbLicense->SetFont(lbLicenseFont);
126  TextCtrl1 = new wxTextCtrl(
127  Notebook1, ID_TEXTCTRL3, tutorial().c_str(), wxPoint(4, 24),
128  wxSize(545, 222), wxTE_MULTILINE | wxTE_READONLY | wxTE_AUTO_URL,
129  wxDefaultValidator, _T("ID_TEXTCTRL3"));
130  wxFont TextCtrl1Font(
131  10, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false,
132  _T("Courier New"), wxFONTENCODING_DEFAULT);
133  TextCtrl1->SetFont(TextCtrl1Font);
134  Notebook1->AddPage(lbInfo, _("Information"), false);
135  Notebook1->AddPage(lbLicense, _("License"), false);
136  Notebook1->AddPage(TextCtrl1, _("Tutorial"), false);
137  FlexGridSizer1->Add(
138  Notebook1, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
139  Button11 = new wxButton(
140  this, ID_BUTTON1, _("OK"), wxPoint(250, 345), wxSize(76, 26), 0,
141  wxDefaultValidator, _T("ID_BUTTON1"));
142  FlexGridSizer1->Add(
143  Button11, 1,
144  wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
145  SetSizer(FlexGridSizer1);
146  FlexGridSizer1->SetSizeHints(this);
147  Center();
148 
149  Bind(wxEVT_BUTTON, &CAboutBox::OnButton1Click, this, ID_BUTTON1);
150  Bind(wxEVT_INIT_DIALOG, &CAboutBox::OnInit, this);
151  //*)
152 
153  lbLicense->SetValue(license().c_str());
154 }
155 
157 {
158  //(*Destroy(CAboutBox)
159  //*)
160 }
161 
162 void CAboutBox::OnInit(wxInitDialogEvent& event)
163 {
164  // Build strings:
165  wxString MRPTver(MRPT_getVersion().c_str(), wxConvLibc);
166 
167  // Set the label with MRPT version:
168  wxString s(_("Build: "));
170  s << _(" - ") << MRPTver;
171 
172  lbBuild->SetLabel(s);
173 
174  // Info:
175  lbInfo->Clear();
176 
177  {
178  CMyRedirector myRedirector(lbInfo);
179  wxString wxVer(wxVERSION_STRING);
180  cout << information("wxWidgets", std::string(wxVer.mb_str()));
181  }
182 
183  lbProgName->SetLabel(m_appName.c_str());
184  lbProgName->SetForegroundColour(wxColour(0, 0, 128));
185 
186  FlexGridSizer1->RecalcSizes();
187  this->Fit();
188 }
189 
190 void CAboutBox::OnButton1Click(wxCommandEvent& event) { Close(); }
191 #endif // MRPT_HAS_WXWIDGETS
static const long ID_STATICLINE1
Definition: CAboutBox_wx.h:35
static const long ID_STATICBITMAP1
Definition: CAboutBox_wx.h:34
void OnButton1Click(wxCommandEvent &event)
STL namespace.
std::string MRPT_getCompilationDate()
Returns the MRPT source code timestamp, according to the Reproducible-Builds specifications: https://...
Definition: os.cpp:154
#define wxFONTWEIGHT_BOLD
Definition: wx28-fixes.h:14
This auxiliary class redirects the output sent to a streambuf to a wxTextCtrl object.
Definition: CMyRedirector.h:36
static const long ID_BUTTON1
Definition: CAboutBox_wx.h:41
static const long ID_TEXTCTRL2
Definition: CAboutBox_wx.h:38
static const long ID_NOTEBOOK1
Definition: CAboutBox_wx.h:40
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
static const long ID_TEXTCTRL3
Definition: CAboutBox_wx.h:39
void OnInit(wxInitDialogEvent &event)
static const long ID_TEXTCTRL1
Definition: CAboutBox_wx.h:37
static const long ID_STATICTEXT2
Definition: CAboutBox_wx.h:33
std::string MRPT_getVersion()
Returns a string describing the MRPT version.
Definition: os.cpp:187
~CAboutBox() override
static const long ID_STATICTEXT1
Definition: CAboutBox_wx.h:32



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: c7a3bec24 Sun Mar 29 18:33:13 2020 +0200 at dom mar 29 18:50:38 CEST 2020