summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend/mame/ui/slotopt.h
blob: 91c78de7d1e4508a6705722c850c9f7fd3d45c11 (plain) (blame)
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
// license:BSD-3-Clause
// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods
/***************************************************************************

    ui/slotopt.h

    Internal menu for the slot options.

***************************************************************************/
#ifndef MAME_FRONTEND_UI_SLOTOPT_H
#define MAME_FRONTEND_UI_SLOTOPT_H

#pragma once

#include "ui/menu.h"

#include <unordered_map>


namespace ui {

class menu_slot_devices : public menu
{
public:
	menu_slot_devices(mame_ui_manager &mui, render_container &container);
	virtual ~menu_slot_devices() override;

protected:
	virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
	virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) override;

private:
	enum class step_t
	{
		NEXT,
		PREVIOUS
	};

	virtual void populate() override;
	virtual bool handle(event const *ev) override;

	device_slot_interface::slot_option const *get_current_option(device_slot_interface &slot) const;
	void set_slot_device(device_slot_interface &slot, std::string_view val);
	void record_current_options();
	bool try_refresh_current_options();
	void rotate_slot_device(device_slot_interface &slot, step_t step);

	// variables
	std::unique_ptr<machine_config>                 m_config;
	std::unordered_map<std::string, std::string>    m_slot_options;
	std::string                                     m_current_option_list_slot_tag;
	std::vector<std::string>                        m_current_option_list;
	std::vector<std::string>::const_iterator        m_current_option_list_iter;
};

} // namespace ui

#endif  /* MAME_FRONTEND_UI_SLOTOPT_H */