Go to the documentation of this file.
20 #include <mrpt/config.h>
22 #include <nanogui/nanogui.h>
76 using Ptr = std::shared_ptr<CDisplayWindowGUI>;
77 using ConstPtr = std::shared_ptr<const CDisplayWindowGUI>;
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
std::shared_ptr< CDisplayWindowGUI > Ptr
This base class implements a working with opengl::Camera and a OpenGL canvas, and it's used in gui::C...
void setDropFilesCallback(const std::function< bool(const std::vector< std::string > &)> &callback)
Sets a handle for file drop events.
nanogui::Window * m_window
the pointer is owned by the parent class Screen, no need to delete it
const auto & dropFilesCallback() const
virtual bool scrollEvent(const nanogui::Vector2i &p, const nanogui::Vector2f &rel) override
const CGlCanvasBase & camera() const
std::mutex background_scene_mtx
void setKeyboardCallback(const std::function< bool(int, int, int, int)> &callback)
#define ASSERT_(f)
Defines an assertion mechanism.
const auto & keyboardCallback() const
std::function< bool(const std::vector< std::string > &)> m_dropFilesCallback
CDisplayWindowGUI & operator=(const CDisplayWindowGUI &)=delete
const auto & loopCallback() const
virtual bool keyboardEvent(int key, int scancode, int action, int modifiers) override
A window with powerful GUI capabilities, via the nanogui library.
Specialization of CGlCanvasBaseHeadless for nanogui events.
virtual ~CDisplayWindowGUI() override
CDisplayWindowGUI_Params()=default
Classes for creating GUI windows for 2D and 3D visualization.
void setWindowTitle(const std::string &str)
Changes the window title.
internal::NanoGUICanvasHeadless m_background_canvas
Used to keep track of mouse events on the camera.
std::function< void(void)> m_loopCallback
void setLoopCallback(const std::function< void(void)> &callback)
Every time the window is about to be repainted, an optional callback can be called,...
virtual void drawContents() override
std::shared_ptr< mrpt::opengl ::COpenGLScene > Ptr
std::shared_ptr< const CDisplayWindowGUI > ConstPtr
mrpt::opengl::COpenGLScene::Ptr background_scene
void setPos(int x, int y)
Changes the position of the window on the screen.
void resize(unsigned int width, unsigned int height)
Resizes the window.
static Ptr Create(Args &&... args)
Class factory returning a smart pointer.
CDisplayWindowGUI(const std::string &caption=std::string(), unsigned int width=400, unsigned int height=300, const CDisplayWindowGUI_Params &p=CDisplayWindowGUI_Params())
Additional parameters to change the window behavior and OpenGL context.
virtual bool mouseButtonEvent(const nanogui::Vector2i &p, int button, bool down, int modifiers) override
nanogui::Window * nanogui_win()
std::function< bool(int, int, int, int)> m_keyboardCallback
virtual bool mouseMotionEvent(const nanogui::Vector2i &p, const nanogui::Vector2i &rel, int button, int modifiers) override
virtual bool dropEvent(const std::vector< std::string > &filenames) override
Page generated by Doxygen 1.8.17 for MRPT 2.0.3 at Thu May 21 21:53:32 UTC 2020 | |