cmCursesLongMessageForm.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #pragma once
  4. #include "cmConfigure.h" // IWYU pragma: keep
  5. #include <string>
  6. #include <vector>
  7. #include "cmCursesForm.h"
  8. #include "cmCursesStandardIncludes.h"
  9. class cmCursesLongMessageForm : public cmCursesForm
  10. {
  11. public:
  12. enum class ScrollBehavior
  13. {
  14. NoScroll,
  15. ScrollDown
  16. };
  17. cmCursesLongMessageForm(std::vector<std::string> const& messages,
  18. const char* title, ScrollBehavior scrollBehavior);
  19. ~cmCursesLongMessageForm() override;
  20. cmCursesLongMessageForm(cmCursesLongMessageForm const&) = delete;
  21. cmCursesLongMessageForm& operator=(cmCursesLongMessageForm const&) = delete;
  22. void UpdateContent(std::string const& output, std::string const& title);
  23. // Description:
  24. // Handle user input.
  25. void HandleInput() override;
  26. // Description:
  27. // Display form. Use a window of size width x height, starting
  28. // at top, left.
  29. void Render(int left, int top, int width, int height) override;
  30. // Description:
  31. // This method should normally called only by the form.
  32. // The only exception is during a resize.
  33. void PrintKeys();
  34. // Description:
  35. // This method should normally called only by the form.
  36. // The only exception is during a resize.
  37. void UpdateStatusBar() override;
  38. protected:
  39. static constexpr int MAX_CONTENT_SIZE = 60000;
  40. void DrawMessage(const char* msg) const;
  41. std::string Messages;
  42. std::string Title;
  43. ScrollBehavior Scrolling;
  44. FIELD* Fields[2];
  45. };