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