cmCursesForm.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file LICENSE.rst or https://cmake.org/licensing for details. */
  3. #pragma once
  4. #include "cmConfigure.h" // IWYU pragma: keep
  5. #include <string>
  6. #include "cmsys/FStream.hxx"
  7. #include "cmCursesStandardIncludes.h"
  8. class cmCursesForm
  9. {
  10. public:
  11. cmCursesForm();
  12. virtual ~cmCursesForm();
  13. cmCursesForm(cmCursesForm const&) = delete;
  14. cmCursesForm& operator=(cmCursesForm const&) = delete;
  15. // Description:
  16. // Handle user input.
  17. virtual void HandleInput() = 0;
  18. // Description:
  19. // Display form.
  20. virtual void Render(int left, int top, int width, int height) = 0;
  21. // Description:
  22. // This method should normally called only by the form.
  23. // The only exception is during a resize.
  24. virtual void UpdateStatusBar() = 0;
  25. // Description:
  26. // During a CMake run, an error handle should add errors
  27. // to be displayed afterwards.
  28. virtual void AddError(std::string const&, char const*) {}
  29. // Description:
  30. // Turn debugging on. This will create ccmakelog.txt.
  31. static void DebugStart();
  32. // Description:
  33. // Turn debugging off. This will close ccmakelog.txt.
  34. static void DebugEnd();
  35. // Description:
  36. // Write a debugging message.
  37. static void LogMessage(char const* msg);
  38. // Description:
  39. // Return the FORM. Should be only used by low-level methods.
  40. FORM* GetForm() { return this->Form; }
  41. static cmCursesForm* CurrentForm;
  42. // Description:
  43. // Handle resizing the form with curses.
  44. void HandleResize();
  45. protected:
  46. static cmsys::ofstream DebugFile;
  47. static bool Debug;
  48. FORM* Form;
  49. };