diff options
Diffstat (limited to 'src/frontend/mame/ui/selector.cpp')
-rw-r--r-- | src/frontend/mame/ui/selector.cpp | 66 |
1 files changed, 13 insertions, 53 deletions
diff --git a/src/frontend/mame/ui/selector.cpp b/src/frontend/mame/ui/selector.cpp index 8d5dd900e13..56b8af13ec0 100644 --- a/src/frontend/mame/ui/selector.cpp +++ b/src/frontend/mame/ui/selector.cpp @@ -149,60 +149,20 @@ void menu_selector::populate(float &customtop, float &custombottom) void menu_selector::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { - float width; - 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, - mame_ui_manager::NONE, rgb_t::white(), rgb_t::black(), &width, nullptr); - width += (2.0f * UI_BOX_LR_BORDER) + 0.01f; - float maxwidth = std::max(width, origx2 - origx1); - - // compute our bounds - float x1 = 0.5f - 0.5f * maxwidth; - float x2 = x1 + maxwidth; - float y1 = origy1 - top; - float y2 = origy1 - UI_BOX_TB_BORDER; - - // draw a box - 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; - - // 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, - mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); - - // bottom text + std::string tempbuf[1] = { std::string(_("Selection List - Search: ")).append(m_search).append("_") }; + draw_text_box( + std::begin(tempbuf), std::end(tempbuf), + origx1, origx2, origy1 - top, origy1 - UI_BOX_TB_BORDER, + ui::text_layout::CENTER, ui::text_layout::TRUNCATE, false, + UI_TEXT_COLOR, UI_GREEN_COLOR, 1.0f); + // get the text for 'UI Select' - 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, - mame_ui_manager::NONE, rgb_t::white(), rgb_t::black(), &width, nullptr); - width += 2 * UI_BOX_LR_BORDER; - maxwidth = std::max(maxwidth, width); - - // compute our bounds - x1 = 0.5f - 0.5f * maxwidth; - x2 = x1 + maxwidth; - y1 = origy2 + UI_BOX_TB_BORDER; - y2 = origy2 + bottom; - - // draw a box - ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_RED_COLOR); - - // take off the borders - x1 += UI_BOX_LR_BORDER; - x2 -= UI_BOX_LR_BORDER; - 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_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + tempbuf[0] = string_format(_("Double click or press %1$s to select"), machine().input().seq_name(machine().ioport().type_seq(IPT_UI_SELECT, 0, SEQ_TYPE_STANDARD))); + draw_text_box( + std::begin(tempbuf), std::end(tempbuf), + origx1, origx2, origy2 + UI_BOX_TB_BORDER, origy2 + bottom, + ui::text_layout::CENTER, ui::text_layout::TRUNCATE, false, + UI_TEXT_COLOR, UI_RED_COLOR, 1.0f); } //------------------------------------------------- |