Advertisement
Guest User

Untitled

a guest
May 26th, 2015
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.21 KB | None | 0 0
  1. CARCodeAddEdit::CARCodeAddEdit(int _selection, std::vector<ActionReplay::ARCode>* _arCodes, wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style)
  2.     : wxDialog(parent, id, title, position, size, style)
  3.     , arCodes(_arCodes)
  4.     , selection(_selection)
  5. {
  6.     Bind(wxEVT_BUTTON, &CARCodeAddEdit::SaveCheatData, this, wxID_OK);
  7.  
  8.     ActionReplay::ARCode tempEntries;
  9.     wxString currentName = _("Insert name here...");
  10.  
  11.     if (selection == wxNOT_FOUND)
  12.     {
  13.         tempEntries.name = "";
  14.     }
  15.     else
  16.     {
  17.         currentName = StrToWxStr(arCodes->at(selection).name);
  18.         tempEntries = arCodes->at(selection);
  19.     }
  20.  
  21.     wxBoxSizer* sEditCheat = new wxBoxSizer(wxVERTICAL);
  22.     wxStaticBoxSizer* sbEntry = new wxStaticBoxSizer(wxVERTICAL, this, _("Cheat Code"));
  23.     wxGridBagSizer* sgEntry = new wxGridBagSizer(0, 0);
  24.  
  25.     wxStaticText* EditCheatNameText = new wxStaticText(this, wxID_ANY, _("Name:"));
  26.     EditCheatName = new wxTextCtrl(this, wxID_ANY, wxEmptyString);
  27.     EditCheatName->SetValue(currentName);
  28.     EditCheatName->Bind(wxEVT_LEFT_DOWN, &CARCodeAddEdit::OnInputClicked, this);
  29.  
  30.     EntrySelection = new wxSpinButton(this);
  31.     EntrySelection->SetRange(1, std::max((int)arCodes->size(), 1));
  32.     EntrySelection->SetValue((int)(arCodes->size() - selection));
  33.     EntrySelection->Bind(wxEVT_SPIN, &CARCodeAddEdit::ChangeEntry, this);
  34.  
  35.     EditCheatCode = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(300, 100), wxTE_MULTILINE);
  36.     UpdateTextCtrl(tempEntries);
  37.  
  38.     sgEntry->Add(EditCheatNameText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER | wxALL, 5);
  39.     sgEntry->Add(EditCheatName,     wxGBPosition(0, 1), wxGBSpan(1, 1), wxEXPAND | wxALL, 5);
  40.     sgEntry->Add(EntrySelection,    wxGBPosition(0, 2), wxGBSpan(2, 1), wxEXPAND | wxALL, 5);
  41.     sgEntry->Add(EditCheatCode,     wxGBPosition(1, 0), wxGBSpan(1, 2), wxEXPAND | wxALL, 5);
  42.     sgEntry->AddGrowableCol(1);
  43.     sgEntry->AddGrowableRow(1);
  44.     sbEntry->Add(sgEntry, 1, wxEXPAND | wxALL);
  45.  
  46.     sEditCheat->Add(sbEntry, 1, wxEXPAND | wxALL, 5);
  47.     sEditCheat->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxALL, 5);
  48.  
  49.     SetSizerAndFit(sEditCheat);
  50.     SetFocus();
  51. }
  52.  
  53. void OnInputClicked(wxMouseEvent& WXUNUSED(event))
  54. {
  55.     EditCheatName->Clear();
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement