You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ovdCCommentProxy.h 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #pragma once
  2. #include "ovd_base.h"
  3. #include <string>
  4. namespace OpenViBE {
  5. namespace Designer {
  6. class CCommentProxy final
  7. {
  8. public:
  9. CCommentProxy(const Kernel::IKernelContext& ctx, const Kernel::IComment& comment);
  10. CCommentProxy(const Kernel::IKernelContext& ctx, Kernel::IScenario& scenario, const CIdentifier& commentID);
  11. ~CCommentProxy() { if (!m_applied) { this->apply(); } }
  12. operator Kernel::IComment*() const { return m_comment; }
  13. operator const Kernel::IComment*() const { return m_constComment; }
  14. int getWidth(GtkWidget* widget) const;
  15. int getHeight(GtkWidget* widget) const;
  16. int getXCenter() const { return m_centerX; }
  17. int getYCenter() const { return m_centerY; }
  18. void setCenter(int centerX, int centerY);
  19. void apply();
  20. const char* getLabel() const;
  21. protected:
  22. static void updateSize(GtkWidget* widget, const char* text, int* xSize, int* ySize);
  23. const Kernel::IKernelContext& m_kernelCtx;
  24. const Kernel::IComment* m_constComment = nullptr;
  25. Kernel::IComment* m_comment = nullptr;
  26. bool m_applied = false;
  27. int m_centerX = 0;
  28. int m_centerY = 0;
  29. mutable std::string m_label;
  30. };
  31. } // namespace Designer
  32. } // namespace OpenViBE