Main MRPT website > C++ reference for MRPT 1.5.7
List of all members | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Attributes | Friends
mrpt::gui::CBaseGUIWindow Class Referenceabstract

Detailed Description

The base class for GUI window classes.

This class can be observed (see mrpt::utils::CObserver) for the following events (see mrpt::utils::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.

Definition at line 44 of file CBaseGUIWindow.h.

#include <mrpt/gui/CBaseGUIWindow.h>

Inheritance diagram for mrpt::gui::CBaseGUIWindow:
Inheritance graph

Public Member Functions

voidgetWxObject ()
 Read-only access to the wxDialog object. More...
 
void notifyChildWindowDestruction ()
 Called by wx main thread to set m_hwnd to NULL. More...
 
void notifySemThreadReady ()
 Called by wx main thread to signal the semaphore that the wx window is built and ready. More...
 
 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... More...
 
virtual ~CBaseGUIWindow ()
 
bool isOpen ()
 Returns false if the user has already closed the window. More...
 
virtual void resize (unsigned int width, unsigned int height)=0
 Resizes the window, stretching the image to fit into the display area. More...
 
virtual void setPos (int x, int y)=0
 Changes the position of the window on the screen. More...
 
virtual void setWindowTitle (const std::string &str)=0
 Changes the window title text. More...
 
virtual bool getLastMousePosition (int &x, int &y) const =0
 Gets the last x,y pixel coordinates of the mouse. More...
 
virtual void setCursorCross (bool cursorIsCross)=0
 Set cursor style to default (cursorIsCross=false) or to a cross (cursorIsCross=true) More...
 
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. More...
 
bool keyHit () const
 Returns true if a key has been pushed, without blocking waiting for a new key being pushed. More...
 
void clearKeyHitFlag ()
 Assure that "keyHit" will return false until the next pushed key. More...
 
int getPushedKey (mrptKeyModifier *out_pushModifier=NULL)
 Returns the latest pushed key, or 0 if there is no new key stroke. More...
 
virtual CObjectduplicate () const =0
 Returns a copy of the object, indepently of its class. More...
 
CObjectclone () const
 Cloning interface for smart pointers. More...
 
RTTI classes and functions
mrpt::utils::CObjectPtr duplicateGetSmartPtr () const
 Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer). More...
 

Static Public Attributes

static const mrpt::utils::TRuntimeClassId classCObject
 

Protected Member Functions

void createWxWindow (unsigned int initialWidth, unsigned int initialHeight)
 Must be called by child classes just within the constructor. More...
 
void destroyWxWindow ()
 Must be called by child classes in their destructors. The code cannot be put into this class' destructor. More...
 
void publishEvent (const mrptEvent &e) const
 Called when you want this object to emit an event to all the observers currently subscribed to this object. More...
 
bool hasSubscribers () const
 Can be called by a derived class before preparing an event for publishing with publishEvent to determine if there is no one subscribed, so it can save the wasted time preparing an event that will be not read. More...
 

Protected Attributes

synch::CSemaphore m_semThreadReady
 This semaphore will be signaled when the wx window is built and ready. More...
 
synch::CSemaphore m_semWindowDestroyed
 This semaphore will be signaled when the wx window is destroyed. More...
 
std::string m_caption
 The caption of the window. More...
 
mrpt::utils::void_ptr_noncopy m_hwnd
 The window handle. More...
 
volatile bool m_keyPushed
 
volatile int m_keyPushedCode
 
volatile mrptKeyModifier m_keyPushedModifier
 

Private Attributes

const int m_CMD_CREATE_WIN
 can be 200,300,400... See WxSubsystem More...
 
const int m_CMD_DESTROY_WIN
 can be 299,399,499... See WxSubsystem More...
 
voidm_winobj_voidptr
 

Friends

class CWindowDialog
 
class C3DWindowDialog
 
class CWindowDialogPlots
 

RTTI stuff

typedef CBaseGUIWindowPtr Ptr
 
