cmake/Source/CursesDialog/cmCursesForm.h

68 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
2020-02-01 23:06:01 +01:00
#include <string>
2016-07-09 11:21:54 +02:00
2017-07-20 19:35:53 +02:00
#include "cmsys/FStream.hxx"
2020-02-01 23:06:01 +01:00
#include "cmCursesStandardIncludes.h"
2019-11-11 23:01:05 +01:00
class cmCursesForm
{
public:
cmCursesForm();
virtual ~cmCursesForm();
2013-03-16 19:13:01 +02:00
2019-11-11 23:01:05 +01:00
cmCursesForm(cmCursesForm const&) = delete;
cmCursesForm& operator=(cmCursesForm const&) = delete;
// Description:
// Handle user input.
virtual void HandleInput() = 0;
// Description:
// Display form.
virtual void Render(int left, int top, int width, int height) = 0;
// Description:
// This method should normally called only by the form.
// The only exception is during a resize.
virtual void UpdateStatusBar() = 0;
// Description:
// During a CMake run, an error handle should add errors
// to be displayed afterwards.
2019-11-11 23:01:05 +01:00
virtual void AddError(const std::string&, const char*) {}
// Description:
// Turn debugging on. This will create ccmakelog.txt.
static void DebugStart();
// Description:
// Turn debugging off. This will close ccmakelog.txt.
static void DebugEnd();
// Description:
// Write a debugging message.
static void LogMessage(const char* msg);
// Description:
// Return the FORM. Should be only used by low-level methods.
2016-07-09 11:21:54 +02:00
FORM* GetForm() { return this->Form; }
static cmCursesForm* CurrentForm;
2013-03-16 19:13:01 +02:00
2022-03-29 21:10:50 +02:00
// Description:
// Handle resizing the form with curses.
void HandleResize();
protected:
2014-08-03 19:52:23 +02:00
static cmsys::ofstream DebugFile;
static bool Debug;
FORM* Form;
};