cmCursesLongMessageForm.h 1.6 KB

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