cmake/Source/CursesDialog/cmCursesLongMessageForm.h

61 lines
1.6 KiB
C
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
2021-09-14 00:13:48 +02:00
#pragma once
2018-01-26 17:06:56 +01:00
#include "cmConfigure.h" // IWYU pragma: keep
2016-10-30 18:24:19 +01:00
#include <string>
#include <vector>
2020-02-01 23:06:01 +01:00
#include "cmCursesForm.h"
#include "cmCursesStandardIncludes.h"
class cmCursesLongMessageForm : public cmCursesForm
{
public:
2020-08-30 11:54:41 +02:00
enum class ScrollBehavior
{
NoScroll,
ScrollDown
};
2013-03-16 19:13:01 +02:00
cmCursesLongMessageForm(std::vector<std::string> const& messages,
2020-08-30 11:54:41 +02:00
const char* title, ScrollBehavior scrollBehavior);
2018-01-26 17:06:56 +01:00
~cmCursesLongMessageForm() override;
2013-03-16 19:13:01 +02:00
2019-11-11 23:01:05 +01:00
cmCursesLongMessageForm(cmCursesLongMessageForm const&) = delete;
cmCursesLongMessageForm& operator=(cmCursesLongMessageForm const&) = delete;
2020-08-30 11:54:41 +02:00
void UpdateContent(std::string const& output, std::string const& title);
// Description:
// Handle user input.
2018-01-26 17:06:56 +01:00
void HandleInput() override;
// Description:
// Display form. Use a window of size width x height, starting
// at top, left.
2018-01-26 17:06:56 +01:00
void Render(int left, int top, int width, int height) override;
// Description:
// This method should normally called only by the form.
// The only exception is during a resize.
void PrintKeys();
// Description:
// This method should normally called only by the form.
// The only exception is during a resize.
2018-01-26 17:06:56 +01:00
void UpdateStatusBar() override;
protected:
2020-08-30 11:54:41 +02:00
static constexpr int MAX_CONTENT_SIZE = 60000;
void DrawMessage(const char* msg) const;
std::string Messages;
std::string Title;
2020-08-30 11:54:41 +02:00
ScrollBehavior Scrolling;
FIELD* Fields[2];
};