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 bool showDemoWindow = false;
50
51 unsigned joystick = 0;
52 unsigned popupForKey = unsigned(-1);
53 float popupTimeout = 0.0f;
54 bool listening = false;
55
56 int selectedStyle = -1; // no style loaded yet
57 std::string saveLayoutName;
58
59 std::string confirmText;
60 std::function<void()> confirmAction;
61
62 std::vector<std::string> availableFonts;
63
64 static constexpr auto persistentElements = std::tuple{
65 PersistentElement{"style", &ImGuiSettings::selectedStyle},
66 };
67};
68
69} // namespace openmsx
70
71#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