2015-04-11 05:24:45 +00:00
|
|
|
// Copyright 2015 Dolphin Emulator Project
|
2015-05-17 23:08:10 +00:00
|
|
|
// Licensed under GPLv2+
|
2015-04-11 05:24:45 +00:00
|
|
|
// 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"
|
|
|
|
|
2015-08-16 05:08:51 +00:00
|
|
|
ChangeGameDialog::ChangeGameDialog(wxWindow* parent, const CGameListCtrl* const game_list)
|
2016-07-13 22:45:38 +00:00
|
|
|
: wxDialog(parent, wxID_ANY, _("Select Game"))
|
2015-04-11 05:24:45 +00:00
|
|
|
{
|
2016-08-02 06:23:02 +00:00
|
|
|
const int space5 = FromDIP(5);
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
m_game_lbox =
|
|
|
|
new wxListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, nullptr, wxLB_SORT);
|
|
|
|
m_game_lbox->Bind(wxEVT_LISTBOX_DCLICK, &ChangeGameDialog::OnPick, this);
|
2015-04-11 05:24:45 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
NetPlayDialog::FillWithGameNames(m_game_lbox, *game_list);
|
2015-04-11 05:24:45 +00:00
|
|
|
|
2016-07-13 22:45:38 +00:00
|
|
|
wxButton* const ok_btn = new wxButton(this, wxID_OK, _("Select"));
|
2016-06-24 08:43:46 +00:00
|
|
|
ok_btn->Bind(wxEVT_BUTTON, &ChangeGameDialog::OnPick, this);
|
2015-04-11 05:24:45 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
wxBoxSizer* const szr = new wxBoxSizer(wxVERTICAL);
|
2016-08-02 06:23:02 +00:00
|
|
|
szr->AddSpacer(space5);
|
|
|
|
szr->Add(m_game_lbox, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
|
|
|
|
szr->AddSpacer(space5);
|
|
|
|
szr->Add(ok_btn, 0, wxALIGN_RIGHT | wxLEFT | wxRIGHT, space5);
|
|
|
|
szr->AddSpacer(space5);
|
2015-04-11 05:24:45 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
SetSizerAndFit(szr);
|
|
|
|
SetFocus();
|
2015-04-11 05:24:45 +00:00
|
|
|
}
|
|
|
|
|
2015-08-16 05:08:51 +00:00
|
|
|
wxString ChangeGameDialog::GetChosenGameName() const
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
return m_game_name;
|
2015-08-16 05:08:51 +00:00
|
|
|
}
|
|
|
|
|
2015-04-11 05:24:45 +00:00
|
|
|
void ChangeGameDialog::OnPick(wxCommandEvent& event)
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
m_game_name = m_game_lbox->GetStringSelection();
|
|
|
|
EndModal(wxID_OK);
|
2015-04-11 05:24:45 +00:00
|
|
|
}
|