cmCursesMainForm.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. #ifndef __cmCursesMainForm_h
  2. #define __cmCursesMainForm_h
  3. #include "../cmStandardIncludes.h"
  4. #include "cmCursesForm.h"
  5. #include "cmCursesStandardIncludes.h"
  6. class cmCursesCacheEntryComposite;
  7. /** \class cmCursesMainForm
  8. * \brief The main page of ccmake
  9. *
  10. * cmCursesMainForm is the main page of ccmake.
  11. */
  12. class cmCursesMainForm : public cmCursesForm
  13. {
  14. public:
  15. cmCursesMainForm(std::vector<std::string> const& args);
  16. virtual ~cmCursesMainForm();
  17. /**
  18. * Set the widgets which represent the cache entries.
  19. */
  20. void InitializeUI();
  21. /**
  22. * Handle user input.
  23. */
  24. virtual void HandleInput();
  25. /**
  26. * Display form. Use a window of size width x height, starting
  27. * at top, left.
  28. */
  29. virtual void Render(int left, int top, int width, int height);
  30. /**
  31. * Returns true if an entry with the given key is in the
  32. * list of current composites.
  33. */
  34. bool LookForCacheEntry(const char* key);
  35. enum {
  36. MIN_WIDTH = 65,
  37. MIN_HEIGHT = 6,
  38. IDEAL_WIDTH = 80,
  39. MAX_WIDTH = 512
  40. };
  41. /**
  42. * This method should normally called only by the form.
  43. * The only exception is during a resize.
  44. */
  45. virtual void UpdateStatusBar();
  46. /**
  47. * Display current commands and their keys on the toolbar.
  48. * This method should normally called only by the form.
  49. * The only exception is during a resize.
  50. */
  51. void PrintKeys();
  52. /**
  53. * During a CMake run, an error handle should add errors
  54. * to be displayed afterwards.
  55. */
  56. virtual void AddError(const char* message, const char* title);
  57. /**
  58. * Used to run cmake.
  59. */
  60. void RunCMake(bool generateMakefiles);
  61. protected:
  62. cmCursesMainForm(const cmCursesMainForm& from);
  63. void operator=(const cmCursesMainForm&);
  64. // Copy the cache values from the user interface to the actual
  65. // cache.
  66. void FillCacheManagerFromUI();
  67. // Re-post the existing fields. Used to toggle between
  68. // normal and advanced modes. Render() should be called
  69. // afterwards.
  70. void RePost();
  71. // Remove an entry from the interface and the cache.
  72. void RemoveEntry(const char* value);
  73. // Copies of cache entries stored in the user interface
  74. std::vector<cmCursesCacheEntryComposite*>* m_Entries;
  75. // Errors produced during last run of cmake
  76. std::vector<std::string> m_Errors;
  77. // Command line argumens to be passed to cmake each time
  78. // it is run
  79. std::vector<std::string> m_Args;
  80. // Message displayed when user presses 'h'
  81. // It is: Welcome + info about current entry + common help
  82. std::vector<std::string> m_HelpMessage;
  83. // Common help
  84. static const char* s_ConstHelpMessage;
  85. // Fields displayed. Includes labels, new entry markers, entries
  86. FIELD** m_Fields;
  87. // Where is source of current project
  88. std::string m_WhereSource;
  89. // Where is cmake executable
  90. std::string m_WhereCMake;
  91. // Number of entries shown (depends on mode -normal or advanced-)
  92. int m_NumberOfVisibleEntries;
  93. bool m_AdvancedMode;
  94. // Did the iteration converge (no new entries) ?
  95. bool m_OkToGenerate;
  96. // Number of pages displayed
  97. int m_NumberOfPages;
  98. };
  99. #endif // __cmCursesMainForm_h