typedef CBaseGUIWindowPtr ConstPtr
 
static const mrpt::utils::TRuntimeClassId classCBaseGUIWindow
 
class mrpt::utils::CStream
 
static const mrpt::utils::TRuntimeClassId_GetBaseClass ()
 
virtual const mrpt::utils::TRuntimeClassIdGetRuntimeClass () const
 Returns information about the class of an object in runtime. More...
 

Member Typedef Documentation

◆ ConstPtr

typedef CBaseGUIWindowPtr mrpt::gui::CBaseGUIWindow::ConstPtr

Definition at line 49 of file CBaseGUIWindow.h.

◆ Ptr

typedef CBaseGUIWindowPtr mrpt::gui::CBaseGUIWindow::Ptr

Definition at line 49 of file CBaseGUIWindow.h.

Constructor & Destructor Documentation

◆ CBaseGUIWindow()

CBaseGUIWindow::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

Definition at line 28 of file CBaseGUIWindow.cpp.

◆ ~CBaseGUIWindow()

CBaseGUIWindow::~CBaseGUIWindow ( )
virtual

Definition at line 98 of file CBaseGUIWindow.cpp.

Member Function Documentation

◆ _GetBaseClass()

static const mrpt::utils::TRuntimeClassId* mrpt::gui::CBaseGUIWindow::_GetBaseClass ( )
staticprotected

◆ clearKeyHitFlag()

void mrpt::gui::CBaseGUIWindow::clearKeyHitFlag ( )
inline

Assure that "keyHit" will return false until the next pushed key.

See also
keyHit, waitForKey

Definition at line 127 of file CBaseGUIWindow.h.

◆ clone()

CObject* mrpt::utils::CObject::clone ( ) const
inlineinherited

Cloning interface for smart pointers.

Definition at line 133 of file CObject.h.

◆ createWxWindow()

void CBaseGUIWindow::createWxWindow ( unsigned int  initialWidth,
unsigned int  initialHeight 
)
protected

◆ destroyWxWindow()

void CBaseGUIWindow::destroyWxWindow ( )
protected

◆ duplicate()

virtual CObject* mrpt::utils::CObject::duplicate ( ) const
pure virtualinherited

Returns a copy of the object, indepently of its class.

