diff options
author | Vas Crabb <vas@vastheman.com> | 2016-07-09 01:06:33 +1000 |
---|---|---|
committer | Vas Crabb <vas@vastheman.com> | 2016-07-09 01:07:10 +1000 |
commit | 7738284b0e6a3b4e5ee066fb5b93f0c7ef77db25 (patch) | |
tree | 2aaca94890afa65ef803db8c7f71e5a185ba1646 /src/frontend/mame/ui/menu.h | |
parent | 45de5e113eefa03e583d97ec2095a48d2a791f62 (diff) |
another baby step untangling the menu code
Diffstat (limited to 'src/frontend/mame/ui/menu.h')
-rw-r--r-- | src/frontend/mame/ui/menu.h | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/src/frontend/mame/ui/menu.h b/src/frontend/mame/ui/menu.h index 38e2367102e..7317150ba9e 100644 --- a/src/frontend/mame/ui/menu.h +++ b/src/frontend/mame/ui/menu.h @@ -53,9 +53,6 @@ public: running_machine &machine() const { return m_ui.machine(); } render_container *container; // render_container we render to - int resetpos; // reset position - void *resetref; // reset reference - int selected; // which item is selected int hover; // which item is being hovered over int visitems; // number of visible items float customtop; // amount of extra height to add at the top @@ -74,12 +71,6 @@ public: // allocate temporary memory from the menu's memory pool void *m_pool_alloc(size_t size); - // retrieves the index of the currently selected menu item - void *get_selection(); - - // changes the index of the currently selected menu item - void set_selection(void *selected_itemref); - // request the specific handling of the game selection main menu bool is_special_main_menu() const; @@ -253,6 +244,7 @@ protected: int l_hover; int totallines; int skip_main_items; + int selected; // which item is selected menu(mame_ui_manager &mui, render_container *container); @@ -268,6 +260,15 @@ protected: focused_menu get_focus() const { return m_focus; } void set_focus(focused_menu focus) { m_focus = focus; } + // retrieves the ref of the currently selected menu item or nullptr + void *get_selection_ref() const { return selection_valid() ? item[selected].ref : nullptr; } + bool selection_valid() const { return (0 <= selected) && (item.size() > selected); } + bool is_first_selected() const { return 0 == selected; } + bool is_last_selected() const { return (item.size() - 1) == selected; } + + // changes the index of the currently selected menu item + void set_selection(void *selected_itemref); + // draw right box float draw_right_box_title(float x1, float y1, float x2, float y2); @@ -348,13 +349,16 @@ private: void extra_text_draw_box(float origx1, float origx2, float origy, float yspan, const char *text, int direction); bool m_special_main_menu; - mame_ui_manager &m_ui; // UI we are attached to - std::unique_ptr<menu> m_parent; // pointer to parent menu - bool m_pressed; // mouse button held down + mame_ui_manager &m_ui; // UI we are attached to + std::unique_ptr<menu> m_parent; // pointer to parent menu + bool m_pressed; // mouse button held down osd_ticks_t m_repeat; - event m_event; // the UI event that occurred - pool *m_pool; // list of memory pools + event m_event; // the UI event that occurred + pool *m_pool; // list of memory pools focused_menu m_focus; + int m_resetpos; // reset position + void *m_resetref; // reset reference + static std::vector<const game_driver *> m_old_icons; static std::unique_ptr<menu> menu_stack; |