1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmCursesMainForm.h,v $
6 Date: $Date: 2006-03-16 15:44:55 $
7 Version: $Revision: 1.24 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #ifndef __cmCursesMainForm_h
18 #define __cmCursesMainForm_h
20 #include "../cmStandardIncludes.h"
21 #include "cmCursesForm.h"
22 #include "cmCursesStandardIncludes.h"
24 class cmCursesCacheEntryComposite
;
28 /** \class cmCursesMainForm
29 * \brief The main page of ccmake
31 * cmCursesMainForm is the main page of ccmake.
33 class cmCursesMainForm
: public cmCursesForm
36 cmCursesMainForm(std::vector
<std::string
> const& args
, int initwidth
);
37 virtual ~cmCursesMainForm();
40 * Set the widgets which represent the cache entries.
47 virtual void HandleInput();
50 * Display form. Use a window of size width x height, starting
53 virtual void Render(int left
, int top
, int width
, int height
);
56 * Returns true if an entry with the given key is in the
57 * list of current composites.
59 bool LookForCacheEntry(const char* key
);
69 * This method should normally be called only by the form. The only
70 * exception is during a resize. The optional argument specifies the
71 * string to be displayed in the status bar.
73 virtual void UpdateStatusBar() { this->UpdateStatusBar(0); }
74 virtual void UpdateStatusBar(const char* message
);
77 * Display current commands and their keys on the toolbar. This
78 * method should normally called only by the form. The only
79 * exception is during a resize. If the optional argument process is
80 * specified and is either 1 (configure) or 2 (generate), then keys
81 * will be displayed accordingly.
83 void PrintKeys(int process
= 0);
86 * During a CMake run, an error handle should add errors
87 * to be displayed afterwards.
89 virtual void AddError(const char* message
, const char* title
);
92 * Used to do a configure. If argument is specified, it does only the check
95 int Configure(int noconfigure
=0);
103 * Used by main program
105 int LoadCache(const char *dir
);
110 static void UpdateProgressOld(const char *msg
, float prog
, void*);
111 static void UpdateProgress(const char *msg
, float prog
, void*);
114 cmCursesMainForm(const cmCursesMainForm
& from
);
115 void operator=(const cmCursesMainForm
&);
117 // Copy the cache values from the user interface to the actual
119 void FillCacheManagerFromUI();
120 // Fix formatting of values to a consistent form.
121 void FixValue(cmCacheManager::CacheEntryType type
,
122 const std::string
& in
, std::string
& out
) const;
123 // Re-post the existing fields. Used to toggle between
124 // normal and advanced modes. Render() should be called
127 // Remove an entry from the interface and the cache.
128 void RemoveEntry(const char* value
);
130 // Jump to the cache value with index idx. If string str is
131 // specified, it will stop on widget that contain that string.
132 void JumpToCacheEntry(int idx
, const char* str
);
134 // Copies of cache entries stored in the user interface
135 std::vector
<cmCursesCacheEntryComposite
*>* Entries
;
136 // Errors produced during last run of cmake
137 std::vector
<std::string
> Errors
;
138 // Command line argumens to be passed to cmake each time
140 std::vector
<std::string
> Args
;
141 // Message displayed when user presses 'h'
142 // It is: Welcome + info about current entry + common help
143 std::vector
<std::string
> HelpMessage
;
146 static const char* s_ConstHelpMessage
;
148 // Fields displayed. Includes labels, new entry markers, entries
150 // Where is source of current project
151 std::string WhereSource
;
152 // Where is cmake executable
153 std::string WhereCMake
;
154 // Number of entries shown (depends on mode -normal or advanced-)
155 int NumberOfVisibleEntries
;
157 // Did the iteration converge (no new entries) ?
159 // Number of pages displayed
163 cmake
*CMakeInstance
;
165 std::string SearchString
;
166 std::string OldSearchString
;
170 #endif // __cmCursesMainForm_h