openMSX
ImGuiSettings.hh
Go to the documentation of this file.
1#ifndef IMGUI_SETTINGS_HH
2#define IMGUI_SETTINGS_HH
3
4#include "ImGuiPart.hh"
5
6#include "Shortcuts.hh"
7
8#include "EventListener.hh"
9
10#include <functional>
11#include <span>
12#include <string>
13#include <vector>
14
15namespace openmsx {
16
17class ImGuiSettings final : public ImGuiPart, private EventListener
18{
19public:
22
23 [[nodiscard]] zstring_view iniName() const override { return "settings"; }
24 void save(ImGuiTextBuffer& buf) override;
25 void loadLine(std::string_view name, zstring_view value) override;
26 void loadEnd() override;
27
28 void showMenu(MSXMotherBoard* motherBoard) override;
29 void paint(MSXMotherBoard* motherBoard) override;
30
31private:
32 bool signalEvent(const Event& event) override;
33 void initListener();
34 void deinitListener();
35
36 void setStyle() const;
37 void paintJoystick(MSXMotherBoard& motherBoard);
38 void paintFont();
39 void paintShortcut();
40 void paintEditShortcut();
41
42 std::span<const std::string> getAvailableFonts();
43
44private:
45 bool showConfigureJoystick = false;
46 bool showFont = false;
47 bool showShortcut = false;
49
50 unsigned joystick = 0;
51 unsigned popupForKey = unsigned(-1);
52 float popupTimeout = 0.0f;
53 bool listening = false;
54
55 int selectedStyle = -1; // no style loaded yet
56 std::string saveLayoutName;
57
58 std::string confirmText;
59 std::function<void()> confirmAction;
60
61 std::vector<std::string> availableFonts;
62
63 static constexpr auto persistentElements = std::tuple{
64 PersistentElement{"style", &ImGuiSettings::selectedStyle},
65 };
66};
67
68} // namespace openmsx
69
70#endif
ImGuiPart(ImGuiManager &manager_)
Definition ImGuiPart.hh:12
zstring_view iniName() const override
void save(ImGuiTextBuffer &buf) override
void paint(MSXMotherBoard *motherBoard) override
void showMenu(MSXMotherBoard *motherBoard) override
void loadLine(std::string_view name, zstring_view value) override
void loadEnd() override
Like std::string_view, but with the extra guarantee that it refers to a zero-terminated string.
This file implemented 3 utility functions:
Definition Autofire.cc:11
std::variant< KeyUpEvent, KeyDownEvent, MouseMotionEvent, MouseButtonUpEvent, MouseButtonDownEvent, MouseWheelEvent, JoystickAxisMotionEvent, JoystickHatEvent, JoystickButtonUpEvent, JoystickButtonDownEvent, OsdControlReleaseEvent, OsdControlPressEvent, WindowEvent, TextEvent, FileDropEvent, QuitEvent, FinishFrameEvent, CliCommandEvent, GroupEvent, BootEvent, FrameDrawnEvent, BreakEvent, SwitchRendererEvent, TakeReverseSnapshotEvent, AfterTimedEvent, MachineLoadedEvent, MachineActivatedEvent, MachineDeactivatedEvent, MidiInReaderEvent, MidiInWindowsEvent, MidiInCoreMidiEvent, MidiInCoreMidiVirtualEvent, MidiInALSAEvent, Rs232TesterEvent, Rs232NetEvent, ImGuiDelayedActionEvent, ImGuiActiveEvent > Event
Definition Event.hh:445