summaryrefslogtreecommitdiffstats
path: root/src/frontend/mame/ui/quitmenu.cpp
blob: bb26f7e62900991932c5fca4c916540b87cacecd (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
// license:BSD-3-Clause
// copyright-holders:Vas Crabb
/***************************************************************************

    ui/quitmenu.h

    Menus involved in quitting MAME.

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

#include "emu.h"
#include "quitmenu.h"

#include "uiinput.h"


namespace ui {

menu_confirm_quit::menu_confirm_quit(mame_ui_manager &mui, render_container &container)
	: autopause_menu<>(mui, container)
{
	set_one_shot(true);
	set_process_flags(PROCESS_CUSTOM_ONLY | PROCESS_NOINPUT);
}


menu_confirm_quit::~menu_confirm_quit()
{
}


void menu_confirm_quit::custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2)
{
	ui().draw_text_box(
			container(),
			util::string_format(
				_("Are you sure you want to quit?\n\n"
				"Press %1$s to quit\n"
				"Press %2$s to return to emulation"),
				ui().get_general_input_setting(IPT_UI_SELECT),
				ui().get_general_input_setting(IPT_UI_CANCEL)),
			text_layout::text_justify::CENTER,
			0.5f, 0.5f,
			UI_RED_COLOR);
}


void menu_confirm_quit::populate(float &customtop, float &custombottom)
{
}


void menu_confirm_quit::handle(event const *ev)
{
	if (machine().ui_input().pressed(IPT_UI_SELECT))
		machine().schedule_exit();
	else if (machine().ui_input().pressed(IPT_UI_CANCEL))
		stack_pop();
}

} // namespace ui