summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/FrameAui.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2016-10-21 21:44:56 +0200
committerGitHub <noreply@github.com>2016-10-21 21:44:56 +0200
commita2644cd102efd99db97b4055a9a1e86ad8dd8bd0 (patch)
tree49f961c714919b0909ca6d4c7346301ab0418c52 /Source/Core/DolphinWX/FrameAui.cpp
parentd62a0368666d35a0660a0dfdf0d0fa75e0ff96d5 (diff)
parent42e1dafd6dc312d85bad2605fb494af0b7895892 (diff)
Merge pull request #4363 from lioncash/wx-menu
DolphinWX: Move main menu creation into a wxMenuBar subclass
Diffstat (limited to 'Source/Core/DolphinWX/FrameAui.cpp')
-rw-r--r--Source/Core/DolphinWX/FrameAui.cpp32
1 files changed, 9 insertions, 23 deletions
diff --git a/Source/Core/DolphinWX/FrameAui.cpp b/Source/Core/DolphinWX/FrameAui.cpp
index 4bc4e50206..de3a4cba01 100644
--- a/Source/Core/DolphinWX/FrameAui.cpp
+++ b/Source/Core/DolphinWX/FrameAui.cpp
@@ -2,6 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
+#include <algorithm>
#include <cstddef>
#include <string>
#include <vector>
@@ -36,6 +37,7 @@
#include "DolphinWX/Globals.h"
#include "DolphinWX/LogConfigWindow.h"
#include "DolphinWX/LogWindow.h"
+#include "DolphinWX/MainMenuBar.h"
#include "DolphinWX/WxUtils.h"
#include "DolphinWX/Debugger/DebuggerUIUtil.h"
@@ -484,32 +486,16 @@ void CFrame::DoAddPage(wxWindow* Win, int i, bool Float)
void CFrame::PopulateSavedPerspectives()
{
- // If the perspective submenu hasn't been created yet, return
- if (!m_SavedPerspectives)
- return;
+ std::vector<std::string> perspective_names(Perspectives.size());
- // Delete all saved perspective menu items
- while (m_SavedPerspectives->GetMenuItemCount() != 0)
- {
- // Delete the first menu item in the list (while there are menu items)
- m_SavedPerspectives->Delete(m_SavedPerspectives->FindItemByPosition(0));
- }
-
- if (Perspectives.size() > 0)
- {
- for (u32 i = 0; i < Perspectives.size(); i++)
- {
- wxMenuItem* mItem = new wxMenuItem(m_SavedPerspectives, IDM_PERSPECTIVES_0 + i,
- StrToWxStr(Perspectives[i].Name), "", wxITEM_CHECK);
+ std::transform(Perspectives.begin(), Perspectives.end(), perspective_names.begin(),
+ [](const auto& perspective) { return perspective.Name; });
- m_SavedPerspectives->Append(mItem);
+ MainMenuBar::PopulatePerspectivesEvent event{GetId(), EVT_POPULATE_PERSPECTIVES_MENU,
+ std::move(perspective_names),
+ static_cast<int>(ActivePerspective)};
- if (i == ActivePerspective)
- {
- mItem->Check(true);
- }
- }
- }
+ wxPostEvent(GetMenuBar(), event);
}
void CFrame::OnPerspectiveMenu(wxCommandEvent& event)