9 #ifndef MRPT_WX_SUBSYSTEM_H 10 #define MRPT_WX_SUBSYSTEM_H 15 #include <mrpt/config.h> 27 #if MRPT_HAS_WXWIDGETS 30 #include <wx/statbmp.h> 32 #include <wx/toolbar.h> 35 #include <wx/statusbr.h> 36 #include <wx/msgdlg.h> 37 #include <wx/artprov.h> 38 #include <wx/bitmap.h> 41 #include <wx/string.h> 42 #include <wx/msgdlg.h> 43 #include <wx/filedlg.h> 44 #include <wx/progdlg.h> 45 #include <wx/imaglist.h> 46 #include <wx/busyinfo.h> 48 #include <wx/textdlg.h> 49 #include <wx/dirdlg.h> 50 #include <wx/colordlg.h> 51 #include <wx/dcmemory.h> 60 #include <wx/chartpanel.h> 61 #include <wx/bars/barplot.h> 63 #include <wx/axis/numberaxis.h> 64 #include <wx/axis/categoryaxis.h> 65 #include <wx/axis/dateaxis.h> 67 #include <wx/xy/xyhistorenderer.h> 68 #include <wx/xy/xydataset.h> 69 #include <wx/xy/xylinerenderer.h> 70 #include <wx/xy/xyplot.h> 71 #include <wx/xy/xysimpledataset.h> 73 #include <wx/xyz/xyzdataset.h> 74 #include <wx/xyz/bubbleplot.h> 76 #include <wx/category/categorydataset.h> 77 #include <wx/category/categorysimpledataset.h> 101 #if MRPT_HAS_WXWIDGETS 107 static void waitWxShutdownsIfNoWindows();
141 static int notifyWindowCreation();
146 static int notifyWindowDestruction();
158 void OnTimerProcessRequests(wxTimerEvent& event);
160 DECLARE_EVENT_TABLE()
178 static void wxMainThread();
187 sourcePlots ( NULL ),
188 sourceCameraSelectDialog(false),
273 static bool createOneInstanceMainThread();
276 static wxBitmap getMRPTDefaultIcon();
286 #if MRPT_HAS_WXWIDGETS 303 wxMRPTImageControl( wxWindow *parent,wxWindowID winID,
int x,
int y,
int width,
int height);
309 void AssignImage(wxBitmap *img);
310 void GetBitmap(wxBitmap &bmp);
312 void OnPaint(wxPaintEvent &ev);
313 void OnMouseMove(wxMouseEvent& ev);
314 void OnMouseClick(wxMouseEvent& ev);
315 void OnChar(wxKeyEvent& ev);
336 void OnClose (wxCloseEvent& event);
337 void OnMenuClose(wxCommandEvent& event);
338 void OnMenuAbout(wxCommandEvent& event);
339 void OnMenuSave(wxCommandEvent& event);
340 void OnChar(wxKeyEvent& event);
341 void OnKeyDown(wxKeyEvent& event);
342 void OnResize(wxSizeEvent& event);
343 void OnMouseDown(wxMouseEvent& event);
345 DECLARE_EVENT_TABLE()
350 friend class gui::CMyGLCanvas_DisplayWindow3D;
362 void clearTextMessages();
366 const std::string &text,
368 const size_t unique_index,
374 const std::string &text,
376 const std::string &font_name,
377 const double font_size,
379 const size_t unique_index,
380 const double font_spacing,
381 const double font_kerning,
382 const bool has_shadow,
388 void OnClose (wxCloseEvent& event);
389 void OnMenuClose(wxCommandEvent& event);
390 void OnMenuAbout(wxCommandEvent& event);
391 void OnChar(wxKeyEvent& event);
392 void OnResize(wxSizeEvent& event);
397 DECLARE_EVENT_TABLE()
420 void OnMenuSelected(wxCommandEvent& ev);
421 void OnMouseMove(wxMouseEvent& event);
429 const std::string &lineFormat,
430 const std::string &plotName);
437 const std::string &lineFormat,
438 const std::string &plotName,
439 bool showName =
false);
449 const std::string &plotName);
453 void OnClose (wxCloseEvent& event);
454 void OnMenuPrint(wxCommandEvent& event);
455 void OnMenuClose(wxCommandEvent& event);
456 void OnMenuAbout(wxCommandEvent& event);
457 void OnChar(wxKeyEvent& event);
458 void OnResize(wxSizeEvent& event);
459 void OnMouseDown(wxMouseEvent& event);
461 DECLARE_EVENT_TABLE()
466 #define _U(x) wxString((x),wxConvUTF8) 467 #define _UU(x,y) wxString((x),y) An auxiliary global object used just to launch a final request to the wxSubsystem for shutdown: ...
static std::queue< TRequestToWxMainThread * > * listPendingWxRequests
Do not access directly to this, use the thread-safe functions.
This class provides simple critical sections functionality.
static const long ID_MENUITEM1
static CAuxWxSubsystemShutdowner global_wxsubsystem_shutdown
mrpt::gui::CDisplayWindow3D * source3D
Only one of source* can be non-NULL, indicating the class that generated the request.
The data structure for each inter-thread request:
static void waitWxShutdownsIfNoWindows()
This method must be called in the destructor of the user class FROM THE MAIN THREAD, in order to wait for the shutdown of the wx thread if this was the last open window.
Create a GUI window and display plots with MATLAB-like interfaces and commands.
Canvas for plotting mpLayer implementations.
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction...
The wx dialog for gui::CDisplayWindowPlots.
mrpt::synch::CSemaphore m_semWxMainThreadReady
This is signaled when wxMainThread is ready.
wxPoint m_last_mouse_point
In pixels.
CDisplayWindow3D * m_win3D
static const long ID_PLOT
wxPoint m_last_mouse_point
WxSubsystem::CWXMainFrame * m_mainFrame
int OPCODE
Valid codes are: For CDisplayWindow:
wxMRPTImageControl * m_image
CDisplayWindowPlots * m_winPlots
static const long ID_IMAGE_BITMAP
A custom control to display the bitmap and avoid flicker.
mrpt::math::TPoint2D m_curCursorPos
In graph coords.
TOpenGLFont
Existing fonts for 2D texts in mrpt::opengl methods.
static synch::CCriticalSection cs_windowCount
TOpenGLFontStyle
Different style for vectorized font rendering.
This class creates a window as a graphical user interface (GUI) for displaying images to the user...
mrpt::math::CVectorFloat vector_y
The main frame of the wxWidgets application.
The wx dialog for gui::CDisplayWindow.
bool sourceCameraSelectDialog
Only one of source* can be non-NULL, indicating the class that generated the request.
static const long ID_MENUITEM2
static volatile bool isConsoleApp
Will be set to true at runtime if it's not detected a running wxApp instance.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
WxSubsystem::CWXMainFrame * m_mainFrame
This class implements the GUI thread required for the wxWidgets-based GUI.
This structure contains the information needed to interface the threads API on each platform: ...
static volatile CWXMainFrame * oneInstance
x y t t *t x y t t t x y t t t x *y t *t t x *y t *t t x y t t t x y t t t x(y+z)
A RGB color - floats in the range [0,1].
mrpt::synch::CCriticalSection m_img_cs
mrpt::gui::CDisplayWindowPlots * sourcePlots
Only one of source* can be non-NULL, indicating the class that generated the request.
mrpt::synch::CCriticalSection m_csWxMainThreadId
The critical section for accessing "m_wxMainThreadId".
std::map< long, long > m_ID2ID
wxIDs to user IDs for submenus.
static const long ID_MENU_PRINT
mrpt::gui::CDisplayWindow * source2D
Only one of source* can be non-NULL, indicating the class that generated the request.
std::string str
Parameters, depending on OPCODE.
WxSubsystem::CWXMainFrame * m_mainFrame
mrpt::system::TThreadHandle m_wxMainThreadId
The thread ID of wxMainThread, or 0 if it is not running.
A semaphore for inter-thread synchronization.
void OnEraseBackground(wxEraseEvent &ev)
static synch::CCriticalSection * cs_listPendingWxRequests
CMyGLCanvas_DisplayWindow3D * m_canvas
A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.
bool m_firstSubmenu
to know whether to insert a separator the first time.