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();
#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:
The base class for GUI window classes.
void notifyChildWindowDestruction()
Called by wx main thread to set m_hwnd to NULL.
int getPushedKey(mrptKeyModifier *out_pushModifier=NULL)
Returns the latest pushed key, or 0 if there is no new key stroke.
bool isOpen()
Returns false if the user has already closed the window.
void createWxWindow(unsigned int initialWidth, unsigned int initialHeight)
Must be called by child classes just within the constructor.
void destroyWxWindow()
Must be called by child classes in their destructors. The code cannot be put into this class' destruc...
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.
virtual ~CBaseGUIWindow()
void notifySemThreadReady()
Called by wx main thread to signal the semaphore that the wx window is built and ready.
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.
static bool createOneInstanceMainThread()
Thread-safe method to create one single instance of the main wxWidgets thread: it will create the thr...
static void pushPendingWxRequest(TRequestToWxMainThread *data)
Thread-safe method to insert a new pending request (The memory must be dinamically allocated with "ne...
static volatile bool isConsoleApp
Will be set to true at runtime if it's not detected a running wxApp instance.
static void waitWxShutdownsIfNoWindows()
This method must be called in the destructor of the user class FROM THE MAIN THREAD,...
The virtual base class of all MRPT classes with a unified RTTI system.
bool BASE_IMPEXP kbhit() MRPT_NO_THROWS
An OS-independent version of kbhit, which returns true if a key has been pushed.
int BASE_IMPEXP getch() MRPT_NO_THROWS
An OS-independent version of getch, which waits until a key is pushed.
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.
#define THROW_EXCEPTION(msg)
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
Classes for creating GUI windows for 2D and 3D visualization.
This namespace provides a OS-independent interface to many useful functions: filenames manipulation,...
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values,...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
The data structure for each inter-thread request:
int OPCODE
Valid codes are: For CDisplayWindow:
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.