19 #include <mrpt/config.h> 21 #include <nanogui/nanogui.h> 79 const std::string& caption = std::string(),
unsigned int width = 400,
80 unsigned int height = 300,
86 template <
typename... Args>
89 return std::make_shared<CDisplayWindowGUI>(std::forward<Args>(args)...);
93 void resize(
unsigned int width,
unsigned int height);
112 bool(
const std::vector<std::string>& )>& callback)
162 int key,
int scancode,
int action,
int modifiers)
override;
168 const nanogui::Vector2i& p,
const nanogui::Vector2i& rel,
int button,
169 int modifiers)
override;
171 const nanogui::Vector2i& p,
int button,
bool down,
172 int modifiers)
override;
174 const nanogui::Vector2i& p,
const nanogui::Vector2f& rel)
override;
175 virtual bool dropEvent(
const std::vector<std::string>& filenames)
override;
183 std::function<bool(const std::vector<std::string>& )>
187 int ,
int ,
int ,
int )>
193 #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()