Implemented in mrpt::nav::CLogFileRecord_ND, mrpt::obs::CObservation3DRangeScan, mrpt::maps::CMultiMetricMap, mrpt::utils::CSimpleDatabase, mrpt::nav::CLogFileRecord_FullEval, mrpt::utils::CImage, mrpt::gui::CDisplayWindow3D, mrpt::detectors::CDetectable3D, mrpt::hmtslam::THypothesisIDSet, mrpt::maps::CRandomFieldGridMap3D, mrpt::obs::CObservationIMU, mrpt::poses::CPose3D, mrpt::hmtslam::CLocalMetricHypothesis, mrpt::maps::COccupancyGridMap2D, mrpt::maps::CMultiMetricMapPDF, mrpt::obs::CObservationRGBD360, mrpt::maps::TMapGenericParams, mrpt::hmtslam::CHMTSLAM, mrpt::obs::CObservationGPS, mrpt::maps::CLandmarksMap, mrpt::maps::CHeightGridMap2D, mrpt::opengl::COctoMapVoxels, mrpt::poses::CPointPDFParticles, mrpt::opengl::COpenGLViewport, mrpt::obs::CObservationVelodyneScan, mrpt::vision::CFeature, mrpt::kinematics::CKinematicChain, mrpt::opengl::CPlanarLaserScan, mrpt::nav::CHolonomicVFF, mrpt::obs::CRawlog, mrpt::obs::CSensoryFrame, mrpt::nav::CHolonomicND, mrpt::poses::CPose3DInterpolator, mrpt::nav::CHolonomicFullEval, mrpt::opengl::CPointCloud, mrpt::detectors::CDetectable2D, mrpt::opengl::COpenGLScene, mrpt::pbmap::Plane, mrpt::poses::CPose2DInterpolator, mrpt::opengl::CFrustum, mrpt::opengl::CPointCloudColoured, mrpt::pbmap::PbMap, mrpt::maps::CBeaconMap, mrpt::maps::CReflectivityGridMap2D, mrpt::opengl::CEllipsoidInverseDepth3D, mrpt::obs::CObservation2DRangeScan, mrpt::hmtslam::CLSLAMParticleData, mrpt::opengl::CEllipsoid, mrpt::opengl::CEllipsoidInverseDepth2D, mrpt::opengl::CText3D, mrpt::opengl::CVectorField3D, mrpt::poses::CPose3DQuat, mrpt::poses::CPose3DRotVec, mrpt::utils::CMHPropertiesValuesList, mrpt::hmtslam::CHMHMapNode, mrpt::obs::CObservationStereoImages, mrpt::opengl::CAssimpModel, mrpt::poses::CPose3DQuatPDFGaussianInf, mrpt::maps::CBeacon, mrpt::nav::CPTG_DiffDrive_C, mrpt::opengl::CMeshFast, mrpt::poses::CPose3DQuatPDFGaussian, mrpt::opengl::CEllipsoidRangeBearing2D, mrpt::opengl::CMesh, mrpt::poses::CPose3DPDFGaussianInf, mrpt::opengl::CAngularObservationMesh, mrpt::obs::CObservationStereoImagesFeatures, mrpt::opengl::CMesh3D, mrpt::opengl::CText, mrpt::poses::CPose2D, mrpt::poses::CPose3DPDFGaussian, mrpt::poses::CPosePDFSOG, mrpt::hmtslam::CRobotPosesGraph, mrpt::maps::COctoMap, mrpt::maps::CRBPFParticleData, mrpt::poses::CPoint2D, mrpt::poses::CPose3DPDFParticles, mrpt::poses::CPosePDFParticles, mrpt::poses::CPointPDFSOG, mrpt::poses::CPosePDFGaussianInf, mrpt::nav::CPTG_DiffDrive_alpha, mrpt::obs::CObservationImage, mrpt::opengl::CBox, mrpt::opengl::CVectorField2D, mrpt::poses::CPose3DPDFSOG, mrpt::hmtslam::CHierarchicalMHMap, mrpt::hmtslam::CHMHMapArc, mrpt::maps::CGasConcentrationGridMap2D, mrpt::maps::CHeightGridMap2D_MRF, mrpt::maps::CWirelessPowerGridMap2D, mrpt::maps::CSimpleMap, mrpt::obs::CObservationBatteryState, mrpt::opengl::CGridPlaneXY, mrpt::opengl::CGridPlaneXZ, mrpt::opengl::CSetOfLines, mrpt::maps::CLandmark, mrpt::maps::CColouredOctoMap, mrpt::maps::CSimplePointsMap, mrpt::opengl::CArrow, mrpt::opengl::CAxis, mrpt::opengl::CDisk, mrpt::opengl::CSphere, mrpt::poses::CPoint3D, mrpt::poses::CPosePDFGaussian, mrpt::utils::CStringList, mrpt::maps::CColouredPointsMap, mrpt::maps::CWeightedPointsMap, mrpt::nav::CLogFileRecord, mrpt::obs::CActionRobotMovement2D, mrpt::obs::CObservationOdometry, mrpt::obs::CObservationWindSensor, mrpt::opengl::CCamera, mrpt::opengl::CColorBar, mrpt::opengl::CPolyhedron, mrpt::slam::CIncrementalMapPartitioner, mrpt::gui::CDisplayWindowPlots, mrpt::obs::CActionCollection, mrpt::opengl::CSetOfObjects, mrpt::math::CMatrix, mrpt::math::CMatrixD, mrpt::poses::CPosePDFGrid, mrpt::utils::TCamera, mrpt::obs::CObservationRange, mrpt::obs::CObservationRawDAQ, mrpt::obs::CObservationSkeleton, mrpt::math::CSplineInterpolator1D, mrpt::utils::CSimpleDatabaseTable, mrpt::gui::CDisplayWindow, mrpt::nav::CLogFileRecord_VFF, mrpt::obs::CObservationBearingRange, mrpt::obs::CObservationGasSensors, mrpt::obs::CObservationWirelessPower, mrpt::obs::CObservationVisualLandmarks, mrpt::poses::CPoses2DSequence, mrpt::poses::CPoses3DSequence, mrpt::obs::CObservation6DFeatures, mrpt::obs::CObservationBeaconRanges, mrpt::obs::CObservationComment, mrpt::obs::CObservationRFID, mrpt::opengl::C3DSScene, mrpt::opengl::CCylinder, mrpt::opengl::CSetOfTriangles, mrpt::poses::TSimple3DPoint, mrpt::utils::CMemoryChunk, mrpt::nav::CMultiObjMotionOpt_Scalarization, mrpt::nav::CPTG_DiffDrive_CC, mrpt::nav::CPTG_DiffDrive_CCS, mrpt::nav::CPTG_DiffDrive_CS, mrpt::nav::CPTG_Holo_Blend, mrpt::obs::CActionRobotMovement3D, mrpt::obs::CObservationReflectivity, mrpt::opengl::CSetOfTexturedTriangles, mrpt::math::CMatrixB, mrpt::poses::CPointPDFGaussian, mrpt::utils::CPropertiesValuesList, mrpt::obs::CObservationCANBusJ1939, mrpt::obs::CObservationRobotPose, mrpt::opengl::CGeneralizedCylinder, mrpt::opengl::CSimpleLine, mrpt::opengl::CTexturedPlane, mrpt::math::CPolygon, mrpt::utils::CTypeSelector, mrpt::poses::CPoint2DPDFGaussian, mrpt::utils::TStereoCamera, mrpt::kinematics::CVehicleVelCmd_DiffDriven, mrpt::kinematics::CVehicleVelCmd_Holo, and mrpt::opengl::COpenGLStandardObject.

