openMSX
OSDTopWidget.hh
Go to the documentation of this file.
1#ifndef OSDTOPWIDGET_HH
2#define OSDTOPWIDGET_HH
3
4#include "OSDWidget.hh"
5#include "TclObject.hh"
6#include "hash_set.hh"
7#include "view.hh"
8#include <vector>
9#include <string>
10
11namespace openmsx {
12
13class OSDTopWidget final : public OSDWidget
14{
15public:
16 explicit OSDTopWidget(Display& display);
17 [[nodiscard]] std::string_view getType() const override;
18 [[nodiscard]] gl::vec2 getSize(const OutputSurface& output) const override;
19 [[nodiscard]] bool isVisible() const override;
20 [[nodiscard]] bool isRecursiveFading() const override;
21
22 void queueError(std::string message);
23 void showAllErrors();
24
25 [[nodiscard]] OSDWidget* findByName(std::string_view name);
26 [[nodiscard]] const OSDWidget* findByName(std::string_view name) const;
27 void addName(OSDWidget& widget);
28 void removeName(OSDWidget& widget);
29 [[nodiscard]] auto getAllWidgetNames() const {
30 return view::transform(widgetsByName,
31 [](auto* p) -> std::string_view { return p->getName(); });
32 }
33
34
35protected:
36 void invalidateLocal() override;
37 void paintSDL(OutputSurface& output) override;
38 void paintGL (OutputSurface& output) override;
39
40private:
41 std::vector<std::string> errors;
42
43 struct NameFromWidget {
44 [[nodiscard]] std::string_view operator()(const OSDWidget* w) const {
45 return w->getName();
46 }
47 };
49};
50
51} // namespace openmsx
52
53#endif
Represents the output window/screen of openMSX.
Definition: Display.hh:33
std::string_view getType() const override
Definition: OSDTopWidget.cc:14
OSDWidget * findByName(std::string_view name)
Definition: OSDTopWidget.cc:63
bool isRecursiveFading() const override
Definition: OSDTopWidget.cc:29
void addName(OSDWidget &widget)
Definition: OSDTopWidget.cc:74
void queueError(std::string message)
Definition: OSDTopWidget.cc:49
gl::vec2 getSize(const OutputSurface &output) const override
Definition: OSDTopWidget.cc:19
void removeName(OSDWidget &widget)
Definition: OSDTopWidget.cc:80
void paintGL(OutputSurface &output) override
Definition: OSDTopWidget.cc:44
bool isVisible() const override
Definition: OSDTopWidget.cc:24
void invalidateLocal() override
Definition: OSDTopWidget.cc:34
auto getAllWidgetNames() const
Definition: OSDTopWidget.hh:29
OSDTopWidget(Display &display)
Definition: OSDTopWidget.cc:8
void paintSDL(OutputSurface &output) override
Definition: OSDTopWidget.cc:39
std::string_view getName() const
Definition: OSDWidget.hh:34
A frame buffer where pixels can be written to.
This file implemented 3 utility functions:
Definition: Autofire.cc:9
constexpr auto transform(Range &&range, UnaryOp op)
Definition: view.hh:458