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>
56 #include <mrpt/otherlibs/mathplot/mathplot.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
312 void OnPaint(wxPaintEvent &ev);
315 void OnChar(wxKeyEvent& ev);
336 void OnClose (wxCloseEvent& event);
340 void OnChar(wxKeyEvent& event);
346 DECLARE_EVENT_TABLE()
369 const size_t unique_index,
378 const double font_size,
380 const size_t unique_index,
381 const double font_spacing,
382 const double font_kerning,
383 const bool has_shadow,
389 void OnClose (wxCloseEvent& event);
392 void OnChar(wxKeyEvent& event);
398 DECLARE_EVENT_TABLE()
440 bool showName =
false);
454 void OnClose (wxCloseEvent& event);
458 void OnChar(wxKeyEvent& event);
462 DECLARE_EVENT_TABLE()
467 #define _U(x) wxString((x),wxConvUTF8)
468 #define _UU(x,y) wxString((x),y)
void OnMenuClose(wxCommandEvent &event)
friend class gui::CMyGLCanvas_DisplayWindow3D
static const long ID_MENUITEM1
virtual ~C3DWindowDialog()
void OnClose(wxCloseEvent &event)
WxSubsystem::CWXMainFrame * m_mainFrame
C3DWindowDialog(CDisplayWindow3D *win3D, WxSubsystem::CWXMainFrame *parent, wxWindowID id=-1, const std::string &caption=std::string("[MRPT-CDisplayWindow3D]"), wxSize initialSize=wxDefaultSize)
void addTextMessage(const double x_frac, const double y_frac, const std::string &text, const mrpt::utils::TColorf &color, const size_t unique_index, const mrpt::opengl::TOpenGLFont font)
CMyGLCanvas_DisplayWindow3D * m_canvas
void OnResize(wxSizeEvent &event)
void OnChar(wxKeyEvent &event)
static const long ID_MENUITEM2
CDisplayWindow3D * m_win3D
void OnMenuAbout(wxCommandEvent &event)
A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.
This class creates a window as a graphical user interface (GUI) for displaying images to the user.
Create a GUI window and display plots with MATLAB-like interfaces and commands.
A custom control to display the bitmap and avoid flicker.
virtual ~wxMRPTImageControl()
void OnMouseMove(wxMouseEvent &ev)
wxPoint m_last_mouse_point
void OnEraseBackground(wxEraseEvent &ev)
void OnPaint(wxPaintEvent &ev)
void GetBitmap(wxBitmap &bmp)
void OnChar(wxKeyEvent &ev)
void AssignImage(wxBitmap *img)
Assigns this image. This object has the ownship of the image and will delete it when appropriate.
mrpt::synch::CCriticalSection m_img_cs
wxMRPTImageControl(wxWindow *parent, wxWindowID winID, int x, int y, int width, int height)
wxPoint m_last_mouse_click
void OnMouseClick(wxMouseEvent &ev)
The wx dialog for gui::CDisplayWindow.
WxSubsystem::CWXMainFrame * m_mainFrame
void OnResize(wxSizeEvent &event)
void OnKeyDown(wxKeyEvent &event)
CWindowDialog(CDisplayWindow *win2D, WxSubsystem::CWXMainFrame *parent, wxWindowID id=-1, const std::string &caption=std::string("[MRPT-CDisplayWindow]"), wxSize initialSize=wxDefaultSize)
void OnChar(wxKeyEvent &event)
void OnMenuClose(wxCommandEvent &event)
void OnMenuAbout(wxCommandEvent &event)
void OnMouseMove(wxMouseEvent &event)
void OnMouseDown(wxMouseEvent &event)
wxMRPTImageControl * m_image
static const long ID_IMAGE_BITMAP
void OnMenuSave(wxCommandEvent &event)
void OnClose(wxCloseEvent &event)
The wx dialog for gui::CDisplayWindowPlots.
void OnResize(wxSizeEvent &event)
void OnMouseMove(wxMouseEvent &event)
static const long ID_PLOT
void OnMenuAbout(wxCommandEvent &event)
wxPoint m_last_mouse_point
In pixels.
void image(void *theWxImage, const float &x0, const float &y0, const float &w, const float &h, const std::string &plotName)
Redirected from CDisplayWindowPlots::image.
static const long ID_MENU_PRINT
void OnClose(wxCloseEvent &event)
void OnMenuPrint(wxCommandEvent &event)
void OnMouseDown(wxMouseEvent &event)
CWindowDialogPlots(CDisplayWindowPlots *winPlots, WxSubsystem::CWXMainFrame *parent, wxWindowID id=-1, const std::string &caption=std::string("[MRPT-CDisplayWindowPlots]"), wxSize initialSize=wxDefaultSize)
void OnMenuClose(wxCommandEvent &event)
std::map< long, long > m_ID2ID
wxIDs to user IDs for submenus.
CDisplayWindowPlots * m_winPlots
virtual ~CWindowDialogPlots()
void plot(const mrpt::math::CVectorFloat &x, const mrpt::math::CVectorFloat &y, const std::string &lineFormat, const std::string &plotName)
Redirected from CDisplayWindowPlots::plot.
WxSubsystem::CWXMainFrame * m_mainFrame
void OnChar(wxKeyEvent &event)
bool m_firstSubmenu
to know whether to insert a separator the first time.
void plotEllipse(const mrpt::math::CVectorFloat &x, const mrpt::math::CVectorFloat &y, const std::string &lineFormat, const std::string &plotName, bool showName=false)
Redirected from CDisplayWindowPlots::plotEllipse.
mrpt::math::TPoint2D m_curCursorPos
In graph coords.
void OnMenuSelected(wxCommandEvent &ev)
An auxiliary global object used just to launch a final request to the wxSubsystem for shutdown:
The main frame of the wxWidgets application.
static synch::CCriticalSection cs_windowCount
static volatile CWXMainFrame * oneInstance
This class implements the GUI thread required for the wxWidgets-based GUI.
static synch::CCriticalSection * cs_listPendingWxRequests
static volatile bool isConsoleApp
Will be set to true at runtime if it's not detected a running wxApp instance.
static CAuxWxSubsystemShutdowner global_wxsubsystem_shutdown
static void waitWxShutdownsIfNoWindows()
This method must be called in the destructor of the user class FROM THE MAIN THREAD,...
static std::queue< TRequestToWxMainThread * > * listPendingWxRequests
Do not access directly to this, use the thread-safe functions.
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction.
This class provides simple critical sections functionality.
A semaphore for inter-thread synchronization.
GLubyte GLubyte GLubyte GLubyte w
GLsizei GLsizei GLenum GLenum const GLvoid * data
GLenum GLsizei GLsizei height
GLsizei const GLchar ** string
TOpenGLFont
Existing fonts for 2D texts in mrpt::opengl methods.
TOpenGLFontStyle
Different style for vectorized font rendering.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
The data structure for each inter-thread request:
bool sourceCameraSelectDialog
Only one of source* can be non-NULL, indicating the class that generated the request.
int OPCODE
Valid codes are: For CDisplayWindow:
mrpt::math::CVectorFloat vector_x
mrpt::gui::CDisplayWindowPlots * sourcePlots
Only one of source* can be non-NULL, indicating the class that generated the request.
mrpt::gui::CDisplayWindow3D * source3D
Only one of source* can be non-NULL, indicating the class that generated the request.
void * voidPtr
Parameters, depending on OPCODE.
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.
mrpt::synch::CSemaphore m_semWxMainThreadReady
This is signaled when wxMainThread is ready.
mrpt::system::TThreadHandle m_wxMainThreadId
The thread ID of wxMainThread, or 0 if it is not running.
mrpt::synch::CCriticalSection m_csWxMainThreadId
The critical section for accessing "m_wxMainThreadId".
A RGB color - floats in the range [0,1].