Referenced by mrpt::poses::CPoseRandomSampler::CPoseRandomSampler(), mrpt::maps::CSimpleMap::insert(), mrpt::obs::CActionCollection::insert(), mrpt::poses::CPoseRandomSampler::operator=(), and mrpt::poses::CPoseRandomSampler::setPosePDF().

◆ duplicateGetSmartPtr()

mrpt::utils::CObjectPtr CObject::duplicateGetSmartPtr ( ) const
inlineinherited

Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer).

Definition at line 162 of file CObject.h.

References mrpt::utils::CObjectPtr.

Referenced by mrpt::obs::CRawlog::addActions(), mrpt::slam::CIncrementalMapPartitioner::addMapFrame(), and mrpt::obs::CRawlog::addObservations().

◆ getLastMousePosition()

virtual bool mrpt::gui::CBaseGUIWindow::getLastMousePosition ( int &  x,
int &  y 
) const
pure virtual

Gets the last x,y pixel coordinates of the mouse.

Returns
False if the window is closed.

Implemented in mrpt::gui::CDisplayWindow3D, mrpt::gui::CDisplayWindowPlots, and mrpt::gui::CDisplayWindow.

◆ getPushedKey()

int CBaseGUIWindow::getPushedKey ( mrptKeyModifier out_pushModifier = NULL)

Returns the latest pushed key, or 0 if there is no new key stroke.

Parameters
out_pushModifierIf set to !=NULL, 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
keyHit, waitForKey

Definition at line 188 of file CBaseGUIWindow.cpp.

References mrpt::gui::MRPTKMOD_NONE, and mrpt::system::sleep().

◆ GetRuntimeClass()

virtual const mrpt::utils::TRuntimeClassId* mrpt::gui::CBaseGUIWindow::GetRuntimeClass ( ) const
virtual

