rpcsx/rpcs3/Gui/TextInputDialog.cpp
Lioncash b877879db6 Clean up UI code.
- Use Bind instead of connect. It's recommended for anyone using wx 2.9+
- Remove AppConnector. All this did was destroy objects used in the UI. However, wxWidgets handles this. So it's redundant.
- Misc other unimportant changes.
2014-04-27 19:53:13 -04:00

37 lines
1,018 B
C++

#include "stdafx.h"
#include "TextInputDialog.h"
TextInputDialog::TextInputDialog(wxWindow* parent, const std::string& defvalue, const std::string& label)
: wxDialog(parent, wxID_ANY, label)
{
m_tctrl_text = new wxTextCtrl(this, wxID_ANY, fmt::ToUTF8(defvalue));
wxBoxSizer* s_text = new wxBoxSizer(wxVERTICAL);
s_text->Add(m_tctrl_text, 1, wxEXPAND);
wxBoxSizer* s_btns = new wxBoxSizer(wxHORIZONTAL);
s_btns->Add(new wxButton(this, wxID_OK));
s_btns->AddSpacer(30);
s_btns->Add(new wxButton(this, wxID_CANCEL));
wxBoxSizer* s_main = new wxBoxSizer(wxVERTICAL);
s_main->Add(s_text, 1, wxEXPAND | wxUP | wxLEFT | wxRIGHT, 5);
s_main->AddSpacer(30);
s_main->Add(s_btns, 0, wxCENTER | wxDOWN | wxLEFT | wxRIGHT, 5);
SetSizerAndFit(s_main);
SetSize(250, -1);
Bind(wxEVT_BUTTON, &TextInputDialog::OnOk, this);
}
void TextInputDialog::OnOk(wxCommandEvent& event)
{
m_result = fmt::ToUTF8(m_tctrl_text->GetValue());
EndModal(wxID_OK);
}
std::string TextInputDialog::GetResult()
{
return m_result;
}