summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend/mame/ui/custmenu.h
blob: 9bd4ba9b4ef4505d5e6ca2d314093536e7d157e2 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
// license:BSD-3-Clause
// copyright-holders:Maurizio Petrarota
/***************************************************************************

    ui/custmenu.h

    Internal UI user interface.


***************************************************************************/

#pragma once

#ifndef MAME_FRONTEND_UI_CUSTMENU_H
#define MAME_FRONTEND_UI_CUSTMENU_H

#include "ui/menu.h"
#include "ui/utils.h"

namespace ui {
// Software region
struct c_sw_region
{
	std::vector<std::string> ui;
	UINT16 actual;
	void set(std::string &str);
	std::string getname(std::string &str);
};

// Software publishers
struct c_sw_publisher
{
	std::vector<std::string> ui;
	UINT16 actual;
	void set(std::string &str);
	std::string getname(std::string &str);
};

// Software device type
struct c_sw_type
{
	std::vector<std::string> ui;
	UINT16 actual;
	void set(std::string &str);
};

// Software list
struct c_sw_list
{
	std::vector<std::string> name;
	std::vector<std::string> description;
	UINT16 actual;
};

// Software years
struct c_sw_year
{
	std::vector<std::string> ui;
	UINT16 actual;
	void set(std::string &str);
};

struct s_filter
{
	c_sw_region     region;
	c_sw_publisher  publisher;
	c_sw_year       year;
	c_sw_type       type;
	c_sw_list       swlist;
};

//-------------------------------------------------
//  custom software filter menu class
//-------------------------------------------------
class menu_swcustom_filter : public menu
{
public:
	menu_swcustom_filter(mame_ui_manager &mui, render_container *container, const game_driver *_driver, s_filter &_filter);
	virtual ~menu_swcustom_filter() override;
	virtual void populate() override;
	virtual void handle() override;
	virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;

private:
	enum
	{
		MAIN_FILTER = 1,
		ADD_FILTER,
		REMOVE_FILTER,
		MNFCT_FILTER,
		YEAR_FILTER   = MNFCT_FILTER  + MAX_CUST_FILTER + 1,
		REGION_FILTER = YEAR_FILTER   + MAX_CUST_FILTER + 1,
		TYPE_FILTER   = REGION_FILTER + MAX_CUST_FILTER + 1,
		LIST_FILTER   = TYPE_FILTER   + MAX_CUST_FILTER + 1,
		OTHER_FILTER  = LIST_FILTER   + MAX_CUST_FILTER + 1
	};

	bool               m_added;
	s_filter           &m_filter;
	const game_driver  *m_driver;

	void save_sw_custom_filters();
};

//-------------------------------------------------
//  custom filter menu class
//-------------------------------------------------
class menu_custom_filter : public menu
{
public:
	menu_custom_filter(mame_ui_manager &mui, render_container *container, bool _single_menu = false);
	virtual ~menu_custom_filter() override;
	virtual void populate() override;
	virtual void handle() override;
	virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;

private:
	enum
	{
		MAIN_FILTER = 1,
		ADD_FILTER,
		REMOVE_FILTER,
		MNFCT_FILTER,
		YEAR_FILTER   = MNFCT_FILTER  + MAX_CUST_FILTER + 1,
		SCREEN_FILTER = YEAR_FILTER   + MAX_CUST_FILTER + 1,
		OTHER_FILTER  = SCREEN_FILTER + MAX_CUST_FILTER + 1
	};

	bool m_single_menu, m_added;
	void save_custom_filters();
};

} // namespace ui

#endif  /* MAME_FRONTEND_UI_CUSTMENU_H */