summaryrefslogtreecommitdiff
path: root/Source/CursesDialog/cmCursesMainForm.h
blob: aa6c0ed2f3b31cdfebb2ff1ae385e31cabccfb1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#ifndef __cmCursesMainForm_h
#define __cmCursesMainForm_h

#include "../cmStandardIncludes.h"
#include "cmCursesForm.h"
#include "cmCursesStandardIncludes.h"

class cmCursesCacheEntryComposite;

class cmCursesMainForm : public cmCursesForm
{
public:
  cmCursesMainForm(std::vector<std::string> const& args);
  virtual ~cmCursesMainForm();
  
  // Description:
  // Set the widgets which represent the cache entries.
  void InitializeUI();
  
  // Description:
  // Handle user input.
  virtual void HandleInput();

  // Description:
  // Display form. Use a window of size width x height, starting
  // at top, left.
  virtual void Render(int left, int top, int width, int height);

  // Description:
  // Returns true if an entry with the given key is in the
  // list of current composites.
  bool LookForCacheEntry(const char* key);

  enum {
    MIN_WIDTH = 65,
    MIN_HEIGHT = 6,
    IDEAL_WIDTH = 80,
    MAX_WIDTH = 512
  };

  // Description:
  // This method should normally  called only by the form.
  // The only exception is during a resize.
  virtual void UpdateStatusBar();

  // Description:
  // This method should normally  called only by the form.
  // The only exception is during a resize.
  void PrintKeys();

  // Description:
  // During a CMake run, an error handle should add errors
  // to be displayed afterwards.
  virtual void AddError(const char* message, const char* title);

  // Description:
  // Used to run cmake.
  void RunCMake(bool generateMakefiles);

protected:
  cmCursesMainForm(const cmCursesMainForm& from);
  void operator=(const cmCursesMainForm&);

  void FillCacheManagerFromUI();
  void RePost();
  void RemoveEntry(const char* value);

  std::vector<cmCursesCacheEntryComposite*>* m_Entries;
  std::vector<std::string> m_Errors;
  std::vector<std::string> m_Args;
  std::vector<std::string> m_HelpMessage;

  static const char* s_ConstHelpMessage;

  FIELD** m_Fields;
  std::string m_WhereSource;
  std::string m_WhereCMake;
  int m_Height;
  int m_NumberOfVisibleEntries;
  bool m_AdvancedMode;
  bool m_OkToGenerate;

};

#endif // __cmCursesMainForm_h