summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend/mame/ui/dirmenu.h
blob: 556427425e0a7db93d7f4f9a8e790aae6a744e06 (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
// license:BSD-3-Clause
// copyright-holders:Maurizio Petrarota
/***************************************************************************

    ui/dirmenu.h

    Internal UI user interface.

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

#pragma once

#ifndef MAME_FRONTEND_UI_DIRMENU_H
#define MAME_FRONTEND_UI_DIRMENU_H

#include "ui/menu.h"

#include <string>
#include <vector>

namespace ui {

//-------------------------------------------------
//  class directory menu
//-------------------------------------------------

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

protected:
	virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;

private:
	virtual void populate(float &customtop, float &custombottom) override;
	virtual void handle(event const *ev) override;
};

//-------------------------------------------------
//  class directory specific menu
//-------------------------------------------------

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

protected:
	virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;

private:
	enum
	{
		ADD_CHANGE = 1,
		REMOVE,
	};

	virtual void populate(float &customtop, float &custombottom) override;
	virtual void handle(event const *ev) override;

	std::string              m_heading[1], m_searchpath;
	std::vector<std::string> m_folders;
	int                      m_ref;
};

//-------------------------------------------------
//  class remove folder menu
//-------------------------------------------------

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

protected:
	virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;

private:
	virtual void populate(float &customtop, float &custombottom) override;
	virtual void handle(event const *ev) override;

	std::string  m_searchpath;
	int          m_ref;
	std::vector<std::string> m_folders;
};

//-------------------------------------------------
//  class add / change folder menu
//-------------------------------------------------

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

protected:
	virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;

	virtual bool custom_ui_cancel() override { return !m_search.empty(); }

private:
	virtual void populate(float &customtop, float &custombottom) override;
	virtual void handle(event const *ev) override;

	int          m_ref;
	std::string  m_current_path;
	std::string  m_search;
	bool         m_change;
	std::vector<std::string> m_folders;
};

} // namespace ui

#endif // MAME_FRONTEND_UI_DIRMENU_H