Returns information about the class of an object in runtime.

Reimplemented from mrpt::utils::CObject.

Reimplemented in mrpt::gui::CDisplayWindow3D, mrpt::gui::CDisplayWindowPlots, and mrpt::gui::CDisplayWindow.

◆ getWxObject()

void* mrpt::gui::CBaseGUIWindow::getWxObject ( )
inline

Read-only access to the wxDialog object.

Definition at line 75 of file CBaseGUIWindow.h.

References mrpt::utils::non_copiable_ptr_basic< T >::get().

Referenced by mrpt::gui::WxSubsystem::CWXMainFrame::OnTimerProcessRequests().

◆ hasSubscribers()

bool mrpt::utils::CObservable::hasSubscribers ( ) const
inlineprotectedinherited

Can be called by a derived class before preparing an event for publishing with publishEvent to determine if there is no one subscribed, so it can save the wasted time preparing an event that will be not read.

Definition at line 52 of file CObservable.h.

Referenced by mrpt::gui::CWindowDialog::OnMouseDown(), mrpt::gui::CWindowDialog::OnMouseMove(), mrpt::gui::CWindowDialog::OnResize(), and mrpt::opengl::COpenGLViewport::render().

◆ isOpen()

bool CBaseGUIWindow::isOpen ( )

◆ keyHit()

bool mrpt::gui::CBaseGUIWindow::keyHit ( ) const
inline

Returns true if a key has been pushed, without blocking waiting for a new key being pushed.

See also
waitForKey, clearKeyHitFlag

Definition at line 122 of file CBaseGUIWindow.h.

◆ notifyChildWindowDestruction()

void CBaseGUIWindow::notifyChildWindowDestruction ( )

Called by wx main thread to set m_hwnd to NULL.

Definition at line 145 of file CBaseGUIWindow.cpp.

Referenced by mrpt::gui::CWindowDialog::OnClose(), and mrpt::gui::C3DWindowDialog::OnClose().

◆ notifySemThreadReady()

void CBaseGUIWindow::notifySemThreadReady ( )

Called by wx main thread to signal the semaphore that the wx window is built and ready.

Definition at line 220 of file CBaseGUIWindow.cpp.

Referenced by mrpt::gui::WxSubsystem::CWXMainFrame::OnTimerProcessRequests().

◆ publishEvent()

void CObservable::publishEvent ( const mrptEvent e) const
protectedinherited

◆ resize()

virtual void mrpt::gui::CBaseGUIWindow::resize ( unsigned int  width,
unsigned int  height 
)
pure virtual

Resizes the window, stretching the image to fit into the display area.

Implemented in mrpt::gui::CDisplayWindow, mrpt::gui::CDisplayWindow3D, and mrpt::gui::CDisplayWindowPlots.

◆ setCursorCross()

virtual void mrpt::gui::CBaseGUIWindow::setCursorCross ( bool  cursorIsCross)
pure virtual

Set cursor style to default (cursorIsCross=false) or to a cross (cursorIsCross=true)

Implemented in mrpt::gui::CDisplayWindow3D, mrpt::gui::CDisplayWindowPlots, and mrpt::gui::CDisplayWindow.

◆ setPos()

virtual void mrpt::gui::CBaseGUIWindow::setPos ( int  x,
int  y 
)
pure virtual

Changes the position of the window on the screen.

Implemented in mrpt::gui::CDisplayWindow, mrpt::gui::CDisplayWindow3D, and mrpt::gui::CDisplayWindowPlots.

◆ setWindowTitle()

virtual void mrpt::gui::CBaseGUIWindow::setWindowTitle ( const std::string str)
pure virtual

Changes the window title text.

Implemented in mrpt::gui::CDisplayWindow, mrpt::gui::CDisplayWindow3D, and mrpt::gui::CDisplayWindowPlots.

◆ waitForKey()

int CBaseGUIWindow::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.

