| 
    MRPT
    2.0.4
    
   | 
 
A window with powerful GUI capabilities, via the nanogui library.
You can add a background mrpt::opengl::COpenGLScene object rendered on the background of the entire window by setting an object in field background_scene, locking its mutex background_scene_mtx.
Refer to nanogui API docs or MRPT examples for further usage examples. A typical lifecycle of a GUI app with this class might look like:
.. code-block:: cpp
nanogui::init(); { mrpt::gui::CDisplayWindowGUI win; win.drawAll(); win.setVisible(true); nanogui::mainloop(); } nanogui::shutdown();
Definition at line 71 of file CDisplayWindowGUI.h.
#include <mrpt/gui/CDisplayWindowGUI.h>
Public Member Functions | |
Direct access to underlying nanogui API  | |
| nanogui::Window * | nanogui_win () | 
Protected Member Functions | |
| CDisplayWindowGUI (const CDisplayWindowGUI &)=delete | |
| CDisplayWindowGUI & | operator= (const CDisplayWindowGUI &)=delete | 
| CDisplayWindowGUI (CDisplayWindowGUI &&)=delete | |
| CDisplayWindowGUI & | operator= (CDisplayWindowGUI &&)=delete | 
| virtual bool | keyboardEvent (int key, int scancode, int action, int modifiers) override | 
| virtual void | drawContents () override | 
Internal virtual functions to handle GUI events  | |
| virtual bool | mouseMotionEvent (const nanogui::Vector2i &p, const nanogui::Vector2i &rel, int button, int modifiers) override | 
| virtual bool | mouseButtonEvent (const nanogui::Vector2i &p, int button, bool down, int modifiers) override | 
| virtual bool | scrollEvent (const nanogui::Vector2i &p, const nanogui::Vector2f &rel) override | 
| virtual bool | dropEvent (const std::vector< std::string > &filenames) override | 
Protected Attributes | |
| nanogui::Window * | m_window = nullptr | 
| the pointer is owned by the parent class Screen, no need to delete it  More... | |
| internal::NanoGUICanvasHeadless | m_background_canvas | 
| Used to keep track of mouse events on the camera.  More... | |
| std::function< void(void)> | m_loopCallback | 
| std::function< bool(const std::vector< std::string > &)> | m_dropFilesCallback | 
| std::function< bool(int, int, int, int)> | m_keyboardCallback | 
Ctor and basic window set up | |
| using | Ptr = std::shared_ptr< CDisplayWindowGUI > | 
| using | ConstPtr = std::shared_ptr< const CDisplayWindowGUI > | 
| CDisplayWindowGUI (const std::string &caption=std::string(), unsigned int width=400, unsigned int height=300, const CDisplayWindowGUI_Params &p=CDisplayWindowGUI_Params()) | |
| virtual | ~CDisplayWindowGUI () override | 
| void | resize (unsigned int width, unsigned int height) | 
| Resizes the window.  More... | |
| void | setPos (int x, int y) | 
| Changes the position of the window on the screen.  More... | |
| void | setWindowTitle (const std::string &str) | 
| Changes the window title.  More... | |
| void | setLoopCallback (const std::function< void(void)> &callback) | 
| Every time the window is about to be repainted, an optional callback can be called, if provided via this method.  More... | |
| const auto & | loopCallback () const | 
| void | setDropFilesCallback (const std::function< bool(const std::vector< std::string > &)> &callback) | 
| Sets a handle for file drop events.  More... | |
| const auto & | dropFilesCallback () const | 
| void | setKeyboardCallback (const std::function< bool(int, int, int, int)> &callback) | 
| const auto & | keyboardCallback () const | 
| template<typename... Args> | |
| static Ptr | Create (Args &&... args) | 
| Class factory returning a smart pointer.  More... | |
Access to full-window (background) GL scene | |
| mrpt::opengl::COpenGLScene::Ptr | background_scene | 
| std::mutex | background_scene_mtx | 
| CGlCanvasBase & | camera () | 
| const CGlCanvasBase & | camera () const | 
Definition at line 77 of file CDisplayWindowGUI.h.
Definition at line 76 of file CDisplayWindowGUI.h.
| CDisplayWindowGUI::CDisplayWindowGUI | ( | const std::string & | caption = std::string(),  | 
        
| unsigned int | width = 400,  | 
        ||
| unsigned int | height = 300,  | 
        ||
| const CDisplayWindowGUI_Params & | p = CDisplayWindowGUI_Params()  | 
        ||
| ) | 
Definition at line 20 of file CDisplayWindowGUI.cpp.
References mrpt::gui::default_mrpt_glfw_icon(), and images.
      
  | 
  overridevirtual | 
Definition at line 41 of file CDisplayWindowGUI.cpp.
      
  | 
  protecteddelete | 
      
  | 
  protecteddelete | 
      
  | 
  inline | 
