forked from f3d-app/f3d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvtkF3DImguiConsole.h
71 lines (56 loc) · 1.62 KB
/
vtkF3DImguiConsole.h
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
/**
* @class vtkF3DImguiConsole
* @brief An ImGui console window
*
* This class is used instead of vtkF3DConsoleOutputWindow if F3D_MODULE_UI is enabled
* On top of the regular behavior of printing the log in the console, all the logs are also added
* in an imgui window so the user can access it easily by calling ShowConsole()
* It is also adding an input widget where commands registered in libf3d can be executed.
* Finally, a small icon is displayed on the top right corner when the console is hidden but a new
* warning or error is logged.
*/
#ifndef vtkF3DImguiConsole_h
#define vtkF3DImguiConsole_h
#include "vtkF3DConsoleOutputWindow.h"
#include <vtkCommand.h>
#include <functional>
#include <memory>
class vtkOpenGLRenderWindow;
class vtkWindow;
class vtkF3DImguiConsole : public vtkF3DConsoleOutputWindow
{
public:
static vtkF3DImguiConsole* New();
vtkTypeMacro(vtkF3DImguiConsole, vtkF3DConsoleOutputWindow);
/**
* Add text to console
*/
void DisplayText(const char*) override;
/**
* Show console window
*/
void ShowConsole(bool);
/**
* Show console badge
*/
void ShowBadge();
/**
* Clear console
*/
void Clear();
/**
* Set the callback to get the list of commands matching pattern
*/
void SetCommandsMatchCallback(
std::function<std::vector<std::string>(const std::string& pattern)> callback);
protected:
vtkF3DImguiConsole();
~vtkF3DImguiConsole() override;
private:
struct Internals;
std::unique_ptr<Internals> Pimpl;
private:
vtkF3DImguiConsole(const vtkF3DImguiConsole&) = delete;
void operator=(const vtkF3DImguiConsole&) = delete;
};
#endif