summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/NetPlay/ChangeGameDialog.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2015-04-11 01:24:45 -0400
committerLioncash <mathew1800@gmail.com>2015-04-11 01:35:54 -0400
commitbd28d260cefe86f8e0cd914f73c94b9043f94e68 (patch)
tree664afa47440e9a16e1f76ff6d30f51023cc55c8f /Source/Core/DolphinWX/NetPlay/ChangeGameDialog.cpp
parent1a18cad178b65c4f339982e3db451763e1425c45 (diff)
DolphinWX: Break the netplay UI controls into separate classes.
Diffstat (limited to 'Source/Core/DolphinWX/NetPlay/ChangeGameDialog.cpp')
-rw-r--r--Source/Core/DolphinWX/NetPlay/ChangeGameDialog.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/Source/Core/DolphinWX/NetPlay/ChangeGameDialog.cpp b/Source/Core/DolphinWX/NetPlay/ChangeGameDialog.cpp
new file mode 100644
index 0000000000..6151cf8b98
--- /dev/null
+++ b/Source/Core/DolphinWX/NetPlay/ChangeGameDialog.cpp
@@ -0,0 +1,37 @@
+// Copyright 2015 Dolphin Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
+
+#include <wx/button.h>
+#include <wx/listbox.h>
+#include <wx/sizer.h>
+
+#include "DolphinWX/NetPlay/ChangeGameDialog.h"
+#include "DolphinWX/NetPlay/NetWindow.h"
+
+ChangeGameDialog::ChangeGameDialog(wxWindow* parent, const CGameListCtrl* const game_list, wxString& game_name)
+ : wxDialog(parent, wxID_ANY, _("Change Game"))
+ , m_game_name(game_name)
+{
+ m_game_lbox = new wxListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, nullptr, wxLB_SORT);
+ m_game_lbox->Bind(wxEVT_LISTBOX_DCLICK, &ChangeGameDialog::OnPick, this);
+
+ NetPlayDialog::FillWithGameNames(m_game_lbox, *game_list);
+
+ wxButton* const ok_btn = new wxButton(this, wxID_OK, _("Change"));
+ ok_btn->Bind(wxEVT_BUTTON, &ChangeGameDialog::OnPick, this);
+
+ wxBoxSizer* const szr = new wxBoxSizer(wxVERTICAL);
+ szr->Add(m_game_lbox, 1, wxLEFT | wxRIGHT | wxTOP | wxEXPAND, 5);
+ szr->Add(ok_btn, 0, wxALL | wxALIGN_RIGHT, 5);
+
+ SetSizerAndFit(szr);
+ SetFocus();
+}
+
+void ChangeGameDialog::OnPick(wxCommandEvent& event)
+{
+ // return the selected game name
+ m_game_name = m_game_lbox->GetStringSelection();
+ EndModal(wxID_OK);
+}