diff --git a/rpcs3/Gui/GameViewer.cpp b/rpcs3/Gui/GameViewer.cpp index 69ca5674ed..705696ab8b 100644 --- a/rpcs3/Gui/GameViewer.cpp +++ b/rpcs3/Gui/GameViewer.cpp @@ -43,6 +43,7 @@ GameViewer::GameViewer(wxWindow* parent) : wxListView(parent) m_sortColumn = 1; m_sortAscending = true; m_popup = new wxMenu(); + InitPopupMenu(); Bind(wxEVT_LIST_ITEM_ACTIVATED, &GameViewer::DClick, this); Bind(wxEVT_LIST_COL_CLICK, &GameViewer::OnColClick, this); @@ -56,6 +57,24 @@ GameViewer::~GameViewer() SaveSettings(); } +void GameViewer::InitPopupMenu() +{ + wxMenuItem* boot_item = new wxMenuItem(m_popup, 0, _T("Boot")); +#if defined (_WIN32) + // wxMenuItem::Set(Get)Font only available for the wxMSW port + wxFont font = GetFont(); + font.SetWeight(wxFONTWEIGHT_BOLD); + boot_item->SetFont(font); +#endif + m_popup->Append(boot_item); + m_popup->Append(1, _T("Configure")); + m_popup->Append(2, _T("Remove Game")); + + Bind(wxEVT_MENU, &GameViewer::BootGame, this, 0); + Bind(wxEVT_MENU, &GameViewer::ConfigureGame, this, 1); + Bind(wxEVT_MENU, &GameViewer::RemoveGame, this, 2); +} + void GameViewer::DoResize(wxSize size) { SetSize(size); @@ -198,25 +217,6 @@ void GameViewer::DClick(wxListEvent& event) void GameViewer::RightClick(wxListEvent& event) { - for (wxMenuItem *item : m_popup->GetMenuItems()) { - m_popup->Destroy(item); - } - - wxMenuItem* boot_item = new wxMenuItem(m_popup, 0, _T("Boot")); -#if defined (_WIN32) - // wxMenuItem::Set(Get)Font only available for the wxMSW port - wxFont font = GetFont(); - font.SetWeight(wxFONTWEIGHT_BOLD); - boot_item->SetFont(font); -#endif - m_popup->Append(boot_item); - m_popup->Append(1, _T("Configure")); - m_popup->Append(2, _T("Remove Game")); - - Bind(wxEVT_MENU, &GameViewer::BootGame, this, 0); - Bind(wxEVT_MENU, &GameViewer::ConfigureGame, this, 1); - Bind(wxEVT_MENU, &GameViewer::RemoveGame, this, 2); - PopupMenu(m_popup, event.GetPoint()); } diff --git a/rpcs3/Gui/GameViewer.h b/rpcs3/Gui/GameViewer.h index b6b9b4df4c..cf0b24edbc 100644 --- a/rpcs3/Gui/GameViewer.h +++ b/rpcs3/Gui/GameViewer.h @@ -72,6 +72,8 @@ public: GameViewer(wxWindow* parent); ~GameViewer(); + void InitPopupMenu(); + void DoResize(wxSize size); void LoadGames();