29 : m_CMD_CREATE_WIN(CMD_CREATE_WIN),
30 m_CMD_DESTROY_WIN(CMD_DESTROY_WIN),
31 m_winobj_voidptr(winobj_voidptr),
32 m_semThreadReady(0,1),
33 m_semWindowDestroyed(0,1),
34 m_caption(initial_caption),
49 #if MRPT_HAS_WXWIDGETS 61 REQ->
OPCODE = m_CMD_CREATE_WIN;
62 REQ->
voidPtr = m_hwnd.getPtrToPtr();
63 REQ->
x = initialWidth ;
64 REQ->
y = initialHeight ;
72 wxApp::GetInstance()->Yield(
true);
81 const char *envVal = getenv(
"MRPT_WXSUBSYS_TIMEOUT_MS");
82 if (envVal) maxTimeout = atoi(envVal);
85 if(!m_semThreadReady.waitForSignal(maxTimeout))
87 cerr <<
"[CBaseGUIWindow::ctor] Timeout waiting window creation." << endl;
108 #if MRPT_HAS_WXWIDGETS 113 REQ->
OPCODE = m_CMD_DESTROY_WIN;
124 wxApp::GetInstance()->Yield(
true);
126 const int maxTimeout =
132 if(!m_semWindowDestroyed.waitForSignal(maxTimeout))
134 cerr <<
"[CBaseGUIWindow::dtor] Timeout waiting window destruction." << endl;
171 if (m_keyPushedCode<256 || !ignoreControlKeys)
173 if (out_pushModifier) *out_pushModifier = m_keyPushedModifier;
199 if (out_pushModifier) *out_pushModifier = m_keyPushedModifier;
222 m_semThreadReady.release();
static void pushPendingWxRequest(TRequestToWxMainThread *data)
Thread-safe method to insert a new pending request (The memory must be dinamically allocated with "ne...
void * voidPtr
Parameters, depending on OPCODE.
int waitForKey(bool ignoreControlKeys=true, mrptKeyModifier *out_pushModifier=NULL)
Waits for any key to be pushed on the image or the console, and returns the key code.
int getPushedKey(mrptKeyModifier *out_pushModifier=NULL)
Returns the latest pushed key, or 0 if there is no new key stroke.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
#define IMPLEMENTS_VIRTUAL_MRPT_OBJECT(class_name, base_class_name, NameSpace)
This must be inserted as implementation of some required members for virtual CSerializable classes: ...
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:
This namespace provides a OS-independent interface to many useful functions: filenames manipulation...
Create a GUI window and display plots with MATLAB-like interfaces and commands.
#define THROW_EXCEPTION(msg)
int OPCODE
Valid codes are: For CDisplayWindow:
void notifyChildWindowDestruction()
Called by wx main thread to set m_hwnd to NULL.
int BASE_IMPEXP getch() MRPT_NO_THROWS
An OS-independent version of getch, which waits until a key is pushed.
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
void BASE_IMPEXP sleep(int time_ms) MRPT_NO_THROWS
An OS-independent method for sending the current thread to "sleep" for a given period of time...
This class creates a window as a graphical user interface (GUI) for displaying images to the user...
bool isOpen()
Returns false if the user has already closed the window.
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.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
bool BASE_IMPEXP kbhit() MRPT_NO_THROWS
An OS-independent version of kbhit, which returns true if a key has been pushed.
mrpt::gui::CDisplayWindowPlots * sourcePlots
Only one of source* can be non-NULL, indicating the class that generated the request.
void destroyWxWindow()
Must be called by child classes in their destructors. The code cannot be put into this class' destruc...
Classes for creating GUI windows for 2D and 3D visualization.
void createWxWindow(unsigned int initialWidth, unsigned int initialHeight)
Must be called by child classes just within the constructor.
static volatile bool isConsoleApp
Will be set to true at runtime if it's not detected a running wxApp instance.
The virtual base class of all MRPT classes with a unified RTTI system.
virtual ~CBaseGUIWindow()
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.
void notifySemThreadReady()
Called by wx main thread to signal the semaphore that the wx window is built and ready.
The base class for GUI window classes.
static bool createOneInstanceMainThread()
Thread-safe method to create one single instance of the main wxWidgets thread: it will create the thr...
A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.