cmCursesMainForm.h 3.7 KB

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