20 #include <mrpt/config.h>    22 #include <nanogui/nanogui.h>    80         const std::string& caption = std::string(), 
unsigned int width = 400,
    81         unsigned int height = 300,
    87     template <
typename... Args>
    90         return std::make_shared<CDisplayWindowGUI>(std::forward<Args>(args)...);
    94     void resize(
unsigned int width, 
unsigned int height);
   113             bool(
const std::vector<std::string>& )>& callback)
   163         int key, 
int scancode, 
int action, 
int modifiers) 
override;
   169         const nanogui::Vector2i& p, 
const nanogui::Vector2i& rel, 
int button,
   170         int modifiers) 
override;
   172         const nanogui::Vector2i& p, 
int button, 
bool down,
   173         int modifiers) 
override;
   175         const nanogui::Vector2i& p, 
const nanogui::Vector2f& rel) 
override;
   176     virtual bool dropEvent(
const std::vector<std::string>& filenames) 
override;
   184     std::function<bool(const std::vector<std::string>& )>
   188         int , 
int , 
int , 
int )>
   192 #define NANOGUI_START_TRY \   195 #define NANOGUI_END_TRY(_parentWindowRef_)                             \   197     catch (const std::exception& e)                                    \   199         const auto sErr = mrpt::exception_to_str(e);                   \   200         auto dlg = new nanogui::MessageDialog(                         \   201             &_parentWindowRef_, nanogui::MessageDialog::Type::Warning, \   202             "Exception", sErr);                                        \   203         dlg->setCallback([](int ) {});                       \   207 #endif  // MRPT_HAS_NANOGUI 
virtual bool mouseMotionEvent(const nanogui::Vector2i &p, const nanogui::Vector2i &rel, int button, int modifiers) override
 
std::function< void(void)> m_loopCallback
 
const auto & keyboardCallback() const
 
std::function< bool(const std::vector< std::string > &)> m_dropFilesCallback
 
std::function< bool(int, int, int, int)> m_keyboardCallback
 
void resize(unsigned int width, unsigned int height)
Resizes the window. 
 
virtual bool dropEvent(const std::vector< std::string > &filenames) override
 
CDisplayWindowGUI & operator=(const CDisplayWindowGUI &)=delete
 
virtual ~CDisplayWindowGUI() override
 
void setDropFilesCallback(const std::function< bool(const std::vector< std::string > &)> &callback)
Sets a handle for file drop events. 
 
#define ASSERT_(f)
Defines an assertion mechanism. 
 
nanogui::Window * m_window
the pointer is owned by the parent class Screen, no need to delete it 
 
void setKeyboardCallback(const std::function< bool(int, int, int, int)> &callback)
 
const auto & dropFilesCallback() const
 
void setWindowTitle(const std::string &str)
Changes the window title. 
 
CDisplayWindowGUI(const std::string &caption=std::string(), unsigned int width=400, unsigned int height=300, const CDisplayWindowGUI_Params &p=CDisplayWindowGUI_Params())
 
const CGlCanvasBase & camera() const
 
static Ptr Create(Args &&... args)
Class factory returning a smart pointer. 
 
virtual bool scrollEvent(const nanogui::Vector2i &p, const nanogui::Vector2f &rel) override
 
std::mutex background_scene_mtx
 
internal::NanoGUICanvasHeadless m_background_canvas
Used to keep track of mouse events on the camera. 
 
void setPos(int x, int y)
Changes the position of the window on the screen. 
 
mrpt::opengl::COpenGLScene::Ptr background_scene
 
virtual void drawContents() override
 
Additional parameters to change the window behavior and OpenGL context. 
 
virtual bool keyboardEvent(int key, int scancode, int action, int modifiers) override
 
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. 
 
CDisplayWindowGUI_Params()=default
 
virtual bool mouseButtonEvent(const nanogui::Vector2i &p, int button, bool down, int modifiers) override
 
const auto & loopCallback() const
 
Classes for creating GUI windows for 2D and 3D visualization. 
 
Specialization of CGlCanvasBaseHeadless for nanogui events. 
 
This base class implements a working with opengl::Camera and a OpenGL canvas, and it's used in gui::C...
 
A window with powerful GUI capabilities, via the nanogui library. 
 
nanogui::Window * nanogui_win()