This method remove key strokes previous to its call, so it will always wait. To get the latest pushed key, see

Parameters
ignoreControlKeysIf set to false, any push of shift, cmd, control, etc... will make this method to return.
out_pushModifierIf set to !=NULL, 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

Definition at line 154 of file CBaseGUIWindow.cpp.

References mrpt::system::os::getch(), mrpt::system::os::kbhit(), mrpt::gui::MRPTKMOD_NONE, and mrpt::system::sleep().

Referenced by find_chessboard_corners_multiple(), and mrpt::vision::CFeature::internal_distanceBetweenPolarImages().

Friends And Related Function Documentation

◆ C3DWindowDialog

friend class C3DWindowDialog
friend

Definition at line 52 of file CBaseGUIWindow.h.

◆ CWindowDialog

friend class CWindowDialog
friend

Definition at line 51 of file CBaseGUIWindow.h.

◆ CWindowDialogPlots

friend class CWindowDialogPlots
friend

Definition at line 53 of file CBaseGUIWindow.h.

◆ mrpt::utils::CStream

friend class mrpt::utils::CStream
friend

Definition at line 49 of file CBaseGUIWindow.h.

Member Data Documentation

◆ classCBaseGUIWindow

const mrpt::utils::TRuntimeClassId mrpt::gui::CBaseGUIWindow::classCBaseGUIWindow
static

Definition at line 49 of file CBaseGUIWindow.h.

◆ classCObject

const mrpt::utils::TRuntimeClassId mrpt::utils::CObject::classCObject
staticinherited

Definition at line 118 of file CObject.h.

◆ m_caption

std::string mrpt::gui::CBaseGUIWindow::m_caption
protected

◆ m_CMD_CREATE_WIN

const int mrpt::gui::CBaseGUIWindow::m_CMD_CREATE_WIN
private

can be 200,300,400... See WxSubsystem

Definition at line 56 of file CBaseGUIWindow.h.

◆ m_CMD_DESTROY_WIN

const int mrpt::gui::CBaseGUIWindow::m_CMD_DESTROY_WIN
private

can be 299,399,499... See WxSubsystem

Definition at line 57 of file CBaseGUIWindow.h.

◆ m_hwnd

mrpt::utils::void_ptr_noncopy mrpt::gui::CBaseGUIWindow::m_hwnd
protected

◆ m_keyPushed

volatile bool mrpt::gui::CBaseGUIWindow::m_keyPushed
protected

Definition at line 67 of file CBaseGUIWindow.h.

Referenced by mrpt::gui::CWindowDialog::OnChar().

◆ m_keyPushedCode

volatile int mrpt::gui::CBaseGUIWindow::m_keyPushedCode
protected

Definition at line 68 of file CBaseGUIWindow.h.

Referenced by mrpt::gui::CWindowDialog::OnChar().

◆ m_keyPushedModifier

volatile mrptKeyModifier mrpt::gui::CBaseGUIWindow::m_keyPushedModifier
protected

Definition at line 69 of file CBaseGUIWindow.h.

Referenced by mrpt::gui::CWindowDialog::OnChar().

◆ m_semThreadReady

synch::CSemaphore mrpt::gui::CBaseGUIWindow::m_semThreadReady
protected

This semaphore will be signaled when the wx window is built and ready.

Definition at line 61 of file CBaseGUIWindow.h.

◆ m_semWindowDestroyed

synch::CSemaphore mrpt::gui::CBaseGUIWindow::m_semWindowDestroyed
protected

This semaphore will be signaled when the wx window is destroyed.

Definition at line 62 of file CBaseGUIWindow.h.

Referenced by mrpt::gui::CWindowDialog::OnClose(), and mrpt::gui::C3DWindowDialog::OnClose().

◆ m_winobj_voidptr

void* mrpt::gui::CBaseGUIWindow::m_winobj_voidptr
private

Definition at line 58 of file CBaseGUIWindow.h.




Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019