mirror of https://github.com/RPCS3/rpcs3.git
38 lines
1.0 KiB
C++
38 lines
1.0 KiB
C++
#include "stdafx.h"
|
|
#include "stdafx_gui.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;
|
|
} |