mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 03:25:16 +00:00
overlays: add getter for selected entry
This commit is contained in:
parent
6f5f7ece06
commit
048a44cbe5
2 changed files with 14 additions and 4 deletions
|
@ -71,21 +71,30 @@ namespace rsx
|
|||
m_scroll_indicator_bottom->fore_color.a = 0.f;
|
||||
}
|
||||
|
||||
void list_view::update_selection()
|
||||
const overlay_element* list_view::get_selected_entry() const
|
||||
{
|
||||
if (m_selected_entry < 0)
|
||||
{
|
||||
return; // Ideally unreachable but it should still be possible to recover by user interaction.
|
||||
return nullptr; // Ideally unreachable but it should still be possible to recover by user interaction.
|
||||
}
|
||||
|
||||
const usz current_index = static_cast<usz>(m_selected_entry) * (m_use_separators ? 2 : 1);
|
||||
|
||||
if (current_index >= m_items.size())
|
||||
{
|
||||
return; // Ideally unreachable but it should still be possible to recover by user interaction.
|
||||
return nullptr; // Ideally unreachable but it should still be possible to recover by user interaction.
|
||||
}
|
||||
|
||||
const auto current_element = m_items[current_index].get();
|
||||
return m_items[current_index].get();
|
||||
}
|
||||
|
||||
void list_view::update_selection()
|
||||
{
|
||||
const overlay_element* current_element = get_selected_entry();
|
||||
if (!current_element)
|
||||
{
|
||||
return; // Ideally unreachable but it should still be possible to recover by user interaction.
|
||||
}
|
||||
|
||||
// Calculate bounds
|
||||
const auto min_y = current_element->y - y;
|
||||
|
|
|
@ -36,6 +36,7 @@ namespace rsx
|
|||
|
||||
int get_selected_index() const;
|
||||
bool get_cancel_only() const;
|
||||
const overlay_element* get_selected_entry() const;
|
||||
|
||||
void set_cancel_only(bool cancel_only);
|
||||
void translate(s16 _x, s16 _y) override;
|
||||
|
|
Loading…
Add table
Reference in a new issue