OXYGENHUB
◆ main openmsx / src / console / OSDGUI.hh
1.5 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
#ifndef OSDGUI_HH
2
#define OSDGUI_HH
3
4
#include "OSDTopWidget.hh"
5
6
#include "Command.hh"
7
8
#include <memory>
9
10
namespace openmsx {
11
12
class Display;
13
class CommandController;
14
15
class OSDGUI
16
{
17
public:
18
	OSDGUI(CommandController& commandController, Display& display);
19
20
	[[nodiscard]] Display& getDisplay() const { return display; }
21
	[[nodiscard]] const OSDTopWidget& getTopWidget() const { return topWidget; }
22
	[[nodiscard]]       OSDTopWidget& getTopWidget()       { return topWidget; }
23
	void refresh() const;
24
25
private:
26
	Display& display;
27
28
	class OSDCommand final : public Command {
29
	public:
30
		explicit OSDCommand(CommandController& commandController);
31
		void execute(std::span<const TclObject> tokens, TclObject& result) override;
32
		[[nodiscard]] std::string help(std::span<const TclObject> tokens) const override;
33
		void tabCompletion(std::vector<std::string>& tokens) const override;
34
35
	private:
36
		void create   (std::span<const TclObject> tokens, TclObject& result);
37
		void destroy  (std::span<const TclObject> tokens, TclObject& result);
38
		void info     (std::span<const TclObject> tokens, TclObject& result);
39
		void exists   (std::span<const TclObject> tokens, TclObject& result);
40
		void configure(std::span<const TclObject> tokens, TclObject& result);
41
		[[nodiscard]] std::unique_ptr<OSDWidget> create(
42
			std::string_view type, const TclObject& name) const;
43
		void configure(OSDWidget& widget, std::span<const TclObject> tokens) const;
44
45
		[[nodiscard]] OSDWidget& getWidget(std::string_view name) const;
46
	} osdCommand;
47
48
	OSDTopWidget topWidget;
49
};
50
51
} // namespace openmsx
52
53
#endif