Definition at line 135 of file CDisplayWindowGUI.h.
References m_background_canvas.
      
  | 
  inline | 
Definition at line 136 of file CDisplayWindowGUI.h.
References m_background_canvas.
      
  | 
  inlinestatic | 
Class factory returning a smart pointer.
Definition at line 88 of file CDisplayWindowGUI.h.
      
  | 
  overrideprotectedvirtual | 
Definition at line 47 of file CDisplayWindowGUI.cpp.
References background_scene, background_scene_mtx, mrpt::exception_to_str(), m_background_canvas, m_loopCallback, mrpt::opengl::CCamera::render(), THROW_EXCEPTION, and mrpt::gui::CGlCanvasBase::updateCameraParams().
      
  | 
  overrideprotectedvirtual | 
Definition at line 121 of file CDisplayWindowGUI.cpp.
References m_dropFilesCallback.
      
  | 
  inline | 
Definition at line 117 of file CDisplayWindowGUI.h.
References m_dropFilesCallback.
      
  | 
  inline | 
Definition at line 125 of file CDisplayWindowGUI.h.
References m_keyboardCallback.
      
  | 
  overrideprotectedvirtual | 
Definition at line 129 of file CDisplayWindowGUI.cpp.
References m_keyboardCallback.
      
  | 
  inline | 
Definition at line 108 of file CDisplayWindowGUI.h.
References m_loopCallback.
      
  | 
  overrideprotectedvirtual | 
Definition at line 94 of file CDisplayWindowGUI.cpp.
References m_background_canvas, and mrpt::gui::internal::NanoGUICanvasHeadless::mouseButtonEvent().
      
  | 
  overrideprotectedvirtual | 
Definition at line 103 of file CDisplayWindowGUI.cpp.
References m_background_canvas, and mrpt::gui::internal::NanoGUICanvasHeadless::mouseMotionEvent().
      
  | 
  inline | 
Definition at line 143 of file CDisplayWindowGUI.h.
      
  | 
  protecteddelete | 
      
  | 
  protecteddelete | 
| void CDisplayWindowGUI::resize | ( | unsigned int | width, | 
| unsigned int | height | ||
| ) | 
Resizes the window.
Definition at line 82 of file CDisplayWindowGUI.cpp.
      
  | 
  overrideprotectedvirtual | 
Definition at line 113 of file CDisplayWindowGUI.cpp.
References m_background_canvas, and mrpt::gui::internal::NanoGUICanvasHeadless::scrollEvent().
      
  | 
  inline | 
Sets a handle for file drop events.
Definition at line 111 of file CDisplayWindowGUI.h.
References m_dropFilesCallback.
      
  | 
  inline | 
Definition at line 119 of file CDisplayWindowGUI.h.
References m_keyboardCallback.
      
  | 
  inline | 
Every time the window is about to be repainted, an optional callback can be called, if provided via this method.
Definition at line 104 of file CDisplayWindowGUI.h.
References m_loopCallback.
| void CDisplayWindowGUI::setPos | ( | int | x, | 
| int | y | ||
| ) | 
Changes the position of the window on the screen.
Definition at line 87 of file CDisplayWindowGUI.cpp.
| void CDisplayWindowGUI::setWindowTitle | ( | const std::string & | str | ) | 
Changes the window title.
Definition at line 89 of file CDisplayWindowGUI.cpp.
| mrpt::opengl::COpenGLScene::Ptr mrpt::gui::CDisplayWindowGUI::background_scene | 
Definition at line 132 of file CDisplayWindowGUI.h.
Referenced by drawContents().
| std::mutex mrpt::gui::CDisplayWindowGUI::background_scene_mtx | 
Definition at line 133 of file CDisplayWindowGUI.h.
Referenced by drawContents().
      
  | 
  protected | 
Used to keep track of mouse events on the camera.
Definition at line 180 of file CDisplayWindowGUI.h.
Referenced by camera(), drawContents(), mouseButtonEvent(), mouseMotionEvent(), and scrollEvent().
      
  | 
  protected | 
Definition at line 185 of file CDisplayWindowGUI.h.
Referenced by dropEvent(), dropFilesCallback(), and setDropFilesCallback().
      
  | 
  protected | 
Definition at line 189 of file CDisplayWindowGUI.h.
Referenced by keyboardCallback(), keyboardEvent(), and setKeyboardCallback().
      
  | 
  protected | 
Definition at line 182 of file CDisplayWindowGUI.h.
Referenced by drawContents(), loopCallback(), and setLoopCallback().
      
  | 
  protected | 
the pointer is owned by the parent class Screen, no need to delete it
Definition at line 160 of file CDisplayWindowGUI.h.
Referenced by nanogui_win().
| Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020 |