/
Console.h
61 lines (48 loc) · 1.46 KB
/
Console.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
#pragma once
#include "icommandsystem.h"
#include "ilogwriter.h"
#include <wx/panel.h>
#include "wxutil/ConsoleView.h"
#include "ui/common/CommandEntry.h"
namespace ui
{
class Console;
typedef std::shared_ptr<Console> ConsolePtr;
/**
* greebo: The Console class encapsulates a GtkTextView and represents
* the "device", which the LogWriter is writing its output to.
*
* The Console is a singleton which needs to be constructed and packed
* during mainframe construction.
*/
class Console :
public wxPanel,
public applog::ILogDevice
{
private:
wxutil::ConsoleView* _view;
// The entry box for console commands
CommandEntry* _commandEntry;
public:
/**
* Creates a new Console instance, ready for packing into
* a sizer/notebook. The caller is responsible for deleting
* the object - usually, when packed into a wxWindow, the wxWidgets
* framework is taking care of that.
*/
Console(wxWindow* parent);
virtual ~Console();
/**
* greebo: Static command target for toggling the console.
*/
static void toggle(const cmd::ArgumentList& args);
// Command target to clear the console
void clearCmd(const cmd::ArgumentList& args);
/**
* greebo: Writes the given output string to the Console.
* The log level indicates which tag is used for colouring the output.
* (Note: this gets called by the LogWriter automatically).
*/
void writeLog(const std::string& outputStr, applog::ELogLevel level) override;
};
} // namespace ui