summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend/mame
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2016-07-10 22:10:44 +1000
committer Vas Crabb <vas@vastheman.com>2016-07-10 22:10:59 +1000
commit3258d3feef7ecba3067bde2ed527849811297020 (patch)
tree82295081a7c83835fe8d42a3ddd3d71a854059b1 /src/frontend/mame
parent9bbf1208e309370371d54b620077c5e2c993bbe3 (diff)
UI refactoring: [Vas Crabb]
* std::bind - accept no substitutes * pointer -> reference conversion * make more menu members private or protected * don't play so fast and loose with integer types * reduce some vector copying * make more static constants const
Diffstat (limited to 'src/frontend/mame')
-rw-r--r--src/frontend/mame/cheat.cpp2
-rw-r--r--src/frontend/mame/luaengine.cpp4
-rw-r--r--src/frontend/mame/mame.cpp4
-rw-r--r--src/frontend/mame/ui/auditmenu.cpp4
-rw-r--r--src/frontend/mame/ui/auditmenu.h8
-rw-r--r--src/frontend/mame/ui/barcode.cpp2
-rw-r--r--src/frontend/mame/ui/barcode.h5
-rw-r--r--src/frontend/mame/ui/cheatopt.cpp6
-rw-r--r--src/frontend/mame/ui/cheatopt.h9
-rw-r--r--src/frontend/mame/ui/custmenu.cpp56
-rw-r--r--src/frontend/mame/ui/custmenu.h28
-rw-r--r--src/frontend/mame/ui/custui.cpp149
-rw-r--r--src/frontend/mame/ui/custui.h65
-rw-r--r--src/frontend/mame/ui/datmenu.cpp50
-rw-r--r--src/frontend/mame/ui/datmenu.h11
-rw-r--r--src/frontend/mame/ui/devctrl.h4
-rw-r--r--src/frontend/mame/ui/devopt.cpp2
-rw-r--r--src/frontend/mame/ui/devopt.h5
-rw-r--r--src/frontend/mame/ui/dirmenu.cpp50
-rw-r--r--src/frontend/mame/ui/dirmenu.h43
-rw-r--r--src/frontend/mame/ui/filecreate.cpp16
-rw-r--r--src/frontend/mame/ui/filecreate.h30
-rw-r--r--src/frontend/mame/ui/filemngr.cpp8
-rw-r--r--src/frontend/mame/ui/filemngr.h13
-rw-r--r--src/frontend/mame/ui/filesel.cpp14
-rw-r--r--src/frontend/mame/ui/filesel.h15
-rw-r--r--src/frontend/mame/ui/floppycntrl.cpp8
-rw-r--r--src/frontend/mame/ui/floppycntrl.h8
-rw-r--r--src/frontend/mame/ui/imgcntrl.cpp16
-rw-r--r--src/frontend/mame/ui/imgcntrl.h7
-rw-r--r--src/frontend/mame/ui/info.cpp4
-rw-r--r--src/frontend/mame/ui/info.h10
-rw-r--r--src/frontend/mame/ui/info_pty.cpp2
-rw-r--r--src/frontend/mame/ui/info_pty.h4
-rw-r--r--src/frontend/mame/ui/inputmap.cpp32
-rw-r--r--src/frontend/mame/ui/inputmap.h46
-rw-r--r--src/frontend/mame/ui/mainmenu.cpp52
-rw-r--r--src/frontend/mame/ui/mainmenu.h7
-rw-r--r--src/frontend/mame/ui/menu.cpp83
-rw-r--r--src/frontend/mame/ui/menu.h70
-rw-r--r--src/frontend/mame/ui/miscmenu.cpp42
-rw-r--r--src/frontend/mame/ui/miscmenu.h67
-rw-r--r--src/frontend/mame/ui/optsmenu.cpp46
-rw-r--r--src/frontend/mame/ui/optsmenu.h13
-rw-r--r--src/frontend/mame/ui/pluginopt.cpp6
-rw-r--r--src/frontend/mame/ui/pluginopt.h12
-rw-r--r--src/frontend/mame/ui/selector.cpp16
-rw-r--r--src/frontend/mame/ui/selector.h17
-rw-r--r--src/frontend/mame/ui/selgame.cpp186
-rw-r--r--src/frontend/mame/ui/selgame.h24
-rw-r--r--src/frontend/mame/ui/selmenu.cpp140
-rw-r--r--src/frontend/mame/ui/selmenu.h12
-rw-r--r--src/frontend/mame/ui/selsoft.cpp128
-rw-r--r--src/frontend/mame/ui/selsoft.h39
-rw-r--r--src/frontend/mame/ui/simpleselgame.cpp20
-rw-r--r--src/frontend/mame/ui/simpleselgame.h28
-rw-r--r--src/frontend/mame/ui/sliders.cpp20
-rw-r--r--src/frontend/mame/ui/sliders.h13
-rw-r--r--src/frontend/mame/ui/slotopt.cpp4
-rw-r--r--src/frontend/mame/ui/slotopt.h5
-rw-r--r--src/frontend/mame/ui/sndmenu.cpp12
-rw-r--r--src/frontend/mame/ui/sndmenu.h9
-rw-r--r--src/frontend/mame/ui/submenu.cpp140
-rw-r--r--src/frontend/mame/ui/submenu.h26
-rw-r--r--src/frontend/mame/ui/swlist.cpp15
-rw-r--r--src/frontend/mame/ui/swlist.h13
-rw-r--r--src/frontend/mame/ui/tapectrl.cpp2
-rw-r--r--src/frontend/mame/ui/tapectrl.h5
-rw-r--r--src/frontend/mame/ui/text.cpp6
-rw-r--r--src/frontend/mame/ui/text.h2
-rw-r--r--src/frontend/mame/ui/ui.cpp137
-rw-r--r--src/frontend/mame/ui/ui.h93
-rw-r--r--src/frontend/mame/ui/utils.h4
-rw-r--r--src/frontend/mame/ui/videoopt.cpp10
-rw-r--r--src/frontend/mame/ui/videoopt.h11
-rw-r--r--src/frontend/mame/ui/viewgfx.cpp42
-rw-r--r--src/frontend/mame/ui/viewgfx.h2
77 files changed, 1229 insertions, 1090 deletions
diff --git a/src/frontend/mame/cheat.cpp b/src/frontend/mame/cheat.cpp
index 71569aff8b4..db184a035eb 100644
--- a/src/frontend/mame/cheat.cpp
+++ b/src/frontend/mame/cheat.cpp
@@ -1235,7 +1235,7 @@ void cheat_manager::render_text(mame_ui_manager &mui, render_container &containe
if (!m_output[linenum].empty())
{
// output the text
- mui.draw_text_full(&container, m_output[linenum].c_str(),
+ mui.draw_text_full(container, m_output[linenum].c_str(),
0.0f, (float)linenum * mui.get_line_height(), 1.0f,
m_justify[linenum], ui::text_layout::NEVER, mame_ui_manager::OPAQUE_,
rgb_t::white, rgb_t::black, nullptr, nullptr);
diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp
index c30527858bc..52af1b85bef 100644
--- a/src/frontend/mame/luaengine.cpp
+++ b/src/frontend/mame/luaengine.cpp
@@ -1630,7 +1630,7 @@ int lua_engine::lua_screen::l_draw_box(lua_State *L)
// draw the box
render_container &rc = sc->container();
- mame_machine_manager::instance()->ui().draw_outlined_box(&rc, x1, y1, x2, y2, fgcolor, bgcolor);
+ mame_machine_manager::instance()->ui().draw_outlined_box(rc, x1, y1, x2, y2, fgcolor, bgcolor);
return 0;
}
@@ -1716,7 +1716,7 @@ int lua_engine::lua_screen::l_draw_text(lua_State *L)
// draw the text
render_container &rc = sc->container();
- mame_machine_manager::instance()->ui().draw_text_full(&rc, msg, x, y, (1.0f - x),
+ mame_machine_manager::instance()->ui().draw_text_full(rc, msg, x, y, (1.0f - x),
justify, ui::text_layout::WORD, mame_ui_manager::NORMAL, textcolor,
bgcolor, nullptr, nullptr);
return 0;
diff --git a/src/frontend/mame/mame.cpp b/src/frontend/mame/mame.cpp
index d72d77bbc3e..2be26a357c0 100644
--- a/src/frontend/mame/mame.cpp
+++ b/src/frontend/mame/mame.cpp
@@ -314,7 +314,7 @@ void emulator_info::display_ui_chooser(running_machine& machine)
{
// force the UI to show the game select screen
mame_ui_manager &mui = mame_machine_manager::instance()->ui();
- render_container *container = &machine.render().ui_container();
+ render_container &container = machine.render().ui_container();
if (machine.options().ui() == emu_options::UI_SIMPLE)
ui::simple_menu_select_game::force_game_select(mui, container);
else
@@ -329,7 +329,7 @@ int emulator_info::start_frontend(emu_options &options, osd_interface &osd, int
void emulator_info::draw_user_interface(running_machine& machine)
{
- mame_machine_manager::instance()->ui().update_and_render(&machine.render().ui_container());
+ mame_machine_manager::instance()->ui().update_and_render(machine.render().ui_container());
}
void emulator_info::periodic_check()
diff --git a/src/frontend/mame/ui/auditmenu.cpp b/src/frontend/mame/ui/auditmenu.cpp
index ea3058914ab..2c243215f49 100644
--- a/src/frontend/mame/ui/auditmenu.cpp
+++ b/src/frontend/mame/ui/auditmenu.cpp
@@ -85,7 +85,7 @@ bool sorted_game_list(const game_driver *x, const game_driver *y)
// ctor / dtor
//-------------------------------------------------
-menu_audit::menu_audit(mame_ui_manager &mui, render_container *container, vptr_game &availablesorted, vptr_game &unavailablesorted, int _audit_mode)
+menu_audit::menu_audit(mame_ui_manager &mui, render_container &container, vptr_game &availablesorted, vptr_game &unavailablesorted, int _audit_mode)
: menu(mui, container)
, m_availablesorted(availablesorted)
, m_unavailablesorted(unavailablesorted)
@@ -113,7 +113,7 @@ void menu_audit::handle()
if (m_first)
{
- ui().draw_text_box(container, _("Audit in progress..."), ui::text_layout::CENTER, 0.5f, 0.5f, UI_GREEN_COLOR);
+ ui().draw_text_box(container(), _("Audit in progress..."), ui::text_layout::CENTER, 0.5f, 0.5f, UI_GREEN_COLOR);
m_first = false;
return;
}
diff --git a/src/frontend/mame/ui/auditmenu.h b/src/frontend/mame/ui/auditmenu.h
index a7427c2861e..4f630792023 100644
--- a/src/frontend/mame/ui/auditmenu.h
+++ b/src/frontend/mame/ui/auditmenu.h
@@ -24,17 +24,19 @@ using vptr_game = std::vector<const game_driver *>;
class menu_audit : public menu
{
public:
- menu_audit(mame_ui_manager &mui, render_container *container, vptr_game &availablesorted, vptr_game &unavailablesorted, int audit_mode);
+ menu_audit(mame_ui_manager &mui, render_container &container, vptr_game &availablesorted, vptr_game &unavailablesorted, int audit_mode);
virtual ~menu_audit() override;
+
+private:
virtual void populate() override;
virtual void handle() override;
-private:
+ void save_available_machines();
+
vptr_game &m_availablesorted;
vptr_game &m_unavailablesorted;
int m_audit_mode;
- void save_available_machines();
bool m_first;
};
diff --git a/src/frontend/mame/ui/barcode.cpp b/src/frontend/mame/ui/barcode.cpp
index 6fb322b0ed7..6d11de0036f 100644
--- a/src/frontend/mame/ui/barcode.cpp
+++ b/src/frontend/mame/ui/barcode.cpp
@@ -31,7 +31,7 @@ namespace ui {
// ctor
//-------------------------------------------------
-menu_barcode_reader::menu_barcode_reader(mame_ui_manager &mui, render_container *container, barcode_reader_device *device)
+menu_barcode_reader::menu_barcode_reader(mame_ui_manager &mui, render_container &container, barcode_reader_device *device)
: menu_device_control<barcode_reader_device>(mui, container, device)
{
}
diff --git a/src/frontend/mame/ui/barcode.h b/src/frontend/mame/ui/barcode.h
index 114e797a5f8..88dee12296c 100644
--- a/src/frontend/mame/ui/barcode.h
+++ b/src/frontend/mame/ui/barcode.h
@@ -19,12 +19,13 @@
namespace ui {
class menu_barcode_reader : public menu_device_control<barcode_reader_device> {
public:
- menu_barcode_reader(mame_ui_manager &mui, render_container *container, barcode_reader_device *device);
+ menu_barcode_reader(mame_ui_manager &mui, render_container &container, barcode_reader_device *device);
virtual ~menu_barcode_reader() override;
+
+private:
virtual void populate() override;
virtual void handle() override;
-private:
char m_barcode_buffer[20];
};
diff --git a/src/frontend/mame/ui/cheatopt.cpp b/src/frontend/mame/ui/cheatopt.cpp
index b7d6852c3b9..b3838a296e7 100644
--- a/src/frontend/mame/ui/cheatopt.cpp
+++ b/src/frontend/mame/ui/cheatopt.cpp
@@ -108,7 +108,7 @@ void menu_cheat::handle()
/* handle autofire menu */
if (menu_event->itemref == ITEMREF_CHEATS_AUTOFIRE_SETTINGS && menu_event->iptkey == IPT_UI_SELECT)
{
- menu::stack_push<menu_autofire>(ui(), container);
+ menu::stack_push<menu_autofire>(ui(), container());
}
/* if things changed, update */
@@ -122,7 +122,7 @@ void menu_cheat::handle()
menu_cheat_populate - populate the cheat menu
-------------------------------------------------*/
-menu_cheat::menu_cheat(mame_ui_manager &mui, render_container *container) : menu(mui, container)
+menu_cheat::menu_cheat(mame_ui_manager &mui, render_container &container) : menu(mui, container)
{
}
@@ -174,7 +174,7 @@ menu_cheat::~menu_cheat()
menu
-------------------------------------------------*/
-menu_autofire::menu_autofire(mame_ui_manager &mui, render_container *container) : menu(mui, container), last_toggle(false)
+menu_autofire::menu_autofire(mame_ui_manager &mui, render_container &container) : menu(mui, container), last_toggle(false)
{
const screen_device *screen = mui.machine().first_screen();
diff --git a/src/frontend/mame/ui/cheatopt.h b/src/frontend/mame/ui/cheatopt.h
index 349ed4bf29c..7c0b8973587 100644
--- a/src/frontend/mame/ui/cheatopt.h
+++ b/src/frontend/mame/ui/cheatopt.h
@@ -19,8 +19,10 @@ namespace ui {
class menu_cheat : public menu
{
public:
- menu_cheat(mame_ui_manager &mui, render_container *container);
+ menu_cheat(mame_ui_manager &mui, render_container &container);
virtual ~menu_cheat() override;
+
+private:
virtual void populate() override;
virtual void handle() override;
};
@@ -29,12 +31,13 @@ public:
class menu_autofire : public menu
{
public:
- menu_autofire(mame_ui_manager &mui, render_container *container);
+ menu_autofire(mame_ui_manager &mui, render_container &container);
virtual ~menu_autofire() override;
+
+private:
virtual void populate() override;
virtual void handle() override;
-private:
float refresh;
bool last_toggle;
};
diff --git a/src/frontend/mame/ui/custmenu.cpp b/src/frontend/mame/ui/custmenu.cpp
index ed2db5fcd96..774cce13fe9 100644
--- a/src/frontend/mame/ui/custmenu.cpp
+++ b/src/frontend/mame/ui/custmenu.cpp
@@ -24,7 +24,7 @@ namespace ui {
//-------------------------------------------------
// ctor / dtor
//-------------------------------------------------
-menu_custom_filter::menu_custom_filter(mame_ui_manager &mui, render_container *container, bool _single_menu)
+menu_custom_filter::menu_custom_filter(mame_ui_manager &mui, render_container &container, bool _single_menu)
: menu(mui, container)
, m_single_menu(_single_menu)
, m_added(false)
@@ -106,7 +106,7 @@ void menu_custom_filter::handle()
else
s_sel[index] = main_filters::text[index];
- menu::stack_push<menu_selector>(ui(), container, s_sel, custfltr::other[pos]);
+ menu::stack_push<menu_selector>(ui(), container(), s_sel, custfltr::other[pos]);
}
}
else if ((FPTR)menu_event->itemref >= YEAR_FILTER && (FPTR)menu_event->itemref < YEAR_FILTER + MAX_CUST_FILTER)
@@ -123,7 +123,7 @@ void menu_custom_filter::handle()
changed = true;
}
else if (menu_event->iptkey == IPT_UI_SELECT)
- menu::stack_push<menu_selector>(ui(), container, c_year::ui, custfltr::year[pos]);
+ menu::stack_push<menu_selector>(ui(), container(), c_year::ui, custfltr::year[pos]);
}
else if ((FPTR)menu_event->itemref >= MNFCT_FILTER && (FPTR)menu_event->itemref < MNFCT_FILTER + MAX_CUST_FILTER)
{
@@ -139,7 +139,7 @@ void menu_custom_filter::handle()
changed = true;
}
else if (menu_event->iptkey == IPT_UI_SELECT)
- menu::stack_push<menu_selector>(ui(), container, c_mnfct::ui, custfltr::mnfct[pos]);
+ menu::stack_push<menu_selector>(ui(), container(), c_mnfct::ui, custfltr::mnfct[pos]);
}
}
@@ -155,7 +155,7 @@ void menu_custom_filter::handle()
void menu_custom_filter::populate()
{
// add main filter
- UINT32 arrow_flags = get_arrow_flags((int)FILTER_ALL, (int)FILTER_UNAVAILABLE, custfltr::main);
+ UINT32 arrow_flags = get_arrow_flags<UINT16>(FILTER_ALL, FILTER_UNAVAILABLE, custfltr::main);
item_append(_("Main filter"), main_filters::text[custfltr::main], arrow_flags, (void *)(FPTR)MAIN_FILTER);
// add other filters
@@ -164,7 +164,7 @@ void menu_custom_filter::populate()
item_append(menu_item_type::SEPARATOR);
// add filter items
- arrow_flags = get_arrow_flags((int)FILTER_UNAVAILABLE + 1, (int)FILTER_LAST - 1, custfltr::other[x]);
+ arrow_flags = get_arrow_flags<UINT16>(FILTER_UNAVAILABLE + 1, FILTER_LAST - 1, custfltr::other[x]);
item_append(_("Other filter"), main_filters::text[custfltr::other[x]], arrow_flags, (void *)(FPTR)(OTHER_FILTER + x));
if (m_added)
@@ -173,7 +173,7 @@ void menu_custom_filter::populate()
// add manufacturer subitem
if (custfltr::other[x] == FILTER_MANUFACTURER && c_mnfct::ui.size() > 0)
{
- arrow_flags = get_arrow_flags(0, c_mnfct::ui.size() - 1, custfltr::mnfct[x]);
+ arrow_flags = get_arrow_flags<UINT16>(0, c_mnfct::ui.size() - 1, custfltr::mnfct[x]);
std::string fbuff(_("^!Manufacturer"));
convert_command_glyph(fbuff);
item_append(fbuff, c_mnfct::ui[custfltr::mnfct[x]], arrow_flags, (void *)(FPTR)(MNFCT_FILTER + x));
@@ -182,7 +182,7 @@ void menu_custom_filter::populate()
// add year subitem
else if (custfltr::other[x] == FILTER_YEAR && c_year::ui.size() > 0)
{
- arrow_flags = get_arrow_flags(0, c_year::ui.size() - 1, custfltr::year[x]);
+ arrow_flags = get_arrow_flags<UINT16>(0, c_year::ui.size() - 1, custfltr::year[x]);
std::string fbuff(_("^!Year"));
convert_command_glyph(fbuff);
item_append(fbuff, c_year::ui[custfltr::year[x]], arrow_flags, (void *)(FPTR)(YEAR_FILTER + x));
@@ -209,7 +209,7 @@ void menu_custom_filter::custom_render(void *selectedref, float top, float botto
float width;
// get the size of the text
- ui().draw_text_full(container, _("Select custom filters:"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), _("Select custom filters:"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += (2.0f * UI_BOX_LR_BORDER) + 0.01f;
float maxwidth = MAX(width, origx2 - origx1);
@@ -221,7 +221,7 @@ void menu_custom_filter::custom_render(void *selectedref, float top, float botto
float y2 = origy1 - UI_BOX_TB_BORDER;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_GREEN_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -229,7 +229,7 @@ void menu_custom_filter::custom_render(void *selectedref, float top, float botto
y1 += UI_BOX_TB_BORDER;
// draw the text within it
- ui().draw_text_full(container, _("Select custom filters:"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), _("Select custom filters:"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
}
@@ -267,7 +267,7 @@ void menu_custom_filter::save_custom_filters()
//-------------------------------------------------
// ctor / dtor
//-------------------------------------------------
-menu_swcustom_filter::menu_swcustom_filter(mame_ui_manager &mui, render_container *container, const game_driver *_driver, s_filter &_filter)
+menu_swcustom_filter::menu_swcustom_filter(mame_ui_manager &mui, render_container &container, const game_driver *_driver, s_filter &_filter)
: menu(mui, container)
, m_added(false)
, m_filter(_filter)
@@ -345,7 +345,7 @@ void menu_swcustom_filter::handle()
else
s_sel[index] = sw_filters::text[index];
- menu::stack_push<menu_selector>(ui(), container, s_sel, sw_custfltr::other[pos]);
+ menu::stack_push<menu_selector>(ui(), container(), s_sel, sw_custfltr::other[pos]);
}
}
else if ((FPTR)menu_event->itemref >= YEAR_FILTER && (FPTR)menu_event->itemref < YEAR_FILTER + MAX_CUST_FILTER)
@@ -362,7 +362,7 @@ void menu_swcustom_filter::handle()
changed = true;
}
else if (menu_event->iptkey == IPT_UI_SELECT)
- menu::stack_push<menu_selector>(ui(), container, m_filter.year.ui, sw_custfltr::year[pos]);
+ menu::stack_push<menu_selector>(ui(), container(), m_filter.year.ui, sw_custfltr::year[pos]);
}
else if ((FPTR)menu_event->itemref >= TYPE_FILTER && (FPTR)menu_event->itemref < TYPE_FILTER + MAX_CUST_FILTER)
{
@@ -378,7 +378,7 @@ void menu_swcustom_filter::handle()
changed = true;
}
else if (menu_event->iptkey == IPT_UI_SELECT)
- menu::stack_push<menu_selector>(ui(), container, m_filter.type.ui, sw_custfltr::type[pos]);
+ menu::stack_push<menu_selector>(ui(), container(), m_filter.type.ui, sw_custfltr::type[pos]);
}
else if ((FPTR)menu_event->itemref >= MNFCT_FILTER && (FPTR)menu_event->itemref < MNFCT_FILTER + MAX_CUST_FILTER)
{
@@ -394,7 +394,7 @@ void menu_swcustom_filter::handle()
changed = true;
}
else if (menu_event->iptkey == IPT_UI_SELECT)
- menu::stack_push<menu_selector>(ui(), container, m_filter.publisher.ui, sw_custfltr::mnfct[pos]);
+ menu::stack_push<menu_selector>(ui(), container(), m_filter.publisher.ui, sw_custfltr::mnfct[pos]);
}
else if ((FPTR)menu_event->itemref >= REGION_FILTER && (FPTR)menu_event->itemref < REGION_FILTER + MAX_CUST_FILTER)
{
@@ -410,7 +410,7 @@ void menu_swcustom_filter::handle()
changed = true;
}
else if (menu_event->iptkey == IPT_UI_SELECT)
- menu::stack_push<menu_selector>(ui(), container, m_filter.region.ui, sw_custfltr::region[pos]);
+ menu::stack_push<menu_selector>(ui(), container(), m_filter.region.ui, sw_custfltr::region[pos]);
}
else if ((FPTR)menu_event->itemref >= LIST_FILTER && (FPTR)menu_event->itemref < LIST_FILTER + MAX_CUST_FILTER)
{
@@ -426,7 +426,7 @@ void menu_swcustom_filter::handle()
changed = true;
}
else if (menu_event->iptkey == IPT_UI_SELECT)
- menu::stack_push<menu_selector>(ui(), container, m_filter.swlist.description, sw_custfltr::list[pos]);
+ menu::stack_push<menu_selector>(ui(), container(), m_filter.swlist.description, sw_custfltr::list[pos]);
}
}
@@ -442,7 +442,7 @@ void menu_swcustom_filter::handle()
void menu_swcustom_filter::populate()
{
// add main filter
- UINT32 arrow_flags = get_arrow_flags((int)UI_SW_ALL, (int)UI_SW_UNAVAILABLE, sw_custfltr::main);
+ UINT32 arrow_flags = get_arrow_flags<UINT16>(UI_SW_ALL, UI_SW_UNAVAILABLE, sw_custfltr::main);
item_append(_("Main filter"), sw_filters::text[sw_custfltr::main], arrow_flags, (void *)(FPTR)MAIN_FILTER);
// add other filters
@@ -451,7 +451,7 @@ void menu_swcustom_filter::populate()
item_append(menu_item_type::SEPARATOR);
// add filter items
- arrow_flags = get_arrow_flags((int)UI_SW_UNAVAILABLE + 1, (int)UI_SW_LAST - 1, sw_custfltr::other[x]);
+ arrow_flags = get_arrow_flags<UINT16>(UI_SW_UNAVAILABLE + 1, UI_SW_LAST - 1, sw_custfltr::other[x]);
item_append(_("Other filter"), sw_filters::text[sw_custfltr::other[x]], arrow_flags, (void *)(FPTR)(OTHER_FILTER + x));
if (m_added)
@@ -460,7 +460,7 @@ void menu_swcustom_filter::populate()
// add publisher subitem
if (sw_custfltr::other[x] == UI_SW_PUBLISHERS && m_filter.publisher.ui.size() > 0)
{
- arrow_flags = get_arrow_flags(0, m_filter.publisher.ui.size() - 1, sw_custfltr::mnfct[x]);
+ arrow_flags = get_arrow_flags<UINT16>(0, m_filter.publisher.ui.size() - 1, sw_custfltr::mnfct[x]);
std::string fbuff(_("^!Publisher"));
convert_command_glyph(fbuff);
item_append(fbuff, m_filter.publisher.ui[sw_custfltr::mnfct[x]], arrow_flags, (void *)(FPTR)(MNFCT_FILTER + x));
@@ -469,7 +469,7 @@ void menu_swcustom_filter::populate()
// add year subitem
else if (sw_custfltr::other[x] == UI_SW_YEARS && m_filter.year.ui.size() > 0)
{
- arrow_flags = get_arrow_flags(0, m_filter.year.ui.size() - 1, sw_custfltr::year[x]);
+ arrow_flags = get_arrow_flags<UINT16>(0, m_filter.year.ui.size() - 1, sw_custfltr::year[x]);
std::string fbuff(_("^!Year"));
convert_command_glyph(fbuff);
item_append(fbuff, m_filter.year.ui[sw_custfltr::year[x]], arrow_flags, (void *)(FPTR)(YEAR_FILTER + x));
@@ -478,7 +478,7 @@ void menu_swcustom_filter::populate()
// add year subitem
else if (sw_custfltr::other[x] == UI_SW_LIST && m_filter.swlist.name.size() > 0)
{
- arrow_flags = get_arrow_flags(0, m_filter.swlist.name.size() - 1, sw_custfltr::list[x]);
+ arrow_flags = get_arrow_flags<UINT16>(0, m_filter.swlist.name.size() - 1, sw_custfltr::list[x]);
std::string fbuff(_("^!Software List"));
convert_command_glyph(fbuff);
item_append(fbuff, m_filter.swlist.description[sw_custfltr::list[x]], arrow_flags, (void *)(FPTR)(LIST_FILTER + x));
@@ -487,7 +487,7 @@ void menu_swcustom_filter::populate()
// add device type subitem
else if (sw_custfltr::other[x] == UI_SW_TYPE && m_filter.type.ui.size() > 0)
{
- arrow_flags = get_arrow_flags(0, m_filter.type.ui.size() - 1, sw_custfltr::type[x]);
+ arrow_flags = get_arrow_flags<UINT16>(0, m_filter.type.ui.size() - 1, sw_custfltr::type[x]);
std::string fbuff(_("^!Device type"));
convert_command_glyph(fbuff);
item_append(fbuff, m_filter.type.ui[sw_custfltr::type[x]], arrow_flags, (void *)(FPTR)(TYPE_FILTER + x));
@@ -496,7 +496,7 @@ void menu_swcustom_filter::populate()
// add region subitem
else if (sw_custfltr::other[x] == UI_SW_REGION && m_filter.region.ui.size() > 0)
{
- arrow_flags = get_arrow_flags(0, m_filter.region.ui.size() - 1, sw_custfltr::region[x]);
+ arrow_flags = get_arrow_flags<UINT16>(0, m_filter.region.ui.size() - 1, sw_custfltr::region[x]);
std::string fbuff(_("^!Region"));
convert_command_glyph(fbuff);
item_append(fbuff, m_filter.region.ui[sw_custfltr::region[x]], arrow_flags, (void *)(FPTR)(REGION_FILTER + x));
@@ -524,7 +524,7 @@ void menu_swcustom_filter::custom_render(void *selectedref, float top, float bot
float width;
// get the size of the text
- ui().draw_text_full(container, _("Select custom filters:"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), _("Select custom filters:"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += (2.0f * UI_BOX_LR_BORDER) + 0.01f;
float maxwidth = MAX(width, origx2 - origx1);
@@ -536,7 +536,7 @@ void menu_swcustom_filter::custom_render(void *selectedref, float top, float bot
float y2 = origy1 - UI_BOX_TB_BORDER;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_GREEN_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -544,7 +544,7 @@ void menu_swcustom_filter::custom_render(void *selectedref, float top, float bot
y1 += UI_BOX_TB_BORDER;
// draw the text within it
- ui().draw_text_full(container, _("Select custom filters:"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), _("Select custom filters:"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
}
diff --git a/src/frontend/mame/ui/custmenu.h b/src/frontend/mame/ui/custmenu.h
index 9bd4ba9b4ef..5d3084f9121 100644
--- a/src/frontend/mame/ui/custmenu.h
+++ b/src/frontend/mame/ui/custmenu.h
@@ -9,11 +9,11 @@
***************************************************************************/
-#pragma once
-
#ifndef MAME_FRONTEND_UI_CUSTMENU_H
#define MAME_FRONTEND_UI_CUSTMENU_H
+#pragma once
+
#include "ui/menu.h"
#include "ui/utils.h"
@@ -75,10 +75,10 @@ struct s_filter
class menu_swcustom_filter : public menu
{
public:
- menu_swcustom_filter(mame_ui_manager &mui, render_container *container, const game_driver *_driver, s_filter &_filter);
+ 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;
+
+protected:
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
private:
@@ -95,11 +95,14 @@ private:
OTHER_FILTER = LIST_FILTER + MAX_CUST_FILTER + 1
};
+ virtual void populate() override;
+ virtual void handle() override;
+
+ void save_sw_custom_filters();
+
bool m_added;
s_filter &m_filter;
const game_driver *m_driver;
-
- void save_sw_custom_filters();
};
//-------------------------------------------------
@@ -108,10 +111,10 @@ private:
class menu_custom_filter : public menu
{
public:
- menu_custom_filter(mame_ui_manager &mui, render_container *container, bool _single_menu = false);
+ 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;
+
+protected:
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
private:
@@ -125,9 +128,12 @@ private:
SCREEN_FILTER = YEAR_FILTER + MAX_CUST_FILTER + 1,
OTHER_FILTER = SCREEN_FILTER + MAX_CUST_FILTER + 1
};
+ virtual void populate() override;
+ virtual void handle() override;
- bool m_single_menu, m_added;
void save_custom_filters();
+
+ bool m_single_menu, m_added;
};
} // namespace ui
diff --git a/src/frontend/mame/ui/custui.cpp b/src/frontend/mame/ui/custui.cpp
index 0b2032631e7..060f50a2239 100644
--- a/src/frontend/mame/ui/custui.cpp
+++ b/src/frontend/mame/ui/custui.cpp
@@ -21,9 +21,12 @@
#include "osdepend.h"
#include "uiinput.h"
+#include <algorithm>
+#include <utility>
+
namespace ui {
-const char *const menu_custom_ui::hide_status[] = {
+const char *const menu_custom_ui::HIDE_STATUS[] = {
__("Show All"),
__("Hide Filters"),
__("Hide Info/Image"),
@@ -33,14 +36,15 @@ const char *const menu_custom_ui::hide_status[] = {
// ctor
//-------------------------------------------------
-menu_custom_ui::menu_custom_ui(mame_ui_manager &mui, render_container *container) : menu(mui, container)
+menu_custom_ui::menu_custom_ui(mame_ui_manager &mui, render_container &container) : menu(mui, container)
{
// load languages
file_enumerator path(mui.machine().options().language_path());
auto lang = mui.machine().options().language();
const osd::directory::entry *dirent;
- int cnt = 0;
+ std::size_t cnt = 0;
while ((dirent = path.next()) != nullptr)
+ {
if (dirent->type == osd::directory::entry::entry_type::DIR && strcmp(dirent->name, ".") != 0 && strcmp(dirent->name, "..") != 0)
{
auto name = std::string(dirent->name);
@@ -51,6 +55,7 @@ menu_custom_ui::menu_custom_ui(mame_ui_manager &mui, render_container *container
m_currlang = cnt;
++cnt;
}
+ }
}
//-------------------------------------------------
@@ -87,11 +92,11 @@ void menu_custom_ui::handle()
{
case FONT_MENU:
if (menu_event->iptkey == IPT_UI_SELECT)
- menu::stack_push<menu_font_ui>(ui(), container);
+ menu::stack_push<menu_font_ui>(ui(), container());
break;
case COLORS_MENU:
if (menu_event->iptkey == IPT_UI_SELECT)
- menu::stack_push<menu_colors_ui>(ui(), container);
+ menu::stack_push<menu_colors_ui>(ui(), container());
break;
case HIDE_MENU:
{
@@ -102,12 +107,9 @@ void menu_custom_ui::handle()
}
else if (menu_event->iptkey == IPT_UI_SELECT)
{
- int total = ARRAY_LENGTH(hide_status);
- std::vector<std::string> s_sel(total);
- for (int index = 0; index < total; ++index)
- s_sel[index] = _(hide_status[index]);
-
- menu::stack_push<menu_selector>(ui(), container, s_sel, ui_globals::panels_status);
+ std::vector<std::string> s_sel(ARRAY_LENGTH(HIDE_STATUS));
+ std::transform(std::begin(HIDE_STATUS), std::end(HIDE_STATUS), s_sel.begin(), [](auto &s) { return _(s); });
+ menu::stack_push<menu_selector>(ui(), container(), std::move(s_sel), ui_globals::panels_status);
}
break;
}
@@ -120,12 +122,7 @@ void menu_custom_ui::handle()
}
else if (menu_event->iptkey == IPT_UI_SELECT)
{
- int total = m_lang.size();
- std::vector<std::string> s_sel(total);
- for (int index = 0; index < total; ++index)
- s_sel[index] = m_lang[index];
-
- menu::stack_push<menu_selector>(ui(), container, s_sel, m_currlang);
+ menu::stack_push<menu_selector>(ui(), container(), m_lang, m_currlang);
}
break;
}
@@ -148,12 +145,12 @@ void menu_custom_ui::populate()
if (!m_lang.empty())
{
- arrow_flags = get_arrow_flags(0, m_lang.size() - 1, m_currlang);
+ arrow_flags = get_arrow_flags<std::uint16_t>(0, m_lang.size() - 1, m_currlang);
item_append(_("Language"), m_lang[m_currlang].c_str(), arrow_flags, (void *)(FPTR)LANGUAGE_MENU);
}
- arrow_flags = get_arrow_flags(0, (int)HIDE_BOTH, ui_globals::panels_status);
- item_append(_("Show side panels"), _(hide_status[ui_globals::panels_status]), arrow_flags, (void *)(FPTR)HIDE_MENU);
+ arrow_flags = get_arrow_flags<UINT16>(0, HIDE_BOTH, ui_globals::panels_status);
+ item_append(_("Show side panels"), _(HIDE_STATUS[ui_globals::panels_status]), arrow_flags, (void *)(FPTR)HIDE_MENU);
item_append(menu_item_type::SEPARATOR);
customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
@@ -167,7 +164,7 @@ void menu_custom_ui::custom_render(void *selectedref, float top, float bottom, f
{
float width;
- ui().draw_text_full(container, _("Custom UI Settings"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), _("Custom UI Settings"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
float maxwidth = MAX(origx2 - origx1, width);
@@ -179,7 +176,7 @@ void menu_custom_ui::custom_render(void *selectedref, float top, float bottom, f
float y2 = origy1 - UI_BOX_TB_BORDER;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_GREEN_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -187,7 +184,7 @@ void menu_custom_ui::custom_render(void *selectedref, float top, float bottom, f
y1 += UI_BOX_TB_BORDER;
// draw the text within it
- ui().draw_text_full(container, _("Custom UI Settings"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), _("Custom UI Settings"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
}
@@ -195,7 +192,7 @@ void menu_custom_ui::custom_render(void *selectedref, float top, float bottom, f
// ctor
//-------------------------------------------------
-menu_font_ui::menu_font_ui(mame_ui_manager &mui, render_container *container) : menu(mui, container)
+menu_font_ui::menu_font_ui(mame_ui_manager &mui, render_container &container) : menu(mui, container)
{
ui_options &moptions = mui.options();
std::string name(mui.machine().options().ui_font());
@@ -207,7 +204,7 @@ menu_font_ui::menu_font_ui(mame_ui_manager &mui, render_container *container) :
#endif
m_actual = 0;
- for (size_t index = 0; index < m_fonts.size(); index++)
+ for (std::size_t index = 0; index < m_fonts.size(); index++)
{
if (m_fonts[index].first == name)
{
@@ -316,7 +313,7 @@ void menu_font_ui::handle()
std::vector<std::string> display_names;
display_names.reserve(m_fonts.size());
for (auto const &font : m_fonts) display_names.emplace_back(font.second);
- menu::stack_push<menu_selector>(ui(), container, std::move(display_names), m_actual);
+ menu::stack_push<menu_selector>(ui(), container(), std::move(display_names), m_actual);
changed = true;
}
break;
@@ -347,7 +344,7 @@ void menu_font_ui::populate()
UINT32 arrow_flags;
// add fonts option
- arrow_flags = get_arrow_flags(0, m_fonts.size() - 1, m_actual);
+ arrow_flags = get_arrow_flags<std::uint16_t>(0, m_fonts.size() - 1, m_actual);
item_append(_("UI Font"), m_fonts[m_actual].second, arrow_flags, (void *)(FPTR)MUI_FNT);
#ifdef UI_WINDOWS
@@ -383,7 +380,7 @@ void menu_font_ui::custom_render(void *selectedref, float top, float bottom, flo
// top text
std::string topbuf(_("UI Fonts Settings"));
- ui().draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), topbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
float maxwidth = MAX(origx2 - origx1, width);
@@ -395,7 +392,7 @@ void menu_font_ui::custom_render(void *selectedref, float top, float bottom, flo
float y2 = origy1 - UI_BOX_TB_BORDER;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_GREEN_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -403,14 +400,14 @@ void menu_font_ui::custom_render(void *selectedref, float top, float bottom, flo
y1 += UI_BOX_TB_BORDER;
// draw the text within it
- ui().draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), topbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
if ((FPTR)selectedref == INFOS_SIZE)
{
topbuf = _("Sample text - Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
- ui().draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::LEFT, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), topbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::LEFT, ui::text_layout::NEVER,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr, m_info_size);
width += 2 * UI_BOX_LR_BORDER;
maxwidth = MAX(origx2 - origx1, width);
@@ -422,7 +419,7 @@ void menu_font_ui::custom_render(void *selectedref, float top, float bottom, flo
y2 = origy2 + bottom;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_GREEN_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -430,7 +427,7 @@ void menu_font_ui::custom_render(void *selectedref, float top, float bottom, flo
y1 += UI_BOX_TB_BORDER;
// draw the text within it
- ui().draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::LEFT, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), topbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::LEFT, ui::text_layout::NEVER,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, m_info_size);
}
}
@@ -440,7 +437,7 @@ void menu_font_ui::custom_render(void *selectedref, float top, float bottom, flo
//-------------------------------------------------
#define SET_COLOR_UI(var, opt) var[M##opt].color = opt; var[M##opt].option = OPTION_##opt
-menu_colors_ui::menu_colors_ui(mame_ui_manager &mui, render_container *container) : menu(mui, container)
+menu_colors_ui::menu_colors_ui(mame_ui_manager &mui, render_container &container) : menu(mui, container)
{
SET_COLOR_UI(m_color_table, UI_BACKGROUND_COLOR);
SET_COLOR_UI(m_color_table, UI_BORDER_COLOR);
@@ -488,7 +485,7 @@ void menu_colors_ui::handle()
if (menu_event != nullptr && menu_event->itemref != nullptr && menu_event->iptkey == IPT_UI_SELECT)
{
if ((FPTR)menu_event->itemref != MUI_RESTORE)
- menu::stack_push<menu_rgb_ui>(ui(), container, &m_color_table[(FPTR)menu_event->itemref].color, item[selected].text);
+ menu::stack_push<menu_rgb_ui>(ui(), container(), &m_color_table[(FPTR)menu_event->itemref].color, item[selected].text);
else
{
changed = true;
@@ -541,7 +538,7 @@ void menu_colors_ui::custom_render(void *selectedref, float top, float bottom, f
// top text
std::string topbuf(_("UI Colors Settings"));
- ui().draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), topbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
maxwidth = MAX(maxwidth, width);
@@ -553,7 +550,7 @@ void menu_colors_ui::custom_render(void *selectedref, float top, float bottom, f
float y2 = origy1 - UI_BOX_TB_BORDER;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_GREEN_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -561,7 +558,7 @@ void menu_colors_ui::custom_render(void *selectedref, float top, float bottom, f
y1 += UI_BOX_TB_BORDER;
// draw the text within it
- ui().draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), topbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
// bottom text
@@ -569,7 +566,7 @@ void menu_colors_ui::custom_render(void *selectedref, float top, float bottom, f
std::string ui_select_text = machine().input().seq_name(machine().ioport().type_seq(IPT_UI_SELECT, 0, SEQ_TYPE_STANDARD));
topbuf = string_format(_("Double click or press %1$s to change the color value"), ui_select_text);
- ui().draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), topbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
maxwidth = MAX(maxwidth, width);
@@ -581,7 +578,7 @@ void menu_colors_ui::custom_render(void *selectedref, float top, float bottom, f
y2 = origy2 + bottom;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_RED_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_RED_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -589,13 +586,13 @@ void menu_colors_ui::custom_render(void *selectedref, float top, float bottom, f
y1 += UI_BOX_TB_BORDER;
// draw the text within it
- ui().draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), topbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
// compute maxwidth
topbuf = _("Menu Preview");
- ui().draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), topbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
maxwidth = width + 2.0f * UI_BOX_LR_BORDER;
@@ -609,7 +606,7 @@ void menu_colors_ui::custom_render(void *selectedref, float top, float bottom, f
for (auto & elem: sampletxt)
{
- ui().draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), elem.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
maxwidth = MAX(maxwidth, width);
@@ -622,7 +619,7 @@ void menu_colors_ui::custom_render(void *selectedref, float top, float bottom, f
y2 = y1 + bottom - UI_BOX_TB_BORDER;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_GREEN_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -631,7 +628,7 @@ void menu_colors_ui::custom_render(void *selectedref, float top, float bottom, f
y2 -= UI_BOX_TB_BORDER;
// draw the text within it
- ui().draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), topbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
// compute our bounds for menu preview
@@ -641,7 +638,7 @@ void menu_colors_ui::custom_render(void *selectedref, float top, float bottom, f
y2 = y1 + 5.0f * line_height + 2.0f * UI_BOX_TB_BORDER;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, m_color_table[MUI_BACKGROUND_COLOR].color);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, m_color_table[MUI_BACKGROUND_COLOR].color);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -649,29 +646,29 @@ void menu_colors_ui::custom_render(void *selectedref, float top, float bottom, f
y1 += UI_BOX_TB_BORDER;
// draw normal text
- ui().draw_text_full(container, sampletxt[0].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), sampletxt[0].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NORMAL, m_color_table[MUI_TEXT_COLOR].color, m_color_table[MUI_TEXT_BG_COLOR].color, nullptr, nullptr);
y1 += line_height;
// draw subitem text
- ui().draw_text_full(container, sampletxt[1].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), sampletxt[1].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NORMAL, m_color_table[MUI_SUBITEM_COLOR].color, m_color_table[MUI_TEXT_BG_COLOR].color, nullptr, nullptr);
y1 += line_height;
// draw selected text
- highlight(container, x1, y1, x2, y1 + line_height, m_color_table[MUI_SELECTED_BG_COLOR].color);
- ui().draw_text_full(container, sampletxt[2].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ highlight(x1, y1, x2, y1 + line_height, m_color_table[MUI_SELECTED_BG_COLOR].color);
+ ui().draw_text_full(container(), sampletxt[2].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NORMAL, m_color_table[MUI_SELECTED_COLOR].color, m_color_table[MUI_SELECTED_BG_COLOR].color, nullptr, nullptr);
y1 += line_height;
// draw mouse over text
- highlight(container, x1, y1, x2, y1 + line_height, m_color_table[MUI_MOUSEOVER_BG_COLOR].color);
- ui().draw_text_full(container, sampletxt[3].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ highlight(x1, y1, x2, y1 + line_height, m_color_table[MUI_MOUSEOVER_BG_COLOR].color);
+ ui().draw_text_full(container(), sampletxt[3].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NORMAL, m_color_table[MUI_MOUSEOVER_COLOR].color, m_color_table[MUI_MOUSEOVER_BG_COLOR].color, nullptr, nullptr);
y1 += line_height;
// draw clone text
- ui().draw_text_full(container, sampletxt[4].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), sampletxt[4].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NORMAL, m_color_table[MUI_CLONE_COLOR].color, m_color_table[MUI_TEXT_BG_COLOR].color, nullptr, nullptr);
}
@@ -691,7 +688,7 @@ void menu_colors_ui::restore_colors()
// ctor
//-------------------------------------------------
-menu_rgb_ui::menu_rgb_ui(mame_ui_manager &mui, render_container *container, rgb_t *_color, std::string _title) : menu(mui, container)
+menu_rgb_ui::menu_rgb_ui(mame_ui_manager &mui, render_container &container, rgb_t *_color, std::string _title) : menu(mui, container)
{
m_color = _color;
m_key_active = false;
@@ -814,7 +811,7 @@ void menu_rgb_ui::handle()
case PALETTE_CHOOSE:
if (menu_event->iptkey == IPT_UI_SELECT)
- menu::stack_push<menu_palette_sel>(ui(), container, *m_color);
+ menu::stack_push<menu_palette_sel>(ui(), container(), *m_color);
break;
}
}
@@ -835,7 +832,7 @@ void menu_rgb_ui::populate()
if (m_lock_ref != RGB_ALPHA)
{
- arrow_flags = get_arrow_flags(0, 255, m_color->a());
+ arrow_flags = get_arrow_flags<UINT8>(0, 255, m_color->a());
item_append(_("Alpha"), string_format("%3u", m_color->a()), arrow_flags, (void *)(FPTR)RGB_ALPHA);
}
else
@@ -843,7 +840,7 @@ void menu_rgb_ui::populate()
if (m_lock_ref != RGB_RED)
{
- arrow_flags = get_arrow_flags(0, 255, m_color->r());
+ arrow_flags = get_arrow_flags<UINT8>(0, 255, m_color->r());
item_append(_("Red"), string_format("%3u", m_color->r()), arrow_flags, (void *)(FPTR)RGB_RED);
}
else
@@ -851,7 +848,7 @@ void menu_rgb_ui::populate()
if (m_lock_ref != RGB_GREEN)
{
- arrow_flags = get_arrow_flags(0, 255, m_color->g());
+ arrow_flags = get_arrow_flags<UINT8>(0, 255, m_color->g());
item_append(_("Green"), string_format("%3u", m_color->g()), arrow_flags, (void *)(FPTR)RGB_GREEN);
}
else
@@ -859,7 +856,7 @@ void menu_rgb_ui::populate()
if (m_lock_ref != RGB_BLUE)
{
- arrow_flags = get_arrow_flags(0, 255, m_color->b());
+ arrow_flags = get_arrow_flags<UINT8>(0, 255, m_color->b());
item_append(_("Blue"), string_format("%3u", m_color->b()), arrow_flags, (void *)(FPTR)RGB_BLUE);
}
else
@@ -882,7 +879,7 @@ void menu_rgb_ui::custom_render(void *selectedref, float top, float bottom, floa
// top text
std::string topbuf = std::string(m_title).append(_(" - ARGB Settings"));
- ui().draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), topbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
maxwidth = MAX(maxwidth, width);
@@ -894,7 +891,7 @@ void menu_rgb_ui::custom_render(void *selectedref, float top, float bottom, floa
float y2 = origy1 - UI_BOX_TB_BORDER;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_GREEN_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -902,12 +899,12 @@ void menu_rgb_ui::custom_render(void *selectedref, float top, float bottom, floa
y1 += UI_BOX_TB_BORDER;
// draw the text within it
- ui().draw_text_full(container, topbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), topbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
std::string sampletxt(_("Color preview ="));
maxwidth = origx2 - origx1;
- ui().draw_text_full(container, sampletxt.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), sampletxt.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
maxwidth = MAX(maxwidth, width);
@@ -919,7 +916,7 @@ void menu_rgb_ui::custom_render(void *selectedref, float top, float bottom, floa
y2 = origy2 + bottom;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_RED_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_RED_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -927,7 +924,7 @@ void menu_rgb_ui::custom_render(void *selectedref, float top, float bottom, floa
y1 += UI_BOX_TB_BORDER;
// draw the normal text
- ui().draw_text_full(container, sampletxt.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), sampletxt.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NORMAL, rgb_t::white, rgb_t::black, nullptr, nullptr);
float t_x2 = x1 - UI_BOX_LR_BORDER + maxwidth;
@@ -935,7 +932,7 @@ void menu_rgb_ui::custom_render(void *selectedref, float top, float bottom, floa
x2 = t_x2;
y1 -= UI_BOX_TB_BORDER;
- ui().draw_outlined_box(container, x1, y1, x2, y2, *m_color);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, *m_color);
}
@@ -1021,7 +1018,7 @@ std::pair<const char *, const char *> const menu_palette_sel::s_palette[] = {
// ctor
//-------------------------------------------------
-menu_palette_sel::menu_palette_sel(mame_ui_manager &mui, render_container *container, rgb_t &_color)
+menu_palette_sel::menu_palette_sel(mame_ui_manager &mui, render_container &container, rgb_t &_color)
: menu(mui, container), m_original(_color)
{
}
@@ -1138,7 +1135,7 @@ void menu_palette_sel::draw(UINT32 flags)
float y1 = visible_top - UI_BOX_TB_BORDER;
float x2 = visible_left + visible_width + UI_BOX_LR_BORDER;
float y2 = visible_top + visible_main_menu_height + UI_BOX_TB_BORDER;
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_BACKGROUND_COLOR);
// determine the first visible line based on the current selection
int top_line = selected - visible_lines / 2;
@@ -1156,7 +1153,7 @@ void menu_palette_sel::draw(UINT32 flags)
mouse_button = false;
mouse_target = machine().ui_input().find_mouse(&mouse_target_x, &mouse_target_y, &mouse_button);
if (mouse_target != nullptr)
- if (mouse_target->map_point_container(mouse_target_x, mouse_target_y, *container, mouse_x, mouse_y))
+ if (mouse_target->map_point_container(mouse_target_x, mouse_target_y, container(), mouse_x, mouse_y))
mouse_hit = true;
// loop over visible lines
@@ -1195,12 +1192,12 @@ void menu_palette_sel::draw(UINT32 flags)
// if we have some background hilighting to do, add a quad behind everything else
if (bgcolor != UI_TEXT_BG_COLOR)
- highlight(container, line_x0, line_y0, line_x1, line_y1, bgcolor);
+ highlight(line_x0, line_y0, line_x1, line_y1, bgcolor);
// if we're on the top line, display the up arrow
if (linenum == 0 && top_line != 0)
{
- draw_arrow(container,
+ draw_arrow(
0.5f * (x1 + x2) - 0.5f * ud_arrow_width,
line_y + 0.25f * line_height,
0.5f * (x1 + x2) + 0.5f * ud_arrow_width,
@@ -1214,7 +1211,7 @@ void menu_palette_sel::draw(UINT32 flags)
// if we're on the bottom line, display the down arrow
else if (linenum == visible_lines - 1 && itemnum != item.size() - 1)
{
- draw_arrow(container,
+ draw_arrow(
0.5f * (x1 + x2) - 0.5f * ud_arrow_width,
line_y + 0.25f * line_height,
0.5f * (x1 + x2) + 0.5f * ud_arrow_width,
@@ -1227,11 +1224,11 @@ void menu_palette_sel::draw(UINT32 flags)
// if we're just a divider, draw a line
else if (pitem.type == menu_item_type::SEPARATOR)
- container->add_line(visible_left, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container().add_line(visible_left, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
// if we don't have a subitem, just draw the string centered
else if (pitem.subtext.empty())
- ui().draw_text_full(container, itemtext, effective_left, line_y, effective_width,
+ ui().draw_text_full(container(), itemtext, effective_left, line_y, effective_width,
ui::text_layout::CENTER, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr);
// otherwise, draw the item on the left and the subitem text on the right
@@ -1241,13 +1238,13 @@ void menu_palette_sel::draw(UINT32 flags)
rgb_t color = rgb_t((UINT32)strtoul(subitem_text, nullptr, 16));
// draw the left-side text
- ui().draw_text_full(container, itemtext, effective_left, line_y, effective_width,
+ ui().draw_text_full(container(), itemtext, effective_left, line_y, effective_width,
ui::text_layout::LEFT, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr);
// give 2 spaces worth of padding
float subitem_width = ui().get_string_width("FF00FF00");
- ui().draw_outlined_box(container, effective_left + effective_width - subitem_width, line_y0,
+ ui().draw_outlined_box(container(), effective_left + effective_width - subitem_width, line_y0,
effective_left + effective_width, line_y1, color);
}
}
diff --git a/src/frontend/mame/ui/custui.h b/src/frontend/mame/ui/custui.h
index 59fba714c5e..904ca3283c3 100644
--- a/src/frontend/mame/ui/custui.h
+++ b/src/frontend/mame/ui/custui.h
@@ -23,10 +23,10 @@ namespace ui {
class menu_custom_ui : public menu
{
public:
- menu_custom_ui(mame_ui_manager &mui, render_container *container);
+ menu_custom_ui(mame_ui_manager &mui, render_container &container);
virtual ~menu_custom_ui() override;
- virtual void populate() override;
- virtual void handle() override;
+
+protected:
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
private:
@@ -37,9 +37,14 @@ private:
COLORS_MENU,
HIDE_MENU
};
- static const char *const hide_status[];
- std::vector<std::string> m_lang;
- std::uint16_t m_currlang;
+
+ virtual void populate() override;
+ virtual void handle() override;
+
+ static const char *const HIDE_STATUS[];
+
+ std::vector<std::string> m_lang;
+ std::uint16_t m_currlang;
};
//-------------------------------------------------
@@ -49,10 +54,10 @@ private:
class menu_font_ui : public menu
{
public:
- menu_font_ui(mame_ui_manager &mui, render_container *container);
+ menu_font_ui(mame_ui_manager &mui, render_container &container);
virtual ~menu_font_ui() override;
- virtual void populate() override;
- virtual void handle() override;
+
+protected:
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
private:
@@ -65,6 +70,9 @@ private:
MUI_ITALIC
};
+ virtual void populate() override;
+ virtual void handle() override;
+
void list();
std::uint16_t m_actual;
@@ -84,10 +92,10 @@ private:
class menu_colors_ui : public menu
{
public:
- menu_colors_ui(mame_ui_manager &mui, render_container *container);
+ menu_colors_ui(mame_ui_manager &mui, render_container &container);
virtual ~menu_colors_ui() override;
- virtual void populate() override;
- virtual void handle() override;
+
+protected:
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
private:
@@ -118,6 +126,9 @@ private:
const char *option;
};
+ virtual void populate() override;
+ virtual void handle() override;
+
s_color_table m_color_table[MUI_RESTORE];
void restore_colors();
};
@@ -129,19 +140,13 @@ private:
class menu_rgb_ui : public menu
{
public:
- menu_rgb_ui(mame_ui_manager &mui, render_container *container, rgb_t *_color, std::string _title);
+ menu_rgb_ui(mame_ui_manager &mui, render_container &container, rgb_t *_color, std::string _title);
virtual ~menu_rgb_ui() override;
- virtual void populate() override;
- virtual void handle() override;
+
+protected:
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
private:
- rgb_t *m_color;
- char m_search[4];
- bool m_key_active;
- int m_lock_ref;
- std::string m_title;
-
enum
{
RGB_ALPHA = 1,
@@ -151,7 +156,16 @@ private:
PALETTE_CHOOSE
};
+ virtual void populate() override;
+ virtual void handle() override;
+
void inkey_special(const event *menu_event);
+
+ rgb_t *m_color;
+ char m_search[4];
+ bool m_key_active;
+ int m_lock_ref;
+ std::string m_title;
};
//-------------------------------------------------
@@ -161,16 +175,19 @@ private:
class menu_palette_sel : public menu
{
public:
- menu_palette_sel(mame_ui_manager &mui, render_container *container, rgb_t &_color);
+ menu_palette_sel(mame_ui_manager &mui, render_container &container, rgb_t &_color);
virtual ~menu_palette_sel() override;
- virtual void populate() override;
- virtual void handle() override;
+
+protected:
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
private:
// draw palette menu
virtual void draw(UINT32 flags) override;
+ virtual void populate() override;
+ virtual void handle() override;
+
static std::pair<const char *, const char *> const s_palette[];
rgb_t &m_original;
};
diff --git a/src/frontend/mame/ui/datmenu.cpp b/src/frontend/mame/ui/datmenu.cpp
index 346d3572bf8..c4d7b809266 100644
--- a/src/frontend/mame/ui/datmenu.cpp
+++ b/src/frontend/mame/ui/datmenu.cpp
@@ -28,7 +28,7 @@ namespace ui {
// ctor / dtor
//-------------------------------------------------
-menu_dats_view::menu_dats_view(mame_ui_manager &mui, render_container *container, const game_driver *driver)
+menu_dats_view::menu_dats_view(mame_ui_manager &mui, render_container &container, const game_driver *driver)
: menu(mui, container)
, m_actual(0)
, m_driver((driver == nullptr) ? &mui.machine().system() : driver)
@@ -53,7 +53,7 @@ menu_dats_view::menu_dats_view(mame_ui_manager &mui, render_container *container
// ctor
//-------------------------------------------------
-menu_dats_view::menu_dats_view(mame_ui_manager &mui, render_container *container, ui_software_info *swinfo, const game_driver *driver)
+menu_dats_view::menu_dats_view(mame_ui_manager &mui, render_container &container, ui_software_info *swinfo, const game_driver *driver)
: menu(mui, container)
, m_actual(0)
, m_driver((driver == nullptr) ? &mui.machine().system() : driver)
@@ -147,7 +147,7 @@ void menu_dats_view::draw(UINT32 flags)
mouse_button = false;
mouse_target = machine().ui_input().find_mouse(&mouse_target_x, &mouse_target_y, &mouse_button);
if (mouse_target != nullptr)
- if (mouse_target->map_point_container(mouse_target_x, mouse_target_y, *container, mouse_x, mouse_y))
+ if (mouse_target->map_point_container(mouse_target_x, mouse_target_y, container(), mouse_x, mouse_y))
mouse_hit = true;
// account for extra space at the top and bottom
@@ -168,7 +168,7 @@ void menu_dats_view::draw(UINT32 flags)
float y2 = visible_top + visible_main_menu_height + UI_BOX_TB_BORDER + extra_height;
float line = visible_top + float(m_visible_lines) * line_height;
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_BACKGROUND_COLOR);
m_visible_lines = (std::min)(visible_items, m_visible_lines);
top_line = (std::max)(0, top_line);
@@ -196,28 +196,28 @@ void menu_dats_view::draw(UINT32 flags)
// if we're on the top line, display the up arrow
if (linenum == 0 && top_line != 0)
{
- draw_arrow(container, 0.5f * (x1 + x2) - 0.5f * ud_arrow_width, line_y + 0.25f * line_height,
+ draw_arrow(0.5f * (x1 + x2) - 0.5f * ud_arrow_width, line_y + 0.25f * line_height,
0.5f * (x1 + x2) + 0.5f * ud_arrow_width, line_y + 0.75f * line_height, fgcolor, ROT0);
if (mouse_hit && line_x0 <= mouse_x && line_x1 > mouse_x && line_y0 <= mouse_y && line_y1 > mouse_y)
{
fgcolor = UI_MOUSEOVER_COLOR;
bgcolor = UI_MOUSEOVER_BG_COLOR;
- highlight(container, line_x0, line_y0, line_x1, line_y1, bgcolor);
+ highlight(line_x0, line_y0, line_x1, line_y1, bgcolor);
hover = HOVER_ARROW_UP;
}
}
// if we're on the bottom line, display the down arrow
else if (linenum == m_visible_lines - 1 && itemnum != visible_items - 1)
{
- draw_arrow(container, 0.5f * (x1 + x2) - 0.5f * ud_arrow_width, line_y + 0.25f * line_height,
+ draw_arrow(0.5f * (x1 + x2) - 0.5f * ud_arrow_width, line_y + 0.25f * line_height,
0.5f * (x1 + x2) + 0.5f * ud_arrow_width, line_y + 0.75f * line_height, fgcolor, ROT0 ^ ORIENTATION_FLIP_Y);
if (mouse_hit && line_x0 <= mouse_x && line_x1 > mouse_x && line_y0 <= mouse_y && line_y1 > mouse_y)
{
fgcolor = UI_MOUSEOVER_COLOR;
bgcolor = UI_MOUSEOVER_BG_COLOR;
- highlight(container, line_x0, line_y0, line_x1, line_y1, bgcolor);
+ highlight(line_x0, line_y0, line_x1, line_y1, bgcolor);
hover = HOVER_ARROW_DOWN;
}
}
@@ -225,7 +225,7 @@ void menu_dats_view::draw(UINT32 flags)
// draw dats text
else if (pitem.subtext.empty())
{
- ui().draw_text_full(container, itemtext, effective_left, line_y, effective_width, ui::text_layout::LEFT, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), itemtext, effective_left, line_y, effective_width, ui::text_layout::LEFT, ui::text_layout::NEVER,
mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr);
}
}
@@ -245,12 +245,12 @@ void menu_dats_view::draw(UINT32 flags)
hover = count;
if (pitem.type == menu_item_type::SEPARATOR)
- container->add_line(visible_left, line + 0.5f * line_height, visible_left + visible_width, line + 0.5f * line_height,
+ container().add_line(visible_left, line + 0.5f * line_height, visible_left + visible_width, line + 0.5f * line_height,
UI_LINE_WIDTH, UI_TEXT_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
else
{
- highlight(container, line_x0, line_y0, line_x1, line_y1, bgcolor);
- ui().draw_text_full(container, itemtext, effective_left, line, effective_width, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ highlight(line_x0, line_y0, line_x1, line_y1, bgcolor);
+ ui().draw_text_full(container(), itemtext, effective_left, line, effective_width, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr);
}
line += line_height;
@@ -273,7 +273,7 @@ void menu_dats_view::custom_render(void *selectedref, float top, float bottom, f
float width;
std::string driver = (m_issoft == true) ? m_swinfo->longname : m_driver->description;
- ui().draw_text_full(container, driver.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), driver.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
maxwidth = MAX(maxwidth, width);
@@ -285,20 +285,20 @@ void menu_dats_view::custom_render(void *selectedref, float top, float bottom, f
float y2 = origy1 - 2.0f * UI_BOX_TB_BORDER - ui().get_line_height();
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_GREEN_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
x2 -= UI_BOX_LR_BORDER;
y1 += UI_BOX_TB_BORDER;
- ui().draw_text_full(container, driver.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), driver.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
maxwidth = 0;
for (auto & elem : m_items_list)
{
- ui().draw_text_full(container, elem.label.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), elem.label.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
maxwidth += width;
}
@@ -312,7 +312,7 @@ void menu_dats_view::custom_render(void *selectedref, float top, float bottom, f
y2 += ui().get_line_height() + 2.0f * UI_BOX_TB_BORDER;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_BACKGROUND_COLOR);
// take off the borders
y1 += UI_BOX_TB_BORDER;
@@ -324,13 +324,13 @@ void menu_dats_view::custom_render(void *selectedref, float top, float bottom, f
x1 += space;
rgb_t fcolor = (m_actual == x) ? rgb_t(0xff, 0xff, 0xff, 0x00) : UI_TEXT_COLOR;
rgb_t bcolor = (m_actual == x) ? rgb_t(0xff, 0xff, 0xff, 0xff) : UI_TEXT_BG_COLOR;
- ui().draw_text_full(container, elem.label.c_str(), x1, y1, 1.0f, ui::text_layout::LEFT, ui::text_layout::NEVER, mame_ui_manager::NONE, fcolor, bcolor, &width, nullptr);
+ ui().draw_text_full(container(), elem.label.c_str(), x1, y1, 1.0f, ui::text_layout::LEFT, ui::text_layout::NEVER, mame_ui_manager::NONE, fcolor, bcolor, &width, nullptr);
if (bcolor != UI_TEXT_BG_COLOR)
- ui().draw_textured_box(container, x1 - (space / 2), y1, x1 + width + (space / 2), y2, bcolor, rgb_t(255, 43, 43, 43),
+ ui().draw_textured_box(container(), x1 - (space / 2), y1, x1 + width + (space / 2), y2, bcolor, rgb_t(255, 43, 43, 43),
hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
- ui().draw_text_full(container, elem.label.c_str(), x1, y1, 1.0f, ui::text_layout::LEFT, ui::text_layout::NEVER, mame_ui_manager::NORMAL, fcolor, bcolor, &width, nullptr);
+ ui().draw_text_full(container(), elem.label.c_str(), x1, y1, 1.0f, ui::text_layout::LEFT, ui::text_layout::NEVER, mame_ui_manager::NORMAL, fcolor, bcolor, &width, nullptr);
x1 += width + space;
++x;
}
@@ -338,7 +338,7 @@ void menu_dats_view::custom_render(void *selectedref, float top, float bottom, f
// bottom
std::string revision;
revision.assign(_("Revision: ")).append(m_items_list[m_actual].revision);
- ui().draw_text_full(container, revision.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
+ ui().draw_text_full(container(), revision.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
maxwidth = MAX(origx2 - origx1, width);
@@ -349,7 +349,7 @@ void menu_dats_view::custom_render(void *selectedref, float top, float bottom, f
y2 = origy2 + bottom;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_GREEN_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -357,7 +357,7 @@ void menu_dats_view::custom_render(void *selectedref, float top, float bottom, f
y1 += UI_BOX_TB_BORDER;
// draw the text within it
- ui().draw_text_full(container, revision.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), revision.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
}
@@ -388,7 +388,7 @@ void menu_dats_view::get_data()
else
mame_machine_manager::instance()->datfile().load_data_info(m_driver, buffer, m_items_list[m_actual].option);
- auto lines = ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (4.0f * UI_BOX_LR_BORDER), xstart, xend);
+ auto lines = ui().wrap_text(container(), buffer.c_str(), 0.0f, 0.0f, 1.0f - (4.0f * UI_BOX_LR_BORDER), xstart, xend);
for (int x = 0; x < lines; ++x)
{
std::string tempbuf(buffer.substr(xstart[x], xend[x] - xstart[x]));
@@ -411,7 +411,7 @@ void menu_dats_view::get_data_sw()
mame_machine_manager::instance()->datfile().load_software_info(m_swinfo->listname, buffer, m_swinfo->shortname, m_swinfo->parentname);
}
- auto lines = ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (4.0f * UI_BOX_LR_BORDER), xstart, xend);
+ auto lines = ui().wrap_text(container(), buffer.c_str(), 0.0f, 0.0f, 1.0f - (4.0f * UI_BOX_LR_BORDER), xstart, xend);
for (int x = 0; x < lines; ++x)
{
std::string tempbuf(buffer.substr(xstart[x], xend[x] - xstart[x]));
diff --git a/src/frontend/mame/ui/datmenu.h b/src/frontend/mame/ui/datmenu.h
index 300a0f60eeb..03299187c97 100644
--- a/src/frontend/mame/ui/datmenu.h
+++ b/src/frontend/mame/ui/datmenu.h
@@ -30,17 +30,20 @@ namespace ui {
class menu_dats_view : public menu
{
public:
- menu_dats_view(mame_ui_manager &mui, render_container *container, ui_software_info *swinfo, const game_driver *driver = nullptr);
- menu_dats_view(mame_ui_manager &mui, render_container *container, const game_driver *driver = nullptr);
+ menu_dats_view(mame_ui_manager &mui, render_container &container, ui_software_info *swinfo, const game_driver *driver = nullptr);
+ menu_dats_view(mame_ui_manager &mui, render_container &container, const game_driver *driver = nullptr);
virtual ~menu_dats_view() override;
- virtual void populate() override;
- virtual void handle() override;
+
+protected:
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
private:
// draw dats menu
virtual void draw(UINT32 flags) override;
+ virtual void populate() override;
+ virtual void handle() override;
+
int visible_items;
int m_actual;
const game_driver *m_driver;
diff --git a/src/frontend/mame/ui/devctrl.h b/src/frontend/mame/ui/devctrl.h
index 21505e0a0e7..332d020144e 100644
--- a/src/frontend/mame/ui/devctrl.h
+++ b/src/frontend/mame/ui/devctrl.h
@@ -30,7 +30,7 @@ template<class DeviceType>
class menu_device_control : public menu
{
public:
- menu_device_control(mame_ui_manager &mui, render_container *container, DeviceType *device);
+ menu_device_control(mame_ui_manager &mui, render_container &container, DeviceType *device);
protected:
DeviceType *current_device() { return m_device; }
@@ -56,7 +56,7 @@ private:
//-------------------------------------------------
template<class DeviceType>
-menu_device_control<DeviceType>::menu_device_control(mame_ui_manager &mui, render_container *container, DeviceType *device)
+menu_device_control<DeviceType>::menu_device_control(mame_ui_manager &mui, render_container &container, DeviceType *device)
: menu(mui, container)
{
iterator iter(mui.machine().root_device());
diff --git a/src/frontend/mame/ui/devopt.cpp b/src/frontend/mame/ui/devopt.cpp
index eecb790b81f..099c62428f0 100644
--- a/src/frontend/mame/ui/devopt.cpp
+++ b/src/frontend/mame/ui/devopt.cpp
@@ -19,7 +19,7 @@ namespace ui {
menu
-------------------------------------------------*/
-menu_device_config::menu_device_config(mame_ui_manager &mui, render_container *container, device_slot_interface *slot, device_slot_option *option) : menu(mui, container)
+menu_device_config::menu_device_config(mame_ui_manager &mui, render_container &container, device_slot_interface *slot, device_slot_option *option) : menu(mui, container)
{
m_option = option;
m_owner = slot;
diff --git a/src/frontend/mame/ui/devopt.h b/src/frontend/mame/ui/devopt.h
index 0079291323a..bf6835f9df0 100644
--- a/src/frontend/mame/ui/devopt.h
+++ b/src/frontend/mame/ui/devopt.h
@@ -19,12 +19,13 @@ namespace ui {
class menu_device_config : public menu
{
public:
- menu_device_config(mame_ui_manager &mui, render_container *container, device_slot_interface *slot, device_slot_option *option);
+ menu_device_config(mame_ui_manager &mui, render_container &container, device_slot_interface *slot, device_slot_option *option);
virtual ~menu_device_config() override;
+
+private:
virtual void populate() override;
virtual void handle() override;
-private:
device_slot_interface *m_owner;
device_slot_option *m_option;
bool m_mounted;
diff --git a/src/frontend/mame/ui/dirmenu.cpp b/src/frontend/mame/ui/dirmenu.cpp
index 5e377d4e474..040ecf9a826 100644
--- a/src/frontend/mame/ui/dirmenu.cpp
+++ b/src/frontend/mame/ui/dirmenu.cpp
@@ -71,7 +71,7 @@ static const folders_entry s_folders[] =
// ctor / dtor
//-------------------------------------------------
-menu_directory::menu_directory(mame_ui_manager &mui, render_container *container) : menu(mui, container)
+menu_directory::menu_directory(mame_ui_manager &mui, render_container &container) : menu(mui, container)
{
}
@@ -92,7 +92,7 @@ void menu_directory::handle()
const event *menu_event = process(0);
if (menu_event != nullptr && menu_event->itemref != nullptr && menu_event->iptkey == IPT_UI_SELECT)
- menu::stack_push<menu_display_actual>(ui(), container, selected);
+ menu::stack_push<menu_display_actual>(ui(), container(), selected);
}
//-------------------------------------------------
@@ -117,7 +117,7 @@ void menu_directory::custom_render(void *selectedref, float top, float bottom, f
float width;
// get the size of the text
- ui().draw_text_full(container, _("Folders Setup"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), _("Folders Setup"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += (2.0f * UI_BOX_LR_BORDER) + 0.01f;
float maxwidth = MAX(width, origx2 - origx1);
@@ -129,7 +129,7 @@ void menu_directory::custom_render(void *selectedref, float top, float bottom, f
float y2 = origy1 - UI_BOX_TB_BORDER;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_GREEN_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -137,7 +137,7 @@ void menu_directory::custom_render(void *selectedref, float top, float bottom, f
y1 += UI_BOX_TB_BORDER;
// draw the text within it
- ui().draw_text_full(container, _("Folders Setup"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), _("Folders Setup"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
}
@@ -148,7 +148,7 @@ void menu_directory::custom_render(void *selectedref, float top, float bottom, f
// ctor / dtor
//-------------------------------------------------
-menu_display_actual::menu_display_actual(mame_ui_manager &mui, render_container *container, int ref)
+menu_display_actual::menu_display_actual(mame_ui_manager &mui, render_container &container, int ref)
: menu(mui, container), m_ref(ref)
{
}
@@ -169,11 +169,11 @@ void menu_display_actual::handle()
switch ((FPTR)menu_event->itemref)
{
case REMOVE:
- menu::stack_push<menu_remove_folder>(ui(), container, m_ref);
+ menu::stack_push<menu_remove_folder>(ui(), container(), m_ref);
break;
case ADD_CHANGE:
- menu::stack_push<menu_add_change_folder>(ui(), container, m_ref);
+ menu::stack_push<menu_add_change_folder>(ui(), container(), m_ref);
break;
}
}
@@ -216,13 +216,13 @@ void menu_display_actual::custom_render(void *selectedref, float top, float bott
for (auto & elem : m_folders)
{
- ui().draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::LEFT, ui::text_layout::TRUNCATE, mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
+ ui().draw_text_full(container(), elem.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::LEFT, ui::text_layout::TRUNCATE, mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += (2.0f * UI_BOX_LR_BORDER) + 0.01f;
maxwidth = MAX(maxwidth, width);
}
// get the size of the text
- ui().draw_text_full(container, m_tempbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
+ ui().draw_text_full(container(), m_tempbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += (2.0f * UI_BOX_LR_BORDER) + 0.01f;
maxwidth = MAX(width, maxwidth);
@@ -233,7 +233,7 @@ void menu_display_actual::custom_render(void *selectedref, float top, float bott
float y2 = y1 + lineh + 2.0f * UI_BOX_TB_BORDER;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_GREEN_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -241,7 +241,7 @@ void menu_display_actual::custom_render(void *selectedref, float top, float bott
y1 += UI_BOX_TB_BORDER;
// draw the text within it
- ui().draw_text_full(container, m_tempbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), m_tempbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
// compute our bounds
@@ -251,7 +251,7 @@ void menu_display_actual::custom_render(void *selectedref, float top, float bott
y2 = origy1 - UI_BOX_TB_BORDER;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_BACKGROUND_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -261,7 +261,7 @@ void menu_display_actual::custom_render(void *selectedref, float top, float bott
// draw the text within it
for (auto & elem : m_folders)
{
- ui().draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, ui::text_layout::LEFT, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), elem.c_str(), x1, y1, x2 - x1, ui::text_layout::LEFT, ui::text_layout::TRUNCATE,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
y1 += lineh;
}
@@ -275,7 +275,7 @@ MENU ADD FOLDER
// ctor / dtor
//-------------------------------------------------
-menu_add_change_folder::menu_add_change_folder(mame_ui_manager &mui, render_container *container, int ref) : menu(mui, container)
+menu_add_change_folder::menu_add_change_folder(mame_ui_manager &mui, render_container &container, int ref) : menu(mui, container)
{
m_ref = ref;
m_change = (s_folders[ref].action == CHANGE);
@@ -505,7 +505,7 @@ void menu_add_change_folder::custom_render(void *selectedref, float top, float b
// get the size of the text
for (auto & elem : tempbuf)
{
- ui().draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), elem.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += (2.0f * UI_BOX_LR_BORDER) + 0.01f;
maxwidth = MAX(width, maxwidth);
@@ -518,7 +518,7 @@ void menu_add_change_folder::custom_render(void *selectedref, float top, float b
float y2 = origy1 - UI_BOX_TB_BORDER;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_GREEN_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -528,7 +528,7 @@ void menu_add_change_folder::custom_render(void *selectedref, float top, float b
// draw the text within it
for (auto & elem : tempbuf)
{
- ui().draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), elem.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
y1 = y1 + ui().get_line_height();
}
@@ -536,7 +536,7 @@ void menu_add_change_folder::custom_render(void *selectedref, float top, float b
// bottom text
tempbuf[0] = _("Press TAB to set");
- ui().draw_text_full(container, tempbuf[0].c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), tempbuf[0].c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
maxwidth = MAX(maxwidth, width);
@@ -548,7 +548,7 @@ void menu_add_change_folder::custom_render(void *selectedref, float top, float b
y2 = origy2 + bottom;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_RED_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_RED_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -556,7 +556,7 @@ void menu_add_change_folder::custom_render(void *selectedref, float top, float b
y1 += UI_BOX_TB_BORDER;
// draw the text within it
- ui().draw_text_full(container, tempbuf[0].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), tempbuf[0].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
}
@@ -568,7 +568,7 @@ void menu_add_change_folder::custom_render(void *selectedref, float top, float b
// ctor / dtor
//-------------------------------------------------
-menu_remove_folder::menu_remove_folder(mame_ui_manager &mui, render_container *container, int ref) : menu(mui, container)
+menu_remove_folder::menu_remove_folder(mame_ui_manager &mui, render_container &container, int ref) : menu(mui, container)
{
m_ref = ref;
if (mui.options().exists(s_folders[m_ref].option))
@@ -642,7 +642,7 @@ void menu_remove_folder::custom_render(void *selectedref, float top, float botto
std::string tempbuf = string_format(_("Remove %1$s Folder"), _(s_folders[m_ref].name));
// get the size of the text
- ui().draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER, mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
+ ui().draw_text_full(container(), tempbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER, mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += (2.0f * UI_BOX_LR_BORDER) + 0.01f;
float maxwidth = MAX(width, origx2 - origx1);
@@ -653,7 +653,7 @@ void menu_remove_folder::custom_render(void *selectedref, float top, float botto
float y2 = origy1 - UI_BOX_TB_BORDER;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_GREEN_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -661,7 +661,7 @@ void menu_remove_folder::custom_render(void *selectedref, float top, float botto
y1 += UI_BOX_TB_BORDER;
// draw the text within it
- ui().draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, mame_ui_manager::NORMAL,
+ ui().draw_text_full(container(), tempbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, mame_ui_manager::NORMAL,
UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
}
diff --git a/src/frontend/mame/ui/dirmenu.h b/src/frontend/mame/ui/dirmenu.h
index b9f07a33b3e..fbd83a3ecb8 100644
--- a/src/frontend/mame/ui/dirmenu.h
+++ b/src/frontend/mame/ui/dirmenu.h
@@ -26,11 +26,15 @@ namespace ui {
class menu_directory : public menu
{
public:
- menu_directory(mame_ui_manager &mui, render_container *container);
+ 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() override;
virtual void handle() override;
- virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
};
//-------------------------------------------------
@@ -40,22 +44,25 @@ public:
class menu_display_actual : public menu
{
public:
- menu_display_actual(mame_ui_manager &mui, render_container *container, int selectedref);
+ menu_display_actual(mame_ui_manager &mui, render_container &container, int selectedref);
virtual ~menu_display_actual() override;
- virtual void populate() override;
- virtual void handle() override;
+
+protected:
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
private:
- std::string m_tempbuf, m_searchpath;
- std::vector<std::string> m_folders;
- int m_ref;
-
enum
{
ADD_CHANGE = 1,
REMOVE,
};
+
+ virtual void populate() override;
+ virtual void handle() override;
+
+ std::string m_tempbuf, m_searchpath;
+ std::vector<std::string> m_folders;
+ int m_ref;
};
//-------------------------------------------------
@@ -65,13 +72,16 @@ private:
class menu_remove_folder : public menu
{
public:
- menu_remove_folder(mame_ui_manager &mui, render_container *container, int ref);
+ menu_remove_folder(mame_ui_manager &mui, render_container &container, int ref);
virtual ~menu_remove_folder() override;
- virtual void populate() override;
- virtual void handle() 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() override;
+ virtual void handle() override;
+
std::string m_searchpath;
int m_ref;
std::vector<std::string> m_folders;
@@ -84,15 +94,18 @@ private:
class menu_add_change_folder : public menu
{
public:
- menu_add_change_folder(mame_ui_manager &mui, render_container *container, int ref);
+ menu_add_change_folder(mame_ui_manager &mui, render_container &container, int ref);
virtual ~menu_add_change_folder() override;
- virtual void populate() override;
- virtual void handle() override;
+
+protected:
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual bool menu_has_search_active() override { return (m_search[0] != 0); }
private:
+ virtual void populate() override;
+ virtual void handle() override;
+
int m_ref;
std::string m_current_path;
char m_search[40];
diff --git a/src/frontend/mame/ui/filecreate.cpp b/src/frontend/mame/ui/filecreate.cpp
index 9cd260684a3..e54692e600f 100644
--- a/src/frontend/mame/ui/filecreate.cpp
+++ b/src/frontend/mame/ui/filecreate.cpp
@@ -2,12 +2,12 @@
// copyright-holders:Nathan Woods
/***************************************************************************
- ui/filecreate.cpp
+ ui/filecreate.cpp
- MAME's clunky built-in file manager
+ MAME's clunky built-in file manager
- TODO
- - Support image creation arguments
+ TODO
+ - Support image creation arguments
***************************************************************************/
@@ -80,7 +80,7 @@ CONFIRM SAVE AS MENU
// ctor
//-------------------------------------------------
-menu_confirm_save_as::menu_confirm_save_as(mame_ui_manager &mui, render_container *container, bool *yes)
+menu_confirm_save_as::menu_confirm_save_as(mame_ui_manager &mui, render_container &container, bool *yes)
: menu(mui, container)
{
m_yes = yes;
@@ -139,12 +139,12 @@ FILE CREATE MENU
// ctor
//-------------------------------------------------
-menu_file_create::menu_file_create(mame_ui_manager &mui, render_container *container, device_image_interface *image, std::string &current_directory, std::string &current_file, bool &ok)
+menu_file_create::menu_file_create(mame_ui_manager &mui, render_container &container, device_image_interface *image, std::string &current_directory, std::string &current_file, bool &ok)
: menu(mui, container)
+ , m_ok(ok)
, m_current_directory(current_directory)
, m_current_file(current_file)
, m_current_format(nullptr)
- , m_ok(ok)
{
m_image = image;
m_ok = true;
@@ -268,7 +268,7 @@ SELECT FORMAT MENU
// ctor
//-------------------------------------------------
-menu_select_format::menu_select_format(mame_ui_manager &mui, render_container *container, floppy_image_format_t **formats, int ext_match, int total_usable, int *result)
+menu_select_format::menu_select_format(mame_ui_manager &mui, render_container &container, floppy_image_format_t **formats, int ext_match, int total_usable, int *result)
: menu(mui, container)
{
m_formats = formats;
diff --git a/src/frontend/mame/ui/filecreate.h b/src/frontend/mame/ui/filecreate.h
index 8935fcb1e47..47905564d68 100644
--- a/src/frontend/mame/ui/filecreate.h
+++ b/src/frontend/mame/ui/filecreate.h
@@ -2,9 +2,9 @@
// copyright-holders:Nathan Woods
/***************************************************************************
- ui/filecreate.h
+ ui/filecreate.h
- MESS's clunky built-in file manager
+ MESS's clunky built-in file manager
***************************************************************************/
@@ -23,12 +23,13 @@ namespace ui {
class menu_confirm_save_as : public menu
{
public:
- menu_confirm_save_as(mame_ui_manager &mui, render_container *container, bool *yes);
+ menu_confirm_save_as(mame_ui_manager &mui, render_container &container, bool *yes);
virtual ~menu_confirm_save_as() override;
+
+private:
virtual void populate() override;
virtual void handle() override;
-private:
bool *m_yes;
};
@@ -38,21 +39,23 @@ private:
class menu_file_create : public menu
{
public:
- menu_file_create(mame_ui_manager &mui, render_container *container, device_image_interface *image, std::string &current_directory, std::string &current_file, bool &ok);
+ menu_file_create(mame_ui_manager &mui, render_container &container, device_image_interface *image, std::string &current_directory, std::string &current_file, bool &ok);
virtual ~menu_file_create() override;
- virtual void populate() override;
- virtual void handle() override;
+
+protected:
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
+ bool & m_ok;
+
private:
+ virtual void populate() override;
+ virtual void handle() override;
+
device_image_interface * m_image;
std::string & m_current_directory;
std::string & m_current_file;
const image_device_format * m_current_format;
- std::string m_filename;
-
-protected:
- bool & m_ok;
+ std::string m_filename;
};
// ======================> menu_select_format
@@ -60,13 +63,14 @@ protected:
class menu_select_format : public menu
{
public:
- menu_select_format(mame_ui_manager &mui, render_container *container,
+ menu_select_format(mame_ui_manager &mui, render_container &container,
floppy_image_format_t **formats, int ext_match, int total_usable, int *result);
virtual ~menu_select_format() override;
+
+private:
virtual void populate() override;
virtual void handle() override;
-private:
// internal state
floppy_image_format_t ** m_formats;
int m_ext_match;
diff --git a/src/frontend/mame/ui/filemngr.cpp b/src/frontend/mame/ui/filemngr.cpp
index fe5cd6a2197..8883e4beb9f 100644
--- a/src/frontend/mame/ui/filemngr.cpp
+++ b/src/frontend/mame/ui/filemngr.cpp
@@ -31,7 +31,7 @@ namespace ui {
// ctor
//-------------------------------------------------
-menu_file_manager::menu_file_manager(mame_ui_manager &mui, render_container *container, const char *warnings) : menu(mui, container), selected_device(nullptr)
+menu_file_manager::menu_file_manager(mame_ui_manager &mui, render_container &container, const char *warnings) : menu(mui, container), selected_device(nullptr)
{
// This warning string is used when accessing from the force_file_manager call, i.e.
// when the file manager is loaded top front in the case of mandatory image devices
@@ -184,11 +184,11 @@ void menu_file_manager::handle()
floppy_image_device *floppy_device = dynamic_cast<floppy_image_device *>(selected_device);
if (floppy_device != nullptr)
{
- menu::stack_push<menu_control_floppy_image>(ui(), container, floppy_device);
+ menu::stack_push<menu_control_floppy_image>(ui(), container(), floppy_device);
}
else
{
- menu::stack_push<menu_control_device_image>(ui(), container, selected_device);
+ menu::stack_push<menu_control_device_image>(ui(), container(), selected_device);
}
// reset the existing menu
reset(reset_options::REMEMBER_POSITION);
@@ -198,7 +198,7 @@ void menu_file_manager::handle()
}
// force file manager menu
-void menu_file_manager::force_file_manager(mame_ui_manager &mui, render_container *container, const char *warnings)
+void menu_file_manager::force_file_manager(mame_ui_manager &mui, render_container &container, const char *warnings)
{
// reset the menu stack
menu::stack_reset(mui.machine());
diff --git a/src/frontend/mame/ui/filemngr.h b/src/frontend/mame/ui/filemngr.h
index 25f364ea487..34cdb0a98ce 100644
--- a/src/frontend/mame/ui/filemngr.h
+++ b/src/frontend/mame/ui/filemngr.h
@@ -21,19 +21,22 @@ public:
std::string current_file;
device_image_interface *selected_device;
- static void force_file_manager(mame_ui_manager &mui, render_container *container, const char *warnings);
+ static void force_file_manager(mame_ui_manager &mui, render_container &container, const char *warnings);
- menu_file_manager(mame_ui_manager &mui, render_container *container, const char *warnings);
+ menu_file_manager(mame_ui_manager &mui, render_container &container, const char *warnings);
virtual ~menu_file_manager();
+
+protected:
+ virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
+
+private:
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;
void fill_image_line(device_image_interface *img, std::string &instance, std::string &filename);
-private:
std::string m_warnings;
- bool m_curr_selected;
+ bool m_curr_selected;
};
} // namespace ui
diff --git a/src/frontend/mame/ui/filesel.cpp b/src/frontend/mame/ui/filesel.cpp
index 673f6a96161..21a0d35c28f 100644
--- a/src/frontend/mame/ui/filesel.cpp
+++ b/src/frontend/mame/ui/filesel.cpp
@@ -44,7 +44,7 @@ namespace ui {
// ctor
//-------------------------------------------------
-menu_file_selector::menu_file_selector(mame_ui_manager &mui, render_container *container, device_image_interface *image, std::string &current_directory, std::string &current_file, bool has_empty, bool has_softlist, bool has_create, menu_file_selector::result &result)
+menu_file_selector::menu_file_selector(mame_ui_manager &mui, render_container &container, device_image_interface *image, std::string &current_directory, std::string &current_file, bool has_empty, bool has_softlist, bool has_create, menu_file_selector::result &result)
: menu(mui, container)
, m_current_directory(current_directory)
, m_current_file(current_file)
@@ -73,7 +73,7 @@ menu_file_selector::~menu_file_selector()
void menu_file_selector::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
{
// lay out extra text
- auto layout = ui().create_layout(container);
+ auto layout = ui().create_layout(container());
layout.add_text(m_current_directory.c_str());
// position this extra text
@@ -81,7 +81,7 @@ void menu_file_selector::custom_render(void *selectedref, float top, float botto
extra_text_position(origx1, origx2, origy1, top, layout, -1, x1, y1, x2, y2);
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_BACKGROUND_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -109,7 +109,7 @@ void menu_file_selector::custom_render(void *selectedref, float top, float botto
}
// draw the text within it
- layout.emit(container, x1, y1);
+ layout.emit(container(), x1, y1);
}
@@ -507,11 +507,11 @@ void menu_file_selector::handle()
// ctor
//-------------------------------------------------
-menu_select_rw::menu_select_rw(mame_ui_manager &mui, render_container *container,
+menu_select_rw::menu_select_rw(mame_ui_manager &mui, render_container &container,
bool can_in_place, result &result)
: menu(mui, container),
- m_can_in_place(can_in_place),
- m_result(result)
+ m_can_in_place(can_in_place),
+ m_result(result)
{
}
diff --git a/src/frontend/mame/ui/filesel.h b/src/frontend/mame/ui/filesel.h
index 9daa539ae28..7692a996124 100644
--- a/src/frontend/mame/ui/filesel.h
+++ b/src/frontend/mame/ui/filesel.h
@@ -30,13 +30,11 @@ public:
FILE
};
- menu_file_selector(mame_ui_manager &mui, render_container *container, device_image_interface *image, std::string &current_directory, std::string &current_file, bool has_empty, bool has_softlist, bool has_create, result &result);
+ menu_file_selector(mame_ui_manager &mui, render_container &container, device_image_interface *image, std::string &current_directory, std::string &current_file, bool has_empty, bool has_softlist, bool has_create, result &result);
virtual ~menu_file_selector() 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;
protected:
+ virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual bool custom_mouse_down() override;
private:
@@ -65,9 +63,12 @@ private:
bool m_has_softlist;
bool m_has_create;
result & m_result;
- std::vector<file_selector_entry> m_entrylist;
+ std::vector<file_selector_entry> m_entrylist;
std::string m_hover_directory;
- std::string m_filename;
+ std::string m_filename;
+
+ virtual void populate() override;
+ virtual void handle() override;
// methods
int compare_entries(const file_selector_entry *e1, const file_selector_entry *e2);
@@ -91,7 +92,7 @@ public:
WRITE_OTHER,
WRITE_DIFF
};
- menu_select_rw(mame_ui_manager &mui, render_container *container,
+ menu_select_rw(mame_ui_manager &mui, render_container &container,
bool can_in_place, result &result);
virtual ~menu_select_rw() override;
virtual void populate() override;
diff --git a/src/frontend/mame/ui/floppycntrl.cpp b/src/frontend/mame/ui/floppycntrl.cpp
index f47b4d580bf..33d2abf937d 100644
--- a/src/frontend/mame/ui/floppycntrl.cpp
+++ b/src/frontend/mame/ui/floppycntrl.cpp
@@ -20,7 +20,7 @@ namespace ui {
IMPLEMENTATION
***************************************************************************/
-menu_control_floppy_image::menu_control_floppy_image(mame_ui_manager &mui, render_container *container, device_image_interface *_image) : menu_control_device_image(mui, container, _image)
+menu_control_floppy_image::menu_control_floppy_image(mame_ui_manager &mui, render_container &container, device_image_interface *_image) : menu_control_device_image(mui, container, _image)
{
floppy_image_device *fd = static_cast<floppy_image_device *>(image);
const floppy_image_format_t *fif_list = fd->get_formats();
@@ -94,7 +94,7 @@ void menu_control_floppy_image::hook_load(std::string filename, bool softlist)
can_in_place = false;
}
submenu_result.rw = menu_select_rw::result::INVALID;
- menu::stack_push<menu_select_rw>(ui(), container, can_in_place, submenu_result.rw);
+ menu::stack_push<menu_select_rw>(ui(), container(), can_in_place, submenu_result.rw);
state = SELECT_RW;
}
@@ -120,7 +120,7 @@ void menu_control_floppy_image::handle()
format_array[total_usable++] = i;
}
submenu_result.i = -1;
- menu::stack_push<menu_select_format>(ui(), container, format_array, ext_match, total_usable, &submenu_result.i);
+ menu::stack_push<menu_select_format>(ui(), container(), format_array, ext_match, total_usable, &submenu_result.i);
state = SELECT_FORMAT;
break;
@@ -157,7 +157,7 @@ void menu_control_floppy_image::handle()
break;
case menu_select_rw::result::WRITE_OTHER:
- menu::stack_push<menu_file_create>(ui(), container, image, m_current_directory, m_current_file, create_ok);
+ menu::stack_push<menu_file_create>(ui(), container(), image, m_current_directory, m_current_file, create_ok);
state = CHECK_CREATE;
break;
diff --git a/src/frontend/mame/ui/floppycntrl.h b/src/frontend/mame/ui/floppycntrl.h
index 2902b8bf13c..96790d6eebb 100644
--- a/src/frontend/mame/ui/floppycntrl.h
+++ b/src/frontend/mame/ui/floppycntrl.h
@@ -20,18 +20,18 @@ namespace ui {
class menu_control_floppy_image : public menu_control_device_image
{
public:
- menu_control_floppy_image(mame_ui_manager &ui, render_container *container, device_image_interface *image);
+ menu_control_floppy_image(mame_ui_manager &ui, render_container &container, device_image_interface *image);
virtual ~menu_control_floppy_image() override;
- virtual void handle() override;
-
-protected:
+private:
enum { SELECT_FORMAT = LAST_ID, SELECT_MEDIA, SELECT_RW };
floppy_image_format_t **format_array;
floppy_image_format_t *input_format, *output_format;
std::string input_filename, output_filename;
+ virtual void handle() override;
+
void do_load_create();
virtual void hook_load(std::string filename, bool softlist) override;
};
diff --git a/src/frontend/mame/ui/imgcntrl.cpp b/src/frontend/mame/ui/imgcntrl.cpp
index 62082930f3b..39735b2c8fc 100644
--- a/src/frontend/mame/ui/imgcntrl.cpp
+++ b/src/frontend/mame/ui/imgcntrl.cpp
@@ -33,7 +33,7 @@ namespace ui {
// ctor
//-------------------------------------------------
-menu_control_device_image::menu_control_device_image(mame_ui_manager &mui, render_container *container, device_image_interface *_image)
+menu_control_device_image::menu_control_device_image(mame_ui_manager &mui, render_container &container, device_image_interface *_image)
: menu(mui, container),
create_ok(false),
create_confirmed(false)
@@ -178,20 +178,20 @@ void menu_control_device_image::handle()
switch(state) {
case START_FILE: {
submenu_result.filesel = menu_file_selector::result::INVALID;
- menu::stack_push<menu_file_selector>(ui(), container, image, m_current_directory, m_current_file, true, image->image_interface()!=nullptr, image->is_creatable(), submenu_result.filesel);
+ menu::stack_push<menu_file_selector>(ui(), container(), image, m_current_directory, m_current_file, true, image->image_interface()!=nullptr, image->is_creatable(), submenu_result.filesel);
state = SELECT_FILE;
break;
}
case START_SOFTLIST:
sld = nullptr;
- menu::stack_push<menu_software>(ui(), container, image->image_interface(), &sld);
+ menu::stack_push<menu_software>(ui(), container(), image->image_interface(), &sld);
state = SELECT_SOFTLIST;
break;
case START_OTHER_PART: {
submenu_result.swparts = menu_software_parts::result::INVALID;
- menu::stack_push<menu_software_parts>(ui(), container, swi, swp->interface(), &swp, true, submenu_result.swparts);
+ menu::stack_push<menu_software_parts>(ui(), container(), swi, swp->interface(), &swp, true, submenu_result.swparts);
state = SELECT_OTHER_PART;
break;
}
@@ -202,7 +202,7 @@ void menu_control_device_image::handle()
break;
}
software_info_name = "";
- menu::stack_push<menu_software_list>(ui(), container, sld, image->image_interface(), software_info_name);
+ menu::stack_push<menu_software_list>(ui(), container(), sld, image->image_interface(), software_info_name);
state = SELECT_PARTLIST;
break;
@@ -214,7 +214,7 @@ void menu_control_device_image::handle()
{
submenu_result.swparts = menu_software_parts::result::INVALID;
swp = nullptr;
- menu::stack_push<menu_software_parts>(ui(), container, swi, image->image_interface(), &swp, false, submenu_result.swparts);
+ menu::stack_push<menu_software_parts>(ui(), container(), swi, image->image_interface(), &swp, false, submenu_result.swparts);
state = SELECT_ONE_PART;
}
else
@@ -278,7 +278,7 @@ void menu_control_device_image::handle()
break;
case menu_file_selector::result::CREATE:
- menu::stack_push<menu_file_create>(ui(), container, image, m_current_directory, m_current_file, create_ok);
+ menu::stack_push<menu_file_create>(ui(), container(), image, m_current_directory, m_current_file, create_ok);
state = CHECK_CREATE;
break;
@@ -298,7 +298,7 @@ void menu_control_device_image::handle()
test_create(can_create, need_confirm);
if(can_create) {
if(need_confirm) {
- menu::stack_push<menu_confirm_save_as>(ui(), container, &create_confirmed);
+ menu::stack_push<menu_confirm_save_as>(ui(), container(), &create_confirmed);
state = CREATE_CONFIRM;
} else {
state = DO_CREATE;
diff --git a/src/frontend/mame/ui/imgcntrl.h b/src/frontend/mame/ui/imgcntrl.h
index 501a095d6f9..61d44908a43 100644
--- a/src/frontend/mame/ui/imgcntrl.h
+++ b/src/frontend/mame/ui/imgcntrl.h
@@ -23,10 +23,8 @@ namespace ui {
class menu_control_device_image : public menu
{
public:
- menu_control_device_image(mame_ui_manager &mui, render_container *container, device_image_interface *image);
+ menu_control_device_image(mame_ui_manager &mui, render_container &container, device_image_interface *image);
virtual ~menu_control_device_image() override;
- virtual void populate() override;
- virtual void handle() override;
protected:
enum {
@@ -55,10 +53,13 @@ protected:
// methods
virtual void hook_load(std::string filename, bool softlist);
+ virtual void handle() override;
bool create_ok;
private:
+ virtual void populate() override;
+
// instance variables
bool create_confirmed;
//bool softlist_done;
diff --git a/src/frontend/mame/ui/info.cpp b/src/frontend/mame/ui/info.cpp
index 125f5c6fae3..9461f566d71 100644
--- a/src/frontend/mame/ui/info.cpp
+++ b/src/frontend/mame/ui/info.cpp
@@ -21,7 +21,7 @@ namespace ui {
menu
-------------------------------------------------*/
-menu_game_info::menu_game_info(mame_ui_manager &mui, render_container *container) : menu(mui, container)
+menu_game_info::menu_game_info(mame_ui_manager &mui, render_container &container) : menu(mui, container)
{
}
@@ -47,7 +47,7 @@ void menu_game_info::handle()
menu
-------------------------------------------------*/
-menu_image_info::menu_image_info(mame_ui_manager &mui, render_container *container) : menu(mui, container)
+menu_image_info::menu_image_info(mame_ui_manager &mui, render_container &container) : menu(mui, container)
{
}
diff --git a/src/frontend/mame/ui/info.h b/src/frontend/mame/ui/info.h
index e76c33cd669..2fbd9de3683 100644
--- a/src/frontend/mame/ui/info.h
+++ b/src/frontend/mame/ui/info.h
@@ -19,8 +19,10 @@ namespace ui {
class menu_game_info : public menu
{
public:
- menu_game_info(mame_ui_manager &mui, render_container *container);
+ menu_game_info(mame_ui_manager &mui, render_container &container);
virtual ~menu_game_info() override;
+
+private:
virtual void populate() override;
virtual void handle() override;
};
@@ -29,12 +31,12 @@ public:
class menu_image_info : public menu
{
public:
- menu_image_info(mame_ui_manager &mui, render_container *container);
+ menu_image_info(mame_ui_manager &mui, render_container &container);
virtual ~menu_image_info() override;
- virtual void populate() override;
- virtual void handle() override;
private:
+ virtual void populate() override;
+ virtual void handle() override;
void image_info(device_image_interface *image);
};
diff --git a/src/frontend/mame/ui/info_pty.cpp b/src/frontend/mame/ui/info_pty.cpp
index be4251f0f4a..cf7b6fb4f6f 100644
--- a/src/frontend/mame/ui/info_pty.cpp
+++ b/src/frontend/mame/ui/info_pty.cpp
@@ -14,7 +14,7 @@
namespace ui {
-menu_pty_info::menu_pty_info(mame_ui_manager &mui, render_container *container) :
+menu_pty_info::menu_pty_info(mame_ui_manager &mui, render_container &container) :
menu(mui, container)
{
}
diff --git a/src/frontend/mame/ui/info_pty.h b/src/frontend/mame/ui/info_pty.h
index 46829bd3f0c..be112c003e4 100644
--- a/src/frontend/mame/ui/info_pty.h
+++ b/src/frontend/mame/ui/info_pty.h
@@ -19,8 +19,10 @@ namespace ui {
class menu_pty_info : public menu
{
public:
- menu_pty_info(mame_ui_manager &mui, render_container *container);
+ menu_pty_info(mame_ui_manager &mui, render_container &container);
virtual ~menu_pty_info() override;
+
+private:
virtual void populate() override;
virtual void handle() override;
};
diff --git a/src/frontend/mame/ui/inputmap.cpp b/src/frontend/mame/ui/inputmap.cpp
index 224b37c7944..bf13eb22e84 100644
--- a/src/frontend/mame/ui/inputmap.cpp
+++ b/src/frontend/mame/ui/inputmap.cpp
@@ -41,7 +41,7 @@ namespace ui {
input groups menu
-------------------------------------------------*/
-menu_input_groups::menu_input_groups(mame_ui_manager &mui, render_container *container) : menu(mui, container)
+menu_input_groups::menu_input_groups(mame_ui_manager &mui, render_container &container) : menu(mui, container)
{
}
@@ -73,7 +73,7 @@ void menu_input_groups::handle()
/* process the menu */
const event *menu_event = process(0);
if (menu_event != nullptr && menu_event->iptkey == IPT_UI_SELECT)
- menu::stack_push<menu_input_general>(ui(), container, int((long long)(menu_event->itemref)-1));
+ menu::stack_push<menu_input_general>(ui(), container(), int((long long)(menu_event->itemref)-1));
}
@@ -83,7 +83,7 @@ void menu_input_groups::handle()
input menu
-------------------------------------------------*/
-menu_input_general::menu_input_general(mame_ui_manager &mui, render_container *container, int _group) : menu_input(mui, container)
+menu_input_general::menu_input_general(mame_ui_manager &mui, render_container &container, int _group) : menu_input(mui, container)
{
group = _group;
}
@@ -146,7 +146,7 @@ menu_input_general::~menu_input_general()
input menu
-------------------------------------------------*/
-menu_input_specific::menu_input_specific(mame_ui_manager &mui, render_container *container) : menu_input(mui, container)
+menu_input_specific::menu_input_specific(mame_ui_manager &mui, render_container &container) : menu_input(mui, container)
{
}
@@ -223,7 +223,7 @@ menu_input_specific::~menu_input_specific()
/*-------------------------------------------------
menu_input - display a menu for inputs
-------------------------------------------------*/
-menu_input::menu_input(mame_ui_manager &mui, render_container *container) : menu(mui, container), last_sortorder(0), record_next(false)
+menu_input::menu_input(mame_ui_manager &mui, render_container &container) : menu(mui, container), last_sortorder(0), record_next(false)
{
pollingitem = nullptr;
pollingref = nullptr;
@@ -446,7 +446,7 @@ void menu_input::populate_and_sort(input_item_data *itemlist)
switches menu
-------------------------------------------------*/
-menu_settings_dip_switches::menu_settings_dip_switches(mame_ui_manager &mui, render_container *container) : menu_settings(mui, container, IPT_DIPSWITCH)
+menu_settings_dip_switches::menu_settings_dip_switches(mame_ui_manager &mui, render_container &container) : menu_settings(mui, container, IPT_DIPSWITCH)
{
}
@@ -459,7 +459,7 @@ menu_settings_dip_switches::~menu_settings_dip_switches()
driver config menu
-------------------------------------------------*/
-menu_settings_driver_config::menu_settings_driver_config(mame_ui_manager &mui, render_container *container) : menu_settings(mui, container, IPT_CONFIG)
+menu_settings_driver_config::menu_settings_driver_config(mame_ui_manager &mui, render_container &container) : menu_settings(mui, container, IPT_CONFIG)
{
}
@@ -529,7 +529,7 @@ void menu_settings::handle()
switches menus
-------------------------------------------------*/
-menu_settings::menu_settings(mame_ui_manager &mui, render_container *container, UINT32 _type) : menu(mui, container), diplist(nullptr), dipcount(0)
+menu_settings::menu_settings(mame_ui_manager &mui, render_container &container, UINT32 _type) : menu(mui, container), diplist(nullptr), dipcount(0)
{
type = _type;
}
@@ -641,7 +641,7 @@ void menu_settings_dip_switches::custom_render(void *selectedref, float top, flo
y2 = y1 + bottom;
// draw extra menu area
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_BACKGROUND_COLOR);
y1 += (float)DIP_SWITCH_SPACING;
// iterate over DIP switches
@@ -674,8 +674,8 @@ void menu_settings_dip_switches::custom_render(void *selectedref, float top, flo
void menu_settings_dip_switches::custom_render_one(float x1, float y1, float x2, float y2, const dip_descriptor *dip, UINT32 selectedmask)
{
- float switch_field_width = SINGLE_TOGGLE_SWITCH_FIELD_WIDTH * container->manager().ui_aspect();
- float switch_width = SINGLE_TOGGLE_SWITCH_WIDTH * container->manager().ui_aspect();
+ float switch_field_width = SINGLE_TOGGLE_SWITCH_FIELD_WIDTH * container().manager().ui_aspect();
+ float switch_width = SINGLE_TOGGLE_SWITCH_WIDTH * container().manager().ui_aspect();
int numtoggles, toggle;
float switch_toggle_gap;
float y1_off, y1_on;
@@ -687,7 +687,7 @@ void menu_settings_dip_switches::custom_render_one(float x1, float y1, float x2,
x1 += (x2 - x1 - numtoggles * switch_field_width) / 2;
/* draw the dip switch name */
- ui().draw_text_full( container,
+ ui().draw_text_full(container(),
dip->name,
0,
y1 + (DIP_SWITCH_HEIGHT - UI_TARGET_FONT_HEIGHT) / 2,
@@ -711,7 +711,7 @@ void menu_settings_dip_switches::custom_render_one(float x1, float y1, float x2,
float innerx1;
/* first outline the switch */
- ui().draw_outlined_box(container, x1, y1, x1 + switch_field_width, y2, UI_BACKGROUND_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x1 + switch_field_width, y2, UI_BACKGROUND_COLOR);
/* compute x1/x2 for the inner filled in switch */
innerx1 = x1 + (switch_field_width - switch_width) / 2;
@@ -720,13 +720,13 @@ void menu_settings_dip_switches::custom_render_one(float x1, float y1, float x2,
if (dip->mask & (1 << toggle))
{
float innery1 = (dip->state & (1 << toggle)) ? y1_on : y1_off;
- container->add_rect(innerx1, innery1, innerx1 + switch_width, innery1 + SINGLE_TOGGLE_SWITCH_HEIGHT,
+ container().add_rect(innerx1, innery1, innerx1 + switch_width, innery1 + SINGLE_TOGGLE_SWITCH_HEIGHT,
(selectedmask & (1 << toggle)) ? UI_DIPSW_COLOR : UI_TEXT_COLOR,
PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
}
else
{
- container->add_rect(innerx1, y1_off, innerx1 + switch_width, y1_on + SINGLE_TOGGLE_SWITCH_HEIGHT,
+ container().add_rect(innerx1, y1_off, innerx1 + switch_width, y1_on + SINGLE_TOGGLE_SWITCH_HEIGHT,
UI_UNAVAILABLE_COLOR,
PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
}
@@ -804,7 +804,7 @@ void menu_analog::handle()
settings menu
-------------------------------------------------*/
-menu_analog::menu_analog(mame_ui_manager &mui, render_container *container) : menu(mui, container)
+menu_analog::menu_analog(mame_ui_manager &mui, render_container &container) : menu(mui, container)
{
}
diff --git a/src/frontend/mame/ui/inputmap.h b/src/frontend/mame/ui/inputmap.h
index 290125c734f..522ea8bd7e9 100644
--- a/src/frontend/mame/ui/inputmap.h
+++ b/src/frontend/mame/ui/inputmap.h
@@ -20,8 +20,10 @@ namespace ui {
class menu_input_groups : public menu
{
public:
- menu_input_groups(mame_ui_manager &mui, render_container *container);
+ menu_input_groups(mame_ui_manager &mui, render_container &container);
virtual ~menu_input_groups() override;
+
+private:
virtual void populate() override;
virtual void handle() override;
};
@@ -29,9 +31,8 @@ public:
class menu_input : public menu
{
public:
- menu_input(mame_ui_manager &mui, render_container *container);
+ menu_input(mame_ui_manager &mui, render_container &container);
virtual ~menu_input() override;
- virtual void handle() override;
protected:
enum {
@@ -57,10 +58,8 @@ protected:
};
void populate_and_sort(struct input_item_data *itemlist);
- virtual void update_input(struct input_item_data *seqchangeditem) = 0;
void toggle_none_default(input_seq &selected_seq, input_seq &original_seq, const input_seq &selected_defseq);
-protected:
const void * pollingref;
input_seq_type pollingseq;
input_item_data * pollingitem;
@@ -70,39 +69,41 @@ private:
bool record_next;
input_seq starting_seq;
+ virtual void handle() override;
+ virtual void update_input(struct input_item_data *seqchangeditem) = 0;
+
static int compare_items(const void *i1, const void *i2);
};
class menu_input_general : public menu_input
{
public:
- menu_input_general(mame_ui_manager &mui, render_container *container, int group);
+ menu_input_general(mame_ui_manager &mui, render_container &container, int group);
virtual ~menu_input_general() override;
+
+private:
virtual void populate() override;
+ virtual void update_input(struct input_item_data *seqchangeditem) override;
-protected:
int group;
- virtual void update_input(struct input_item_data *seqchangeditem) override;
};
class menu_input_specific : public menu_input
{
public:
- menu_input_specific(mame_ui_manager &mui, render_container *container);
+ menu_input_specific(mame_ui_manager &mui, render_container &container);
virtual ~menu_input_specific() override;
- virtual void populate() override;
-protected:
+private:
+ virtual void populate() override;
virtual void update_input(struct input_item_data *seqchangeditem) override;
};
class menu_settings : public menu
{
public:
- menu_settings(mame_ui_manager &mui, render_container *container, UINT32 type);
+ menu_settings(mame_ui_manager &mui, render_container &container, UINT32 type);
virtual ~menu_settings() override;
- virtual void populate() override;
- virtual void handle() override;
protected:
/* DIP switch descriptor */
@@ -117,15 +118,21 @@ protected:
dip_descriptor * diplist;
int dipcount;
int type;
+
+private:
+ virtual void populate() override;
+ virtual void handle() override;
};
class menu_settings_dip_switches : public menu_settings
{
public:
- menu_settings_dip_switches(mame_ui_manager &mui, render_container *container);
+ menu_settings_dip_switches(mame_ui_manager &mui, render_container &container);
virtual ~menu_settings_dip_switches() override;
+protected:
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
+
private:
void custom_render_one(float x1, float y1, float x2, float y2, const dip_descriptor *dip, UINT32 selectedmask);
};
@@ -133,17 +140,15 @@ private:
class menu_settings_driver_config : public menu_settings
{
public:
- menu_settings_driver_config(mame_ui_manager &mui, render_container *container);
+ menu_settings_driver_config(mame_ui_manager &mui, render_container &container);
virtual ~menu_settings_driver_config();
};
class menu_analog : public menu
{
public:
- menu_analog(mame_ui_manager &mui, render_container *container);
+ menu_analog(mame_ui_manager &mui, render_container &container);
virtual ~menu_analog() override;
- virtual void populate() override;
- virtual void handle() override;
private:
enum {
@@ -162,6 +167,9 @@ private:
int cur;
int defvalue;
};
+
+ virtual void populate() override;
+ virtual void handle() override;
};
} // namesapce ui
diff --git a/src/frontend/mame/ui/mainmenu.cpp b/src/frontend/mame/ui/mainmenu.cpp
index 0342559d47e..3bf5e5cb7b6 100644
--- a/src/frontend/mame/ui/mainmenu.cpp
+++ b/src/frontend/mame/ui/mainmenu.cpp
@@ -44,7 +44,7 @@ namespace ui {
menu_main constructor - populate the main menu
-------------------------------------------------*/
-menu_main::menu_main(mame_ui_manager &mui, render_container *container) : menu(mui, container)
+menu_main::menu_main(mame_ui_manager &mui, render_container &container) : menu(mui, container)
{
}
@@ -163,102 +163,102 @@ void menu_main::handle()
if (menu_event != nullptr && menu_event->iptkey == IPT_UI_SELECT) {
switch((long long)(menu_event->itemref)) {
case INPUT_GROUPS:
- menu::stack_push<menu_input_groups>(ui(), container);
+ menu::stack_push<menu_input_groups>(ui(), container());
break;
case INPUT_SPECIFIC:
- menu::stack_push<menu_input_specific>(ui(), container);
+ menu::stack_push<menu_input_specific>(ui(), container());
break;
case SETTINGS_DIP_SWITCHES:
- menu::stack_push<menu_settings_dip_switches>(ui(), container);
+ menu::stack_push<menu_settings_dip_switches>(ui(), container());
break;
case SETTINGS_DRIVER_CONFIG:
- menu::stack_push<menu_settings_driver_config>(ui(), container);
+ menu::stack_push<menu_settings_driver_config>(ui(), container());
break;
case ANALOG:
- menu::stack_push<menu_analog>(ui(), container);
+ menu::stack_push<menu_analog>(ui(), container());
break;
case BOOKKEEPING:
- menu::stack_push<menu_bookkeeping>(ui(), container);
+ menu::stack_push<menu_bookkeeping>(ui(), container());
break;
case GAME_INFO:
- menu::stack_push<menu_game_info>(ui(), container);
+ menu::stack_push<menu_game_info>(ui(), container());
break;
case IMAGE_MENU_IMAGE_INFO:
- menu::stack_push<menu_image_info>(ui(), container);
+ menu::stack_push<menu_image_info>(ui(), container());
break;
case IMAGE_MENU_FILE_MANAGER:
- menu::stack_push<menu_file_manager>(ui(), container, nullptr);
+ menu::stack_push<menu_file_manager>(ui(), container(), nullptr);
break;
case TAPE_CONTROL:
- menu::stack_push<menu_tape_control>(ui(), container, nullptr);
+ menu::stack_push<menu_tape_control>(ui(), container(), nullptr);
break;
case PTY_INFO:
- menu::stack_push<menu_pty_info>(ui(), container);
+ menu::stack_push<menu_pty_info>(ui(), container());
break;
case SLOT_DEVICES:
- menu::stack_push<menu_slot_devices>(ui(), container);
+ menu::stack_push<menu_slot_devices>(ui(), container());
break;
case NETWORK_DEVICES:
- menu::stack_push<menu_network_devices>(ui(), container);
+ menu::stack_push<menu_network_devices>(ui(), container());
break;
case KEYBOARD_MODE:
- menu::stack_push<menu_keyboard_mode>(ui(), container);
+ menu::stack_push<menu_keyboard_mode>(ui(), container());
break;
case SLIDERS:
- menu::stack_push<menu_sliders>(ui(), container, false);
+ menu::stack_push<menu_sliders>(ui(), container(), false);
break;
case VIDEO_TARGETS:
- menu::stack_push<menu_video_targets>(ui(), container);
+ menu::stack_push<menu_video_targets>(ui(), container());
break;
case VIDEO_OPTIONS:
- menu::stack_push<menu_video_options>(ui(), container, machine().render().first_target());
+ menu::stack_push<menu_video_options>(ui(), container(), machine().render().first_target());
break;
case CROSSHAIR:
- menu::stack_push<menu_crosshair>(ui(), container);
+ menu::stack_push<menu_crosshair>(ui(), container());
break;
case CHEAT:
- menu::stack_push<menu_cheat>(ui(), container);
+ menu::stack_push<menu_cheat>(ui(), container());
break;
case PLUGINS:
- menu::stack_push<menu_plugin>(ui(), container);
+ menu::stack_push<menu_plugin>(ui(), container());
break;
case SELECT_GAME:
if (machine().options().ui() == emu_options::UI_SIMPLE)
- menu::stack_push<simple_menu_select_game>(ui(), container, nullptr);
+ menu::stack_push<simple_menu_select_game>(ui(), container(), nullptr);
else
- menu::stack_push<menu_select_game>(ui(), container, nullptr);
+ menu::stack_push<menu_select_game>(ui(), container(), nullptr);
break;
case BIOS_SELECTION:
- menu::stack_push<menu_bios_selection>(ui(), container);
+ menu::stack_push<menu_bios_selection>(ui(), container());
break;
case BARCODE_READ:
- menu::stack_push<menu_barcode_reader>(ui(), container, nullptr);
+ menu::stack_push<menu_barcode_reader>(ui(), container(), nullptr);
break;
case EXTERNAL_DATS:
- menu::stack_push<menu_dats_view>(ui(), container);
+ menu::stack_push<menu_dats_view>(ui(), container());
break;
case ADD_FAVORITE:
diff --git a/src/frontend/mame/ui/mainmenu.h b/src/frontend/mame/ui/mainmenu.h
index 0a60d594f92..aab547e9d56 100644
--- a/src/frontend/mame/ui/mainmenu.h
+++ b/src/frontend/mame/ui/mainmenu.h
@@ -17,10 +17,8 @@ namespace ui {
class menu_main : public menu
{
public:
- menu_main(mame_ui_manager &mui, render_container *container);
+ menu_main(mame_ui_manager &mui, render_container &container);
virtual ~menu_main();
- virtual void populate() override;
- virtual void handle() override;
private:
enum {
@@ -52,6 +50,9 @@ private:
REMOVE_FAVORITE,
QUIT_GAME
};
+
+ virtual void populate() override;
+ virtual void handle() override;
};
} // namespace ui
diff --git a/src/frontend/mame/ui/menu.cpp b/src/frontend/mame/ui/menu.cpp
index 4ff056a63f9..4001c208b12 100644
--- a/src/frontend/mame/ui/menu.cpp
+++ b/src/frontend/mame/ui/menu.cpp
@@ -142,6 +142,10 @@ menu::global_state::global_state(running_machine &machine, ui_options const &opt
menu::global_state::~global_state()
{
+ // it shouldn't really be possible to get here with active menus because of reference loops
+ assert(!m_stack);
+ assert(!m_free);
+
stack_reset();
clear_free_list();
@@ -231,10 +235,12 @@ void menu::init(running_machine &machine, ui_options &mopt)
void menu::exit(running_machine &machine)
{
// free menus
- {
- std::lock_guard<std::mutex> guard(s_global_state_guard);
- s_global_states.erase(&machine);
- }
+ global_state_ptr const state(get_global_state(machine));
+ state->stack_reset();
+ state->clear_free_list();
+
+ std::lock_guard<std::mutex> guard(s_global_state_guard);
+ s_global_states.erase(&machine);
}
@@ -247,12 +253,13 @@ void menu::exit(running_machine &machine)
// menu - menu constructor
//-------------------------------------------------
-menu::menu(mame_ui_manager &mui, render_container *_container)
+menu::menu(mame_ui_manager &mui, render_container &container)
: m_visible_lines(0)
, m_visible_items(0)
, m_global_state(get_global_state(mui.machine()))
, m_special_main_menu(false)
, m_ui(mui)
+ , m_container(container)
, m_parent()
, m_event()
, m_pool(nullptr)
@@ -261,8 +268,6 @@ menu::menu(mame_ui_manager &mui, render_container *_container)
{
assert(m_global_state); // not calling init is bad
- container = _container;
-
reset(reset_options::SELECT_FIRST);
top_line = 0;
@@ -530,7 +535,7 @@ void menu::draw(UINT32 flags)
// first draw the FPS counter
if (ui().show_fps_counter())
{
- ui().draw_text_full(container, machine().video().speed_text().c_str(), 0.0f, 0.0f, 1.0f,
+ ui().draw_text_full(container(), machine().video().speed_text().c_str(), 0.0f, 0.0f, 1.0f,
ui::text_layout::RIGHT, ui::text_layout::WORD, mame_ui_manager::OPAQUE_, rgb_t::white, rgb_t::black, nullptr, nullptr);
}
@@ -593,7 +598,7 @@ void menu::draw(UINT32 flags)
float const x2 = visible_left + visible_width + UI_BOX_LR_BORDER;
float const y2 = visible_top + visible_main_menu_height + UI_BOX_TB_BORDER;
if (!customonly)
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_BACKGROUND_COLOR);
if (top_line < 0 || is_first_selected())
top_line = 0;
@@ -621,7 +626,7 @@ void menu::draw(UINT32 flags)
INT32 mouse_target_x, mouse_target_y;
render_target *mouse_target = machine().ui_input().find_mouse(&mouse_target_x, &mouse_target_y, &mouse_button);
if (mouse_target != nullptr)
- if (mouse_target->map_point_container(mouse_target_x, mouse_target_y, *container, mouse_x, mouse_y))
+ if (mouse_target->map_point_container(mouse_target_x, mouse_target_y, container(), mouse_x, mouse_y))
mouse_hit = true;
}
@@ -664,12 +669,12 @@ void menu::draw(UINT32 flags)
// if we have some background hilighting to do, add a quad behind everything else
if (bgcolor != UI_TEXT_BG_COLOR)
- highlight(container, line_x0, line_y0, line_x1, line_y1, bgcolor);
+ highlight(line_x0, line_y0, line_x1, line_y1, bgcolor);
if (linenum == 0 && show_top_arrow)
{
// if we're on the top line, display the up arrow
- draw_arrow(container,
+ draw_arrow(
0.5f * (x1 + x2) - 0.5f * ud_arrow_width,
line_y0 + 0.25f * line_height,
0.5f * (x1 + x2) + 0.5f * ud_arrow_width,
@@ -682,7 +687,7 @@ void menu::draw(UINT32 flags)
else if (linenum == m_visible_lines - 1 && show_bottom_arrow)
{
// if we're on the bottom line, display the down arrow
- draw_arrow(container,
+ draw_arrow(
0.5f * (x1 + x2) - 0.5f * ud_arrow_width,
line_y0 + 0.25f * line_height,
0.5f * (x1 + x2) + 0.5f * ud_arrow_width,
@@ -695,7 +700,7 @@ void menu::draw(UINT32 flags)
else if (pitem.type == menu_item_type::SEPARATOR)
{
// if we're just a divider, draw a line
- container->add_line(visible_left, line_y0 + 0.5f * line_height, visible_left + visible_width, line_y0 + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container().add_line(visible_left, line_y0 + 0.5f * line_height, visible_left + visible_width, line_y0 + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
}
else if (pitem.subtext.empty())
{
@@ -703,10 +708,10 @@ void menu::draw(UINT32 flags)
if (pitem.flags & FLAG_UI_HEADING)
{
float heading_width = ui().get_string_width(itemtext);
- container->add_line(visible_left, line_y0 + 0.5f * line_height, visible_left + ((visible_width - heading_width) / 2) - UI_BOX_LR_BORDER, line_y0 + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
- container->add_line(visible_left + visible_width - ((visible_width - heading_width) / 2) + UI_BOX_LR_BORDER, line_y0 + 0.5f * line_height, visible_left + visible_width, line_y0 + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container().add_line(visible_left, line_y0 + 0.5f * line_height, visible_left + ((visible_width - heading_width) / 2) - UI_BOX_LR_BORDER, line_y0 + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container().add_line(visible_left + visible_width - ((visible_width - heading_width) / 2) + UI_BOX_LR_BORDER, line_y0 + 0.5f * line_height, visible_left + visible_width, line_y0 + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
}
- ui().draw_text_full(container, itemtext, effective_left, line_y0, effective_width,
+ ui().draw_text_full(container(), itemtext, effective_left, line_y0, effective_width,
ui::text_layout::CENTER, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr);
}
else
@@ -717,7 +722,7 @@ void menu::draw(UINT32 flags)
float item_width, subitem_width;
// draw the left-side text
- ui().draw_text_full(container, itemtext, effective_left, line_y0, effective_width,
+ ui().draw_text_full(container(), itemtext, effective_left, line_y0, effective_width,
ui::text_layout::LEFT, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, fgcolor, bgcolor, &item_width, nullptr);
// give 2 spaces worth of padding
@@ -742,13 +747,13 @@ void menu::draw(UINT32 flags)
fgcolor2 = rgb_t(0xff,0xff,0x00);
// draw the subitem right-justified
- ui().draw_text_full(container, subitem_text, effective_left + item_width, line_y0, effective_width - item_width,
+ ui().draw_text_full(container(), subitem_text, effective_left + item_width, line_y0, effective_width - item_width,
ui::text_layout::RIGHT, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, subitem_invert ? fgcolor3 : fgcolor2, bgcolor, &subitem_width, nullptr);
// apply arrows
if (itemnum == selected && (pitem.flags & FLAG_LEFT_ARROW))
{
- draw_arrow(container,
+ draw_arrow(
effective_left + effective_width - subitem_width - gutter_width,
line_y0 + 0.1f * line_height,
effective_left + effective_width - subitem_width - gutter_width + lr_arrow_width,
@@ -758,7 +763,7 @@ void menu::draw(UINT32 flags)
}
if (itemnum == selected && (pitem.flags & FLAG_RIGHT_ARROW))
{
- draw_arrow(container,
+ draw_arrow(
effective_left + effective_width + gutter_width - lr_arrow_width,
line_y0 + 0.1f * line_height,
effective_left + effective_width + gutter_width,
@@ -780,7 +785,7 @@ void menu::draw(UINT32 flags)
float target_width, target_height;
// compute the multi-line target width/height
- ui().draw_text_full(container, pitem.subtext.c_str(), 0, 0, visible_width * 0.75f,
+ ui().draw_text_full(container(), pitem.subtext.c_str(), 0, 0, visible_width * 0.75f,
ui::text_layout::RIGHT, ui::text_layout::WORD, mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &target_width, &target_height);
// determine the target location
@@ -790,13 +795,13 @@ void menu::draw(UINT32 flags)
target_y = line_y - target_height - UI_BOX_TB_BORDER;
// add a box around that
- ui().draw_outlined_box(container, target_x - UI_BOX_LR_BORDER,
+ ui().draw_outlined_box(container(), target_x - UI_BOX_LR_BORDER,
target_y - UI_BOX_TB_BORDER,
target_x + target_width + UI_BOX_LR_BORDER,
target_y + target_height + UI_BOX_TB_BORDER,
subitem_invert ? UI_SELECTED_BG_COLOR : UI_BACKGROUND_COLOR);
- ui().draw_text_full(container, pitem.subtext.c_str(), target_x, target_y, target_width,
+ ui().draw_text_full(container(), pitem.subtext.c_str(), target_x, target_y, target_width,
ui::text_layout::RIGHT, ui::text_layout::WORD, mame_ui_manager::NORMAL, UI_SELECTED_COLOR, UI_SELECTED_BG_COLOR, nullptr, nullptr);
}
@@ -825,7 +830,7 @@ void menu::draw_text_box()
float target_x, target_y;
// compute the multi-line target width/height
- ui().draw_text_full(container, text, 0, 0, 1.0f - 2.0f * UI_BOX_LR_BORDER - 2.0f * gutter_width,
+ ui().draw_text_full(container(), text, 0, 0, 1.0f - 2.0f * UI_BOX_LR_BORDER - 2.0f * gutter_width,
ui::text_layout::LEFT, ui::text_layout::WORD, mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &target_width, &target_height);
target_height += 2.0f * line_height;
if (target_height > 1.0f - 2.0f * UI_BOX_TB_BORDER)
@@ -850,22 +855,22 @@ void menu::draw_text_box()
target_y = 1.0f - UI_BOX_TB_BORDER - target_height;
// add a box around that
- ui().draw_outlined_box(container, target_x - UI_BOX_LR_BORDER - gutter_width,
+ ui().draw_outlined_box(container(), target_x - UI_BOX_LR_BORDER - gutter_width,
target_y - UI_BOX_TB_BORDER,
target_x + target_width + gutter_width + UI_BOX_LR_BORDER,
target_y + target_height + UI_BOX_TB_BORDER,
(item[0].flags & FLAG_REDTEXT) ? UI_RED_COLOR : UI_BACKGROUND_COLOR);
- ui().draw_text_full(container, text, target_x, target_y, target_width,
- ui::text_layout::LEFT, ui::text_layout::WORD, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
+ ui().draw_text_full(container(), text, target_x, target_y, target_width,
+ ui::text_layout::LEFT, ui::text_layout::WORD, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
// draw the "return to prior menu" text with a hilight behind it
- highlight(container,
+ highlight(
target_x + 0.5f * UI_LINE_WIDTH,
target_y + target_height - line_height,
target_x + target_width - 0.5f * UI_LINE_WIDTH,
target_y + target_height,
UI_SELECTED_BG_COLOR);
- ui().draw_text_full(container, backtext, target_x, target_y + target_height - line_height, target_width,
+ ui().draw_text_full(container(), backtext, target_x, target_y + target_height - line_height, target_width,
ui::text_layout::CENTER, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, UI_SELECTED_COLOR, UI_SELECTED_BG_COLOR, nullptr, nullptr);
// artificially set the hover to the last item so a double-click exits
@@ -1174,7 +1179,7 @@ void menu::do_handle()
// and calls the menu handler
//-------------------------------------------------
-UINT32 menu::ui_handler(render_container *container, mame_ui_manager &mui)
+UINT32 menu::ui_handler(render_container &container, mame_ui_manager &mui)
{
global_state_ptr const state(get_global_state(mui.machine()));
@@ -1259,9 +1264,9 @@ void menu::render_triangle(bitmap_argb32 &dest, bitmap_argb32 &source, const rec
// highlight
//-------------------------------------------------
-void menu::highlight(render_container *container, float x0, float y0, float x1, float y1, rgb_t bgcolor)
+void menu::highlight(float x0, float y0, float x1, float y1, rgb_t bgcolor)
{
- container->add_quad(x0, y0, x1, y1, bgcolor, m_global_state->hilight_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE) | PRIMFLAG_PACKABLE);
+ container().add_quad(x0, y0, x1, y1, bgcolor, m_global_state->hilight_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE) | PRIMFLAG_PACKABLE);
}
@@ -1269,9 +1274,9 @@ void menu::highlight(render_container *container, float x0, float y0, float x1,
// draw_arrow
//-------------------------------------------------
-void menu::draw_arrow(render_container *container, float x0, float y0, float x1, float y1, rgb_t fgcolor, UINT32 orientation)
+void menu::draw_arrow(float x0, float y0, float x1, float y1, rgb_t fgcolor, UINT32 orientation)
{
- container->add_quad(x0, y0, x1, y1, fgcolor, m_global_state->arrow_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(orientation) | PRIMFLAG_PACKABLE);
+ container().add_quad(x0, y0, x1, y1, fgcolor, m_global_state->arrow_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(orientation) | PRIMFLAG_PACKABLE);
}
@@ -1283,7 +1288,7 @@ void menu::draw_arrow(render_container *container, float x0, float y0, float x1,
void menu::extra_text_draw_box(float origx1, float origx2, float origy, float yspan, const char *text, int direction)
{
// get the size of the text
- auto layout = ui().create_layout(container);
+ auto layout = ui().create_layout(container());
layout.add_text(text);
// position this extra text
@@ -1291,14 +1296,14 @@ void menu::extra_text_draw_box(float origx1, float origx2, float origy, float ys
extra_text_position(origx1, origx2, origy, yspan, layout, direction, x1, y1, x2, y2);
// draw a box
- ui().draw_outlined_box(container,x1, y1, x2, y2, UI_BACKGROUND_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_BACKGROUND_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
y1 += UI_BOX_TB_BORDER;
// draw the text within it
- layout.emit(container, x1, y1);
+ layout.emit(container(), x1, y1);
}
@@ -1306,7 +1311,7 @@ void menu::draw_background()
{
// draw background image if available
if (ui().options().use_background_image() && m_global_state->bgrnd_bitmap() && m_global_state->bgrnd_bitmap()->valid())
- container->add_quad(0.0f, 0.0f, 1.0f, 1.0f, rgb_t::white, m_global_state->bgrnd_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container().add_quad(0.0f, 0.0f, 1.0f, 1.0f, rgb_t::white, m_global_state->bgrnd_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
}
diff --git a/src/frontend/mame/ui/menu.h b/src/frontend/mame/ui/menu.h
index 5c83408e118..f351ba35fee 100644
--- a/src/frontend/mame/ui/menu.h
+++ b/src/frontend/mame/ui/menu.h
@@ -49,10 +49,6 @@ public:
virtual ~menu();
- mame_ui_manager &ui() const { return m_ui; }
- running_machine &machine() const { return m_ui.machine(); }
-
- render_container *container; // render_container we render to
int hover; // which item is being hovered over
float customtop; // amount of extra height to add at the top
float custombottom; // amount of extra height to add at the bottom
@@ -64,12 +60,6 @@ public:
void item_append(menu_item item);
void item_append(menu_item_type type, UINT32 flags = 0);
- // configure the menu for custom rendering
- virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2);
-
- // allocate temporary memory from the menu's memory pool
- void *m_pool_alloc(size_t size);
-
// Global initialization
static void init(running_machine &machine, ui_options &mopt);
@@ -97,22 +87,13 @@ public:
static bool stack_has_special_main_menu(running_machine &machine) { return get_global_state(machine)->stack_has_special_main_menu(); }
// master handler
- static UINT32 ui_handler(render_container *container, mame_ui_manager &mui);
+ static UINT32 ui_handler(render_container &container, mame_ui_manager &mui);
// Used by sliders
void validate_selection(int scandir);
void do_handle();
- // To be reimplemented in the menu subclass
- virtual void populate() = 0;
-
- // To be reimplemented in the menu subclass
- virtual void handle() = 0;
-
- // test if search is active
- virtual bool menu_has_search_active() { return false; }
-
private:
virtual void draw(UINT32 flags);
void draw_text_box();
@@ -128,22 +109,6 @@ public:
INT32 mouse_target_x, mouse_target_y;
float mouse_x, mouse_y;
- // draw left panel
- virtual float draw_left_panel(float x1, float y1, float x2, float y2) { return 0; }
-
- // draw right panel
- virtual void draw_right_panel(void *selectedref, float origx1, float origy1, float origx2, float origy2) { };
-
- // get arrows status
- template <typename _T1, typename _T2, typename _T3>
- UINT32 get_arrow_flags(_T1 min, _T2 max, _T3 actual)
- {
- if (max == 0)
- return 0;
- else
- return ((actual <= min) ? FLAG_RIGHT_ARROW : (actual >= max ? FLAG_LEFT_ARROW : (FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW)));
- }
-
protected:
using cleanup_callback = std::function<void(running_machine &)>;
using bitmap_ptr = std::unique_ptr<bitmap_argb32>;
@@ -212,7 +177,14 @@ protected:
int m_visible_lines; // main box visible lines
int m_visible_items; // number of visible items
- menu(mame_ui_manager &mui, render_container *container);
+ menu(mame_ui_manager &mui, render_container &container);
+
+ mame_ui_manager &ui() const { return m_ui; }
+ running_machine &machine() const { return m_ui.machine(); }
+ render_container &container() const { return m_container; }
+
+ // allocate temporary memory from the menu's memory pool
+ void *m_pool_alloc(size_t size);
void reset(reset_options options);
void reset_parent(reset_options options) { m_parent->reset(options); }
@@ -246,11 +218,11 @@ protected:
bool exclusive_input_pressed(int &iptkey, int key, int repeat);
// highlight
- void highlight(render_container *container, float x0, float y0, float x1, float y1, rgb_t bgcolor);
+ void highlight(float x0, float y0, float x1, float y1, rgb_t bgcolor);
render_texture *hilight_main_texture() { return m_global_state->hilight_main_texture(); }
// draw arrow
- void draw_arrow(render_container *container, float x0, float y0, float x1, float y1, rgb_t fgcolor, UINT32 orientation);
+ void draw_arrow(float x0, float y0, float x1, float y1, rgb_t fgcolor, UINT32 orientation);
// draw header and footer text
void extra_text_render(float top, float bottom, float origx1, float origy1, float origx2, float origy2, const char *header, const char *footer);
@@ -259,16 +231,29 @@ protected:
void draw_background();
+ // configure the menu for custom rendering
+ virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2);
+
// overridable event handling
virtual void handle_events(UINT32 flags, event &ev);
virtual void handle_keys(UINT32 flags, int &iptkey);
virtual bool custom_mouse_down() { return false; }
+ // test if search is active
+ virtual bool menu_has_search_active() { return false; }
+
static bool is_selectable(menu_item const &item)
{
return ((item.flags & (menu::FLAG_MULTILINE | menu::FLAG_DISABLE)) == 0 && item.type != menu_item_type::SEPARATOR);
}
+ // get arrows status
+ template <typename T>
+ UINT32 get_arrow_flags(T min, T max, T actual)
+ {
+ return ((actual > min) ? FLAG_LEFT_ARROW : 0) | ((actual < max) ? FLAG_RIGHT_ARROW : 0);
+ }
+
int right_visible_lines; // right box lines
private:
@@ -330,6 +315,12 @@ private:
bool is_special_main_menu() const;
void set_special_main_menu(bool disable);
+ // To be reimplemented in the menu subclass
+ virtual void populate() = 0;
+
+ // To be reimplemented in the menu subclass
+ virtual void handle() = 0;
+
// push a new menu onto the stack
static void stack_push(std::unique_ptr<menu> &&menu) { get_global_state(menu->machine())->stack_push(std::move(menu)); }
@@ -344,6 +335,7 @@ private:
global_state_ptr const m_global_state;
bool m_special_main_menu;
mame_ui_manager &m_ui; // UI we are attached to
+ render_container &m_container; // render_container we render to
std::unique_ptr<menu> m_parent; // pointer to parent menu
event m_event; // the UI event that occurred
pool *m_pool; // list of memory pools
diff --git a/src/frontend/mame/ui/miscmenu.cpp b/src/frontend/mame/ui/miscmenu.cpp
index 62c04b98cff..f6190e5e7e1 100644
--- a/src/frontend/mame/ui/miscmenu.cpp
+++ b/src/frontend/mame/ui/miscmenu.cpp
@@ -32,7 +32,7 @@ namespace ui {
menu_keyboard_mode - menu that
-------------------------------------------------*/
-menu_keyboard_mode::menu_keyboard_mode(mame_ui_manager &mui, render_container *container) : menu(mui, container)
+menu_keyboard_mode::menu_keyboard_mode(mame_ui_manager &mui, render_container &container) : menu(mui, container)
{
}
@@ -69,7 +69,7 @@ void menu_keyboard_mode::handle()
bios selection menu
-------------------------------------------------*/
-menu_bios_selection::menu_bios_selection(mame_ui_manager &mui, render_container *container) : menu(mui, container)
+menu_bios_selection::menu_bios_selection(mame_ui_manager &mui, render_container &container) : menu(mui, container)
{
}
@@ -142,7 +142,7 @@ void menu_bios_selection::handle()
-menu_network_devices::menu_network_devices(mame_ui_manager &mui, render_container *container) : menu(mui, container)
+menu_network_devices::menu_network_devices(mame_ui_manager &mui, render_container &container) : menu(mui, container)
{
}
@@ -163,7 +163,7 @@ void menu_network_devices::populate()
int curr = network.get_interface();
const char *title = nullptr;
for(auto &entry : get_netdev_list())
- {
+ {
if(entry->id==curr) {
title = entry->description;
break;
@@ -224,7 +224,7 @@ void menu_bookkeeping::handle()
menu_bookkeeping - handle the bookkeeping
information menu
-------------------------------------------------*/
-menu_bookkeeping::menu_bookkeeping(mame_ui_manager &mui, render_container *container) : menu(mui, container)
+menu_bookkeeping::menu_bookkeeping(mame_ui_manager &mui, render_container &container) : menu(mui, container)
{
}
@@ -373,7 +373,7 @@ void menu_crosshair::handle()
crosshair settings menu
-------------------------------------------------*/
-menu_crosshair::menu_crosshair(mame_ui_manager &mui, render_container *container) : menu(mui, container)
+menu_crosshair::menu_crosshair(mame_ui_manager &mui, render_container &container) : menu(mui, container)
{
}
@@ -530,7 +530,7 @@ menu_crosshair::~menu_crosshair()
quitting the game
-------------------------------------------------*/
-menu_quit_game::menu_quit_game(mame_ui_manager &mui, render_container *container) : menu(mui, container)
+menu_quit_game::menu_quit_game(mame_ui_manager &mui, render_container &container) : menu(mui, container)
{
}
@@ -555,7 +555,7 @@ void menu_quit_game::handle()
// ctor / dtor
//-------------------------------------------------
-menu_export::menu_export(mame_ui_manager &mui, render_container *container, std::vector<const game_driver *> drvlist)
+menu_export::menu_export(mame_ui_manager &mui, render_container &container, std::vector<const game_driver *> drvlist)
: menu(mui, container), m_list(drvlist)
{
}
@@ -681,7 +681,7 @@ void menu_export::populate()
// ctor / dtor
//-------------------------------------------------
-menu_machine_configure::menu_machine_configure(mame_ui_manager &mui, render_container *container, const game_driver *prev, float _x0, float _y0)
+menu_machine_configure::menu_machine_configure(mame_ui_manager &mui, render_container &container, const game_driver *prev, float _x0, float _y0)
: menu(mui, container)
, m_drv(prev)
, m_opts(mui.machine().options())
@@ -738,15 +738,15 @@ void menu_machine_configure::handle()
break;
case CONTROLLER:
if (menu_event->iptkey == IPT_UI_SELECT)
- menu::stack_push<submenu>(ui(), container, submenu::control_options, m_drv, &m_opts);
+ menu::stack_push<submenu>(ui(), container(), submenu::control_options, m_drv, &m_opts);
break;
case VIDEO:
if (menu_event->iptkey == IPT_UI_SELECT)
- menu::stack_push<submenu>(ui(), container, submenu::video_options, m_drv, &m_opts);
+ menu::stack_push<submenu>(ui(), container(), submenu::video_options, m_drv, &m_opts);
break;
case ADVANCED:
if (menu_event->iptkey == IPT_UI_SELECT)
- menu::stack_push<submenu>(ui(), container, submenu::advanced_options, m_drv, &m_opts);
+ menu::stack_push<submenu>(ui(), container(), submenu::advanced_options, m_drv, &m_opts);
break;
default:
break;
@@ -773,7 +773,7 @@ void menu_machine_configure::populate()
item_append(_("Bios"), "", FLAG_DISABLE | FLAG_UI_HEADING, nullptr);
if (!m_bios.empty())
{
- UINT32 arrows = get_arrow_flags(0, m_bios.size() - 1, m_curbios);
+ UINT32 arrows = get_arrow_flags(std::size_t(0), m_bios.size() - 1, m_curbios);
item_append(_("Driver"), m_bios[m_curbios].first, arrows, (void *)(FPTR)BIOS);
}
else
@@ -811,7 +811,7 @@ void menu_machine_configure::custom_render(void *selectedref, float top, float b
for (auto & elem : text)
{
- ui().draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), elem.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
maxwidth = MAX(maxwidth, width);
@@ -824,7 +824,7 @@ void menu_machine_configure::custom_render(void *selectedref, float top, float b
float y2 = origy1 - UI_BOX_TB_BORDER;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_GREEN_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -834,7 +834,7 @@ void menu_machine_configure::custom_render(void *selectedref, float top, float b
// draw the text within it
for (auto & elem : text)
{
- ui().draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), elem.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
y1 += ui().get_line_height();
}
@@ -851,7 +851,7 @@ void menu_machine_configure::setup_bios()
if (ROMENTRY_ISDEFAULT_BIOS(rom))
default_name = ROM_GETNAME(rom);
- int bios_count = 0;
+ std::size_t bios_count = 0;
for (const rom_entry *rom = m_drv->rom; !ROMENTRY_ISEND(rom); ++rom)
{
if (ROMENTRY_ISSYSTEM_BIOS(rom))
@@ -883,7 +883,7 @@ void menu_machine_configure::setup_bios()
// ctor / dtor
//-------------------------------------------------
-menu_plugins_configure::menu_plugins_configure(mame_ui_manager &mui, render_container *container)
+menu_plugins_configure::menu_plugins_configure(mame_ui_manager &mui, render_container &container)
: menu(mui, container)
{
}
@@ -955,7 +955,7 @@ void menu_plugins_configure::custom_render(void *selectedref, float top, float b
{
float width;
- ui().draw_text_full(container, _("Plugins"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), _("Plugins"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
float maxwidth = MAX(origx2 - origx1, width);
@@ -967,7 +967,7 @@ void menu_plugins_configure::custom_render(void *selectedref, float top, float b
float y2 = origy1 - UI_BOX_TB_BORDER;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_GREEN_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -975,7 +975,7 @@ void menu_plugins_configure::custom_render(void *selectedref, float top, float b
y1 += UI_BOX_TB_BORDER;
// draw the text within it
- ui().draw_text_full(container, _("Plugins"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), _("Plugins"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
}
diff --git a/src/frontend/mame/ui/miscmenu.h b/src/frontend/mame/ui/miscmenu.h
index 86d7477c1db..4544d75bc99 100644
--- a/src/frontend/mame/ui/miscmenu.h
+++ b/src/frontend/mame/ui/miscmenu.h
@@ -24,8 +24,10 @@ namespace ui {
class menu_keyboard_mode : public menu
{
public:
- menu_keyboard_mode(mame_ui_manager &mui, render_container *container);
+ menu_keyboard_mode(mame_ui_manager &mui, render_container &container);
virtual ~menu_keyboard_mode();
+
+private:
virtual void populate() override;
virtual void handle() override;
};
@@ -33,8 +35,10 @@ public:
class menu_network_devices : public menu
{
public:
- menu_network_devices(mame_ui_manager &mui, render_container *container);
+ menu_network_devices(mame_ui_manager &mui, render_container &container);
virtual ~menu_network_devices();
+
+private:
virtual void populate() override;
virtual void handle() override;
};
@@ -42,22 +46,21 @@ public:
class menu_bookkeeping : public menu
{
public:
- menu_bookkeeping(mame_ui_manager &mui, render_container *container);
+ menu_bookkeeping(mame_ui_manager &mui, render_container &container);
virtual ~menu_bookkeeping();
+
+private:
virtual void populate() override;
virtual void handle() override;
-private:
attotime prevtime;
};
class menu_crosshair : public menu
{
public:
- menu_crosshair(mame_ui_manager &mui, render_container *container);
+ menu_crosshair(mame_ui_manager &mui, render_container &container);
virtual ~menu_crosshair();
- virtual void populate() override;
- virtual void handle() override;
private:
enum {
@@ -67,22 +70,28 @@ private:
};
/* internal crosshair menu item data */
- struct crosshair_item_data {
- UINT8 type;
- UINT8 player;
- UINT8 min, max;
- UINT8 cur;
- UINT8 defvalue;
- char last_name[CROSSHAIR_PIC_NAME_LENGTH + 1];
- char next_name[CROSSHAIR_PIC_NAME_LENGTH + 1];
+ struct crosshair_item_data
+ {
+ UINT8 type;
+ UINT8 player;
+ UINT8 min, max;
+ UINT8 cur;
+ UINT8 defvalue;
+ char last_name[CROSSHAIR_PIC_NAME_LENGTH + 1];
+ char next_name[CROSSHAIR_PIC_NAME_LENGTH + 1];
};
+
+ virtual void populate() override;
+ virtual void handle() override;
};
class menu_quit_game : public menu
{
public:
- menu_quit_game(mame_ui_manager &mui, render_container *container);
+ menu_quit_game(mame_ui_manager &mui, render_container &container);
virtual ~menu_quit_game();
+
+private:
virtual void populate() override;
virtual void handle() override;
};
@@ -90,8 +99,10 @@ public:
class menu_bios_selection : public menu
{
public:
- menu_bios_selection(mame_ui_manager &mui, render_container *container);
+ menu_bios_selection(mame_ui_manager &mui, render_container &container);
virtual ~menu_bios_selection();
+
+private:
virtual void populate() override;
virtual void handle() override;
};
@@ -104,12 +115,13 @@ public:
class menu_export : public menu
{
public:
- menu_export(mame_ui_manager &mui, render_container *container, std::vector<const game_driver*> list);
+ menu_export(mame_ui_manager &mui, render_container &container, std::vector<const game_driver*> list);
virtual ~menu_export();
+
+private:
virtual void populate() override;
virtual void handle() override;
-private:
std::vector<const game_driver*> m_list;
};
@@ -120,10 +132,10 @@ private:
class menu_machine_configure : public menu
{
public:
- menu_machine_configure(mame_ui_manager &mui, render_container *container, const game_driver *prev, float x0 = 0.0f, float y0 = 0.0f);
+ menu_machine_configure(mame_ui_manager &mui, render_container &container, const game_driver *prev, float x0 = 0.0f, float y0 = 0.0f);
virtual ~menu_machine_configure();
- virtual void populate() override;
- virtual void handle() override;
+
+protected:
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
private:
@@ -140,11 +152,15 @@ private:
ADVANCED,
LAST = ADVANCED
};
+
+ virtual void populate() override;
+ virtual void handle() override;
+
const game_driver *m_drv;
emu_options m_opts;
float x0, y0;
s_bios m_bios;
- int m_curbios;
+ std::size_t m_curbios;
void setup_bios();
};
@@ -155,10 +171,13 @@ private:
class menu_plugins_configure : public menu
{
public:
- menu_plugins_configure(mame_ui_manager &mui, render_container *container);
+ menu_plugins_configure(mame_ui_manager &mui, render_container &container);
virtual ~menu_plugins_configure();
+
+protected:
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;
};
diff --git a/src/frontend/mame/ui/optsmenu.cpp b/src/frontend/mame/ui/optsmenu.cpp
index 5762ec9af9f..3073388887f 100644
--- a/src/frontend/mame/ui/optsmenu.cpp
+++ b/src/frontend/mame/ui/optsmenu.cpp
@@ -31,7 +31,7 @@ namespace ui {
// ctor
//-------------------------------------------------
-menu_game_options::menu_game_options(mame_ui_manager &mui, render_container *container) : menu(mui, container)
+menu_game_options::menu_game_options(mame_ui_manager &mui, render_container &container) : menu(mui, container)
{
m_main = main_filters::actual;
}
@@ -85,7 +85,7 @@ void menu_game_options::handle()
for (int index = 0; index < total; ++index)
s_sel[index] = main_filters::text[index];
- menu::stack_push<menu_selector>(ui(), container, s_sel, m_main);
+ menu::stack_push<menu_selector>(ui(), container(), s_sel, m_main);
}
break;
}
@@ -110,7 +110,7 @@ void menu_game_options::handle()
for (size_t index = 0; index < total; ++index)
s_sel[index] = ifile.get_file(index);
- menu::stack_push<menu_selector>(ui(), container, s_sel, ifile.cur_file(), menu_selector::INIFILE);
+ menu::stack_push<menu_selector>(ui(), container(), s_sel, ifile.cur_file(), menu_selector::INIFILE);
}
break;
}
@@ -134,7 +134,7 @@ void menu_game_options::handle()
for (int index = 0; index < total; ++index)
s_sel[index] = ifile.get_category(index);
- menu::stack_push<menu_selector>(ui(), container, s_sel, ifile.cur_cat(), menu_selector::CATEGORY);
+ menu::stack_push<menu_selector>(ui(), container(), s_sel, ifile.cur_cat(), menu_selector::CATEGORY);
}
break;
}
@@ -145,7 +145,7 @@ void menu_game_options::handle()
changed = true;
}
else if (menu_event->iptkey == IPT_UI_SELECT)
- menu::stack_push<menu_selector>(ui(), container, c_mnfct::ui, c_mnfct::actual);
+ menu::stack_push<menu_selector>(ui(), container(), c_mnfct::ui, c_mnfct::actual);
break;
case YEAR_CAT_FILTER:
@@ -155,54 +155,54 @@ void menu_game_options::handle()
changed = true;
}
else if (menu_event->iptkey == IPT_UI_SELECT)
- menu::stack_push<menu_selector>(ui(), container, c_year::ui, c_year::actual);
+ menu::stack_push<menu_selector>(ui(), container(), c_year::ui, c_year::actual);
break;
case CONF_DIR:
if (menu_event->iptkey == IPT_UI_SELECT)
- menu::stack_push<menu_directory>(ui(), container);
+ menu::stack_push<menu_directory>(ui(), container());
break;
case MISC_MENU:
if (menu_event->iptkey == IPT_UI_SELECT)
{
- menu::stack_push<submenu>(ui(), container, submenu::misc_options);
+ menu::stack_push<submenu>(ui(), container(), submenu::misc_options);
ui_globals::reset = true;
}
break;
case SOUND_MENU:
if (menu_event->iptkey == IPT_UI_SELECT)
{
- menu::stack_push<menu_sound_options>(ui(), container);
+ menu::stack_push<menu_sound_options>(ui(), container());
ui_globals::reset = true;
}
break;
case DISPLAY_MENU:
if (menu_event->iptkey == IPT_UI_SELECT)
{
- menu::stack_push<submenu>(ui(), container, submenu::video_options);
+ menu::stack_push<submenu>(ui(), container(), submenu::video_options);
ui_globals::reset = true;
}
break;
case CUSTOM_MENU:
if (menu_event->iptkey == IPT_UI_SELECT)
- menu::stack_push<menu_custom_ui>(ui(), container);
+ menu::stack_push<menu_custom_ui>(ui(), container());
break;
case CONTROLLER_MENU:
if (menu_event->iptkey == IPT_UI_SELECT)
- menu::stack_push<submenu>(ui(), container, submenu::control_options);
+ menu::stack_push<submenu>(ui(), container(), submenu::control_options);
break;
case CGI_MENU:
if (menu_event->iptkey == IPT_UI_SELECT)
- menu::stack_push<menu_input_groups>(ui(), container);
+ menu::stack_push<menu_input_groups>(ui(), container());
break;
case CUSTOM_FILTER:
if (menu_event->iptkey == IPT_UI_SELECT)
- menu::stack_push<menu_custom_filter>(ui(), container);
+ menu::stack_push<menu_custom_filter>(ui(), container());
break;
case ADVANCED_MENU:
if (menu_event->iptkey == IPT_UI_SELECT)
{
- menu::stack_push<submenu>(ui(), container, submenu::advanced_options);
+ menu::stack_push<submenu>(ui(), container(), submenu::advanced_options);
ui_globals::reset = true;
}
break;
@@ -228,7 +228,7 @@ void menu_game_options::populate()
std::string fbuff;
// add filter item
- UINT32 arrow_flags = get_arrow_flags((int)FILTER_FIRST, (int)FILTER_LAST, m_main);
+ UINT32 arrow_flags = get_arrow_flags<UINT16>(FILTER_FIRST, FILTER_LAST, m_main);
item_append(_("Filter"), main_filters::text[m_main], arrow_flags, (void *)(FPTR)FILTER_MENU);
// add category subitem
@@ -236,12 +236,12 @@ void menu_game_options::populate()
{
inifile_manager &inif = mame_machine_manager::instance()->inifile();
- arrow_flags = get_arrow_flags(0, inif.total() - 1, inif.cur_file());
+ arrow_flags = get_arrow_flags(UINT16(0), UINT16(inif.total() - 1), inif.cur_file());
fbuff = _(" ^!File");
convert_command_glyph(fbuff);
item_append(fbuff, inif.get_file(), arrow_flags, (void *)(FPTR)FILE_CATEGORY_FILTER);
- arrow_flags = get_arrow_flags(0, inif.cat_total() - 1, inif.cur_cat());
+ arrow_flags = get_arrow_flags(UINT16(0), UINT16(inif.cat_total() - 1), inif.cur_cat());
fbuff = _(" ^!Category");
convert_command_glyph(fbuff);
item_append(fbuff, inif.get_category(), arrow_flags, (void *)(FPTR)CATEGORY_FILTER);
@@ -249,7 +249,7 @@ void menu_game_options::populate()
// add manufacturer subitem
else if (m_main == FILTER_MANUFACTURER && c_mnfct::ui.size() > 0)
{
- arrow_flags = get_arrow_flags(0, c_mnfct::ui.size() - 1, c_mnfct::actual);
+ arrow_flags = get_arrow_flags(UINT16(0), UINT16(c_mnfct::ui.size() - 1), c_mnfct::actual);
fbuff = _("^!Manufacturer");
convert_command_glyph(fbuff);
item_append(fbuff, c_mnfct::ui[c_mnfct::actual], arrow_flags, (void *)(FPTR)MANUFACT_CAT_FILTER);
@@ -257,7 +257,7 @@ void menu_game_options::populate()
// add year subitem
else if (m_main == FILTER_YEAR && c_year::ui.size() > 0)
{
- arrow_flags = get_arrow_flags(0, c_year::ui.size() - 1, c_year::actual);
+ arrow_flags = get_arrow_flags(UINT16(0), UINT16(c_year::ui.size() - 1), c_year::actual);
fbuff.assign(_("^!Year"));
convert_command_glyph(fbuff);
item_append(fbuff, c_year::ui[c_year::actual], arrow_flags, (void *)(FPTR)YEAR_CAT_FILTER);
@@ -296,7 +296,7 @@ void menu_game_options::populate()
void menu_game_options::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
{
float width;
- ui().draw_text_full(container, _("Settings"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), _("Settings"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
float maxwidth = MAX(origx2 - origx1, width);
@@ -308,7 +308,7 @@ void menu_game_options::custom_render(void *selectedref, float top, float bottom
float y2 = origy1 - UI_BOX_TB_BORDER;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_GREEN_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -316,7 +316,7 @@ void menu_game_options::custom_render(void *selectedref, float top, float bottom
y1 += UI_BOX_TB_BORDER;
// draw the text within it
- ui().draw_text_full(container, _("Settings"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), _("Settings"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
}
diff --git a/src/frontend/mame/ui/optsmenu.h b/src/frontend/mame/ui/optsmenu.h
index 6c388163d51..c131aa76639 100644
--- a/src/frontend/mame/ui/optsmenu.h
+++ b/src/frontend/mame/ui/optsmenu.h
@@ -19,15 +19,13 @@ namespace ui {
class menu_game_options : public menu
{
public:
- menu_game_options(mame_ui_manager &mui, render_container *container);
+ menu_game_options(mame_ui_manager &mui, render_container &container);
virtual ~menu_game_options() override;
- virtual void populate() override;
- virtual void handle() override;
+
+protected:
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
private:
- UINT16 m_main;
-
enum
{
FILTER_MENU = 1,
@@ -47,6 +45,11 @@ private:
CUSTOM_FILTER,
SAVE_CONFIG
};
+
+ virtual void populate() override;
+ virtual void handle() override;
+
+ UINT16 m_main;
};
} // namespace ui
diff --git a/src/frontend/mame/ui/pluginopt.cpp b/src/frontend/mame/ui/pluginopt.cpp
index 8ea60e91011..d6037af438b 100644
--- a/src/frontend/mame/ui/pluginopt.cpp
+++ b/src/frontend/mame/ui/pluginopt.cpp
@@ -24,11 +24,11 @@ void menu_plugin::handle()
if (menu_event != nullptr && menu_event->itemref != nullptr)
{
if (menu_event->iptkey == IPT_UI_SELECT)
- menu::stack_push<menu_plugin_opt>(ui(), container, (char *)menu_event->itemref);
+ menu::stack_push<menu_plugin_opt>(ui(), container(), (char *)menu_event->itemref);
}
}
-menu_plugin::menu_plugin(mame_ui_manager &mui, render_container *container) :
+menu_plugin::menu_plugin(mame_ui_manager &mui, render_container &container) :
menu(mui, container),
m_plugins(mame_machine_manager::instance()->lua()->get_menu())
{
@@ -45,7 +45,7 @@ menu_plugin::~menu_plugin()
{
}
-menu_plugin_opt::menu_plugin_opt(mame_ui_manager &mui, render_container *container, char *menu) :
+menu_plugin_opt::menu_plugin_opt(mame_ui_manager &mui, render_container &container, char *menu) :
ui::menu(mui, container),
m_menu(menu)
{
diff --git a/src/frontend/mame/ui/pluginopt.h b/src/frontend/mame/ui/pluginopt.h
index 83f40b44fd8..21348f23750 100644
--- a/src/frontend/mame/ui/pluginopt.h
+++ b/src/frontend/mame/ui/pluginopt.h
@@ -24,22 +24,26 @@ namespace ui {
class menu_plugin : public menu
{
public:
- menu_plugin(mame_ui_manager &mui, render_container *container);
+ menu_plugin(mame_ui_manager &mui, render_container &container);
virtual ~menu_plugin();
+
+private:
virtual void populate() override;
virtual void handle() override;
-private:
+
std::vector<std::string> &m_plugins;
};
class menu_plugin_opt : public menu
{
public:
- menu_plugin_opt(mame_ui_manager &mui, render_container *container, char *menu);
+ menu_plugin_opt(mame_ui_manager &mui, render_container &container, char *menu);
virtual ~menu_plugin_opt();
+
+private:
virtual void populate() override;
virtual void handle() override;
-private:
+
std::string m_menu;
};
diff --git a/src/frontend/mame/ui/selector.cpp b/src/frontend/mame/ui/selector.cpp
index 236ce06f672..0aa6798d849 100644
--- a/src/frontend/mame/ui/selector.cpp
+++ b/src/frontend/mame/ui/selector.cpp
@@ -21,7 +21,7 @@ namespace ui {
// ctor / dtor
//-------------------------------------------------
-menu_selector::menu_selector(mame_ui_manager &mui, render_container *container, std::vector<std::string> const &s_sel, UINT16 &s_actual, int category, int _hover)
+menu_selector::menu_selector(mame_ui_manager &mui, render_container &container, std::vector<std::string> const &s_sel, UINT16 &s_actual, int category, int _hover)
: menu(mui, container)
, m_selector(s_actual)
, m_category(category)
@@ -33,7 +33,7 @@ menu_selector::menu_selector(mame_ui_manager &mui, render_container *container,
m_searchlist[0] = nullptr;
}
-menu_selector::menu_selector(mame_ui_manager &mui, render_container *container, std::vector<std::string> &&s_sel, UINT16 &s_actual, int category, int _hover)
+menu_selector::menu_selector(mame_ui_manager &mui, render_container &container, std::vector<std::string> &&s_sel, UINT16 &s_actual, int category, int _hover)
: menu(mui, container)
, m_selector(s_actual)
, m_category(category)
@@ -167,7 +167,7 @@ void menu_selector::custom_render(void *selectedref, float top, float bottom, fl
std::string tempbuf = std::string(_("Selection List - Search: ")).append(m_search).append("_");
// get the size of the text
- ui().draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), tempbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += (2.0f * UI_BOX_LR_BORDER) + 0.01f;
float maxwidth = MAX(width, origx2 - origx1);
@@ -179,7 +179,7 @@ void menu_selector::custom_render(void *selectedref, float top, float bottom, fl
float y2 = origy1 - UI_BOX_TB_BORDER;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_GREEN_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -187,7 +187,7 @@ void menu_selector::custom_render(void *selectedref, float top, float bottom, fl
y1 += UI_BOX_TB_BORDER;
// draw the text within it
- ui().draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), tempbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
// bottom text
@@ -195,7 +195,7 @@ void menu_selector::custom_render(void *selectedref, float top, float bottom, fl
std::string ui_select_text = machine().input().seq_name(machine().ioport().type_seq(IPT_UI_SELECT, 0, SEQ_TYPE_STANDARD));
tempbuf = string_format(_("Double click or press %1$s to select"), ui_select_text);
- ui().draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), tempbuf.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
maxwidth = MAX(maxwidth, width);
@@ -207,7 +207,7 @@ void menu_selector::custom_render(void *selectedref, float top, float bottom, fl
y2 = origy2 + bottom;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_RED_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_RED_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -215,7 +215,7 @@ void menu_selector::custom_render(void *selectedref, float top, float bottom, fl
y1 += UI_BOX_TB_BORDER;
// draw the text within it
- ui().draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), tempbuf.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
}
diff --git a/src/frontend/mame/ui/selector.h b/src/frontend/mame/ui/selector.h
index 2b6747e2c80..5c50ec43b3b 100644
--- a/src/frontend/mame/ui/selector.h
+++ b/src/frontend/mame/ui/selector.h
@@ -31,25 +31,28 @@ public:
SOFTWARE
};
- menu_selector(mame_ui_manager &mui, render_container *container, std::vector<std::string> const &_sel, UINT16 &_actual, int _category = 0, int _hover = 0);
- menu_selector(mame_ui_manager &mui, render_container *container, std::vector<std::string> &&_sel, UINT16 &_actual, int _category = 0, int _hover = 0);
+ menu_selector(mame_ui_manager &mui, render_container &container, std::vector<std::string> const &_sel, UINT16 &_actual, int _category = 0, int _hover = 0);
+ menu_selector(mame_ui_manager &mui, render_container &container, std::vector<std::string> &&_sel, UINT16 &_actual, int _category = 0, int _hover = 0);
virtual ~menu_selector() 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;
+protected:
+ virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual bool menu_has_search_active() override { return (m_search[0] != 0); }
private:
enum { VISIBLE_GAMES_IN_SEARCH = 200 };
+
+ virtual void populate() override;
+ virtual void handle() override;
+
+ void find_matches(const char *str);
+
char m_search[40];
UINT16 &m_selector;
int m_category, m_hover;
bool m_first_pass;
std::vector<std::string> m_str_items;
std::string *m_searchlist[VISIBLE_GAMES_IN_SEARCH + 1];
-
- void find_matches(const char *str);
};
} // namespace ui
diff --git a/src/frontend/mame/ui/selgame.cpp b/src/frontend/mame/ui/selgame.cpp
index 7ed67a15ed1..b94c12daf54 100644
--- a/src/frontend/mame/ui/selgame.cpp
+++ b/src/frontend/mame/ui/selgame.cpp
@@ -55,7 +55,7 @@ int menu_select_game::m_isabios = 0;
// ctor
//-------------------------------------------------
-menu_select_game::menu_select_game(mame_ui_manager &mui, render_container *container, const char *gamename)
+menu_select_game::menu_select_game(mame_ui_manager &mui, render_container &container, const char *gamename)
: menu_select_launch(mui, container, false)
{
set_focus(focused_menu::main);
@@ -193,7 +193,7 @@ void menu_select_game::handle()
if (reselect_last::get())
{
const game_driver *driver = (const game_driver *)item[selected].ref;
- menu::stack_push<menu_select_software>(ui(), container, driver);
+ menu::stack_push<menu_select_software>(ui(), container(), driver);
return;
}
@@ -231,11 +231,11 @@ void menu_select_game::handle()
{
// handle IPT_CUSTOM (mouse right click)
if (!isfavorite())
- menu::stack_push<menu_machine_configure>(ui(), container, (const game_driver *)m_prev_selected, menu_event->mouse.x0, menu_event->mouse.y0);
+ menu::stack_push<menu_machine_configure>(ui(), container(), (const game_driver *)m_prev_selected, menu_event->mouse.x0, menu_event->mouse.y0);
else
{
ui_software_info *sw = (ui_software_info *)m_prev_selected;
- menu::stack_push<menu_machine_configure>(ui(), container, (const game_driver *)sw->driver, menu_event->mouse.x0, menu_event->mouse.y0);
+ menu::stack_push<menu_machine_configure>(ui(), container(), (const game_driver *)sw->driver, menu_event->mouse.x0, menu_event->mouse.y0);
}
}
else if (menu_event->iptkey == IPT_UI_LEFT)
@@ -348,7 +348,7 @@ void menu_select_game::handle()
{
const game_driver *driver = (const game_driver *)menu_event->itemref;
if ((FPTR)driver > skip_main_items && mame_machine_manager::instance()->datfile().has_data(driver))
- menu::stack_push<menu_dats_view>(ui(), container, driver);
+ menu::stack_push<menu_dats_view>(ui(), container(), driver);
}
else
{
@@ -358,9 +358,9 @@ void menu_select_game::handle()
if ((FPTR)ui_swinfo > skip_main_items)
{
if (ui_swinfo->startempty == 1 && mdat.has_history(ui_swinfo->driver))
- menu::stack_push<menu_dats_view>(ui(), container, ui_swinfo->driver);
+ menu::stack_push<menu_dats_view>(ui(), container(), ui_swinfo->driver);
else if (mdat.has_software(ui_swinfo->listname, ui_swinfo->shortname, ui_swinfo->parentname) || !ui_swinfo->usage.empty())
- menu::stack_push<menu_dats_view>(ui(), container, ui_swinfo);
+ menu::stack_push<menu_dats_view>(ui(), container(), ui_swinfo);
}
}
}
@@ -405,12 +405,12 @@ void menu_select_game::handle()
else if (menu_event->iptkey == IPT_UI_AUDIT_FAST && !m_unavailsortedlist.empty())
{
// handle UI_AUDIT_FAST
- menu::stack_push<menu_audit>(ui(), container, m_availsortedlist, m_unavailsortedlist, 1);
+ menu::stack_push<menu_audit>(ui(), container(), m_availsortedlist, m_unavailsortedlist, 1);
}
else if (menu_event->iptkey == IPT_UI_AUDIT_ALL)
{
// handle UI_AUDIT_ALL
- menu::stack_push<menu_audit>(ui(), container, m_availsortedlist, m_unavailsortedlist, 2);
+ menu::stack_push<menu_audit>(ui(), container(), m_availsortedlist, m_unavailsortedlist, 2);
}
else if (menu_event->iptkey == IPT_SPECIAL)
{
@@ -459,8 +459,8 @@ void menu_select_game::handle()
// if we're in an error state, overlay an error message
if (m_ui_error)
- ui().draw_text_box(container, _("The selected machine is missing one or more required ROM or CHD images. "
- "Please select a different machine.\n\nPress any key to continue."), ui::text_layout::CENTER, 0.5f, 0.5f, UI_RED_COLOR);
+ ui().draw_text_box(container(), _("The selected machine is missing one or more required ROM or CHD images. "
+ "Please select a different machine.\n\nPress any key to continue."), ui::text_layout::CENTER, 0.5f, 0.5f, UI_RED_COLOR);
// handle filters selection from key shortcuts
if (check_filter)
@@ -469,17 +469,17 @@ void menu_select_game::handle()
if (l_hover == FILTER_CATEGORY)
{
main_filters::actual = l_hover;
- menu::stack_push<menu_game_options>(ui(), container);
+ menu::stack_push<menu_game_options>(ui(), container());
}
else if (l_hover == FILTER_CUSTOM)
{
main_filters::actual = l_hover;
- menu::stack_push<menu_custom_filter>(ui(), container, true);
+ menu::stack_push<menu_custom_filter>(ui(), container(), true);
}
else if (l_hover == FILTER_MANUFACTURER)
- menu::stack_push<menu_selector>(ui(), container, c_mnfct::ui, c_mnfct::actual, menu_selector::GAME, l_hover);
+ menu::stack_push<menu_selector>(ui(), container(), c_mnfct::ui, c_mnfct::actual, menu_selector::GAME, l_hover);
else if (l_hover == FILTER_YEAR)
- menu::stack_push<menu_selector>(ui(), container, c_year::ui, c_year::actual, menu_selector::GAME, l_hover);
+ menu::stack_push<menu_selector>(ui(), container(), c_year::ui, c_year::actual, menu_selector::GAME, l_hover);
else
{
if (l_hover >= FILTER_ALL)
@@ -793,8 +793,8 @@ void menu_select_game::custom_render(void *selectedref, float top, float bottom,
// get the size of the text
for (int line = 0; line < 2; ++line)
{
- ui().draw_text_full(container, tempbuf[line].c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
- mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
+ ui().draw_text_full(container(), tempbuf[line].c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
maxwidth = MAX(width, maxwidth);
}
@@ -812,7 +812,7 @@ void menu_select_game::custom_render(void *selectedref, float top, float bottom,
float y2 = origy1 - 3.0f * UI_BOX_TB_BORDER - tbarspace;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_BACKGROUND_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -822,8 +822,8 @@ void menu_select_game::custom_render(void *selectedref, float top, float bottom,
// draw the text within it
for (int line = 0; line < 2; ++line)
{
- ui().draw_text_full(container, tempbuf[line].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
- mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size);
+ ui().draw_text_full(container(), tempbuf[line].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size);
y1 += ui().get_line_height();
}
@@ -948,8 +948,8 @@ void menu_select_game::custom_render(void *selectedref, float top, float bottom,
for (auto & elem : tempbuf)
{
- ui().draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
- mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
+ ui().draw_text_full(container(), elem.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
maxwidth = MAX(maxwidth, width);
}
@@ -967,7 +967,7 @@ void menu_select_game::custom_render(void *selectedref, float top, float bottom,
y2 = origy2 + bottom;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, color);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, color);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -981,8 +981,8 @@ void menu_select_game::custom_render(void *selectedref, float top, float bottom,
// draw all lines
for (auto & elem : tempbuf)
{
- ui().draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
- mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size);
+ ui().draw_text_full(container(), elem.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size);
y1 += ui().get_line_height();
}
}
@@ -992,7 +992,7 @@ void menu_select_game::custom_render(void *selectedref, float top, float bottom,
// and inescapable
//-------------------------------------------------
-void menu_select_game::force_game_select(mame_ui_manager &mui, render_container *container)
+void menu_select_game::force_game_select(mame_ui_manager &mui, render_container &container)
{
// reset the menu stack
menu::stack_reset(mui.machine());
@@ -1018,20 +1018,20 @@ void menu_select_game::inkey_select(const event *menu_event)
// special case for configure options
if ((FPTR)driver == CONF_OPTS)
- menu::stack_push<menu_game_options>(ui(), container);
+ menu::stack_push<menu_game_options>(ui(), container());
// special case for configure machine
else if ((FPTR)driver == CONF_MACHINE)
{
if (m_prev_selected != nullptr)
- menu::stack_push<menu_machine_configure>(ui(), container, (const game_driver *)m_prev_selected);
+ menu::stack_push<menu_machine_configure>(ui(), container(), (const game_driver *)m_prev_selected);
return;
}
// special case for configure plugins
else if ((FPTR)driver == CONF_PLUGINS)
{
- menu::stack_push<menu_plugins_configure>(ui(), container);
+ menu::stack_push<menu_plugins_configure>(ui(), container());
}
// anything else is a driver
else
@@ -1050,14 +1050,14 @@ void menu_select_game::inkey_select(const event *menu_event)
for (software_list_device &swlistdev : software_list_device_iterator(enumerator.config().root_device()))
if (!swlistdev.get_info().empty())
{
- menu::stack_push<menu_select_software>(ui(), container, driver);
+ menu::stack_push<menu_select_software>(ui(), container(), driver);
return;
}
}
s_bios biosname;
if (!ui().options().skip_bios_menu() && has_multiple_bios(driver, biosname))
- menu::stack_push<bios_selection>(ui(), container, biosname, (void *)driver, false, false);
+ menu::stack_push<bios_selection>(ui(), container(), biosname, (void *)driver, false, false);
else
{
reselect_last::driver = driver->name;
@@ -1088,21 +1088,21 @@ void menu_select_game::inkey_select_favorite(const event *menu_event)
// special case for configure options
if ((FPTR)ui_swinfo == CONF_OPTS)
- menu::stack_push<menu_game_options>(ui(), container);
+ menu::stack_push<menu_game_options>(ui(), container());
// special case for configure machine
else if ((FPTR)ui_swinfo == CONF_MACHINE)
{
if (m_prev_selected != nullptr)
{
ui_software_info *swinfo = (ui_software_info *)m_prev_selected;
- menu::stack_push<menu_machine_configure>(ui(), container, (const game_driver *)swinfo->driver);
+ menu::stack_push<menu_machine_configure>(ui(), container(), (const game_driver *)swinfo->driver);
}
return;
}
// special case for configure plugins
else if ((FPTR)ui_swinfo == CONF_PLUGINS)
{
- menu::stack_push<menu_plugins_configure>(ui(), container);
+ menu::stack_push<menu_plugins_configure>(ui(), container());
}
else if (ui_swinfo->startempty == 1)
{
@@ -1117,7 +1117,7 @@ void menu_select_game::inkey_select_favorite(const event *menu_event)
{
s_bios biosname;
if (!mopt.skip_bios_menu() && has_multiple_bios(ui_swinfo->driver, biosname))
- menu::stack_push<bios_selection>(ui(), container, biosname, (void *)ui_swinfo->driver, false, false);
+ menu::stack_push<bios_selection>(ui(), container(), biosname, (void *)ui_swinfo->driver, false, false);
else
{
reselect_last::driver = ui_swinfo->driver->name;
@@ -1153,7 +1153,7 @@ void menu_select_game::inkey_select_favorite(const event *menu_event)
s_bios biosname;
if (!mopt.skip_bios_menu() && has_multiple_bios(ui_swinfo->driver, biosname))
{
- menu::stack_push<bios_selection>(ui(), container, biosname, (void *)ui_swinfo, true, false);
+ menu::stack_push<bios_selection>(ui(), container(), biosname, (void *)ui_swinfo, true, false);
return;
}
else if (!mopt.skip_parts_menu() && swinfo->has_multiple_parts(ui_swinfo->interface.c_str()))
@@ -1169,7 +1169,7 @@ void menu_select_game::inkey_select_favorite(const event *menu_event)
parts.emplace(swpart.name(), menu_part_name);
}
}
- menu::stack_push<software_parts>(ui(), container, parts, ui_swinfo);
+ menu::stack_push<software_parts>(ui(), container(), parts, ui_swinfo);
return;
}
@@ -1647,7 +1647,7 @@ void menu_select_game::inkey_export()
{
list = m_displaylist;
}
- menu::stack_push<menu_export>(ui(), container, list);
+ menu::stack_push<menu_export>(ui(), container(), list);
}
//-------------------------------------------------
@@ -1837,7 +1837,7 @@ float menu_select_game::draw_left_panel(float x1, float y1, float x2, float y2)
}
x2 = x1 + left_width + 2.0f * UI_BOX_LR_BORDER;
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_BACKGROUND_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -1856,15 +1856,15 @@ float menu_select_game::draw_left_panel(float x1, float y1, float x2, float y2)
bgcolor = UI_MOUSEOVER_BG_COLOR;
fgcolor = UI_MOUSEOVER_COLOR;
hover = phover + filter;
- menu::highlight(container, x1, y1, x2, y1+ line_height_max, bgcolor);
+ menu::highlight(x1, y1, x2, y1+ line_height_max, bgcolor);
}
if (highlight == filter && get_focus() == focused_menu::left)
{
fgcolor = rgb_t(0xff, 0xff, 0xff, 0x00);
bgcolor = rgb_t(0xff, 0xff, 0xff, 0xff);
- ui().draw_textured_box(container, x1, y1, x2, y1 + line_height_max, bgcolor, rgb_t(255, 43, 43, 43),
- hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
+ ui().draw_textured_box(container(), x1, y1, x2, y1 + line_height_max, bgcolor, rgb_t(255, 43, 43, 43),
+ hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
}
float x1t = x1 + text_sign;
@@ -1897,8 +1897,8 @@ float menu_select_game::draw_left_panel(float x1, float y1, float x2, float y2)
convert_command_glyph(str);
}
- ui().draw_text_full(container, str.c_str(), x1t, y1, x2 - x1, ui::text_layout::LEFT, ui::text_layout::NEVER,
- mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr, text_size);
+ ui().draw_text_full(container(), str.c_str(), x1t, y1, x2 - x1, ui::text_layout::LEFT, ui::text_layout::NEVER,
+ mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr, text_size);
y1 += line_height_max;
}
@@ -1916,7 +1916,7 @@ float menu_select_game::draw_left_panel(float x1, float y1, float x2, float y2)
float ar_x1 = ar_x0 + lr_arrow_width;
float ar_y1 = 0.5f * (y2 + y1) + 0.9f * space;
- ui().draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
if (mouse_hit && x1 <= mouse_x && x2 > mouse_x && y1 <= mouse_y && y2 > mouse_y)
{
@@ -1924,7 +1924,7 @@ float menu_select_game::draw_left_panel(float x1, float y1, float x2, float y2)
hover = HOVER_LPANEL_ARROW;
}
- draw_arrow(container, ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90 ^ ORIENTATION_FLIP_X);
+ draw_arrow(ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90 ^ ORIENTATION_FLIP_X);
return x2 + UI_BOX_LR_BORDER;
}
else
@@ -1939,7 +1939,7 @@ float menu_select_game::draw_left_panel(float x1, float y1, float x2, float y2)
float ar_x1 = ar_x0 + lr_arrow_width;
float ar_y1 = 0.5f * (y2 + y1) + 0.9f * space;
- ui().draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
if (mouse_hit && x1 <= mouse_x && x2 > mouse_x && y1 <= mouse_y && y2 > mouse_y)
{
@@ -1947,7 +1947,7 @@ float menu_select_game::draw_left_panel(float x1, float y1, float x2, float y2)
hover = HOVER_LPANEL_ARROW;
}
- draw_arrow(container, ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90);
+ draw_arrow(ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90);
return x2 + UI_BOX_LR_BORDER;
}
}
@@ -2006,8 +2006,8 @@ void menu_select_game::infos_render(void *selectedref, float origx1, float origy
for (int x = UI_FIRST_LOAD; x < UI_LAST_LOAD; ++x)
{
- ui().draw_text_full(container, _(dats_info[x]), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER,
- ui::text_layout::NEVER, mame_ui_manager::NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &txt_length, nullptr);
+ ui().draw_text_full(container(), _(dats_info[x]), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER,
+ ui::text_layout::NEVER, mame_ui_manager::NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &txt_length, nullptr);
txt_length += 0.01f;
title_size = (std::max)(txt_length, title_size);
}
@@ -2028,11 +2028,13 @@ void menu_select_game::infos_render(void *selectedref, float origx1, float origy
title_size *= tmp_size;
if (bgcolor != UI_TEXT_BG_COLOR)
- ui().draw_textured_box(container, origx1 + ((middle - title_size) * 0.5f), origy1, origx1 + ((middle + title_size) * 0.5f),
- origy1 + line_height, bgcolor, rgb_t(255, 43, 43, 43), hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
+ {
+ ui().draw_textured_box(container(), origx1 + ((middle - title_size) * 0.5f), origy1, origx1 + ((middle + title_size) * 0.5f),
+ origy1 + line_height, bgcolor, rgb_t(255, 43, 43, 43), hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
+ }
- ui().draw_text_full(container, snaptext.c_str(), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER,
- ui::text_layout::NEVER, mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr, tmp_size);
+ ui().draw_text_full(container(), snaptext.c_str(), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER,
+ ui::text_layout::NEVER, mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr, tmp_size);
draw_common_arrow(origx1, origy1, origx2, origy2, ui_globals::curdats_view, UI_FIRST_LOAD, UI_LAST_LOAD, title_size);
@@ -2068,14 +2070,14 @@ void menu_select_game::infos_render(void *selectedref, float origx1, float origy
if (buffer.empty())
{
- ui().draw_text_full(container, _("No Infos Available"), origx1, (origy2 + origy1) * 0.5f, origx2 - origx1, ui::text_layout::CENTER,
- ui::text_layout::WORD, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
+ ui().draw_text_full(container(), _("No Infos Available"), origx1, (origy2 + origy1) * 0.5f, origx2 - origx1, ui::text_layout::CENTER,
+ ui::text_layout::WORD, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
return;
}
else if (ui_globals::curdats_view != UI_STORY_LOAD && ui_globals::curdats_view != UI_COMMAND_LOAD)
- m_total_lines = ui().wrap_text(container, buffer.c_str(), origx1, origy1, origx2 - origx1 - (2.0f * gutter_width), xstart, xend, text_size);
+ m_total_lines = ui().wrap_text(container(), buffer.c_str(), origx1, origy1, origx2 - origx1 - (2.0f * gutter_width), xstart, xend, text_size);
else
- m_total_lines = ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (2.0f * gutter_width), xstart, xend, text_size);
+ m_total_lines = ui().wrap_text(container(), buffer.c_str(), 0.0f, 0.0f, 1.0f - (2.0f * gutter_width), xstart, xend, text_size);
int r_visible_lines = floor((origy2 - oy1) / (line_height * text_size));
if (m_total_lines < r_visible_lines)
@@ -2107,8 +2109,8 @@ void menu_select_game::infos_render(void *selectedref, float origx1, float origy
size_t last_underscore = tempbuf.find_last_of("_");
if (last_underscore == std::string::npos)
{
- ui().draw_text_full(container, tempbuf.c_str(), origx1, oy1, origx2 - origx1, ui::text_layout::CENTER,
- ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size2);
+ ui().draw_text_full(container(), tempbuf.c_str(), origx1, oy1, origx2 - origx1, ui::text_layout::CENTER,
+ ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size2);
}
else
{
@@ -2118,12 +2120,12 @@ void menu_select_game::infos_render(void *selectedref, float origx1, float origy
std::string first_part(tempbuf.substr(0, tempbuf.find("___")));
float item_width;
- ui().draw_text_full(container, first_part.c_str(), effective_left, oy1, effective_width,
- ui::text_layout::LEFT, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &item_width, nullptr, tmp_size2);
+ ui().draw_text_full(container(), first_part.c_str(), effective_left, oy1, effective_width,
+ ui::text_layout::LEFT, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &item_width, nullptr, tmp_size2);
- ui().draw_text_full(container, last_part.c_str(), effective_left + item_width, oy1,
- origx2 - origx1 - 2.0f * gutter_width - item_width, ui::text_layout::RIGHT, ui::text_layout::TRUNCATE,
- mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size2);
+ ui().draw_text_full(container(), last_part.c_str(), effective_left + item_width, oy1,
+ origx2 - origx1 - 2.0f * gutter_width - item_width, ui::text_layout::RIGHT, ui::text_layout::TRUNCATE,
+ mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size2);
}
}
@@ -2142,19 +2144,21 @@ void menu_select_game::infos_render(void *selectedref, float origx1, float origy
std::string first_part(tempbuf.substr(0, first_dspace));
std::string last_part(tempbuf.substr(first_dspace + 1));
strtrimspace(last_part);
- ui().draw_text_full(container, first_part.c_str(), effective_left, oy1, effective_width, ui::text_layout::LEFT,
- ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size3);
+ ui().draw_text_full(container(), first_part.c_str(), effective_left, oy1, effective_width, ui::text_layout::LEFT,
+ ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size3);
- ui().draw_text_full(container, last_part.c_str(), effective_left, oy1, origx2 - origx1 - 2.0f * gutter_width,
- ui::text_layout::RIGHT, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size3);
+ ui().draw_text_full(container(), last_part.c_str(), effective_left, oy1, origx2 - origx1 - 2.0f * gutter_width,
+ ui::text_layout::RIGHT, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size3);
}
else
- ui().draw_text_full(container, tempbuf.c_str(), origx1 + gutter_width, oy1, origx2 - origx1, ui::text_layout::LEFT,
- ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size3);
+ ui().draw_text_full(container(), tempbuf.c_str(), origx1 + gutter_width, oy1, origx2 - origx1, ui::text_layout::LEFT,
+ ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, tmp_size3);
}
else
- ui().draw_text_full(container, tempbuf.c_str(), origx1 + gutter_width, oy1, origx2 - origx1, ui::text_layout::LEFT,
- ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size);
+ {
+ ui().draw_text_full(container(), tempbuf.c_str(), origx1 + gutter_width, oy1, origx2 - origx1, ui::text_layout::LEFT,
+ ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size);
+ }
oy1 += (line_height * text_size);
}
@@ -2171,8 +2175,8 @@ void menu_select_game::infos_render(void *selectedref, float origx1, float origy
// apply title to right panel
if (soft->usage.empty())
{
- ui().draw_text_full(container, _("History"), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
- mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
+ ui().draw_text_full(container(), _("History"), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
ui_globals::cur_sw_dats_view = 0;
}
else
@@ -2185,8 +2189,8 @@ void menu_select_game::infos_render(void *selectedref, float origx1, float origy
for (auto & elem: t_text)
{
- ui().draw_text_full(container, elem.c_str(), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
- mame_ui_manager::NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &txt_length, nullptr);
+ ui().draw_text_full(container(), elem.c_str(), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ mame_ui_manager::NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &txt_length, nullptr);
txt_length += 0.01f;
title_size = (std::max)(txt_length, title_size);
}
@@ -2202,11 +2206,13 @@ void menu_select_game::infos_render(void *selectedref, float origx1, float origy
float middle = origx2 - origx1;
if (bgcolor != UI_TEXT_BG_COLOR)
- ui().draw_textured_box(container, origx1 + ((middle - title_size) * 0.5f), origy1, origx1 + ((middle + title_size) * 0.5f),
- origy1 + line_height, bgcolor, rgb_t(255, 43, 43, 43), hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
+ {
+ ui().draw_textured_box(container(), origx1 + ((middle - title_size) * 0.5f), origy1, origx1 + ((middle + title_size) * 0.5f),
+ origy1 + line_height, bgcolor, rgb_t(255, 43, 43, 43), hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
+ }
- ui().draw_text_full(container, t_text[ui_globals::cur_sw_dats_view].c_str(), origx1, origy1, origx2 - origx1,
- ui::text_layout::CENTER, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr);
+ ui().draw_text_full(container(), t_text[ui_globals::cur_sw_dats_view].c_str(), origx1, origy1, origx2 - origx1,
+ ui::text_layout::CENTER, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr);
draw_common_arrow(origx1, origy1, origx2, origy2, ui_globals::cur_sw_dats_view, 0, 1, title_size);
}
@@ -2229,12 +2235,14 @@ void menu_select_game::infos_render(void *selectedref, float origx1, float origy
if (buffer.empty())
{
- ui().draw_text_full(container, _("No Infos Available"), origx1, (origy2 + origy1) * 0.5f, origx2 - origx1, ui::text_layout::CENTER,
- ui::text_layout::WORD, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
+ ui().draw_text_full(container(), _("No Infos Available"), origx1, (origy2 + origy1) * 0.5f, origx2 - origx1, ui::text_layout::CENTER,
+ ui::text_layout::WORD, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
return;
}
else
- m_total_lines = ui().wrap_text(container, buffer.c_str(), origx1, origy1, origx2 - origx1 - (2.0f * gutter_width), xstart, xend, text_size);
+ {
+ m_total_lines = ui().wrap_text(container(), buffer.c_str(), origx1, origy1, origx2 - origx1 - (2.0f * gutter_width), xstart, xend, text_size);
+ }
int r_visible_lines = floor((origy2 - oy1) / (line_height * text_size));
if (m_total_lines < r_visible_lines)
@@ -2256,8 +2264,8 @@ void menu_select_game::infos_render(void *selectedref, float origx1, float origy
else if (r == r_visible_lines - 1 && itemline != m_total_lines - 1)
draw_info_arrow(1, origx1, origx2, oy1, line_height, text_size, ud_arrow_width);
else
- ui().draw_text_full(container, tempbuf.c_str(), origx1 + gutter_width, oy1, origx2 - origx1, ui::text_layout::LEFT,
- ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size);
+ ui().draw_text_full(container(), tempbuf.c_str(), origx1 + gutter_width, oy1, origx2 - origx1, ui::text_layout::LEFT,
+ ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size);
oy1 += (line_height * text_size);
}
@@ -2284,7 +2292,7 @@ void menu_select_game::draw_right_panel(void *selectedref, float origx1, float o
float ar_x1 = ar_x0 + lr_arrow_width;
float ar_y1 = 0.5f * (origy2 + origy1) + 0.9f * space;
- ui().draw_outlined_box(container, origx1, origy1, origx2, origy2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
+ ui().draw_outlined_box(container(), origx1, origy1, origx2, origy2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
if (mouse_hit && origx1 <= mouse_x && x2 > mouse_x && origy1 <= mouse_y && origy2 > mouse_y)
{
@@ -2294,11 +2302,11 @@ void menu_select_game::draw_right_panel(void *selectedref, float origx1, float o
if (hide)
{
- draw_arrow(container, ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90 ^ ORIENTATION_FLIP_X);
+ draw_arrow(ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90 ^ ORIENTATION_FLIP_X);
return;
}
- draw_arrow(container, ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90);
+ draw_arrow(ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90);
origx1 = x2;
origy1 = draw_right_box_title(origx1, origy1, origx2, origy2);
diff --git a/src/frontend/mame/ui/selgame.h b/src/frontend/mame/ui/selgame.h
index 153e353c93b..c1c934bee62 100644
--- a/src/frontend/mame/ui/selgame.h
+++ b/src/frontend/mame/ui/selgame.h
@@ -20,23 +20,16 @@ namespace ui {
class menu_select_game : public menu_select_launch
{
public:
- menu_select_game(mame_ui_manager &mui, render_container *container, const char *gamename);
+ menu_select_game(mame_ui_manager &mui, render_container &container, const char *gamename);
virtual ~menu_select_game();
- 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;
// force game select menu
- static void force_game_select(mame_ui_manager &mui, render_container *container);
+ static void force_game_select(mame_ui_manager &mui, render_container &container);
+protected:
+ virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual bool menu_has_search_active() override { return (m_search[0] != 0); }
- // draw left panel
- virtual float draw_left_panel(float x1, float y1, float x2, float y2) override;
-
- // draw right panel
- virtual void draw_right_panel(void *selectedref, float origx1, float origy1, float origx2, float origy2) override;
-
private:
enum
{
@@ -57,6 +50,15 @@ private:
const game_driver *m_searchlist[VISIBLE_GAMES_IN_SEARCH + 1];
+ virtual void populate() override;
+ virtual void handle() override;
+
+ // draw left panel
+ virtual float draw_left_panel(float x1, float y1, float x2, float y2) override;
+
+ // draw right panel
+ virtual void draw_right_panel(void *selectedref, float origx1, float origy1, float origx2, float origy2) override;
+
// internal methods
void build_custom();
void build_category();
diff --git a/src/frontend/mame/ui/selmenu.cpp b/src/frontend/mame/ui/selmenu.cpp
index f9db29a1a87..24eea3378ed 100644
--- a/src/frontend/mame/ui/selmenu.cpp
+++ b/src/frontend/mame/ui/selmenu.cpp
@@ -93,7 +93,7 @@ menu_select_launch::cache::cache(running_machine &machine)
m_star_texture = texture_ptr(render.texture_alloc(), texture_free);
m_star_texture->set_bitmap(*m_star_bitmap, m_star_bitmap->cliprect(), TEXFORMAT_ARGB32);
- m_toolbar_bitmap.reserve(UI_TOOLBAR_BUTTONS);
+ m_toolbar_bitmap.reserve(UI_TOOLBAR_BUTTONS);
m_sw_toolbar_bitmap.reserve(UI_TOOLBAR_BUTTONS);
m_toolbar_texture.reserve(UI_TOOLBAR_BUTTONS);
m_sw_toolbar_texture.reserve(UI_TOOLBAR_BUTTONS);
@@ -143,7 +143,7 @@ menu_select_launch::~menu_select_launch()
}
-menu_select_launch::menu_select_launch(mame_ui_manager &mui, render_container *container, bool is_swlist)
+menu_select_launch::menu_select_launch(mame_ui_manager &mui, render_container &container, bool is_swlist)
: menu(mui, container)
, m_total_lines(0)
, m_topline_datsview(0)
@@ -195,10 +195,10 @@ float menu_select_launch::draw_right_box_title(float x1, float y1, float x2, flo
float midl = (x2 - x1) * 0.5f;
// add outlined box for options
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_BACKGROUND_COLOR);
// add separator line
- container->add_line(x1 + midl, y1, x1 + midl, y1 + line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container().add_line(x1 + midl, y1, x1 + midl, y1 + line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
std::string buffer[RP_LAST + 1];
buffer[RP_IMAGES] = _("Images");
@@ -230,8 +230,8 @@ float menu_select_launch::draw_right_box_title(float x1, float y1, float x2, flo
if (ui_globals::rpanel != cells)
{
- container->add_line(x1, y1 + line_height, x1 + midl, y1 + line_height, UI_LINE_WIDTH,
- UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container().add_line(x1, y1 + line_height, x1 + midl, y1 + line_height, UI_LINE_WIDTH,
+ UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
if (fgcolor != UI_MOUSEOVER_COLOR)
fgcolor = UI_CLONE_COLOR;
}
@@ -240,15 +240,17 @@ float menu_select_launch::draw_right_box_title(float x1, float y1, float x2, flo
{
fgcolor = rgb_t(0xff, 0xff, 0x00);
bgcolor = rgb_t(0xff, 0xff, 0xff);
- ui().draw_textured_box(container, x1 + UI_LINE_WIDTH, y1 + UI_LINE_WIDTH, x1 + midl - UI_LINE_WIDTH, y1 + line_height,
- bgcolor, rgb_t(43, 43, 43), hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
+ ui().draw_textured_box(container(), x1 + UI_LINE_WIDTH, y1 + UI_LINE_WIDTH, x1 + midl - UI_LINE_WIDTH, y1 + line_height,
+ bgcolor, rgb_t(43, 43, 43), hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
}
else if (bgcolor == UI_MOUSEOVER_BG_COLOR)
- container->add_rect(x1 + UI_LINE_WIDTH, y1 + UI_LINE_WIDTH, x1 + midl - UI_LINE_WIDTH, y1 + line_height,
- bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
+ {
+ container().add_rect(x1 + UI_LINE_WIDTH, y1 + UI_LINE_WIDTH, x1 + midl - UI_LINE_WIDTH, y1 + line_height,
+ bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
+ }
- ui().draw_text_full(container, buffer[cells].c_str(), x1 + UI_LINE_WIDTH, y1, midl - UI_LINE_WIDTH,
- ui::text_layout::CENTER, ui::text_layout::NEVER, mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr, text_size);
+ ui().draw_text_full(container(), buffer[cells].c_str(), x1 + UI_LINE_WIDTH, y1, midl - UI_LINE_WIDTH,
+ ui::text_layout::CENTER, ui::text_layout::NEVER, mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr, text_size);
x1 += midl;
}
@@ -273,8 +275,8 @@ std::string menu_select_launch::arts_render_common(float origx1, float origy1, f
// apply title to right panel
for (int x = FIRST_VIEW; x < LAST_VIEW; x++)
{
- ui().draw_text_full(container, _(arts_info[x].first), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER,
- ui::text_layout::TRUNCATE, mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &txt_lenght, nullptr);
+ ui().draw_text_full(container(), _(arts_info[x].first), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER,
+ ui::text_layout::TRUNCATE, mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &txt_lenght, nullptr);
txt_lenght += 0.01f;
title_size = MAX(txt_lenght, title_size);
}
@@ -289,11 +291,13 @@ std::string menu_select_launch::arts_render_common(float origx1, float origy1, f
title_size *= tmp_size;
if (bgcolor != UI_TEXT_BG_COLOR)
- ui().draw_textured_box(container, origx1 + ((middle - title_size) * 0.5f), origy1, origx1 + ((middle + title_size) * 0.5f),
- origy1 + line_height, bgcolor, rgb_t(43, 43, 43), hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
+ {
+ ui().draw_textured_box(container(), origx1 + ((middle - title_size) * 0.5f), origy1, origx1 + ((middle + title_size) * 0.5f),
+ origy1 + line_height, bgcolor, rgb_t(43, 43, 43), hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
+ }
- ui().draw_text_full(container, snaptext.c_str(), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
- mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr, tmp_size);
+ ui().draw_text_full(container(), snaptext.c_str(), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr, tmp_size);
draw_common_arrow(origx1, origy1, origx2, origy2, ui_globals::curimage_view, FIRST_VIEW, LAST_VIEW, title_size);
@@ -423,28 +427,28 @@ void menu_select_launch::draw_common_arrow(float origx1, float origy1, float ori
// set hover
if (mouse_hit && ar_x0 <= mouse_x && ar_x1 > mouse_x && ar_y0 <= mouse_y && ar_y1 > mouse_y && current != dmax)
{
- ui().draw_textured_box(container, ar_x0 + 0.01f, ar_y0, ar_x1 - 0.01f, ar_y1, UI_MOUSEOVER_BG_COLOR, rgb_t(43, 43, 43),
- hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
+ ui().draw_textured_box(container(), ar_x0 + 0.01f, ar_y0, ar_x1 - 0.01f, ar_y1, UI_MOUSEOVER_BG_COLOR, rgb_t(43, 43, 43),
+ hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
hover = HOVER_UI_RIGHT;
fgcolor_right = UI_MOUSEOVER_COLOR;
}
else if (mouse_hit && al_x0 <= mouse_x && al_x1 > mouse_x && al_y0 <= mouse_y && al_y1 > mouse_y && current != dmin)
{
- ui().draw_textured_box(container, al_x0 + 0.01f, al_y0, al_x1 - 0.01f, al_y1, UI_MOUSEOVER_BG_COLOR, rgb_t(43, 43, 43),
- hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
+ ui().draw_textured_box(container(), al_x0 + 0.01f, al_y0, al_x1 - 0.01f, al_y1, UI_MOUSEOVER_BG_COLOR, rgb_t(43, 43, 43),
+ hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
hover = HOVER_UI_LEFT;
fgcolor_left = UI_MOUSEOVER_COLOR;
}
// apply arrow
if (current == dmin)
- draw_arrow(container, ar_x0, ar_y0, ar_x1, ar_y1, fgcolor_right, ROT90);
+ draw_arrow(ar_x0, ar_y0, ar_x1, ar_y1, fgcolor_right, ROT90);
else if (current == dmax)
- draw_arrow(container, al_x0, al_y0, al_x1, al_y1, fgcolor_left, ROT90 ^ ORIENTATION_FLIP_X);
+ draw_arrow(al_x0, al_y0, al_x1, al_y1, fgcolor_left, ROT90 ^ ORIENTATION_FLIP_X);
else
{
- draw_arrow(container, ar_x0, ar_y0, ar_x1, ar_y1, fgcolor_right, ROT90);
- draw_arrow(container, al_x0, al_y0, al_x1, al_y1, fgcolor_left, ROT90 ^ ORIENTATION_FLIP_X);
+ draw_arrow(ar_x0, ar_y0, ar_x1, ar_y1, fgcolor_right, ROT90);
+ draw_arrow(al_x0, al_y0, al_x1, al_y1, fgcolor_left, ROT90 ^ ORIENTATION_FLIP_X);
}
}
@@ -460,13 +464,13 @@ void menu_select_launch::draw_info_arrow(int ub, float origx1, float origx2, flo
if (mouse_hit && origx1 <= mouse_x && origx2 > mouse_x && oy1 <= mouse_y && oy1 + (line_height * text_size) > mouse_y)
{
- ui().draw_textured_box(container, origx1 + 0.01f, oy1, origx2 - 0.01f, oy1 + (line_height * text_size), UI_MOUSEOVER_BG_COLOR,
- rgb_t(43, 43, 43), hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
+ ui().draw_textured_box(container(), origx1 + 0.01f, oy1, origx2 - 0.01f, oy1 + (line_height * text_size), UI_MOUSEOVER_BG_COLOR,
+ rgb_t(43, 43, 43), hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
hover = (!ub) ? HOVER_DAT_UP : HOVER_DAT_DOWN;
fgcolor = UI_MOUSEOVER_COLOR;
}
- draw_arrow(container, 0.5f * (origx1 + origx2) - 0.5f * (ud_arrow_width * text_size), oy1 + 0.25f * (line_height * text_size),
+ draw_arrow(0.5f * (origx1 + origx2) - 0.5f * (ud_arrow_width * text_size), oy1 + 0.25f * (line_height * text_size),
0.5f * (origx1 + origx2) + 0.5f * (ud_arrow_width * text_size), oy1 + 0.75f * (line_height * text_size), fgcolor, orientation);
}
@@ -478,7 +482,7 @@ void menu_select_launch::draw_info_arrow(int ub, float origx1, float origx2, flo
void menu_select_launch::draw_toolbar(float x1, float y1, float x2, float y2, bool software)
{
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -491,7 +495,7 @@ void menu_select_launch::draw_toolbar(float x1, float y1, float x2, float y2, bo
auto const num_valid(std::count_if(std::begin(t_bitmap), std::end(t_bitmap), [](bitmap_ptr const &e) { return e && e->valid(); }));
- float const space_x = (y2 - y1) * container->manager().ui_aspect(container);
+ float const space_x = (y2 - y1) * container().manager().ui_aspect(&container());
float const total = (float(num_valid) * space_x) + (float(num_valid - 1) * 0.001f);
x1 += (x2 - x1) * 0.5f - total * 0.5f;
x2 = x1 + space_x;
@@ -506,10 +510,10 @@ void menu_select_launch::draw_toolbar(float x1, float y1, float x2, float y2, bo
hover = HOVER_B_FAV + z;
color = rgb_t::white;
float ypos = y2 + ui().get_line_height() + 2.0f * UI_BOX_TB_BORDER;
- ui().draw_text_box(container, _(hover_msg[z]), ui::text_layout::CENTER, 0.5f, ypos, UI_BACKGROUND_COLOR);
+ ui().draw_text_box(container(), _(hover_msg[z]), ui::text_layout::CENTER, 0.5f, ypos, UI_BACKGROUND_COLOR);
}
- container->add_quad(x1, y1, x2, y2, color, t_texture[z].get(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container().add_quad(x1, y1, x2, y2, color, t_texture[z].get(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
x1 += space_x + ((z < UI_TOOLBAR_BUTTONS - 1) ? 0.001f : 0.0f);
x2 = x1 + space_x;
}
@@ -524,8 +528,8 @@ void menu_select_launch::draw_toolbar(float x1, float y1, float x2, float y2, bo
void menu_select_launch::draw_star(float x0, float y0)
{
float y1 = y0 + ui().get_line_height();
- float x1 = x0 + ui().get_line_height() * container->manager().ui_aspect();
- container->add_quad(x0, y0, x1, y1, rgb_t::white, m_cache->star_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_PACKABLE);
+ float x1 = x0 + ui().get_line_height() * container().manager().ui_aspect();
+ container().add_quad(x0, y0, x1, y1, rgb_t::white, m_cache->star_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_PACKABLE);
}
@@ -545,7 +549,7 @@ void menu_select_launch::draw_snapx(float origx1, float origy1, float origx2, fl
float const y2 = origy2 - UI_BOX_TB_BORDER - line_height;
// apply texture
- container->add_quad(x1, y1, x2, y2, rgb_t::white, m_cache->snapx_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container().add_quad(x1, y1, x2, y2, rgb_t::white, m_cache->snapx_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
}
}
@@ -566,7 +570,7 @@ float menu_select_launch::draw_icon(int linenum, void *selectedref, float x0, fl
if (!ui_globals::has_icons || m_is_swlist)
return 0.0f;
- float ud_arrow_width = ui().get_line_height() * container->manager().ui_aspect(container);
+ float ud_arrow_width = ui().get_line_height() * container().manager().ui_aspect(&container());
const game_driver *driver = nullptr;
if (item[0].flags & FLAG_UI_FAVORITE)
@@ -671,7 +675,7 @@ float menu_select_launch::draw_icon(int linenum, void *selectedref, float x0, fl
}
if (m_icons_bitmap[linenum] != nullptr && m_icons_bitmap[linenum]->valid())
- container->add_quad(x0, y0, x1, y1, rgb_t::white, m_icons_texture[linenum], PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container().add_quad(x0, y0, x1, y1, rgb_t::white, m_icons_texture[linenum], PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
return ud_arrow_width * 1.5f;
}
@@ -1167,7 +1171,7 @@ void menu_select_launch::draw(UINT32 flags)
{
mouse_target = machine().ui_input().find_mouse(&mouse_target_x, &mouse_target_y, &mouse_button);
if (mouse_target)
- if (mouse_target->map_point_container(mouse_target_x, mouse_target_y, *container, mouse_x, mouse_y))
+ if (mouse_target->map_point_container(mouse_target_x, mouse_target_y, container(), mouse_x, mouse_y))
mouse_hit = true;
}
@@ -1202,7 +1206,7 @@ void menu_select_launch::draw(UINT32 flags)
x1 = visible_left - UI_BOX_LR_BORDER;
x2 = visible_left + visible_width + UI_BOX_LR_BORDER;
float line = visible_top + (float(m_visible_lines) * line_height);
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_BACKGROUND_COLOR);
if (visible_items < m_visible_lines)
m_visible_lines = visible_items;
@@ -1243,28 +1247,28 @@ void menu_select_launch::draw(UINT32 flags)
fgcolor = rgb_t(0xff, 0xff, 0x00);
bgcolor = rgb_t(0xff, 0xff, 0xff);
fgcolor3 = rgb_t(0xcc, 0xcc, 0x00);
- ui().draw_textured_box(container, line_x0 + 0.01f, line_y0, line_x1 - 0.01f, line_y1, bgcolor, rgb_t(43, 43, 43),
- hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
+ ui().draw_textured_box(container(), line_x0 + 0.01f, line_y0, line_x1 - 0.01f, line_y1, bgcolor, rgb_t(43, 43, 43),
+ hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
}
// else if the mouse is over this item, draw with a different background
else if (itemnum == hover)
{
fgcolor = fgcolor3 = UI_MOUSEOVER_COLOR;
bgcolor = UI_MOUSEOVER_BG_COLOR;
- highlight(container, line_x0, line_y0, line_x1, line_y1, bgcolor);
+ highlight(line_x0, line_y0, line_x1, line_y1, bgcolor);
}
else if (pitem.ref == m_prev_selected)
{
fgcolor = fgcolor3 = UI_MOUSEOVER_COLOR;
bgcolor = UI_MOUSEOVER_BG_COLOR;
- ui().draw_textured_box(container, line_x0 + 0.01f, line_y0, line_x1 - 0.01f, line_y1, bgcolor, rgb_t(43, 43, 43),
- hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
+ ui().draw_textured_box(container(), line_x0 + 0.01f, line_y0, line_x1 - 0.01f, line_y1, bgcolor, rgb_t(43, 43, 43),
+ hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
}
if (linenum == 0 && top_line != 0)
{
// if we're on the top line, display the up arrow
- draw_arrow(container, 0.5f * (x1 + x2) - 0.5f * ud_arrow_width, line_y + 0.25f * line_height,
+ draw_arrow(0.5f * (x1 + x2) - 0.5f * ud_arrow_width, line_y + 0.25f * line_height,
0.5f * (x1 + x2) + 0.5f * ud_arrow_width, line_y + 0.75f * line_height, fgcolor, ROT0);
if (hover == itemnum)
@@ -1273,7 +1277,7 @@ void menu_select_launch::draw(UINT32 flags)
else if (linenum == m_visible_lines - 1 && itemnum != visible_items - 1)
{
// if we're on the bottom line, display the down arrow
- draw_arrow(container, 0.5f * (x1 + x2) - 0.5f * ud_arrow_width, line_y + 0.25f * line_height,
+ draw_arrow(0.5f * (x1 + x2) - 0.5f * ud_arrow_width, line_y + 0.25f * line_height,
0.5f * (x1 + x2) + 0.5f * ud_arrow_width, line_y + 0.75f * line_height, fgcolor, ROT0 ^ ORIENTATION_FLIP_Y);
if (hover == itemnum)
@@ -1282,16 +1286,16 @@ void menu_select_launch::draw(UINT32 flags)
else if (pitem.type == menu_item_type::SEPARATOR)
{
// if we're just a divider, draw a line
- container->add_line(visible_left, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height,
- UI_LINE_WIDTH, UI_TEXT_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container().add_line(visible_left, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height,
+ UI_LINE_WIDTH, UI_TEXT_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
}
else if (pitem.subtext.empty())
{
// draw the item centered
int item_invert = pitem.flags & FLAG_INVERT;
auto icon = draw_icon(linenum, item[itemnum].ref, effective_left, line_y);
- ui().draw_text_full(container, itemtext, effective_left + icon, line_y, effective_width - icon, ui::text_layout::LEFT, ui::text_layout::TRUNCATE,
- mame_ui_manager::NORMAL, item_invert ? fgcolor3 : fgcolor, bgcolor, nullptr, nullptr);
+ ui().draw_text_full(container(), itemtext, effective_left + icon, line_y, effective_width - icon, ui::text_layout::LEFT, ui::text_layout::TRUNCATE,
+ mame_ui_manager::NORMAL, item_invert ? fgcolor3 : fgcolor, bgcolor, nullptr, nullptr);
}
else
{
@@ -1300,17 +1304,17 @@ void menu_select_launch::draw(UINT32 flags)
float item_width, subitem_width;
// compute right space for subitem
- ui().draw_text_full(container, subitem_text, effective_left, line_y, ui().get_string_width(pitem.subtext.c_str()),
- ui::text_layout::RIGHT, ui::text_layout::NEVER, mame_ui_manager::NONE, item_invert ? fgcolor3 : fgcolor, bgcolor, &subitem_width, nullptr);
+ ui().draw_text_full(container(), subitem_text, effective_left, line_y, ui().get_string_width(pitem.subtext.c_str()),
+ ui::text_layout::RIGHT, ui::text_layout::NEVER, mame_ui_manager::NONE, item_invert ? fgcolor3 : fgcolor, bgcolor, &subitem_width, nullptr);
subitem_width += gutter_width;
// draw the item left-justified
- ui().draw_text_full(container, itemtext, effective_left, line_y, effective_width - subitem_width,
- ui::text_layout::LEFT, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, item_invert ? fgcolor3 : fgcolor, bgcolor, &item_width, nullptr);
+ ui().draw_text_full(container(), itemtext, effective_left, line_y, effective_width - subitem_width,
+ ui::text_layout::LEFT, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, item_invert ? fgcolor3 : fgcolor, bgcolor, &item_width, nullptr);
// draw the subitem right-justified
- ui().draw_text_full(container, subitem_text, effective_left + item_width, line_y, effective_width - item_width,
- ui::text_layout::RIGHT, ui::text_layout::NEVER, mame_ui_manager::NORMAL, item_invert ? fgcolor3 : fgcolor, bgcolor, nullptr, nullptr);
+ ui().draw_text_full(container(), subitem_text, effective_left + item_width, line_y, effective_width - item_width,
+ ui::text_layout::RIGHT, ui::text_layout::NEVER, mame_ui_manager::NORMAL, item_invert ? fgcolor3 : fgcolor, bgcolor, nullptr, nullptr);
}
}
@@ -1333,23 +1337,27 @@ void menu_select_launch::draw(UINT32 flags)
{
fgcolor = rgb_t(0xff, 0xff, 0x00);
bgcolor = rgb_t(0xff, 0xff, 0xff);
- ui().draw_textured_box(container, line_x0 + 0.01f, line_y0, line_x1 - 0.01f, line_y1, bgcolor, rgb_t(43, 43, 43),
- hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
+ ui().draw_textured_box(container(), line_x0 + 0.01f, line_y0, line_x1 - 0.01f, line_y1, bgcolor, rgb_t(43, 43, 43),
+ hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
}
// else if the mouse is over this item, draw with a different background
else if (count == hover)
{
fgcolor = UI_MOUSEOVER_COLOR;
bgcolor = UI_MOUSEOVER_BG_COLOR;
- highlight(container, line_x0, line_y0, line_x1, line_y1, bgcolor);
+ highlight(line_x0, line_y0, line_x1, line_y1, bgcolor);
}
if (pitem.type == menu_item_type::SEPARATOR)
- container->add_line(visible_left, line + 0.5f * line_height, visible_left + visible_width, line + 0.5f * line_height,
- UI_LINE_WIDTH, UI_TEXT_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ {
+ container().add_line(visible_left, line + 0.5f * line_height, visible_left + visible_width, line + 0.5f * line_height,
+ UI_LINE_WIDTH, UI_TEXT_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ }
else
- ui().draw_text_full(container, itemtext, effective_left, line, effective_width, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
- mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr);
+ {
+ ui().draw_text_full(container(), itemtext, effective_left, line, effective_width, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr);
+ }
line += line_height;
}
@@ -1377,7 +1385,7 @@ void menu_select_launch::draw(UINT32 flags)
if (alpha > 255)
alpha = 255;
if (alpha >= 0)
- container->add_rect(0.0f, 0.0f, 1.0f, 1.0f, rgb_t(alpha, 0x00, 0x00, 0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container().add_rect(0.0f, 0.0f, 1.0f, 1.0f, rgb_t(alpha, 0x00, 0x00, 0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
}
}
@@ -1388,4 +1396,4 @@ void menu_select_launch::exit(running_machine &machine)
s_caches.erase(&machine);
}
-} // namespace ui \ No newline at end of file
+} // namespace ui
diff --git a/src/frontend/mame/ui/selmenu.h b/src/frontend/mame/ui/selmenu.h
index 3a9e313c0c3..006c0f54b4e 100644
--- a/src/frontend/mame/ui/selmenu.h
+++ b/src/frontend/mame/ui/selmenu.h
@@ -39,7 +39,7 @@ protected:
rightbottom
};
- menu_select_launch(mame_ui_manager &mui, render_container *container, bool is_swlist);
+ menu_select_launch(mame_ui_manager &mui, render_container &container, bool is_swlist);
focused_menu get_focus() const { return m_focus; }
void set_focus(focused_menu focus) { m_focus = focus; }
@@ -111,6 +111,12 @@ private:
bool mouse_pressed() const { return (osd_ticks() >= m_repeat); }
void set_pressed();
+ // draw left panel
+ virtual float draw_left_panel(float x1, float y1, float x2, float y2) = 0;
+
+ // draw right panel
+ virtual void draw_right_panel(void *selectedref, float origx1, float origy1, float origx2, float origy2) = 0;
+
float draw_icon(int linenum, void *selectedref, float x1, float y1);
void get_title_search(std::string &title, std::string &search);
@@ -127,7 +133,7 @@ private:
// cleanup function
static void exit(running_machine &machine);
- cache_ptr m_cache;
+ cache_ptr m_cache;
bool m_is_swlist;
focused_menu m_focus;
bool m_pressed; // mouse button held down
@@ -143,4 +149,4 @@ private:
} // namespace ui
-#endif // MAME_FRONTEND_UI_SELMENU_H \ No newline at end of file
+#endif // MAME_FRONTEND_UI_SELMENU_H
diff --git a/src/frontend/mame/ui/selsoft.cpp b/src/frontend/mame/ui/selsoft.cpp
index a28aa465dea..a884fd6070c 100644
--- a/src/frontend/mame/ui/selsoft.cpp
+++ b/src/frontend/mame/ui/selsoft.cpp
@@ -125,7 +125,7 @@ bool has_multiple_bios(const game_driver *driver, s_bios &biosname)
// ctor
//-------------------------------------------------
-menu_select_software::menu_select_software(mame_ui_manager &mui, render_container *container, const game_driver *driver)
+menu_select_software::menu_select_software(mame_ui_manager &mui, render_container &container, const game_driver *driver)
: menu_select_launch(mui, container, true)
{
if (reselect_last::get())
@@ -246,9 +246,9 @@ void menu_select_software::handle()
datfile_manager &mdat = mame_machine_manager::instance()->datfile();
if (ui_swinfo->startempty == 1 && mdat.has_history(ui_swinfo->driver))
- menu::stack_push<menu_dats_view>(ui(), container, ui_swinfo->driver);
+ menu::stack_push<menu_dats_view>(ui(), container(), ui_swinfo->driver);
else if (mdat.has_software(ui_swinfo->listname, ui_swinfo->shortname, ui_swinfo->parentname) || !ui_swinfo->usage.empty())
- menu::stack_push<menu_dats_view>(ui(), container, ui_swinfo);
+ menu::stack_push<menu_dats_view>(ui(), container(), ui_swinfo);
}
else if (menu_event->iptkey == IPT_UI_LEFT_PANEL)
{
@@ -373,7 +373,7 @@ void menu_select_software::handle()
// if we're in an error state, overlay an error message
if (m_ui_error)
- ui().draw_text_box(container, _("The selected software is missing one or more required files. "
+ ui().draw_text_box(container(), _("The selected software is missing one or more required files. "
"Please select a different software.\n\nPress any key to continue."),
ui::text_layout::CENTER, 0.5f, 0.5f, UI_RED_COLOR);
@@ -384,23 +384,23 @@ void menu_select_software::handle()
switch (l_sw_hover)
{
case UI_SW_REGION:
- menu::stack_push<menu_selector>(ui(), container, m_filter.region.ui, m_filter.region.actual, menu_selector::SOFTWARE, l_sw_hover);
+ menu::stack_push<menu_selector>(ui(), container(), m_filter.region.ui, m_filter.region.actual, menu_selector::SOFTWARE, l_sw_hover);
break;
case UI_SW_YEARS:
- menu::stack_push<menu_selector>(ui(), container, m_filter.year.ui, m_filter.year.actual, menu_selector::SOFTWARE, l_sw_hover);
+ menu::stack_push<menu_selector>(ui(), container(), m_filter.year.ui, m_filter.year.actual, menu_selector::SOFTWARE, l_sw_hover);
break;
case UI_SW_LIST:
- menu::stack_push<menu_selector>(ui(), container, m_filter.swlist.description, m_filter.swlist.actual, menu_selector::SOFTWARE, l_sw_hover);
+ menu::stack_push<menu_selector>(ui(), container(), m_filter.swlist.description, m_filter.swlist.actual, menu_selector::SOFTWARE, l_sw_hover);
break;
case UI_SW_TYPE:
- menu::stack_push<menu_selector>(ui(), container, m_filter.type.ui, m_filter.type.actual, menu_selector::SOFTWARE, l_sw_hover);
+ menu::stack_push<menu_selector>(ui(), container(), m_filter.type.ui, m_filter.type.actual, menu_selector::SOFTWARE, l_sw_hover);
break;
case UI_SW_PUBLISHERS:
- menu::stack_push<menu_selector>(ui(), container, m_filter.publisher.ui, m_filter.publisher.actual, menu_selector::SOFTWARE, l_sw_hover);
+ menu::stack_push<menu_selector>(ui(), container(), m_filter.publisher.ui, m_filter.publisher.actual, menu_selector::SOFTWARE, l_sw_hover);
break;
case UI_SW_CUSTOM:
sw_filters::actual = l_sw_hover;
- menu::stack_push<menu_swcustom_filter>(ui(), container, m_driver, m_filter);
+ menu::stack_push<menu_swcustom_filter>(ui(), container(), m_driver, m_filter);
break;
default:
sw_filters::actual = l_sw_hover;
@@ -688,7 +688,7 @@ void menu_select_software::custom_render(void *selectedref, float top, float bot
for (int line = 0; line < 3; ++line)
{
- ui().draw_text_full(container, tempbuf[line].c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), tempbuf[line].c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
maxwidth = MAX(width, maxwidth);
@@ -707,7 +707,7 @@ void menu_select_software::custom_render(void *selectedref, float top, float bot
float y2 = origy1 - 3.0f * UI_BOX_TB_BORDER - tbarspace;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_BACKGROUND_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -717,8 +717,8 @@ void menu_select_software::custom_render(void *selectedref, float top, float bot
// draw the text within it
for (int line = 0; line < 3; ++line)
{
- ui().draw_text_full(container, tempbuf[line].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
- mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size);
+ ui().draw_text_full(container(), tempbuf[line].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size);
y1 += ui().get_line_height();
}
@@ -835,10 +835,10 @@ void menu_select_software::custom_render(void *selectedref, float top, float bot
// get the size of the text
maxwidth = origx2 - origx1;
- for (auto & elem : tempbuf)
+ for (auto &elem : tempbuf)
{
- ui().draw_text_full(container, elem.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
- mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
+ ui().draw_text_full(container(), elem.c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
maxwidth = MAX(maxwidth, width);
}
@@ -856,7 +856,7 @@ void menu_select_software::custom_render(void *selectedref, float top, float bot
y2 = origy2 + bottom;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, color);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, color);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -870,8 +870,8 @@ void menu_select_software::custom_render(void *selectedref, float top, float bot
// draw all lines
for (auto & elem : tempbuf)
{
- ui().draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
- mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size);
+ ui().draw_text_full(container(), elem.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size);
y1 += ui().get_line_height();
}
}
@@ -889,7 +889,9 @@ void menu_select_software::inkey_select(const event *menu_event)
{
s_bios biosname;
if (!mopt.skip_bios_menu() && has_multiple_bios(ui_swinfo->driver, biosname))
- menu::stack_push<bios_selection>(ui(), container, biosname, (void *)ui_swinfo->driver, false, true);
+ {
+ menu::stack_push<bios_selection>(ui(), container(), biosname, (void *)ui_swinfo->driver, false, true);
+ }
else
{
reselect_last::driver = ui_swinfo->driver->name;
@@ -918,7 +920,7 @@ void menu_select_software::inkey_select(const event *menu_event)
s_bios biosname;
if (!mopt.skip_bios_menu() && has_multiple_bios(ui_swinfo->driver, biosname))
{
- menu::stack_push<bios_selection>(ui(), container, biosname, (void *)ui_swinfo, true, false);
+ menu::stack_push<bios_selection>(ui(), container(), biosname, (void *)ui_swinfo, true, false);
return;
}
else if (!mopt.skip_parts_menu() && swinfo->has_multiple_parts(ui_swinfo->interface.c_str()))
@@ -934,7 +936,7 @@ void menu_select_software::inkey_select(const event *menu_event)
parts.emplace(swpart.name(), menu_part_name);
}
}
- menu::stack_push<software_parts>(ui(), container, parts, ui_swinfo);
+ menu::stack_push<software_parts>(ui(), container(), parts, ui_swinfo);
return;
}
@@ -1427,7 +1429,7 @@ float menu_select_software::draw_left_panel(float x1, float y1, float x2, float
}
x2 = x1 + left_width + 2.0f * UI_BOX_LR_BORDER;
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_BACKGROUND_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -1455,8 +1457,10 @@ float menu_select_software::draw_left_panel(float x1, float y1, float x2, float
}
if (bgcolor != UI_TEXT_BG_COLOR)
- ui().draw_textured_box(container, x1, y1, x2, y1 + line_height, bgcolor, rgb_t(255, 43, 43, 43),
- hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
+ {
+ ui().draw_textured_box(container(), x1, y1, x2, y1 + line_height, bgcolor, rgb_t(255, 43, 43, 43),
+ hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
+ }
float x1t = x1 + text_sign;
if (afilter == UI_SW_CUSTOM)
@@ -1488,8 +1492,8 @@ float menu_select_software::draw_left_panel(float x1, float y1, float x2, float
convert_command_glyph(str);
}
- ui().draw_text_full(container, str.c_str(), x1t, y1, x2 - x1, ui::text_layout::LEFT, ui::text_layout::NEVER,
- mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr, text_size);
+ ui().draw_text_full(container(), str.c_str(), x1t, y1, x2 - x1, ui::text_layout::LEFT, ui::text_layout::NEVER,
+ mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr, text_size);
y1 += line_height;
}
@@ -1507,7 +1511,7 @@ float menu_select_software::draw_left_panel(float x1, float y1, float x2, float
float ar_x1 = ar_x0 + lr_arrow_width;
float ar_y1 = 0.5f * (y2 + y1) + 0.9f * space;
- ui().draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
if (mouse_hit && x1 <= mouse_x && x2 > mouse_x && y1 <= mouse_y && y2 > mouse_y)
{
@@ -1515,7 +1519,7 @@ float menu_select_software::draw_left_panel(float x1, float y1, float x2, float
hover = HOVER_LPANEL_ARROW;
}
- draw_arrow(container, ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90 ^ ORIENTATION_FLIP_X);
+ draw_arrow(ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90 ^ ORIENTATION_FLIP_X);
return x2 + UI_BOX_LR_BORDER;
}
else
@@ -1530,7 +1534,7 @@ float menu_select_software::draw_left_panel(float x1, float y1, float x2, float
float ar_x1 = ar_x0 + lr_arrow_width;
float ar_y1 = 0.5f * (y2 + y1) + 0.9f * space;
- ui().draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
if (mouse_hit && x1 <= mouse_x && x2 > mouse_x && y1 <= mouse_y && y2 > mouse_y)
{
@@ -1538,7 +1542,7 @@ float menu_select_software::draw_left_panel(float x1, float y1, float x2, float
hover = HOVER_LPANEL_ARROW;
}
- draw_arrow(container, ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90);
+ draw_arrow(ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90);
return x2 + UI_BOX_LR_BORDER;
}
}
@@ -1567,8 +1571,8 @@ void menu_select_software::infos_render(void *selectedref, float origx1, float o
{
float title_size = 0.0f;
- ui().draw_text_full(container, _("History"), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
- mame_ui_manager::NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &title_size, nullptr);
+ ui().draw_text_full(container(), _("History"), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ mame_ui_manager::NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &title_size, nullptr);
title_size += 0.01f;
rgb_t fgcolor = UI_TEXT_COLOR;
@@ -1582,11 +1586,11 @@ void menu_select_software::infos_render(void *selectedref, float origx1, float o
float middle = origx2 - origx1;
if (bgcolor != UI_TEXT_BG_COLOR)
- ui().draw_textured_box(container, origx1 + ((middle - title_size) * 0.5f), origy1, origx1 + ((middle + title_size) * 0.5f),
- origy1 + line_height, bgcolor, rgb_t(255, 43, 43, 43), hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
+ ui().draw_textured_box(container(), origx1 + ((middle - title_size) * 0.5f), origy1, origx1 + ((middle + title_size) * 0.5f),
+ origy1 + line_height, bgcolor, rgb_t(255, 43, 43, 43), hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
- ui().draw_text_full(container, _("History"), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER, ui::text_layout::NEVER,
- mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr);
+ ui().draw_text_full(container(), _("History"), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr);
ui_globals::cur_sw_dats_view = 0;
}
else
@@ -1599,8 +1603,8 @@ void menu_select_software::infos_render(void *selectedref, float origx1, float o
for (auto & elem : t_text)
{
- ui().draw_text_full(container, elem.c_str(), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER, ui::text_layout::NEVER,
- mame_ui_manager::NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &txt_lenght, nullptr);
+ ui().draw_text_full(container(), elem.c_str(), origx1, origy1, origx2 - origx1, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ mame_ui_manager::NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &txt_lenght, nullptr);
txt_lenght += 0.01f;
title_size = MAX(txt_lenght, title_size);
}
@@ -1621,11 +1625,11 @@ void menu_select_software::infos_render(void *selectedref, float origx1, float o
title_size *= tmp_size;
if (bgcolor != UI_TEXT_BG_COLOR)
- ui().draw_textured_box(container, origx1 + ((middle - title_size) * 0.5f), origy1, origx1 + ((middle + title_size) * 0.5f),
- origy1 + line_height, bgcolor, rgb_t(255, 43, 43, 43), hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
+ ui().draw_textured_box(container(), origx1 + ((middle - title_size) * 0.5f), origy1, origx1 + ((middle + title_size) * 0.5f),
+ origy1 + line_height, bgcolor, rgb_t(255, 43, 43, 43), hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
- ui().draw_text_full(container, t_text[ui_globals::cur_sw_dats_view].c_str(), origx1, origy1, origx2 - origx1,
- ui::text_layout::CENTER, ui::text_layout::NEVER, mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr, tmp_size);
+ ui().draw_text_full(container(), t_text[ui_globals::cur_sw_dats_view].c_str(), origx1, origy1, origx2 - origx1,
+ ui::text_layout::CENTER, ui::text_layout::NEVER, mame_ui_manager::NORMAL, fgcolor, bgcolor, nullptr, nullptr, tmp_size);
draw_common_arrow(origx1, origy1, origx2, origy2, ui_globals::cur_sw_dats_view, 0, 1, title_size);
}
@@ -1648,12 +1652,12 @@ void menu_select_software::infos_render(void *selectedref, float origx1, float o
if (buffer.empty())
{
- ui().draw_text_full(container, _("No Infos Available"), origx1, (origy2 + origy1) * 0.5f, origx2 - origx1, ui::text_layout::CENTER,
- ui::text_layout::WORD, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
+ ui().draw_text_full(container(), _("No Infos Available"), origx1, (origy2 + origy1) * 0.5f, origx2 - origx1, ui::text_layout::CENTER,
+ ui::text_layout::WORD, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
return;
}
else
- m_total_lines = ui().wrap_text(container, buffer.c_str(), origx1, origy1, origx2 - origx1 - (2.0f * gutter_width), xstart, xend, text_size);
+ m_total_lines = ui().wrap_text(container(), buffer.c_str(), origx1, origy1, origx2 - origx1 - (2.0f * gutter_width), xstart, xend, text_size);
int r_visible_lines = floor((origy2 - oy1) / (line_height * text_size));
if (m_total_lines < r_visible_lines)
@@ -1676,9 +1680,9 @@ void menu_select_software::infos_render(void *selectedref, float origx1, float o
else if (r == r_visible_lines - 1 && itemline != m_total_lines - 1)
draw_info_arrow(1, origx1, origx2, oy1, line_height, text_size, ud_arrow_width);
else
- ui().draw_text_full(container, tempbuf.c_str(), origx1 + gutter_width, oy1, origx2 - origx1,
- ui::text_layout::LEFT, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR,
- nullptr, nullptr, text_size);
+ ui().draw_text_full(container(), tempbuf.c_str(), origx1 + gutter_width, oy1, origx2 - origx1,
+ ui::text_layout::LEFT, ui::text_layout::TRUNCATE, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR,
+ nullptr, nullptr, text_size);
oy1 += (line_height * text_size);
}
@@ -1871,7 +1875,7 @@ void menu_select_software::draw_right_panel(void *selectedref, float origx1, flo
float ar_x1 = ar_x0 + lr_arrow_width;
float ar_y1 = 0.5f * (origy2 + origy1) + 0.9f * space;
- ui().draw_outlined_box(container, origx1, origy1, origx2, origy2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
+ ui().draw_outlined_box(container(), origx1, origy1, origx2, origy2, rgb_t(0xEF, 0x12, 0x47, 0x7B));
if (mouse_hit && origx1 <= mouse_x && x2 > mouse_x && origy1 <= mouse_y && origy2 > mouse_y)
{
@@ -1881,11 +1885,11 @@ void menu_select_software::draw_right_panel(void *selectedref, float origx1, flo
if (hide)
{
- draw_arrow(container, ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90 ^ ORIENTATION_FLIP_X);
+ draw_arrow(ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90 ^ ORIENTATION_FLIP_X);
return;
}
- draw_arrow(container, ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90);
+ draw_arrow(ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90);
origx1 = x2;
origy1 = draw_right_box_title(origx1, origy1, origx2, origy2);
@@ -1899,7 +1903,7 @@ void menu_select_software::draw_right_panel(void *selectedref, float origx1, flo
// ctor
//-------------------------------------------------
-software_parts::software_parts(mame_ui_manager &mui, render_container *container, s_parts parts, ui_software_info *ui_info) : menu(mui, container)
+software_parts::software_parts(mame_ui_manager &mui, render_container &container, s_parts parts, ui_software_info *ui_info) : menu(mui, container)
{
m_parts = parts;
m_uiinfo = ui_info;
@@ -1967,7 +1971,7 @@ void software_parts::handle()
void software_parts::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
{
float width;
- ui().draw_text_full(container, _("Software part selection:"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), _("Software part selection:"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
float maxwidth = MAX(origx2 - origx1, width);
@@ -1979,7 +1983,7 @@ void software_parts::custom_render(void *selectedref, float top, float bottom, f
float y2 = origy1 - UI_BOX_TB_BORDER;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_GREEN_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -1987,7 +1991,7 @@ void software_parts::custom_render(void *selectedref, float top, float bottom, f
y1 += UI_BOX_TB_BORDER;
// draw the text within it
- ui().draw_text_full(container, _("Software part selection:"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), _("Software part selection:"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
}
@@ -1995,7 +1999,7 @@ void software_parts::custom_render(void *selectedref, float top, float bottom, f
// ctor
//-------------------------------------------------
-bios_selection::bios_selection(mame_ui_manager &mui, render_container *container, s_bios biosname, void *_driver, bool _software, bool _inlist) : menu(mui, container)
+bios_selection::bios_selection(mame_ui_manager &mui, render_container &container, s_bios biosname, void *_driver, bool _software, bool _inlist) : menu(mui, container)
{
m_bios = biosname;
m_driver = _driver;
@@ -2080,7 +2084,7 @@ void bios_selection::handle()
parts.emplace(swpart.name(), menu_part_name);
}
}
- menu::stack_push<software_parts>(ui(), container, parts, ui_swinfo);
+ menu::stack_push<software_parts>(ui(), container(), parts, ui_swinfo);
return;
}
std::string error_string;
@@ -2108,7 +2112,7 @@ void bios_selection::handle()
void bios_selection::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
{
float width;
- ui().draw_text_full(container, _("Bios selection:"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), _("Bios selection:"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
float maxwidth = MAX(origx2 - origx1, width);
@@ -2120,7 +2124,7 @@ void bios_selection::custom_render(void *selectedref, float top, float bottom, f
float y2 = origy1 - UI_BOX_TB_BORDER;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_GREEN_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -2128,7 +2132,7 @@ void bios_selection::custom_render(void *selectedref, float top, float bottom, f
y1 += UI_BOX_TB_BORDER;
// draw the text within it
- ui().draw_text_full(container, _("Bios selection:"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), _("Bios selection:"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
}
diff --git a/src/frontend/mame/ui/selsoft.h b/src/frontend/mame/ui/selsoft.h
index 9681a8c2068..5661be86c1c 100644
--- a/src/frontend/mame/ui/selsoft.h
+++ b/src/frontend/mame/ui/selsoft.h
@@ -23,20 +23,13 @@ using s_parts = std::unordered_map<std::string, std::string>;
class menu_select_software : public menu_select_launch
{
public:
- menu_select_software(mame_ui_manager &mui, render_container *container, const game_driver *driver);
+ menu_select_software(mame_ui_manager &mui, render_container &container, const game_driver *driver);
virtual ~menu_select_software() 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;
+protected:
+ virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual bool menu_has_search_active() override { return (m_search[0] != 0); }
- // draw left panel
- virtual float draw_left_panel(float x1, float y1, float x2, float y2) override;
-
- // draw right panel
- virtual void draw_right_panel(void *selectedref, float origx1, float origy1, float origx2, float origy2) override;
-
private:
enum { VISIBLE_GAMES_IN_SEARCH = 200 };
char m_search[40];
@@ -45,6 +38,15 @@ private:
s_filter m_filter;
int highlight;
+ virtual void populate() override;
+ virtual void handle() override;
+
+ // draw left panel
+ virtual float draw_left_panel(float x1, float y1, float x2, float y2) override;
+
+ // draw right panel
+ virtual void draw_right_panel(void *selectedref, float origx1, float origy1, float origx2, float origy2) override;
+
ui_software_info *m_searchlist[VISIBLE_GAMES_IN_SEARCH + 1];
std::vector<ui_software_info *> m_displaylist, m_tmp, m_sortedlist;
std::vector<ui_software_info> m_swinfo;
@@ -67,13 +69,16 @@ private:
class software_parts : public menu
{
public:
- software_parts(mame_ui_manager &mui, render_container *container, s_parts parts, ui_software_info *ui_info);
+ software_parts(mame_ui_manager &mui, render_container &container, s_parts parts, ui_software_info *ui_info);
virtual ~software_parts() override;
- virtual void populate() override;
- virtual void handle() 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() override;
+ virtual void handle() override;
+
ui_software_info *m_uiinfo;
s_parts m_parts;
};
@@ -81,13 +86,15 @@ private:
class bios_selection : public menu
{
public:
- bios_selection(mame_ui_manager &mui, render_container *container, s_bios biosname, void *driver, bool software, bool inlist);
+ bios_selection(mame_ui_manager &mui, render_container &container, s_bios biosname, void *driver, bool software, bool inlist);
virtual ~bios_selection() override;
- virtual void populate() override;
- virtual void handle() 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() override;
+ virtual void handle() override;
void *m_driver;
bool m_software, m_inlist;
diff --git a/src/frontend/mame/ui/simpleselgame.cpp b/src/frontend/mame/ui/simpleselgame.cpp
index 4526676a960..9fe101b4d82 100644
--- a/src/frontend/mame/ui/simpleselgame.cpp
+++ b/src/frontend/mame/ui/simpleselgame.cpp
@@ -30,7 +30,7 @@ namespace ui {
// ctor
//-------------------------------------------------
-simple_menu_select_game::simple_menu_select_game(mame_ui_manager &mui, render_container *container, const char *gamename) : menu(mui, container), m_driverlist(driver_list::total() + 1)
+simple_menu_select_game::simple_menu_select_game(mame_ui_manager &mui, render_container &container, const char *gamename) : menu(mui, container), m_driverlist(driver_list::total() + 1)
{
build_driver_list();
if(gamename)
@@ -132,7 +132,7 @@ void simple_menu_select_game::handle()
// if we're in an error state, overlay an error message
if (m_error)
- ui().draw_text_box(container,
+ ui().draw_text_box(container(),
"The selected game is missing one or more required ROM or CHD images. "
"Please select a different game.\n\nPress any key to continue.",
ui::text_layout::CENTER, 0.5f, 0.5f, UI_RED_COLOR);
@@ -149,7 +149,7 @@ void simple_menu_select_game::inkey_select(const event *menu_event)
// special case for configure inputs
if ((FPTR)driver == 1)
- menu::stack_push<menu_game_options>(ui(), container);
+ menu::stack_push<menu_game_options>(ui(), container());
// anything else is a driver
else
{
@@ -297,7 +297,7 @@ void simple_menu_select_game::custom_render(void *selectedref, float top, float
tempbuf[0] = _("Type name or select: (random)");
// get the size of the text
- ui().draw_text_full(container, tempbuf[0].c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), tempbuf[0].c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
maxwidth = MAX(width, origx2 - origx1);
@@ -309,7 +309,7 @@ void simple_menu_select_game::custom_render(void *selectedref, float top, float
y2 = origy1 - UI_BOX_TB_BORDER;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_BACKGROUND_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -317,7 +317,7 @@ void simple_menu_select_game::custom_render(void *selectedref, float top, float
y1 += UI_BOX_TB_BORDER;
// draw the text within it
- ui().draw_text_full(container, tempbuf[0].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), tempbuf[0].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
// determine the text to render below
@@ -387,7 +387,7 @@ void simple_menu_select_game::custom_render(void *selectedref, float top, float
maxwidth = origx2 - origx1;
for (line = 0; line < 4; line++)
{
- ui().draw_text_full(container, tempbuf[line].c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), tempbuf[line].c_str(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
maxwidth = MAX(maxwidth, width);
@@ -407,7 +407,7 @@ void simple_menu_select_game::custom_render(void *selectedref, float top, float
color = UI_YELLOW_COLOR;
if (driver != nullptr && (driver->flags & (MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION)) != 0)
color = UI_RED_COLOR;
- ui().draw_outlined_box(container, x1, y1, x2, y2, color);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, color);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -417,7 +417,7 @@ void simple_menu_select_game::custom_render(void *selectedref, float top, float
// draw all lines
for (line = 0; line < 4; line++)
{
- ui().draw_text_full(container, tempbuf[line].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), tempbuf[line].c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
y1 += ui().get_line_height();
}
@@ -429,7 +429,7 @@ void simple_menu_select_game::custom_render(void *selectedref, float top, float
// select menu to be visible and inescapable
//-------------------------------------------------
-void simple_menu_select_game::force_game_select(mame_ui_manager &mui, render_container *container)
+void simple_menu_select_game::force_game_select(mame_ui_manager &mui, render_container &container)
{
char *gamename = (char *)mui.machine().options().system_name();
diff --git a/src/frontend/mame/ui/simpleselgame.h b/src/frontend/mame/ui/simpleselgame.h
index 8df2a047f9a..bdd3b92872c 100644
--- a/src/frontend/mame/ui/simpleselgame.h
+++ b/src/frontend/mame/ui/simpleselgame.h
@@ -20,31 +20,35 @@ class driver_enumerator;
namespace ui {
class simple_menu_select_game : public menu {
public:
- simple_menu_select_game(mame_ui_manager &mui, render_container *container, const char *gamename);
+ simple_menu_select_game(mame_ui_manager &mui, render_container &container, const char *gamename);
virtual ~simple_menu_select_game();
- 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;
// force game select menu
- static void force_game_select(mame_ui_manager &mui, render_container *container);
+ static void force_game_select(mame_ui_manager &mui, render_container &container);
+protected:
+ virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual bool menu_has_search_active() override { return (m_search[0] != 0); }
+
private:
- // internal state
enum { VISIBLE_GAMES_IN_LIST = 15 };
- UINT8 m_error;
- bool m_rerandomize;
- char m_search[40];
- int m_matchlist[VISIBLE_GAMES_IN_LIST];
- std::vector<const game_driver *> m_driverlist;
- std::unique_ptr<driver_enumerator> m_drivlist;
+
+ virtual void populate() override;
+ virtual void handle() override;
// internal methods
void build_driver_list();
void inkey_select(const event *menu_event);
void inkey_cancel();
void inkey_special(const event *menu_event);
+
+ // internal state
+ UINT8 m_error;
+ bool m_rerandomize;
+ char m_search[40];
+ int m_matchlist[VISIBLE_GAMES_IN_LIST];
+ std::vector<const game_driver *> m_driverlist;
+ std::unique_ptr<driver_enumerator> m_drivlist;
};
} // namespace ui
diff --git a/src/frontend/mame/ui/sliders.cpp b/src/frontend/mame/ui/sliders.cpp
index 2cf36b9c85d..a4e66b74802 100644
--- a/src/frontend/mame/ui/sliders.cpp
+++ b/src/frontend/mame/ui/sliders.cpp
@@ -17,7 +17,7 @@
#include "ui/slider.h"
namespace ui {
-menu_sliders::menu_sliders(mame_ui_manager &mui, render_container *container, bool menuless_mode) : menu(mui, container)
+menu_sliders::menu_sliders(mame_ui_manager &mui, render_container &container, bool menuless_mode) : menu(mui, container)
{
m_menuless_mode = m_hidden = menuless_mode;
}
@@ -220,11 +220,11 @@ void menu_sliders::custom_render(void *selectedref, float top, float bottom, flo
x2 = 1.0f - UI_BOX_LR_BORDER;
// draw extra menu area
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_BACKGROUND_COLOR);
y1 += UI_BOX_TB_BORDER;
// determine the text height
- ui().draw_text_full(container, tempstring.c_str(), 0, 0, x2 - x1 - 2.0f * UI_BOX_LR_BORDER,
+ ui().draw_text_full(container(), tempstring.c_str(), 0, 0, x2 - x1 - 2.0f * UI_BOX_LR_BORDER,
ui::text_layout::CENTER, ui::text_layout::TRUNCATE, mame_ui_manager::NONE, rgb_t::white, rgb_t::black, nullptr, &text_height);
// draw the thermometer
@@ -240,18 +240,18 @@ void menu_sliders::custom_render(void *selectedref, float top, float bottom, flo
current_x = bar_left + bar_width * percentage;
// fill in the percentage
- container->add_rect(bar_left, bar_top, current_x, bar_bottom, UI_SLIDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container().add_rect(bar_left, bar_top, current_x, bar_bottom, UI_SLIDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
// draw the top and bottom lines
- container->add_line(bar_left, bar_top, bar_left + bar_width, bar_top, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
- container->add_line(bar_left, bar_bottom, bar_left + bar_width, bar_bottom, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container().add_line(bar_left, bar_top, bar_left + bar_width, bar_top, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container().add_line(bar_left, bar_bottom, bar_left + bar_width, bar_bottom, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
// draw default marker
- container->add_line(default_x, bar_area_top, default_x, bar_top, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
- container->add_line(default_x, bar_bottom, default_x, bar_area_top + bar_area_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container().add_line(default_x, bar_area_top, default_x, bar_top, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container().add_line(default_x, bar_bottom, default_x, bar_area_top + bar_area_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
// draw the actual text
- ui().draw_text_full(container, tempstring.c_str(), x1 + UI_BOX_LR_BORDER, y1 + line_height, x2 - x1 - 2.0f * UI_BOX_LR_BORDER,
+ ui().draw_text_full(container(), tempstring.c_str(), x1 + UI_BOX_LR_BORDER, y1 + line_height, x2 - x1 - 2.0f * UI_BOX_LR_BORDER,
ui::text_layout::CENTER, ui::text_layout::WORD, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, &text_height);
}
}
@@ -263,7 +263,7 @@ void menu_sliders::custom_render(void *selectedref, float top, float bottom, flo
// standard menu handler
//-------------------------------------------------
-UINT32 menu_sliders::ui_handler(render_container *container, mame_ui_manager &mui)
+UINT32 menu_sliders::ui_handler(render_container &container, mame_ui_manager &mui)
{
UINT32 result;
diff --git a/src/frontend/mame/ui/sliders.h b/src/frontend/mame/ui/sliders.h
index 147674b7375..6e3affb53b8 100644
--- a/src/frontend/mame/ui/sliders.h
+++ b/src/frontend/mame/ui/sliders.h
@@ -19,20 +19,23 @@ namespace ui {
class menu_sliders : public menu
{
public:
- menu_sliders(mame_ui_manager &mui, render_container *container, bool menuless_mode = false);
+ menu_sliders(mame_ui_manager &mui, render_container &container, bool menuless_mode = false);
virtual ~menu_sliders() 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;
+ static UINT32 ui_handler(render_container &container, mame_ui_manager &mui);
- static UINT32 ui_handler(render_container *container, mame_ui_manager &mui);
+protected:
+ virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
private:
enum {
INPUT_GROUPS,
INPUT_SPECIFIC,
};
+
+ virtual void populate() override;
+ virtual void handle() override;
+
bool m_menuless_mode;
bool m_hidden;
};
diff --git a/src/frontend/mame/ui/slotopt.cpp b/src/frontend/mame/ui/slotopt.cpp
index d6b1a438c30..ae7e2b8633e 100644
--- a/src/frontend/mame/ui/slotopt.cpp
+++ b/src/frontend/mame/ui/slotopt.cpp
@@ -147,7 +147,7 @@ void menu_slot_devices::set_slot_device(device_slot_interface &slot, const char
slot device menu
-------------------------------------------------*/
-menu_slot_devices::menu_slot_devices(mame_ui_manager &mui, render_container *container) : menu(mui, container)
+menu_slot_devices::menu_slot_devices(mame_ui_manager &mui, render_container &container) : menu(mui, container)
{
}
@@ -206,7 +206,7 @@ void menu_slot_devices::handle()
device_slot_interface *slot = (device_slot_interface *)menu_event->itemref;
device_slot_option *option = slot_get_current_option(*slot);
if (option)
- menu::stack_push<menu_device_config>(ui(), container, slot, option);
+ menu::stack_push<menu_device_config>(ui(), container(), slot, option);
}
}
}
diff --git a/src/frontend/mame/ui/slotopt.h b/src/frontend/mame/ui/slotopt.h
index e1883fe33d7..faca9fc236f 100644
--- a/src/frontend/mame/ui/slotopt.h
+++ b/src/frontend/mame/ui/slotopt.h
@@ -20,12 +20,13 @@ namespace ui {
class menu_slot_devices : public menu
{
public:
- menu_slot_devices(mame_ui_manager &mui, render_container *container);
+ menu_slot_devices(mame_ui_manager &mui, render_container &container);
virtual ~menu_slot_devices() override;
+
+private:
virtual void populate() override;
virtual void handle() override;
-private:
device_slot_option *slot_get_current_option(device_slot_interface &slot);
int slot_get_current_index(device_slot_interface &slot);
int slot_get_length(device_slot_interface &slot);
diff --git a/src/frontend/mame/ui/sndmenu.cpp b/src/frontend/mame/ui/sndmenu.cpp
index 55e62062512..869ec533050 100644
--- a/src/frontend/mame/ui/sndmenu.cpp
+++ b/src/frontend/mame/ui/sndmenu.cpp
@@ -21,7 +21,7 @@ const int menu_sound_options::m_sound_rate[] = { 11025, 22050, 44100, 48000 };
// ctor
//-------------------------------------------------
-menu_sound_options::menu_sound_options(mame_ui_manager &mui, render_container *container) : menu(mui, container)
+menu_sound_options::menu_sound_options(mame_ui_manager &mui, render_container &container) : menu(mui, container)
{
osd_options &options = downcast<osd_options &>(mui.machine().options());
@@ -101,7 +101,7 @@ void menu_sound_options::handle()
for (int index = 0; index < total; index++)
s_sel[index] = std::to_string(m_sound_rate[index]);
- menu::stack_push<menu_selector>(ui(), container, s_sel, m_cur_rates);
+ menu::stack_push<menu_selector>(ui(), container(), s_sel, m_cur_rates);
}
break;
@@ -126,7 +126,7 @@ void menu_sound_options::handle()
void menu_sound_options::populate()
{
- UINT32 arrow_flags = get_arrow_flags(0, ARRAY_LENGTH(m_sound_rate) - 1, m_cur_rates);
+ UINT32 arrow_flags = get_arrow_flags(UINT16(0), UINT16(ARRAY_LENGTH(m_sound_rate) - 1), m_cur_rates);
m_sample_rate = m_sound_rate[m_cur_rates];
// add options items
@@ -145,7 +145,7 @@ void menu_sound_options::populate()
void menu_sound_options::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
{
float width;
- ui().draw_text_full(container, _("Sound Options"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), _("Sound Options"), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
float maxwidth = MAX(origx2 - origx1, width);
@@ -157,7 +157,7 @@ void menu_sound_options::custom_render(void *selectedref, float top, float botto
float y2 = origy1 - UI_BOX_TB_BORDER;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_GREEN_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -165,7 +165,7 @@ void menu_sound_options::custom_render(void *selectedref, float top, float botto
y1 += UI_BOX_TB_BORDER;
// draw the text within it
- ui().draw_text_full(container, _("Sound Options"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), _("Sound Options"), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
}
diff --git a/src/frontend/mame/ui/sndmenu.h b/src/frontend/mame/ui/sndmenu.h
index 171e4016759..19e110bbc7e 100644
--- a/src/frontend/mame/ui/sndmenu.h
+++ b/src/frontend/mame/ui/sndmenu.h
@@ -22,10 +22,10 @@ namespace ui {
class menu_sound_options : public menu
{
public:
- menu_sound_options(mame_ui_manager &mui, render_container *container);
+ menu_sound_options(mame_ui_manager &mui, render_container &container);
virtual ~menu_sound_options() override;
- virtual void populate() override;
- virtual void handle() override;
+
+protected:
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
private:
@@ -36,6 +36,9 @@ private:
ENABLE_SAMPLES
};
+ virtual void populate() override;
+ virtual void handle() override;
+
UINT16 m_cur_rates;
static const int m_sound_rate[];
int m_sample_rate;
diff --git a/src/frontend/mame/ui/submenu.cpp b/src/frontend/mame/ui/submenu.cpp
index cdecec0ca80..9f13c6cafec 100644
--- a/src/frontend/mame/ui/submenu.cpp
+++ b/src/frontend/mame/ui/submenu.cpp
@@ -16,8 +16,9 @@
#include <limits>
+
namespace ui {
-std::vector<submenu::option> submenu::misc_options = {
+std::vector<submenu::option> const submenu::misc_options = {
{ submenu::option_type::HEAD, __("Miscellaneous Options") },
{ submenu::option_type::UI, __("Re-select last machine played"), OPTION_REMEMBER_LAST },
{ submenu::option_type::UI, __("Enlarge images in the right panel"), OPTION_ENLARGE_SNAPS },
@@ -34,7 +35,7 @@ std::vector<submenu::option> submenu::misc_options = {
{ submenu::option_type::UI, __("Hide romless machine from available list"),OPTION_HIDE_ROMLESS },
};
-std::vector<submenu::option> submenu::advanced_options = {
+std::vector<submenu::option> const submenu::advanced_options = {
{ submenu::option_type::HEAD, __("Advanced Options") },
{ submenu::option_type::HEAD, __("Performance Options") },
{ submenu::option_type::EMU, __("Auto frame skip"), OPTION_AUTOFRAMESKIP },
@@ -83,7 +84,7 @@ std::vector<submenu::option> submenu::advanced_options = {
{ submenu::option_type::EMU, __("Coin impulse"), OPTION_COIN_IMPULSE },
};
-std::vector<submenu::option> submenu::control_options = {
+std::vector<submenu::option> const submenu::control_options = {
{ submenu::option_type::HEAD, __("Device Mapping") },
{ submenu::option_type::EMU, __("Lightgun Device Assignment"), OPTION_LIGHTGUN_DEVICE },
{ submenu::option_type::EMU, __("Trackball Device Assignment"), OPTION_TRACKBALL_DEVICE },
@@ -95,7 +96,7 @@ std::vector<submenu::option> submenu::control_options = {
{ submenu::option_type::EMU, __("Mouse Device Assignment"), OPTION_MOUSE_DEVICE }
};
-std::vector<submenu::option> submenu::video_options = {
+std::vector<submenu::option> const submenu::video_options = {
{ submenu::option_type::HEAD, __("Video Options") },
{ submenu::option_type::OSD, __("Video Mode"), OSDOPTION_VIDEO },
{ submenu::option_type::OSD, __("Number Of Screens"), OSDOPTION_NUMSCREENS },
@@ -113,7 +114,7 @@ std::vector<submenu::option> submenu::video_options = {
{ submenu::option_type::OSD, __("Wait Vertical Sync"), OSDOPTION_WAITVSYNC }
};
-//std::vector<submenu::option> submenu::export_options = {
+//std::vector<submenu::option> const submenu::export_options = {
// { ui_submenu::option_type::COMMAND, __("Export XML format (like -listxml)"), "exportxml" },
// { ui_submenu::option_type::COMMAND, __("Export TXT format (like -listfull)"), "exporttxt" },
//};
@@ -123,9 +124,14 @@ std::vector<submenu::option> submenu::video_options = {
// ctor / dtor
//-------------------------------------------------
-submenu::submenu(mame_ui_manager &mui, render_container *container, std::vector<option> &suboptions, const game_driver *drv, emu_options *options)
+submenu::submenu(mame_ui_manager &mui, render_container &container, std::vector<option> const &suboptions, const game_driver *drv, emu_options *options)
+ : submenu(mui, container, std::vector<option>(suboptions), drv, options)
+{
+}
+
+submenu::submenu(mame_ui_manager &mui, render_container &container, std::vector<option> &&suboptions, const game_driver *drv, emu_options *options)
: menu(mui, container)
- , m_options(suboptions)
+ , m_options(std::move(suboptions))
, m_driver(drv)
{
core_options *opts = nullptr;
@@ -138,62 +144,62 @@ submenu::submenu(mame_ui_manager &mui, render_container *container, std::vector<
{
switch (sm_option.type)
{
- case option_type::EMU:
- sm_option.entry = opts->get_entry(sm_option.name);
- sm_option.options = opts;
- if (sm_option.entry->type() == OPTION_STRING)
+ case option_type::EMU:
+ sm_option.entry = opts->get_entry(sm_option.name);
+ sm_option.options = opts;
+ if (sm_option.entry->type() == OPTION_STRING)
+ {
+ sm_option.value.clear();
+ std::string namestr(sm_option.entry->description());
+ int lparen = namestr.find_first_of('(', 0);
+ int vslash = namestr.find_first_of('|', lparen + 1);
+ int rparen = namestr.find_first_of(')', vslash + 1);
+ if (lparen != -1 && vslash != -1 && rparen != -1)
{
- sm_option.value.clear();
- std::string namestr(sm_option.entry->description());
- int lparen = namestr.find_first_of('(', 0);
- int vslash = namestr.find_first_of('|', lparen + 1);
- int rparen = namestr.find_first_of(')', vslash + 1);
- if (lparen != -1 && vslash != -1 && rparen != -1)
+ int semi;
+ namestr.erase(rparen);
+ namestr.erase(0, lparen + 1);
+ while ((semi = namestr.find_first_of('|')) != -1)
{
- int semi;
- namestr.erase(rparen);
- namestr.erase(0, lparen + 1);
- while ((semi = namestr.find_first_of('|')) != -1)
- {
- sm_option.value.emplace_back(namestr.substr(0, semi));
- namestr.erase(0, semi + 1);
- }
- sm_option.value.emplace_back(namestr);
+ sm_option.value.emplace_back(namestr.substr(0, semi));
+ namestr.erase(0, semi + 1);
}
+ sm_option.value.emplace_back(namestr);
}
- break;
- case option_type::OSD:
- sm_option.entry = opts->get_entry(sm_option.name);
- sm_option.options = opts;
- if (sm_option.entry->type() == OPTION_STRING)
+ }
+ break;
+ case option_type::OSD:
+ sm_option.entry = opts->get_entry(sm_option.name);
+ sm_option.options = opts;
+ if (sm_option.entry->type() == OPTION_STRING)
+ {
+ sm_option.value.clear();
+ std::string descr(sm_option.entry->description()), delim(", ");
+ descr.erase(0, descr.find(":") + 2);
+ size_t p1, p2 = 0;
+ while ((p1 = descr.find_first_not_of(delim, p2)) != std::string::npos)
{
- sm_option.value.clear();
- std::string descr(sm_option.entry->description()), delim(", ");
- descr.erase(0, descr.find(":") + 2);
- size_t p1, p2 = 0;
- while ((p1 = descr.find_first_not_of(delim, p2)) != std::string::npos)
+ p2 = descr.find_first_of(delim, p1 + 1);
+ if (p2 != std::string::npos)
{
- p2 = descr.find_first_of(delim, p1 + 1);
- if (p2 != std::string::npos)
- {
- std::string txt(descr.substr(p1, p2 - p1));
- if (txt != "or")
- sm_option.value.push_back(txt);
- }
- else
- {
- sm_option.value.push_back(descr.substr(p1));
- break;
- }
+ std::string txt(descr.substr(p1, p2 - p1));
+ if (txt != "or")
+ sm_option.value.push_back(txt);
+ }
+ else
+ {
+ sm_option.value.push_back(descr.substr(p1));
+ break;
}
}
- break;
- case option_type::UI:
- sm_option.entry = mui.options().get_entry(sm_option.name);
- sm_option.options = dynamic_cast<core_options*>(&mui.options());
- break;
- default:
- break;
+ }
+ break;
+ case option_type::UI:
+ sm_option.entry = mui.options().get_entry(sm_option.name);
+ sm_option.options = dynamic_cast<core_options*>(&mui.options());
+ break;
+ default:
+ break;
}
}
}
@@ -380,12 +386,12 @@ void submenu::populate()
break;
case OPTION_STRING:
{
- std::string v_cur(sm_option->entry->value());
- int cur_value = std::distance(sm_option->value.begin(), std::find(sm_option->value.begin(), sm_option->value.end(), v_cur));
- arrow_flags = get_arrow_flags(0, sm_option->value.size() - 1, cur_value);
+ std::string const v_cur(sm_option->entry->value());
+ int const cur_value = std::distance(sm_option->value.begin(), std::find(sm_option->value.begin(), sm_option->value.end(), v_cur));
+ arrow_flags = get_arrow_flags(0, int(unsigned(sm_option->value.size() - 1)), cur_value);
item_append(_(sm_option->description),
- sm_option->options->value(sm_option->name),
- arrow_flags, static_cast<void*>(&(*sm_option)));
+ sm_option->options->value(sm_option->name),
+ arrow_flags, static_cast<void*>(&(*sm_option)));
}
break;
default:
@@ -414,8 +420,8 @@ void submenu::custom_render(void *selectedref, float top, float bottom, float or
{
float width;
- ui().draw_text_full(container, _(m_options[0].description), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
- mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
+ ui().draw_text_full(container(), _(m_options[0].description), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
float maxwidth = MAX(origx2 - origx1, width);
@@ -426,7 +432,7 @@ void submenu::custom_render(void *selectedref, float top, float bottom, float or
float y2 = origy1 - UI_BOX_TB_BORDER;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_GREEN_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -434,7 +440,7 @@ void submenu::custom_render(void *selectedref, float top, float bottom, float or
y1 += UI_BOX_TB_BORDER;
// draw the text within it
- ui().draw_text_full(container, _(m_options[0].description), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), _(m_options[0].description), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
if (selectedref != nullptr)
@@ -442,7 +448,7 @@ void submenu::custom_render(void *selectedref, float top, float bottom, float or
option &selected_sm_option = *reinterpret_cast<option *>(selectedref);
if (selected_sm_option.entry != nullptr)
{
- ui().draw_text_full(container, selected_sm_option.entry->description(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
+ ui().draw_text_full(container(), selected_sm_option.entry->description(), 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
mame_ui_manager::NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
@@ -455,7 +461,7 @@ void submenu::custom_render(void *selectedref, float top, float bottom, float or
y2 = origy2 + bottom;
// draw a box
- ui().draw_outlined_box(container, x1, y1, x2, y2, UI_RED_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_RED_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -463,7 +469,7 @@ void submenu::custom_render(void *selectedref, float top, float bottom, float or
y1 += UI_BOX_TB_BORDER;
// draw the text within it
- ui().draw_text_full(container, selected_sm_option.entry->description(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
+ ui().draw_text_full(container(), selected_sm_option.entry->description(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
}
}
diff --git a/src/frontend/mame/ui/submenu.h b/src/frontend/mame/ui/submenu.h
index 8631b4b001f..475abde7018 100644
--- a/src/frontend/mame/ui/submenu.h
+++ b/src/frontend/mame/ui/submenu.h
@@ -49,24 +49,28 @@ public:
const char *description;
const char *name;
core_options::entry *entry;
- core_options (*options);
+ core_options *options;
std::vector<std::string> value;
};
- submenu(mame_ui_manager &mui, render_container *container, std::vector<option> &suboptions, const game_driver *drv = nullptr, emu_options *options = nullptr);
+ submenu(mame_ui_manager &mui, render_container &container, std::vector<option> const &suboptions, const game_driver *drv = nullptr, emu_options *options = nullptr);
+ submenu(mame_ui_manager &mui, render_container &container, std::vector<option> &&suboptions, const game_driver *drv = nullptr, emu_options *options = nullptr);
virtual ~submenu();
- 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;
- static std::vector<option> misc_options;
- static std::vector<option> advanced_options;
- static std::vector<option> control_options;
- static std::vector<option> video_options;
- //static std::vector<option> export_options;
+ static std::vector<option> const misc_options;
+ static std::vector<option> const advanced_options;
+ static std::vector<option> const control_options;
+ static std::vector<option> const video_options;
+ //static std::vector<option> const export_options;
+
+protected:
+ virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
private:
- std::vector<option> &m_options;
+ virtual void populate() override;
+ virtual void handle() override;
+
+ std::vector<option> m_options;
game_driver const *m_driver;
};
diff --git a/src/frontend/mame/ui/swlist.cpp b/src/frontend/mame/ui/swlist.cpp
index 5eb4fe7fd62..0aad599864b 100644
--- a/src/frontend/mame/ui/swlist.cpp
+++ b/src/frontend/mame/ui/swlist.cpp
@@ -33,9 +33,9 @@ namespace ui {
// ctor
//-------------------------------------------------
-menu_software_parts::menu_software_parts(mame_ui_manager &mui, render_container *container, const software_info *info, const char *interface, const software_part **part, bool other_opt, result &result)
+menu_software_parts::menu_software_parts(mame_ui_manager &mui, render_container &container, const software_info *info, const char *interface, const software_part **part, bool other_opt, result &result)
: menu(mui, container),
- m_result(result)
+ m_result(result)
{
m_info = info;
m_interface = interface;
@@ -123,7 +123,7 @@ void menu_software_parts::handle()
// ctor
//-------------------------------------------------
-menu_software_list::menu_software_list(mame_ui_manager &mui, render_container *container, software_list_device *swlist, const char *interface, std::string &result)
+menu_software_list::menu_software_list(mame_ui_manager &mui, render_container &container, software_list_device *swlist, const char *interface, std::string &result)
: menu(mui, container), m_result(result)
{
m_swlist = swlist;
@@ -331,7 +331,7 @@ void menu_software_list::handle()
// ctor
//-------------------------------------------------
-menu_software::menu_software(mame_ui_manager &mui, render_container *container, const char *interface, software_list_device **result)
+menu_software::menu_software(mame_ui_manager &mui, render_container &container, const char *interface, software_list_device **result)
: menu(mui, container)
{
m_interface = interface;
@@ -399,9 +399,10 @@ void menu_software::handle()
// process the menu
const event *event = process(0);
- if (event != nullptr && event->iptkey == IPT_UI_SELECT) {
- //menu::stack_push<menu_software_list>(ui(), container, (software_list_config *)event->itemref, image);
- *m_result = (software_list_device *)event->itemref;
+ if (event != nullptr && event->iptkey == IPT_UI_SELECT)
+ {
+ //menu::stack_push<menu_software_list>(ui(), container(), (software_list_config *)event->itemref, image);
+ *m_result = reinterpret_cast<software_list_device *>(event->itemref);
stack_pop();
}
}
diff --git a/src/frontend/mame/ui/swlist.h b/src/frontend/mame/ui/swlist.h
index 1145f984d78..eef09f1c03d 100644
--- a/src/frontend/mame/ui/swlist.h
+++ b/src/frontend/mame/ui/swlist.h
@@ -29,10 +29,8 @@ public:
ENTRY
};
- menu_software_parts(mame_ui_manager &mui, render_container *container, const software_info *info, const char *interface, const software_part **part, bool other_opt, result &result);
+ menu_software_parts(mame_ui_manager &mui, render_container &container, const software_info *info, const char *interface, const software_part **part, bool other_opt, result &result);
virtual ~menu_software_parts() override;
- virtual void populate() override;
- virtual void handle() override;
private:
struct software_part_menu_entry {
@@ -40,6 +38,9 @@ private:
const software_part *part;
};
+ virtual void populate() override;
+ virtual void handle() override;
+
// variables
const software_info * m_info;
const char * m_interface;
@@ -54,7 +55,7 @@ private:
class menu_software_list : public menu
{
public:
- menu_software_list(mame_ui_manager &mui, render_container *container, software_list_device *swlist, const char *interface, std::string &result);
+ menu_software_list(mame_ui_manager &mui, render_container &container, software_list_device *swlist, const char *interface, std::string &result);
virtual ~menu_software_list() override;
virtual void populate() override;
virtual void handle() override;
@@ -76,7 +77,7 @@ private:
software_list_device * m_swlist; // currently selected list
const char * m_interface;
std::string & m_result;
- std::vector<entry_info> m_entrylist;
+ std::vector<entry_info> m_entrylist;
char m_filename_buffer[1024];
bool m_ordered_by_shortname;
@@ -91,7 +92,7 @@ private:
class menu_software : public menu
{
public:
- menu_software(mame_ui_manager &mui, render_container *container, const char *interface, software_list_device **result);
+ menu_software(mame_ui_manager &mui, render_container &container, const char *interface, software_list_device **result);
virtual ~menu_software() override;
virtual void populate() override;
virtual void handle() override;
diff --git a/src/frontend/mame/ui/tapectrl.cpp b/src/frontend/mame/ui/tapectrl.cpp
index afc5f9d6894..9160ec5c1d7 100644
--- a/src/frontend/mame/ui/tapectrl.cpp
+++ b/src/frontend/mame/ui/tapectrl.cpp
@@ -35,7 +35,7 @@ namespace ui {
// ctor
//-------------------------------------------------
-menu_tape_control::menu_tape_control(mame_ui_manager &mui, render_container *container, cassette_image_device *device)
+menu_tape_control::menu_tape_control(mame_ui_manager &mui, render_container &container, cassette_image_device *device)
: menu_device_control<cassette_image_device>(mui, container, device)
{
}
diff --git a/src/frontend/mame/ui/tapectrl.h b/src/frontend/mame/ui/tapectrl.h
index 09f50d844b0..460503df705 100644
--- a/src/frontend/mame/ui/tapectrl.h
+++ b/src/frontend/mame/ui/tapectrl.h
@@ -20,12 +20,13 @@ namespace ui {
class menu_tape_control : public menu_device_control<cassette_image_device>
{
public:
- menu_tape_control(mame_ui_manager &mui, render_container *container, cassette_image_device *device);
+ menu_tape_control(mame_ui_manager &mui, render_container &container, cassette_image_device *device);
virtual ~menu_tape_control() override;
+
+private:
virtual void populate() override;
virtual void handle() override;
-private:
static void get_time_string(std::string &dest, cassette_image_device *cassette, int *curpos, int *endpos);
};
diff --git a/src/frontend/mame/ui/text.cpp b/src/frontend/mame/ui/text.cpp
index 02cc3c59030..ea6ebc743df 100644
--- a/src/frontend/mame/ui/text.cpp
+++ b/src/frontend/mame/ui/text.cpp
@@ -464,7 +464,7 @@ int text_layout::get_wrap_info(std::vector<int> &xstart, std::vector<int> &xend)
// emit
//-------------------------------------------------
-void text_layout::emit(render_container *container, float x, float y)
+void text_layout::emit(render_container &container, float x, float y)
{
for (const auto &line : m_lines)
{
@@ -484,10 +484,10 @@ void text_layout::emit(render_container *container, float x, float y)
// render the background of the character (if present)
if (ch.style.bgcolor.a() != 0)
- container->add_rect(char_x, char_y, char_x + char_width, char_y + char_height, ch.style.bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container.add_rect(char_x, char_y, char_x + char_width, char_y + char_height, ch.style.bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
// render the foreground
- container->add_char(
+ container.add_char(
char_x,
char_y,
char_height,
diff --git a/src/frontend/mame/ui/text.h b/src/frontend/mame/ui/text.h
index 5db5aef7216..9ab717b5c5a 100644
--- a/src/frontend/mame/ui/text.h
+++ b/src/frontend/mame/ui/text.h
@@ -64,7 +64,7 @@ public:
bool hit_test(float x, float y, size_t &start, size_t &span) const;
void restyle(size_t start, size_t span, rgb_t *fgcolor, rgb_t *bgcolor);
int get_wrap_info(std::vector<int> &xstart, std::vector<int> &xend) const;
- void emit(render_container *container, float x, float y);
+ void emit(render_container &container, float x, float y);
void add_text(const char *text, rgb_t fgcolor = rgb_t::white, rgb_t bgcolor = rgb_t::transparent, float size = 1.0)
{
// create the style
diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp
index c54ad7ebcd4..10e34a4b9ca 100644
--- a/src/frontend/mame/ui/ui.cpp
+++ b/src/frontend/mame/ui/ui.cpp
@@ -197,7 +197,8 @@ void mame_ui_manager::init()
decode_ui_color(0, &machine());
// more initialization
- set_handler(UI_CALLBACK_TYPE_GENERAL, &mame_ui_manager::handler_messagebox);
+ using namespace std::placeholders;
+ set_handler(ui_callback_type::GENERAL, std::bind(&mame_ui_manager::handler_messagebox, this, _1));
m_non_char_keys_down = std::make_unique<UINT8[]>((ARRAY_LENGTH(non_char_keys) + 7) / 8);
m_mouse_show = machine().system().flags & MACHINE_CLICKABLE_ARTWORK ? true : false;
@@ -257,9 +258,9 @@ void mame_ui_manager::initialize(running_machine &machine)
// pair for the current UI handler
//-------------------------------------------------
-void mame_ui_manager::set_handler(ui_callback_type callback_type, const std::function<UINT32 (render_container *)> callback)
+void mame_ui_manager::set_handler(ui_callback_type callback_type, const std::function<UINT32 (render_container &)> &&callback)
{
- m_handler_callback = callback;
+ m_handler_callback = std::move(callback);
m_handler_callback_type = callback_type;
}
@@ -288,7 +289,8 @@ void mame_ui_manager::display_startup_screens(bool first_time)
#endif
// loop over states
- set_handler(UI_CALLBACK_TYPE_GENERAL, &mame_ui_manager::handler_ingame);
+ using namespace std::placeholders;
+ set_handler(ui_callback_type::GENERAL, std::bind(&mame_ui_manager::handler_ingame, this, _1));
for (state = 0; state < maxstate && !machine().scheduled_event_pending() && !ui::menu::stack_has_special_main_menu(machine()); state++)
{
// default to standard colors
@@ -300,7 +302,7 @@ void mame_ui_manager::display_startup_screens(bool first_time)
case 0:
if (show_warnings && warnings_string(messagebox_text).length() > 0)
{
- set_handler(UI_CALLBACK_TYPE_MODAL, &mame_ui_manager::handler_messagebox_anykey);
+ set_handler(ui_callback_type::MODAL, std::bind(&mame_ui_manager::handler_messagebox_anykey, this, _1));
if (machine().system().flags & (MACHINE_WRONG_COLORS | MACHINE_IMPERFECT_COLORS | MACHINE_REQUIRES_ARTWORK | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_KEYBOARD | MACHINE_NO_SOUND))
messagebox_backcolor = UI_YELLOW_COLOR;
if (machine().system().flags & (MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_MECHANICAL))
@@ -310,7 +312,7 @@ void mame_ui_manager::display_startup_screens(bool first_time)
case 1:
if (show_gameinfo && game_info_astring(messagebox_text).length() > 0)
- set_handler(UI_CALLBACK_TYPE_MODAL, &mame_ui_manager::handler_messagebox_anykey);
+ set_handler(ui_callback_type::MODAL, std::bind(&mame_ui_manager::handler_messagebox_anykey, this, _1));
break;
case 2:
@@ -318,7 +320,7 @@ void mame_ui_manager::display_startup_screens(bool first_time)
{
std::string warning;
warning.assign(_("This driver requires images to be loaded in the following device(s): ")).append(messagebox_text.substr(0, messagebox_text.length() - 2));
- ui::menu_file_manager::force_file_manager(*this, &machine().render().ui_container(), warning.c_str());
+ ui::menu_file_manager::force_file_manager(*this, machine().render().ui_container(), warning.c_str());
}
break;
}
@@ -328,13 +330,13 @@ void mame_ui_manager::display_startup_screens(bool first_time)
while (machine().input().poll_switches() != INPUT_CODE_INVALID) { }
// loop while we have a handler
- while (m_handler_callback_type == UI_CALLBACK_TYPE_MODAL && !machine().scheduled_event_pending() && !ui::menu::stack_has_special_main_menu(machine()))
+ while (m_handler_callback_type == ui_callback_type::MODAL && !machine().scheduled_event_pending() && !ui::menu::stack_has_special_main_menu(machine()))
{
machine().video().frame_update();
}
// clear the handler and force an update
- set_handler(UI_CALLBACK_TYPE_GENERAL, &mame_ui_manager::handler_ingame);
+ set_handler(ui_callback_type::GENERAL, std::bind(&mame_ui_manager::handler_ingame, this, _1));
machine().video().frame_update();
}
@@ -372,10 +374,10 @@ void mame_ui_manager::set_startup_text(const char *text, bool force)
// render it; called by video.c
//-------------------------------------------------
-void mame_ui_manager::update_and_render(render_container *container)
+void mame_ui_manager::update_and_render(render_container &container)
{
// always start clean
- container->empty();
+ container.empty();
// if we're paused, dim the whole screen
if (machine().phase() >= MACHINE_PHASE_RESET && (single_step() || machine().paused()))
@@ -386,14 +388,14 @@ void mame_ui_manager::update_and_render(render_container *container)
if (alpha > 255)
alpha = 255;
if (alpha >= 0)
- container->add_rect(0.0f, 0.0f, 1.0f, 1.0f, rgb_t(alpha,0x00,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container.add_rect(0.0f, 0.0f, 1.0f, 1.0f, rgb_t(alpha,0x00,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
}
// render any cheat stuff at the bottom
if (machine().phase() >= MACHINE_PHASE_RESET)
{
mame_machine_manager::instance()->lua()->on_frame_done();
- mame_machine_manager::instance()->cheat().render_text(*this, *container);
+ mame_machine_manager::instance()->cheat().render_text(*this, container);
}
// call the current UI handler
@@ -415,17 +417,20 @@ void mame_ui_manager::update_and_render(render_container *container)
if (mouse_target != nullptr)
{
float mouse_y=-1,mouse_x=-1;
- if (mouse_target->map_point_container(mouse_target_x, mouse_target_y, *container, mouse_x, mouse_y))
+ if (mouse_target->map_point_container(mouse_target_x, mouse_target_y, container, mouse_x, mouse_y))
{
const float cursor_size = 0.6 * get_line_height();
- container->add_quad(mouse_x, mouse_y, mouse_x + cursor_size*container->manager().ui_aspect(container), mouse_y + cursor_size, UI_TEXT_COLOR, m_mouse_arrow_texture, PRIMFLAG_ANTIALIAS(1) | PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container.add_quad(mouse_x, mouse_y, mouse_x + cursor_size * container.manager().ui_aspect(&container), mouse_y + cursor_size, UI_TEXT_COLOR, m_mouse_arrow_texture, PRIMFLAG_ANTIALIAS(1) | PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
}
}
}
// cancel takes us back to the ingame handler
if (m_handler_param == UI_HANDLER_CANCEL)
- set_handler(UI_CALLBACK_TYPE_GENERAL, &mame_ui_manager::handler_ingame);
+ {
+ using namespace std::placeholders;
+ set_handler(ui_callback_type::GENERAL, std::bind(&mame_ui_manager::handler_ingame, this, _1));
+ }
}
@@ -515,7 +520,7 @@ float mame_ui_manager::get_string_width(const char *s, float text_size)
// color
//-------------------------------------------------
-void mame_ui_manager::draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor)
+void mame_ui_manager::draw_outlined_box(render_container &container, float x0, float y0, float x1, float y1, rgb_t backcolor)
{
draw_outlined_box(container, x0, y0, x1, y1, UI_BORDER_COLOR, backcolor);
}
@@ -527,13 +532,13 @@ void mame_ui_manager::draw_outlined_box(render_container *container, float x0, f
// color
//-------------------------------------------------
-void mame_ui_manager::draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t fgcolor, rgb_t bgcolor)
+void mame_ui_manager::draw_outlined_box(render_container &container, float x0, float y0, float x1, float y1, rgb_t fgcolor, rgb_t bgcolor)
{
- container->add_rect(x0, y0, x1, y1, bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
- container->add_line(x0, y0, x1, y0, UI_LINE_WIDTH, fgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
- container->add_line(x1, y0, x1, y1, UI_LINE_WIDTH, fgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
- container->add_line(x1, y1, x0, y1, UI_LINE_WIDTH, fgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
- container->add_line(x0, y1, x0, y0, UI_LINE_WIDTH, fgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container.add_rect(x0, y0, x1, y1, bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container.add_line(x0, y0, x1, y0, UI_LINE_WIDTH, fgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container.add_line(x1, y0, x1, y1, UI_LINE_WIDTH, fgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container.add_line(x1, y1, x0, y1, UI_LINE_WIDTH, fgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container.add_line(x0, y1, x0, y0, UI_LINE_WIDTH, fgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
}
@@ -541,7 +546,7 @@ void mame_ui_manager::draw_outlined_box(render_container *container, float x0, f
// draw_text - simple text renderer
//-------------------------------------------------
-void mame_ui_manager::draw_text(render_container *container, const char *buf, float x, float y)
+void mame_ui_manager::draw_text(render_container &container, const char *buf, float x, float y)
{
draw_text_full(container, buf, x, y, 1.0f - x, ui::text_layout::LEFT, ui::text_layout::WORD, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
}
@@ -553,7 +558,7 @@ void mame_ui_manager::draw_text(render_container *container, const char *buf, fl
// and full size computation
//-------------------------------------------------
-void mame_ui_manager::draw_text_full(render_container *container, const char *origs, float x, float y, float origwrapwidth, ui::text_layout::text_justify justify, ui::text_layout::word_wrapping wrap, draw_mode draw, rgb_t fgcolor, rgb_t bgcolor, float *totalwidth, float *totalheight, float text_size)
+void mame_ui_manager::draw_text_full(render_container &container, const char *origs, float x, float y, float origwrapwidth, ui::text_layout::text_justify justify, ui::text_layout::word_wrapping wrap, draw_mode draw, rgb_t fgcolor, rgb_t bgcolor, float *totalwidth, float *totalheight, float text_size)
{
// create the layout
auto layout = create_layout(container, origwrapwidth, justify, wrap);
@@ -582,7 +587,7 @@ void mame_ui_manager::draw_text_full(render_container *container, const char *or
// message with a box around it
//-------------------------------------------------
-void mame_ui_manager::draw_text_box(render_container *container, const char *text, ui::text_layout::text_justify justify, float xpos, float ypos, rgb_t backcolor)
+void mame_ui_manager::draw_text_box(render_container &container, const char *text, ui::text_layout::text_justify justify, float xpos, float ypos, rgb_t backcolor)
{
// cap the maximum width
float maximum_width = 1.0f - UI_BOX_LR_BORDER * 2;
@@ -603,7 +608,7 @@ void mame_ui_manager::draw_text_box(render_container *container, const char *tex
// message with a box around it
//-------------------------------------------------
-void mame_ui_manager::draw_text_box(render_container *container, ui::text_layout &layout, float xpos, float ypos, rgb_t backcolor)
+void mame_ui_manager::draw_text_box(render_container &container, ui::text_layout &layout, float xpos, float ypos, rgb_t backcolor)
{
// xpos and ypos are where we want to "pin" the layout, but we need to adjust for the actual size of the payload
auto actual_left = layout.actual_left();
@@ -614,10 +619,10 @@ void mame_ui_manager::draw_text_box(render_container *container, ui::text_layout
// add a box around that
draw_outlined_box(container,
- x - UI_BOX_LR_BORDER,
- y - UI_BOX_TB_BORDER,
- x + actual_width + UI_BOX_LR_BORDER,
- y + actual_height + UI_BOX_TB_BORDER, backcolor);
+ x - UI_BOX_LR_BORDER,
+ y - UI_BOX_TB_BORDER,
+ x + actual_width + UI_BOX_LR_BORDER,
+ y + actual_height + UI_BOX_TB_BORDER, backcolor);
// emit the text
layout.emit(container, x - actual_left, y);
@@ -629,7 +634,7 @@ void mame_ui_manager::draw_text_box(render_container *container, ui::text_layout
// message with a box around it
//-------------------------------------------------
-void mame_ui_manager::draw_message_window(render_container *container, const char *text)
+void mame_ui_manager::draw_message_window(render_container &container, const char *text)
{
draw_text_box(container, text, ui::text_layout::text_justify::LEFT, 0.5f, 0.5f, UI_BACKGROUND_COLOR);
}
@@ -714,7 +719,8 @@ bool mame_ui_manager::show_profiler() const
void mame_ui_manager::show_menu()
{
- set_handler<mame_ui_manager&>(UI_CALLBACK_TYPE_MENU, ui::menu::ui_handler, *this);
+ using namespace std::placeholders;
+ set_handler(ui_callback_type::MENU, std::bind(&ui::menu::ui_handler, _1, std::ref(*this)));
}
@@ -735,7 +741,7 @@ void mame_ui_manager::show_mouse(bool status)
bool mame_ui_manager::is_menu_active(void)
{
- return m_handler_callback_type == UI_CALLBACK_TYPE_MENU;
+ return m_handler_callback_type == ui_callback_type::MENU;
}
@@ -1002,7 +1008,7 @@ std::string &mame_ui_manager::game_info_astring(std::string &str)
// messagebox_text string but handles no input
//-------------------------------------------------
-UINT32 mame_ui_manager::handler_messagebox(render_container *container)
+UINT32 mame_ui_manager::handler_messagebox(render_container &container)
{
draw_text_box(container, messagebox_text.c_str(), ui::text_layout::LEFT, 0.5f, 0.5f, messagebox_backcolor);
return 0;
@@ -1015,7 +1021,7 @@ UINT32 mame_ui_manager::handler_messagebox(render_container *container)
// any keypress
//-------------------------------------------------
-UINT32 mame_ui_manager::handler_messagebox_anykey(render_container *container)
+UINT32 mame_ui_manager::handler_messagebox_anykey(render_container &container)
{
UINT32 state = 0;
@@ -1167,7 +1173,7 @@ void mame_ui_manager::paste()
// draw_fps_counter
//-------------------------------------------------
-void mame_ui_manager::draw_fps_counter(render_container *container)
+void mame_ui_manager::draw_fps_counter(render_container &container)
{
draw_text_full(container, machine().video().speed_text().c_str(), 0.0f, 0.0f, 1.0f,
ui::text_layout::RIGHT, ui::text_layout::WORD, OPAQUE_, rgb_t::white, rgb_t::black, nullptr, nullptr);
@@ -1178,7 +1184,7 @@ void mame_ui_manager::draw_fps_counter(render_container *container)
// draw_timecode_counter
//-------------------------------------------------
-void mame_ui_manager::draw_timecode_counter(render_container *container)
+void mame_ui_manager::draw_timecode_counter(render_container &container)
{
std::string tempstring;
draw_text_full(container, machine().video().timecode_text(tempstring).c_str(), 0.0f, 0.0f, 1.0f,
@@ -1190,7 +1196,7 @@ void mame_ui_manager::draw_timecode_counter(render_container *container)
// draw_timecode_total
//-------------------------------------------------
-void mame_ui_manager::draw_timecode_total(render_container *container)
+void mame_ui_manager::draw_timecode_total(render_container &container)
{
std::string tempstring;
draw_text_full(container, machine().video().timecode_total_text(tempstring).c_str(), 0.0f, 0.0f, 1.0f,
@@ -1202,7 +1208,7 @@ void mame_ui_manager::draw_timecode_total(render_container *container)
// draw_profiler
//-------------------------------------------------
-void mame_ui_manager::draw_profiler(render_container *container)
+void mame_ui_manager::draw_profiler(render_container &container)
{
const char *text = g_profiler.text(machine());
draw_text_full(container, text, 0.0f, 0.0f, 1.0f, ui::text_layout::LEFT, ui::text_layout::WORD, OPAQUE_, rgb_t::white, rgb_t::black, nullptr, nullptr);
@@ -1217,7 +1223,8 @@ void mame_ui_manager::start_save_state()
{
machine().pause();
m_load_save_hold = true;
- set_handler(UI_CALLBACK_TYPE_GENERAL, &mame_ui_manager::handler_load_save, (UINT32)LOADSAVE_SAVE);
+ using namespace std::placeholders;
+ set_handler(ui_callback_type::GENERAL, std::bind(&mame_ui_manager::handler_load_save, this, _1, UINT32(LOADSAVE_SAVE)));
}
@@ -1229,7 +1236,8 @@ void mame_ui_manager::start_load_state()
{
machine().pause();
m_load_save_hold = true;
- set_handler(UI_CALLBACK_TYPE_GENERAL, &mame_ui_manager::handler_load_save, (UINT32)LOADSAVE_LOAD);
+ using namespace std::placeholders;
+ set_handler(ui_callback_type::GENERAL, std::bind(&mame_ui_manager::handler_load_save, this, _1, UINT32(LOADSAVE_LOAD)));
}
@@ -1243,7 +1251,7 @@ void mame_ui_manager::image_handler_ingame()
// run display routine for devices
if (machine().phase() == MACHINE_PHASE_RUNNING)
{
- auto layout = create_layout(&machine().render().ui_container());
+ auto layout = create_layout(machine().render().ui_container());
// loop through all devices, build their text into the layout
for (device_image_interface &image : image_interface_iterator(machine().root_device()))
@@ -1261,7 +1269,7 @@ void mame_ui_manager::image_handler_ingame()
{
float x = 0.2f;
float y = 0.5f * get_line_height() + 2.0f * UI_BOX_TB_BORDER;
- draw_text_box(&machine().render().ui_container(), layout, x, y, UI_BACKGROUND_COLOR);
+ draw_text_box(machine().render().ui_container(), layout, x, y, UI_BACKGROUND_COLOR);
}
}
}
@@ -1271,7 +1279,7 @@ void mame_ui_manager::image_handler_ingame()
// of the standard keypresses
//-------------------------------------------------
-UINT32 mame_ui_manager::handler_ingame(render_container *container)
+UINT32 mame_ui_manager::handler_ingame(render_container &container)
{
bool is_paused = machine().paused();
@@ -1370,7 +1378,8 @@ UINT32 mame_ui_manager::handler_ingame(render_container *container)
// if the on-screen display isn't up and the user has toggled it, turn it on
if ((machine().debug_flags & DEBUG_FLAG_ENABLED) == 0 && machine().ui_input().pressed(IPT_UI_ON_SCREEN_DISPLAY))
{
- set_handler<mame_ui_manager&>(UI_CALLBACK_TYPE_MENU, ui::menu_sliders::ui_handler, *this);
+ using namespace std::placeholders;
+ set_handler(ui_callback_type::MENU, std::bind(&ui::menu_sliders::ui_handler, _1, std::ref(*this)));
return 1;
}
@@ -1385,7 +1394,8 @@ UINT32 mame_ui_manager::handler_ingame(render_container *container)
{
if (!is_paused)
machine().pause();
- set_handler<mame_ui_manager&, bool>(UI_CALLBACK_TYPE_GENERAL, ui_gfx_ui_handler, *this, is_paused);
+ using namespace std::placeholders;
+ set_handler(ui_callback_type::GENERAL, std::bind(&ui_gfx_ui_handler, _1, std::ref(*this), is_paused));
return is_paused ? 1 : 0;
}
@@ -1497,7 +1507,7 @@ UINT32 mame_ui_manager::handler_ingame(render_container *container)
// specifying a game to save or load
//-------------------------------------------------
-UINT32 mame_ui_manager::handler_load_save(render_container *container, UINT32 state)
+UINT32 mame_ui_manager::handler_load_save(render_container &container, UINT32 state)
{
char filename[20];
char file = 0;
@@ -1603,10 +1613,11 @@ UINT32 mame_ui_manager::handler_load_save(render_container *container, UINT32 st
void mame_ui_manager::request_quit()
{
+ using namespace std::placeholders;
if (!machine().options().confirm_quit())
machine().schedule_exit();
else
- set_handler(UI_CALLBACK_TYPE_GENERAL, &mame_ui_manager::handler_confirm_quit);
+ set_handler(ui_callback_type::GENERAL, std::bind(&mame_ui_manager::handler_confirm_quit, this, _1));
}
@@ -1615,7 +1626,7 @@ void mame_ui_manager::request_quit()
// confirming quit emulation
//-------------------------------------------------
-UINT32 mame_ui_manager::handler_confirm_quit(render_container *container)
+UINT32 mame_ui_manager::handler_confirm_quit(render_container &container)
{
UINT32 state = 0;
@@ -2374,11 +2385,11 @@ void mame_ui_manager::set_use_natural_keyboard(bool use_natural_keyboard)
// wrap_text
//-------------------------------------------------
-ui::text_layout mame_ui_manager::create_layout(render_container *container, float width, ui::text_layout::text_justify justify, ui::text_layout::word_wrapping wrap)
+ui::text_layout mame_ui_manager::create_layout(render_container &container, float width, ui::text_layout::text_justify justify, ui::text_layout::word_wrapping wrap)
{
// determine scale factors
float yscale = get_line_height();
- float xscale = yscale * machine().render().ui_aspect(container);
+ float xscale = yscale * machine().render().ui_aspect(&container);
// create the layout
return ui::text_layout(*get_font(), xscale, yscale, width, justify, wrap);
@@ -2389,17 +2400,17 @@ ui::text_layout mame_ui_manager::create_layout(render_container *container, floa
// wrap_text
//-------------------------------------------------
-int mame_ui_manager::wrap_text(render_container *container, const char *origs, float x, float y, float origwrapwidth, std::vector<int> &xstart, std::vector<int> &xend, float text_size)
+int mame_ui_manager::wrap_text(render_container &container, const char *origs, float x, float y, float origwrapwidth, std::vector<int> &xstart, std::vector<int> &xend, float text_size)
{
// create the layout
auto layout = create_layout(container, origwrapwidth, ui::text_layout::LEFT, ui::text_layout::WORD);
// add the text
layout.add_text(
- origs,
- rgb_t::black,
- rgb_t::black,
- text_size);
+ origs,
+ rgb_t::black,
+ rgb_t::black,
+ text_size);
// and get the wrapping info
return layout.get_wrap_info(xstart, xend);
@@ -2411,13 +2422,13 @@ int mame_ui_manager::wrap_text(render_container *container, const char *origs, f
// textured background and line color
//-------------------------------------------------
-void mame_ui_manager::draw_textured_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor, rgb_t linecolor, render_texture *texture, UINT32 flags)
+void mame_ui_manager::draw_textured_box(render_container &container, float x0, float y0, float x1, float y1, rgb_t backcolor, rgb_t linecolor, render_texture *texture, UINT32 flags)
{
- container->add_quad(x0, y0, x1, y1, backcolor, texture, flags);
- container->add_line(x0, y0, x1, y0, UI_LINE_WIDTH, linecolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
- container->add_line(x1, y0, x1, y1, UI_LINE_WIDTH, linecolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
- container->add_line(x1, y1, x0, y1, UI_LINE_WIDTH, linecolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
- container->add_line(x0, y1, x0, y0, UI_LINE_WIDTH, linecolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container.add_quad(x0, y0, x1, y1, backcolor, texture, flags);
+ container.add_line(x0, y0, x1, y0, UI_LINE_WIDTH, linecolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container.add_line(x1, y0, x1, y1, UI_LINE_WIDTH, linecolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container.add_line(x1, y1, x0, y1, UI_LINE_WIDTH, linecolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container.add_line(x0, y1, x0, y0, UI_LINE_WIDTH, linecolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
}
//-------------------------------------------------
diff --git a/src/frontend/mame/ui/ui.h b/src/frontend/mame/ui/ui.h
index 77c33c4119b..0c45dd08405 100644
--- a/src/frontend/mame/ui/ui.h
+++ b/src/frontend/mame/ui/ui.h
@@ -8,12 +8,10 @@
***************************************************************************/
-#pragma once
-
-#ifndef __USRINTRF_H__
-#define __USRINTRF_H__
+#ifndef MAME_FRONTEND_UI_UI_H
+#define MAME_FRONTEND_UI_UI_H
-#include <vector>
+#pragma once
#include "render.h"
#include "moptions.h"
@@ -23,6 +21,9 @@
#include "ui/slider.h"
#include "ui/text.h"
+#include <functional>
+#include <vector>
+
namespace ui {
class menu_item;
@@ -128,13 +129,13 @@ enum
***************************************************************************/
class mame_ui_manager;
-typedef UINT32 (*ui_callback)(mame_ui_manager &, render_container *, UINT32);
+typedef UINT32 (*ui_callback)(mame_ui_manager &, render_container &, UINT32);
-enum ui_callback_type
+enum class ui_callback_type
{
- UI_CALLBACK_TYPE_GENERAL,
- UI_CALLBACK_TYPE_MODAL,
- UI_CALLBACK_TYPE_MENU
+ GENERAL,
+ MODAL,
+ MENU
};
// ======================> mame_ui_manager
@@ -166,48 +167,22 @@ public:
void initialize(running_machine &machine);
std::vector<ui::menu_item> slider_init(running_machine &machine);
- void set_handler(ui_callback_type callback_type, const std::function<UINT32 (render_container *)> callback);
-
- template<typename T, typename... Params>
- void set_handler(ui_callback_type callback_type, T &obj, UINT32(T::*callback)(render_container *, Params...), Params ...args)
- {
- auto lambda = [=, &obj](render_container *container)
- {
- return ((obj).*(callback))(container, args...);
- };
- set_handler(callback_type, lambda);
- }
-
- template<typename... Params>
- void set_handler(ui_callback_type callback_type, UINT32(mame_ui_manager::*callback)(render_container *, Params...), Params ...args)
- {
- set_handler(callback_type, *this, callback, args...);
- }
-
- template<typename... Params>
- void set_handler(ui_callback_type callback_type, UINT32(*callback)(render_container *, Params...), Params ...args)
- {
- auto lambda = [&, callback](render_container *container)
- {
- return callback(container, args...);
- };
- set_handler(callback_type, lambda);
- }
+ void set_handler(ui_callback_type callback_type, const std::function<UINT32 (render_container &)> &&callback);
void display_startup_screens(bool first_time);
virtual void set_startup_text(const char *text, bool force) override;
- void update_and_render(render_container *container);
+ void update_and_render(render_container &container);
render_font *get_font();
float get_line_height();
float get_char_width(unicode_char ch);
float get_string_width(const char *s, float text_size = 1.0f);
- void draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor);
- void draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t fgcolor, rgb_t bgcolor);
- void draw_text(render_container *container, const char *buf, float x, float y);
- void draw_text_full(render_container *container, const char *origs, float x, float y, float origwrapwidth, ui::text_layout::text_justify justify, ui::text_layout::word_wrapping wrap, draw_mode draw, rgb_t fgcolor, rgb_t bgcolor, float *totalwidth = nullptr, float *totalheight = nullptr, float text_size = 1.0f);
- void draw_text_box(render_container *container, const char *text, ui::text_layout::text_justify justify, float xpos, float ypos, rgb_t backcolor);
- void draw_text_box(render_container *container, ui::text_layout &layout, float xpos, float ypos, rgb_t backcolor);
- void draw_message_window(render_container *container, const char *text);
+ void draw_outlined_box(render_container &container, float x0, float y0, float x1, float y1, rgb_t backcolor);
+ void draw_outlined_box(render_container &container, float x0, float y0, float x1, float y1, rgb_t fgcolor, rgb_t bgcolor);
+ void draw_text(render_container &container, const char *buf, float x, float y);
+ void draw_text_full(render_container &container, const char *origs, float x, float y, float origwrapwidth, ui::text_layout::text_justify justify, ui::text_layout::word_wrapping wrap, draw_mode draw, rgb_t fgcolor, rgb_t bgcolor, float *totalwidth = nullptr, float *totalheight = nullptr, float text_size = 1.0f);
+ void draw_text_box(render_container &container, const char *text, ui::text_layout::text_justify justify, float xpos, float ypos, rgb_t backcolor);
+ void draw_text_box(render_container &container, ui::text_layout &layout, float xpos, float ypos, rgb_t backcolor);
+ void draw_message_window(render_container &container, const char *text);
// load/save options to file
void load_ui_options();
@@ -231,10 +206,10 @@ public:
void increase_frameskip();
void decrease_frameskip();
void request_quit();
- void draw_fps_counter(render_container *container);
- void draw_timecode_counter(render_container *container);
- void draw_timecode_total(render_container *container);
- void draw_profiler(render_container *container);
+ void draw_fps_counter(render_container &container);
+ void draw_timecode_counter(render_container &container);
+ void draw_timecode_total(render_container &container);
+ void draw_profiler(render_container &container);
void start_save_state();
void start_load_state();
@@ -246,13 +221,13 @@ public:
// other
void process_natural_keyboard();
- ui::text_layout create_layout(render_container *container, float width = 1.0, ui::text_layout::text_justify justify = ui::text_layout::LEFT, ui::text_layout::word_wrapping wrap = ui::text_layout::WORD);
+ ui::text_layout create_layout(render_container &container, float width = 1.0, ui::text_layout::text_justify justify = ui::text_layout::LEFT, ui::text_layout::word_wrapping wrap = ui::text_layout::WORD);
// word wrap
- int wrap_text(render_container *container, const char *origs, float x, float y, float origwrapwidth, std::vector<int> &xstart, std::vector<int> &xend, float text_size = 1.0f);
+ int wrap_text(render_container &container, const char *origs, float x, float y, float origwrapwidth, std::vector<int> &xstart, std::vector<int> &xend, float text_size = 1.0f);
// draw an outlined box with given line color and filled with a texture
- void draw_textured_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor, rgb_t linecolor, render_texture *texture = nullptr, UINT32 flags = PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ void draw_textured_box(render_container &container, float x0, float y0, float x1, float y1, rgb_t backcolor, rgb_t linecolor, render_texture *texture = nullptr, UINT32 flags = PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
virtual void popup_time_string(int seconds, std::string message) override;
virtual void menu_reset() override;
@@ -260,7 +235,7 @@ public:
private:
// instance variables
render_font * m_font;
- std::function<UINT32 (render_container *)> m_handler_callback;
+ std::function<UINT32 (render_container &)> m_handler_callback;
ui_callback_type m_handler_callback_type;
UINT32 m_handler_param;
bool m_single_step;
@@ -286,11 +261,11 @@ private:
std::string &warnings_string(std::string &buffer);
// UI handlers
- UINT32 handler_messagebox(render_container *container);
- UINT32 handler_messagebox_anykey(render_container *container);
- UINT32 handler_ingame(render_container *container);
- UINT32 handler_load_save(render_container *container, UINT32 state);
- UINT32 handler_confirm_quit(render_container *container);
+ UINT32 handler_messagebox(render_container &container);
+ UINT32 handler_messagebox_anykey(render_container &container);
+ UINT32 handler_ingame(render_container &container);
+ UINT32 handler_load_save(render_container &container, UINT32 state);
+ UINT32 handler_confirm_quit(render_container &container);
// private methods
void exit();
@@ -340,4 +315,4 @@ inline void mame_ui_manager::popup_time(int seconds, Format &&fmt, Params &&...
popup_time_string(seconds, string_format(std::forward<Format>(fmt), std::forward<Params>(args)...));
}
-#endif /* __USRINTRF_H__ */
+#endif /* MAME_FRONTEND_UI_UI_H */
diff --git a/src/frontend/mame/ui/utils.h b/src/frontend/mame/ui/utils.h
index 8d3d2d0c085..d2cd12c1beb 100644
--- a/src/frontend/mame/ui/utils.h
+++ b/src/frontend/mame/ui/utils.h
@@ -17,7 +17,7 @@
#define MAX_CUST_FILTER 8
// GLOBAL ENUMERATORS
-enum
+enum : UINT16
{
FILTER_FIRST = 0,
FILTER_ALL = FILTER_FIRST,
@@ -96,7 +96,7 @@ enum
UI_LAST_LOAD = UI_STORY_LOAD
};
-enum
+enum : UINT16
{
UI_SW_FIRST = 0,
UI_SW_ALL = UI_SW_FIRST,
diff --git a/src/frontend/mame/ui/videoopt.cpp b/src/frontend/mame/ui/videoopt.cpp
index cf558b46467..23ce49fa280 100644
--- a/src/frontend/mame/ui/videoopt.cpp
+++ b/src/frontend/mame/ui/videoopt.cpp
@@ -25,7 +25,7 @@ void menu_video_targets::handle()
/* process the menu */
const event *menu_event = process(0);
if (menu_event != nullptr && menu_event->iptkey == IPT_UI_SELECT)
- menu::stack_push<menu_video_options>(ui(), container, static_cast<render_target *>(menu_event->itemref));
+ menu::stack_push<menu_video_options>(ui(), container(), static_cast<render_target *>(menu_event->itemref));
}
@@ -34,7 +34,7 @@ void menu_video_targets::handle()
video targets menu
-------------------------------------------------*/
-menu_video_targets::menu_video_targets(mame_ui_manager &mui, render_container *container) : menu(mui, container)
+menu_video_targets::menu_video_targets(mame_ui_manager &mui, render_container &container) : menu(mui, container)
{
}
@@ -86,9 +86,9 @@ void menu_video_options::handle()
if (target->is_ui_target())
{
render_container::user_settings settings;
- container->get_user_settings(settings);
+ container().get_user_settings(settings);
settings.m_orientation = orientation_add(delta ^ ROT180, settings.m_orientation);
- container->set_user_settings(settings);
+ container().set_user_settings(settings);
}
changed = true;
}
@@ -165,7 +165,7 @@ void menu_video_options::handle()
video options menu
-------------------------------------------------*/
-menu_video_options::menu_video_options(mame_ui_manager &mui, render_container *container, render_target *_target) : menu(mui, container)
+menu_video_options::menu_video_options(mame_ui_manager &mui, render_container &container, render_target *_target) : menu(mui, container)
{
target = _target;
}
diff --git a/src/frontend/mame/ui/videoopt.h b/src/frontend/mame/ui/videoopt.h
index 37148054c8d..3a66f502ca2 100644
--- a/src/frontend/mame/ui/videoopt.h
+++ b/src/frontend/mame/ui/videoopt.h
@@ -19,8 +19,10 @@ namespace ui {
class menu_video_targets : public menu
{
public:
- menu_video_targets(mame_ui_manager &mui, render_container *container);
+ menu_video_targets(mame_ui_manager &mui, render_container &container);
virtual ~menu_video_targets() override;
+
+private:
virtual void populate() override;
virtual void handle() override;
};
@@ -28,10 +30,8 @@ public:
class menu_video_options : public menu
{
public:
- menu_video_options(mame_ui_manager &mui, render_container *container, render_target *target);
+ menu_video_options(mame_ui_manager &mui, render_container &container, render_target *target);
virtual ~menu_video_options() override;
- virtual void populate() override;
- virtual void handle() override;
private:
enum {
@@ -45,6 +45,9 @@ private:
VIDEO_ITEM_VIEW
};
+ virtual void populate() override;
+ virtual void handle() override;
+
render_target *target;
};
diff --git a/src/frontend/mame/ui/viewgfx.cpp b/src/frontend/mame/ui/viewgfx.cpp
index 3d251becbe1..2a4e0ebad38 100644
--- a/src/frontend/mame/ui/viewgfx.cpp
+++ b/src/frontend/mame/ui/viewgfx.cpp
@@ -111,18 +111,18 @@ static void ui_gfx_exit(running_machine &machine);
// palette handling
static void palette_set_device(running_machine &machine, ui_gfx_state &state);
static void palette_handle_keys(running_machine &machine, ui_gfx_state &state);
-static void palette_handler(mame_ui_manager &mui, render_container *container, ui_gfx_state &state);
+static void palette_handler(mame_ui_manager &mui, render_container &container, ui_gfx_state &state);
// graphics set handling
static void gfxset_handle_keys(running_machine &machine, ui_gfx_state &state, int xcells, int ycells);
static void gfxset_draw_item(running_machine &machine, gfx_element &gfx, int index, bitmap_rgb32 &bitmap, int dstx, int dsty, int color, int rotate);
static void gfxset_update_bitmap(running_machine &machine, ui_gfx_state &state, int xcells, int ycells, gfx_element &gfx);
-static void gfxset_handler(mame_ui_manager &mui, render_container *container, ui_gfx_state &state);
+static void gfxset_handler(mame_ui_manager &mui, render_container &container, ui_gfx_state &state);
// tilemap handling
static void tilemap_handle_keys(running_machine &machine, ui_gfx_state &state, int viswidth, int visheight);
static void tilemap_update_bitmap(running_machine &machine, ui_gfx_state &state, int width, int height);
-static void tilemap_handler(mame_ui_manager &mui, render_container *container, ui_gfx_state &state);
+static void tilemap_handler(mame_ui_manager &mui, render_container &container, ui_gfx_state &state);
@@ -240,7 +240,7 @@ bool ui_gfx_is_relevant(running_machine &machine)
// ui_gfx_ui_handler - primary UI handler
//-------------------------------------------------
-UINT32 ui_gfx_ui_handler(render_container *container, mame_ui_manager &mui, bool uistate)
+UINT32 ui_gfx_ui_handler(render_container &container, mame_ui_manager &mui, bool uistate)
{
ui_gfx_state &state = ui_gfx;
@@ -340,7 +340,7 @@ static void palette_set_device(running_machine &machine, ui_gfx_state &state)
// viewer
//-------------------------------------------------
-static void palette_handler(mame_ui_manager &mui, render_container *container, ui_gfx_state &state)
+static void palette_handler(mame_ui_manager &mui, render_container &container, ui_gfx_state &state)
{
palette_device *palette = state.palette.device;
@@ -393,7 +393,7 @@ static void palette_handler(mame_ui_manager &mui, render_container *container, u
y0 = boxbounds.y0 + 0.5f * chheight;
for (x = 0; title[x] != 0; x++)
{
- container->add_char(x0, y0, chheight, mui.machine().render().ui_aspect(), rgb_t::white, *ui_font, title[x]);
+ container.add_char(x0, y0, chheight, mui.machine().render().ui_aspect(), rgb_t::white, *ui_font, title[x]);
x0 += ui_font->char_width(chheight, mui.machine().render().ui_aspect(), title[x]);
}
@@ -407,12 +407,12 @@ static void palette_handler(mame_ui_manager &mui, render_container *container, u
{
x0 = boxbounds.x0 + 6.0f * chwidth + (float)x * cellwidth;
y0 = boxbounds.y0 + 2.0f * chheight;
- container->add_char(x0 + 0.5f * (cellwidth - chwidth), y0, chheight, mui.machine().render().ui_aspect(), rgb_t::white, *ui_font, "0123456789ABCDEF"[x & 0xf]);
+ container.add_char(x0 + 0.5f * (cellwidth - chwidth), y0, chheight, mui.machine().render().ui_aspect(), rgb_t::white, *ui_font, "0123456789ABCDEF"[x & 0xf]);
// if we're skipping, draw a point between the character and the box to indicate which
// one it's referring to
if (skip != 0)
- container->add_point(x0 + 0.5f * cellwidth, 0.5f * (y0 + chheight + cellboxbounds.y0), UI_LINE_WIDTH, rgb_t::white, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container.add_point(x0 + 0.5f * cellwidth, 0.5f * (y0 + chheight + cellboxbounds.y0), UI_LINE_WIDTH, rgb_t::white, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
}
// draw the side column headers
@@ -429,14 +429,14 @@ static void palette_handler(mame_ui_manager &mui, render_container *container, u
x0 = boxbounds.x0 + 5.5f * chwidth;
y0 = boxbounds.y0 + 3.5f * chheight + (float)y * cellheight;
if (skip != 0)
- container->add_point(0.5f * (x0 + cellboxbounds.x0), y0 + 0.5f * cellheight, UI_LINE_WIDTH, rgb_t::white, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container.add_point(0.5f * (x0 + cellboxbounds.x0), y0 + 0.5f * cellheight, UI_LINE_WIDTH, rgb_t::white, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
// draw the row header
sprintf(buffer, "%5X", state.palette.offset + y * state.palette.columns);
for (x = 4; x >= 0; x--)
{
x0 -= ui_font->char_width(chheight, mui.machine().render().ui_aspect(), buffer[x]);
- container->add_char(x0, y0 + 0.5f * (cellheight - chheight), chheight, mui.machine().render().ui_aspect(), rgb_t::white, *ui_font, buffer[x]);
+ container.add_char(x0, y0 + 0.5f * (cellheight - chheight), chheight, mui.machine().render().ui_aspect(), rgb_t::white, *ui_font, buffer[x]);
}
}
@@ -448,7 +448,7 @@ static void palette_handler(mame_ui_manager &mui, render_container *container, u
if (index < total)
{
pen_t pen = state.palette.which ? palette->indirect_color(index) : raw_color[index];
- container->add_rect(cellboxbounds.x0 + x * cellwidth, cellboxbounds.y0 + y * cellheight,
+ container.add_rect(cellboxbounds.x0 + x * cellwidth, cellboxbounds.y0 + y * cellheight,
cellboxbounds.x0 + (x + 1) * cellwidth, cellboxbounds.y0 + (y + 1) * cellheight,
0xff000000 | pen, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
}
@@ -547,7 +547,7 @@ static void palette_handle_keys(running_machine &machine, ui_gfx_state &state)
// viewer
//-------------------------------------------------
-static void gfxset_handler(mame_ui_manager &mui, render_container *container, ui_gfx_state &state)
+static void gfxset_handler(mame_ui_manager &mui, render_container &container, ui_gfx_state &state)
{
render_font *ui_font = mui.get_font();
int dev = state.gfxset.devindex;
@@ -656,7 +656,7 @@ static void gfxset_handler(mame_ui_manager &mui, render_container *container, ui
y0 = boxbounds.y0 + 0.5f * chheight;
for (x = 0; title[x] != 0; x++)
{
- container->add_char(x0, y0, chheight, mui.machine().render().ui_aspect(), rgb_t::white, *ui_font, title[x]);
+ container.add_char(x0, y0, chheight, mui.machine().render().ui_aspect(), rgb_t::white, *ui_font, title[x]);
x0 += ui_font->char_width(chheight, mui.machine().render().ui_aspect(), title[x]);
}
@@ -666,12 +666,12 @@ static void gfxset_handler(mame_ui_manager &mui, render_container *container, ui
{
x0 = boxbounds.x0 + 6.0f * chwidth + (float)x * cellwidth;
y0 = boxbounds.y0 + 2.0f * chheight;
- container->add_char(x0 + 0.5f * (cellwidth - chwidth), y0, chheight, mui.machine().render().ui_aspect(), rgb_t::white, *ui_font, "0123456789ABCDEF"[x & 0xf]);
+ container.add_char(x0 + 0.5f * (cellwidth - chwidth), y0, chheight, mui.machine().render().ui_aspect(), rgb_t::white, *ui_font, "0123456789ABCDEF"[x & 0xf]);
// if we're skipping, draw a point between the character and the box to indicate which
// one it's referring to
if (skip != 0)
- container->add_point(x0 + 0.5f * cellwidth, 0.5f * (y0 + chheight + boxbounds.y0 + 3.5f * chheight), UI_LINE_WIDTH, rgb_t::white, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container.add_point(x0 + 0.5f * cellwidth, 0.5f * (y0 + chheight + boxbounds.y0 + 3.5f * chheight), UI_LINE_WIDTH, rgb_t::white, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
}
// draw the side column headers
@@ -688,14 +688,14 @@ static void gfxset_handler(mame_ui_manager &mui, render_container *container, ui
x0 = boxbounds.x0 + 5.5f * chwidth;
y0 = boxbounds.y0 + 3.5f * chheight + (float)y * cellheight;
if (skip != 0)
- container->add_point(0.5f * (x0 + boxbounds.x0 + 6.0f * chwidth), y0 + 0.5f * cellheight, UI_LINE_WIDTH, rgb_t::white, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container.add_point(0.5f * (x0 + boxbounds.x0 + 6.0f * chwidth), y0 + 0.5f * cellheight, UI_LINE_WIDTH, rgb_t::white, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
// draw the row header
sprintf(buffer, "%5X", info.offset[set] + y * xcells);
for (x = 4; x >= 0; x--)
{
x0 -= ui_font->char_width(chheight, mui.machine().render().ui_aspect(), buffer[x]);
- container->add_char(x0, y0 + 0.5f * (cellheight - chheight), chheight, mui.machine().render().ui_aspect(), rgb_t::white, *ui_font, buffer[x]);
+ container.add_char(x0, y0 + 0.5f * (cellheight - chheight), chheight, mui.machine().render().ui_aspect(), rgb_t::white, *ui_font, buffer[x]);
}
}
@@ -703,7 +703,7 @@ static void gfxset_handler(mame_ui_manager &mui, render_container *container, ui
gfxset_update_bitmap(mui.machine(), state, xcells, ycells, gfx);
// add the final quad
- container->add_quad(boxbounds.x0 + 6.0f * chwidth, boxbounds.y0 + 3.5f * chheight,
+ container.add_quad(boxbounds.x0 + 6.0f * chwidth, boxbounds.y0 + 3.5f * chheight,
boxbounds.x0 + 6.0f * chwidth + (float)cellboxwidth / (float)targwidth,
boxbounds.y0 + 3.5f * chheight + (float)cellboxheight / (float)targheight,
rgb_t::white, state.texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
@@ -947,7 +947,7 @@ static void gfxset_draw_item(running_machine &machine, gfx_element &gfx, int ind
// viewer
//-------------------------------------------------
-static void tilemap_handler(mame_ui_manager &mui, render_container *container, ui_gfx_state &state)
+static void tilemap_handler(mame_ui_manager &mui, render_container &container, ui_gfx_state &state)
{
render_font *ui_font = mui.get_font();
float chwidth, chheight;
@@ -1034,7 +1034,7 @@ static void tilemap_handler(mame_ui_manager &mui, render_container *container, u
y0 = boxbounds.y0 + 0.5f * chheight;
for (x = 0; title[x] != 0; x++)
{
- container->add_char(x0, y0, chheight, mui.machine().render().ui_aspect(), rgb_t::white, *ui_font, title[x]);
+ container.add_char(x0, y0, chheight, mui.machine().render().ui_aspect(), rgb_t::white, *ui_font, title[x]);
x0 += ui_font->char_width(chheight, mui.machine().render().ui_aspect(), title[x]);
}
@@ -1042,7 +1042,7 @@ static void tilemap_handler(mame_ui_manager &mui, render_container *container, u
tilemap_update_bitmap(mui.machine(), state, mapboxwidth / pixelscale, mapboxheight / pixelscale);
// add the final quad
- container->add_quad(mapboxbounds.x0, mapboxbounds.y0,
+ container.add_quad(mapboxbounds.x0, mapboxbounds.y0,
mapboxbounds.x1, mapboxbounds.y1,
rgb_t::white, state.texture,
PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(state.tilemap.rotate));
diff --git a/src/frontend/mame/ui/viewgfx.h b/src/frontend/mame/ui/viewgfx.h
index 2e6467833dd..c7fec1d9260 100644
--- a/src/frontend/mame/ui/viewgfx.h
+++ b/src/frontend/mame/ui/viewgfx.h
@@ -26,7 +26,7 @@ void ui_gfx_init(running_machine &machine);
bool ui_gfx_is_relevant(running_machine &machine);
// master handler
-UINT32 ui_gfx_ui_handler(render_container *container, mame_ui_manager &mui, bool uistate);
+UINT32 ui_gfx_ui_handler(render_container &container, mame_ui_manager &mui, bool uistate);
#endif /* __UI_VIEWGFX_H__ */