Main MRPT website > C++ reference for 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-2017, 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 #include <mrpt/utils/utils_defs.h>
33 
34 using namespace mrpt;
35 using namespace mrpt::system;
36 using namespace std;
37 
38 //(*IdInit(CAboutBox)
39 const long CAboutBox::ID_STATICTEXT1 = wxNewId();
40 const long CAboutBox::ID_STATICTEXT2 = wxNewId();
41 const long CAboutBox::ID_STATICBITMAP1 = wxNewId();
42 const long CAboutBox::ID_STATICLINE1 = wxNewId();
43 const long CAboutBox::ID_TEXTCTRL1 = wxNewId();
44 const long CAboutBox::ID_TEXTCTRL2 = wxNewId();
45 const long CAboutBox::ID_TEXTCTRL3 = wxNewId();
46 const long CAboutBox::ID_NOTEBOOK1 = wxNewId();
47 const long CAboutBox::ID_BUTTON1 = wxNewId();
48 //*)
49 
50 BEGIN_EVENT_TABLE(CAboutBox, wxDialog)
51 //(*EventTable(CAboutBox)
52 //*)
53 END_EVENT_TABLE()
54 
56  wxWindow* parent, const std::string& appName,
57  const std::string& additionalInfo, const bool showStandardInfo)
58  : CAboutBoxBase(appName, additionalInfo, showStandardInfo)
59 {
60  const wxWindowID id = -1;
61  //(*Initialize(CAboutBox)
62  wxFlexGridSizer* FlexGridSizer2;
63 
64  Create(
65  parent, id, _("About box..."), wxDefaultPosition, wxDefaultSize,
66  wxDEFAULT_DIALOG_STYLE | wxCLOSE_BOX, _T("id"));
67  SetClientSize(wxSize(636, 375));
68  FlexGridSizer1 = new wxFlexGridSizer(0, 1, 0, 0);
69  FlexGridSizer1->AddGrowableCol(0);
70  FlexGridSizer4 = new wxFlexGridSizer(0, 2, 0, 0);
71  FlexGridSizer4->AddGrowableCol(1);
72  FlexGridSizer4->AddGrowableRow(0);
73  FlexGridSizer2 = new wxFlexGridSizer(2, 1, 0, 0);
74  FlexGridSizer2->AddGrowableCol(0);
75  FlexGridSizer2->AddGrowableRow(0);
76  FlexGridSizer2->AddGrowableRow(1);
77  lbProgName = new wxStaticText(
78  this, ID_STATICTEXT1, _("Title"), wxDefaultPosition, wxDefaultSize, 0,
79  _T("ID_STATICTEXT1"));
80  wxFont lbProgNameFont(
81  22, wxSWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false,
82  _T("Times New Roman"), wxFONTENCODING_DEFAULT);
83  lbProgName->SetFont(lbProgNameFont);
84  FlexGridSizer2->Add(
85  lbProgName, 1, wxALL | wxALIGN_BOTTOM | wxALIGN_CENTER_HORIZONTAL, 5);
86  lbBuild = new wxStaticText(
87  this, ID_STATICTEXT2, _("Label"), wxDefaultPosition, wxDefaultSize, 0,
88  _T("ID_STATICTEXT2"));
89  FlexGridSizer2->Add(
90  lbBuild, 1, wxALL | wxALIGN_TOP | wxALIGN_CENTER_HORIZONTAL, 5);
91  FlexGridSizer4->Add(
92  FlexGridSizer2, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 0);
93  StaticBitmap1 = new wxStaticBitmap(
94  this, ID_STATICBITMAP1,
95  wxArtProvider::GetBitmap(
96  wxART_MAKE_ART_ID_FROM_STR(_T("IMG_MRPT_LOGO")), wxART_OTHER),
97  wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICBITMAP1"));
98  FlexGridSizer4->Add(
99  StaticBitmap1, 1,
100  wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
101  FlexGridSizer1->Add(
102  FlexGridSizer4, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 1);
103  StaticLine1 = new wxStaticLine(
104  this, ID_STATICLINE1, wxPoint(3, 86), wxSize(627, 2), wxLI_HORIZONTAL,
105  _T("ID_STATICLINE1"));
106  FlexGridSizer1->Add(
107  StaticLine1, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
108  Notebook1 = new wxNotebook(
109  this, ID_NOTEBOOK1, wxPoint(6, 91), wxSize(625, 250), 0,
110  _T("ID_NOTEBOOK1"));
111  lbInfo = new wxTextCtrl(
112  Notebook1, ID_TEXTCTRL1, wxEmptyString, wxPoint(4, 24),
113  wxSize(545, 250), wxTE_MULTILINE | wxTE_READONLY | wxTE_AUTO_URL,
114  wxDefaultValidator, _T("ID_TEXTCTRL1"));
115  wxFont lbInfoFont(
116  10, wxSWISS, wxFONTSTYLE_NORMAL, wxNORMAL, false, _T("Courier New"),
117  wxFONTENCODING_DEFAULT);
118  lbInfo->SetFont(lbInfoFont);
119  lbLicense = new wxTextCtrl(
120  Notebook1, ID_TEXTCTRL2, _(""), wxDefaultPosition, wxDefaultSize,
121  wxTE_MULTILINE | wxTE_READONLY | wxTE_AUTO_URL, wxDefaultValidator,
122  _T("ID_TEXTCTRL2"));
123  wxFont lbLicenseFont(
124  10, wxSWISS, wxFONTSTYLE_NORMAL, wxNORMAL, false, _T("Courier New"),
125  wxFONTENCODING_DEFAULT);
126  lbLicense->SetFont(lbLicenseFont);
127  TextCtrl1 = new wxTextCtrl(
128  Notebook1, ID_TEXTCTRL3, _(tutorial()), wxPoint(4, 24),
129  wxSize(545, 222), wxTE_MULTILINE | wxTE_READONLY | wxTE_AUTO_URL,
130  wxDefaultValidator, _T("ID_TEXTCTRL3"));
131  wxFont TextCtrl1Font(
132  10, wxSWISS, wxFONTSTYLE_NORMAL, wxNORMAL, false, _T("Courier New"),
133  wxFONTENCODING_DEFAULT);
134  TextCtrl1->SetFont(TextCtrl1Font);
135  Notebook1->AddPage(lbInfo, _("Information"), false);
136  Notebook1->AddPage(lbLicense, _("License"), false);
137  Notebook1->AddPage(TextCtrl1, _("Tutorial"), false);
138  FlexGridSizer1->Add(
139  Notebook1, 1, wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP, 5);
140  Button11 = new wxButton(
141  this, ID_BUTTON1, _("OK"), wxPoint(250, 345), wxSize(76, 26), 0,
142  wxDefaultValidator, _T("ID_BUTTON1"));
143  FlexGridSizer1->Add(
144  Button11, 1,
145  wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
146  SetSizer(FlexGridSizer1);
147  FlexGridSizer1->SetSizeHints(this);
148  Center();
149 
150  Connect(
151  ID_BUTTON1, wxEVT_COMMAND_BUTTON_CLICKED,
152  (wxObjectEventFunction)&CAboutBox::OnButton1Click);
153  Connect(
154  wxID_ANY, wxEVT_INIT_DIALOG, (wxObjectEventFunction)&CAboutBox::OnInit);
155  //*)
156 
157  lbLicense->SetValue(_U(license().c_str()));
158 }
159 
161 {
162  //(*Destroy(CAboutBox)
163  //*)
164 }
165 
166 void CAboutBox::OnInit(wxInitDialogEvent& event)
167 {
168  // Build strings:
169  wxString MRPTver(MRPT_getVersion().c_str(), wxConvLibc);
170 
171  // Set the label with MRPT version:
172  wxString s(_("Build: "));
174  s << _(" - ") << MRPTver;
175 
176  lbBuild->SetLabel(s);
177 
178  // Info:
179  lbInfo->Clear();
180 
181  {
182  CMyRedirector myRedirector(lbInfo);
183  wxString wxVer(wxVERSION_STRING);
184  cout << information("wxWidgets", std::string(wxVer.mb_str()));
185  }
186 
187  lbProgName->SetLabel(_U(m_appName.c_str()));
188  lbProgName->SetForegroundColour(wxColour(0, 0, 128));
189 
190  FlexGridSizer1->RecalcSizes();
191  this->Fit();
192 }
193 
194 void CAboutBox::OnButton1Click(wxCommandEvent& event) { Close(); }
195 #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:506
This namespace provides a OS-independent interface to many useful functions: filenames manipulation...
Definition: math_frwds.h:30
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:151
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:184
static const long ID_STATICTEXT1
Definition: CAboutBox_wx.h:33



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019