Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CARCodeAddEdit::CARCodeAddEdit(int _selection, std::vector<ActionReplay::ARCode>* _arCodes, wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style)
- : wxDialog(parent, id, title, position, size, style)
- , arCodes(_arCodes)
- , selection(_selection)
- {
- Bind(wxEVT_BUTTON, &CARCodeAddEdit::SaveCheatData, this, wxID_OK);
- ActionReplay::ARCode tempEntries;
- wxString currentName = _("Insert name here...");
- if (selection == wxNOT_FOUND)
- {
- tempEntries.name = "";
- }
- else
- {
- currentName = StrToWxStr(arCodes->at(selection).name);
- tempEntries = arCodes->at(selection);
- }
- wxBoxSizer* sEditCheat = new wxBoxSizer(wxVERTICAL);
- wxStaticBoxSizer* sbEntry = new wxStaticBoxSizer(wxVERTICAL, this, _("Cheat Code"));
- wxGridBagSizer* sgEntry = new wxGridBagSizer(0, 0);
- wxStaticText* EditCheatNameText = new wxStaticText(this, wxID_ANY, _("Name:"));
- EditCheatName = new wxTextCtrl(this, wxID_ANY, wxEmptyString);
- EditCheatName->SetValue(currentName);
- EditCheatName->Bind(wxEVT_LEFT_DOWN, &CARCodeAddEdit::OnInputClicked, this);
- EntrySelection = new wxSpinButton(this);
- EntrySelection->SetRange(1, std::max((int)arCodes->size(), 1));
- EntrySelection->SetValue((int)(arCodes->size() - selection));
- EntrySelection->Bind(wxEVT_SPIN, &CARCodeAddEdit::ChangeEntry, this);
- EditCheatCode = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(300, 100), wxTE_MULTILINE);
- UpdateTextCtrl(tempEntries);
- sgEntry->Add(EditCheatNameText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER | wxALL, 5);
- sgEntry->Add(EditCheatName, wxGBPosition(0, 1), wxGBSpan(1, 1), wxEXPAND | wxALL, 5);
- sgEntry->Add(EntrySelection, wxGBPosition(0, 2), wxGBSpan(2, 1), wxEXPAND | wxALL, 5);
- sgEntry->Add(EditCheatCode, wxGBPosition(1, 0), wxGBSpan(1, 2), wxEXPAND | wxALL, 5);
- sgEntry->AddGrowableCol(1);
- sgEntry->AddGrowableRow(1);
- sbEntry->Add(sgEntry, 1, wxEXPAND | wxALL);
- sEditCheat->Add(sbEntry, 1, wxEXPAND | wxALL, 5);
- sEditCheat->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxALL, 5);
- SetSizerAndFit(sEditCheat);
- SetFocus();
- }
- void OnInputClicked(wxMouseEvent& WXUNUSED(event))
- {
- EditCheatName->Clear();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement