MRPT  1.9.9
CAboutBox_wx.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://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/intl.h>
21 #include <wx/image.h>
22 #include <wx/string.h>
23 //*)
24 
25 #include <mrpt/gui/CMyRedirector.h>
26 #include <mrpt/gui/WxUtils.h> // _U()
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, wxSWISS, 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, wxSWISS, wxFONTSTYLE_NORMAL, wxNORMAL, false, _T("Courier New"),
116  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, wxSWISS, wxFONTSTYLE_NORMAL, wxNORMAL, false, _T("Courier New"),
124  wxFONTENCODING_DEFAULT);
125  lbLicense->SetFont(lbLicenseFont);
126  TextCtrl1 = new wxTextCtrl(
127  Notebook1, ID_TEXTCTRL3, _U(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, wxSWISS, wxFONTSTYLE_NORMAL, wxNORMAL, false, _T("Courier New"),
132  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  Connect(
150  ID_BUTTON1, wxEVT_COMMAND_BUTTON_CLICKED,
151  (wxObjectEventFunction)&CAboutBox::OnButton1Click);
152  Connect(
153  wxID_ANY, wxEVT_INIT_DIALOG, (wxObjectEventFunction)&CAboutBox::OnInit);
154  //*)
155 
156  lbLicense->SetValue(_U(license().c_str()));
157 }
158 
160 {
161  //(*Destroy(CAboutBox)
162  //*)
163 }
164 
165 void CAboutBox::OnInit(wxInitDialogEvent& event)
166 {
167  // Build strings:
168  wxString MRPTver(MRPT_getVersion().c_str(), wxConvLibc);
169 
170  // Set the label with MRPT version:
171  wxString s(_("Build: "));
173  s << _(" - ") << MRPTver;
174 
175  lbBuild->SetLabel(s);
176 
177  // Info:
178  lbInfo->Clear();
179 
180  {
181  CMyRedirector myRedirector(lbInfo);
182  wxString wxVer(wxVERSION_STRING);
183  cout << information("wxWidgets", std::string(wxVer.mb_str()));
184  }
185 
186  lbProgName->SetLabel(_U(m_appName.c_str()));
187  lbProgName->SetForegroundColour(wxColour(0, 0, 128));
188 
189  FlexGridSizer1->RecalcSizes();
190  this->Fit();
191 }
192 
193 void CAboutBox::OnButton1Click(wxCommandEvent& event) { Close(); }
194 #endif // MRPT_HAS_WXWIDGETS
static const long ID_STATICLINE1
Definition: CAboutBox_wx.h:36
static const long ID_STATICBITMAP1
Definition: CAboutBox_wx.h:35
#define _U(x)
Definition: WxSubsystem.h:503
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:152
GLdouble s
Definition: glext.h:3676
#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:42
GLsizei const GLchar ** string
Definition: glext.h:4101
static const long ID_TEXTCTRL2
Definition: CAboutBox_wx.h:39
static const long ID_NOTEBOOK1
Definition: CAboutBox_wx.h:41
virtual ~CAboutBox()
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
static const long ID_TEXTCTRL3
Definition: CAboutBox_wx.h:40
void OnInit(wxInitDialogEvent &event)
static const long ID_TEXTCTRL1
Definition: CAboutBox_wx.h:38
static const long ID_STATICTEXT2
Definition: CAboutBox_wx.h:34
std::string MRPT_getVersion()
Returns a string describing the MRPT version.
Definition: os.cpp:185
static const long ID_STATICTEXT1
Definition: CAboutBox_wx.h:33



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020