Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Kitware
GitHub Repository: Kitware/CMake
Path: blob/master/Source/CursesDialog/cmCursesLongMessageForm.h
4998 views
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
5
#include "cmConfigure.h" // IWYU pragma: keep
6
7
#include <string>
8
#include <vector>
9
10
#include "cmCursesForm.h"
11
#include "cmCursesStandardIncludes.h"
12
13
class cmCursesLongMessageForm : public cmCursesForm
14
{
15
public:
16
enum class ScrollBehavior
17
{
18
NoScroll,
19
ScrollDown
20
};
21
22
cmCursesLongMessageForm(std::vector<std::string> const& messages,
23
char const* title, ScrollBehavior scrollBehavior);
24
~cmCursesLongMessageForm() override;
25
26
cmCursesLongMessageForm(cmCursesLongMessageForm const&) = delete;
27
cmCursesLongMessageForm& operator=(cmCursesLongMessageForm const&) = delete;
28
29
void UpdateContent(std::string const& output, std::string const& title);
30
31
// Description:
32
// Handle user input.
33
void HandleInput() override;
34
35
// Description:
36
// Display form. Use a window of size width x height, starting
37
// at top, left.
38
void Render(int left, int top, int width, int height) override;
39
40
// Description:
41
// This method should normally called only by the form.
42
// The only exception is during a resize.
43
void PrintKeys();
44
45
// Description:
46
// This method should normally called only by the form.
47
// The only exception is during a resize.
48
void UpdateStatusBar() override;
49
50
protected:
51
static constexpr int MAX_CONTENT_SIZE = 60000;
52
53
void DrawMessage(char const* msg) const;
54
55
std::string Messages;
56
std::string Title;
57
ScrollBehavior Scrolling;
58
59
FIELD* Fields[2];
60
};
61
62