Program Listing for File CDisplayWindow.h

↰ Return to documentation for file (include/mrpt/gui/CDisplayWindow.h)

/*                    _
                     | |    Mobile Robot Programming Toolkit (MRPT)
 _ __ ___  _ __ _ __ | |_
| '_ ` _ \| '__| '_ \| __|          https://www.mrpt.org/
| | | | | | |  | |_) | |_
|_| |_| |_|_|  | .__/ \__|     https://github.com/MRPT/mrpt/
               | |
               |_|

 Copyright (c) 2005-2026, Individual contributors, see AUTHORS file
 See: https://www.mrpt.org/Authors - All rights reserved.
 SPDX-License-Identifier: BSD-3-Clause
*/
#pragma once

#include <mrpt/gui/CBaseGUIWindow.h>
#include <mrpt/img/CImage.h>
#include <mrpt/math/CVectorDynamic.h>
#include <mrpt/system/os.h>

#include <vector>

namespace mrpt
{
namespace gui
{
class CDisplayWindow : public mrpt::gui::CBaseGUIWindow
{
 public:
  using Ptr = std::shared_ptr<CDisplayWindow>;
  using ConstPtr = std::shared_ptr<const CDisplayWindow>;

 protected:
  bool m_enableCursorCoordinates{true};

 public:
  CDisplayWindow(
      const std::string& windowCaption = std::string(),
      unsigned int initWidth = 400,
      unsigned int initHeight = 400);

  static CDisplayWindow::Ptr Create(
      const std::string& windowCaption,
      unsigned int initWidth = 400,
      unsigned int initHeight = 400);

  ~CDisplayWindow() override;

  std::optional<mrpt::img::TPixelCoord> getLastMousePosition() const override;

  void setCursorCross(bool cursorIsCross) override;

  void showImage(const mrpt::img::CImage& img);

  void plot(const mrpt::math::CVectorFloat& x, const mrpt::math::CVectorFloat& y);

  void plot(const mrpt::math::CVectorFloat& y);

  void resize(unsigned int width, unsigned int height) override;

  void setPos(int x, int y) override;

  void enableCursorCoordinatesVisualization(bool enable) { m_enableCursorCoordinates = enable; }

  void setWindowTitle(const std::string& str) override;

};  // End of class def.

}  // namespace gui

}  // namespace mrpt