class mrpt::gui::CBaseGUIWindow¶
The base class for GUI window classes based on wxWidgets.
This class can be observed (see mrpt::system::CObserver) for the following events (see mrpt::system::mrptEvent):
See derived classes to check if they emit other additional events.
IMPORTANTE NOTICE: Event handlers in your observer class will be invoked from the wxWidgets internal MRPT thread, so all your code in the handler must be thread safe.
#include <mrpt/gui/CBaseGUIWindow.h> class CBaseGUIWindow: public mrpt::system::CObservable { public: // construction CBaseGUIWindow( void* winobj_voidptr, int CMD_CREATE_WIN, int CMD_DESTROY_WIN, const std::string& initial_caption = std::string() ); // methods void* getWxObject(); void notifyChildWindowDestruction(); void notifySemThreadReady(); bool isOpen(); virtual void resize(unsigned int width, unsigned int height) = 0; virtual void setPos(int x, int y) = 0; virtual void setWindowTitle(const std::string& str) = 0; virtual bool getLastMousePosition(int& x, int& y) const = 0; virtual void setCursorCross(bool cursorIsCross) = 0; int waitForKey(bool ignoreControlKeys = true, mrptKeyModifier* out_pushModifier = nullptr); bool keyHit() const; void clearKeyHitFlag(); int getPushedKey(mrptKeyModifier* out_pushModifier = nullptr); }; // direct descendants class CDisplayWindow; class CDisplayWindow3D; class CDisplayWindowPlots;
Construction¶
CBaseGUIWindow( void* winobj_voidptr, int CMD_CREATE_WIN, int CMD_DESTROY_WIN, const std::string& initial_caption = std::string() )
CMD_DESTROY_WIN can be 299,399,499…
See WxSubsystem
Methods¶
void* getWxObject()
Read-only access to the wxDialog object.
void notifyChildWindowDestruction()
Called by wx main thread to set m_hwnd to NULL.
void notifySemThreadReady()
Called by wx main thread to signal the semaphore that the wx window is built and ready.
bool isOpen()
Returns false if the user has already closed the window.
virtual void resize(unsigned int width, unsigned int height) = 0
Resizes the window, stretching the image to fit into the display area.
virtual void setPos(int x, int y) = 0
Changes the position of the window on the screen.
virtual void setWindowTitle(const std::string& str) = 0
Changes the window title text.
virtual bool getLastMousePosition(int& x, int& y) const = 0
Gets the last x,y pixel coordinates of the mouse.
Returns:
False if the window is closed.
virtual void setCursorCross(bool cursorIsCross) = 0
Set cursor style to default (cursorIsCross=false) or to a cross (cursorIsCross=true)
int waitForKey(bool ignoreControlKeys = true, mrptKeyModifier* out_pushModifier = nullptr)
Waits for any key to be pushed on the image or the console, and returns the key code.
This method remove key strokes previous to its call, so it will always wait. To get the latest pushed key, see
Parameters:
ignoreControlKeys |
If set to false, any push of shift, cmd, control, etc… will make this method to return. |
out_pushModifier |
If set to !=nullptr, the modifiers of the key stroke will be saved here. |
Returns:
The virtual key code, as defined in mrptKeyCode (a replication of wxWidgets key codes).
See also:
getPushedKey, Key codes in the enum mrptKeyCode
bool keyHit() const
Returns true if a key has been pushed, without blocking waiting for a new key being pushed.
See also:
void clearKeyHitFlag()
Assure that “keyHit” will return false until the next pushed key.
See also:
int getPushedKey(mrptKeyModifier* out_pushModifier = nullptr)
Returns the latest pushed key, or 0 if there is no new key stroke.
Parameters:
out_pushModifier |
If set to !=nullptr, the modifiers of the key stroke will be saved here. |
Returns:
The virtual key code, as defined in <mrpt/gui/keycodes.h
> (a replication of wxWidgets key codes).
See also: