summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/PatchAddEdit.h
blob: 7763bc461980efbc03b3fd9af399c0550998d791 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.

#pragma once

#include <vector>
#include <wx/dialog.h>
#include <wx/event.h>
#include <wx/gdicmn.h>
#include <wx/string.h>
#include <wx/translation.h>
#include <wx/windowid.h>

#include "Core/PatchEngine.h"

class wxButton;
class wxRadioBox;
class wxSpinButton;
class wxSpinEvent;
class wxStaticBoxSizer;
class wxTextCtrl;
class wxWindow;

class CPatchAddEdit : public wxDialog
{
	public:
		CPatchAddEdit(int _selection, wxWindow* parent,
			wxWindowID id = 1,
			const wxString& title = _("Edit Patch"),
			const wxPoint& pos = wxDefaultPosition,
			const wxSize& size = wxDefaultSize,
			long style = wxDEFAULT_DIALOG_STYLE);
		virtual ~CPatchAddEdit();

	private:
		DECLARE_EVENT_TABLE();

		wxTextCtrl *EditPatchName;
		wxTextCtrl *EditPatchOffset;
		wxRadioBox *EditPatchType;
		wxTextCtrl *EditPatchValue;
		wxSpinButton *EntrySelection;
		wxButton *EntryRemove;
		wxStaticBoxSizer* sbEntry;

		enum {
			ID_EDITPATCH_NAME_TEXT = 4500,
			ID_EDITPATCH_NAME,
			ID_EDITPATCH_OFFSET_TEXT,
			ID_EDITPATCH_OFFSET,
			ID_ENTRY_SELECT,
			ID_EDITPATCH_TYPE,
			ID_EDITPATCH_VALUE_TEXT,
			ID_EDITPATCH_VALUE,
			ID_ENTRY_ADD,
			ID_ENTRY_REMOVE
		};

		void CreateGUIControls(int selection);
		void ChangeEntry(wxSpinEvent& event);
		void SavePatchData(wxCommandEvent& event);
		void AddRemoveEntry(wxCommandEvent& event);
		void UpdateEntryCtrls(PatchEngine::PatchEntry pE);
		bool UpdateTempEntryData(std::vector<PatchEngine::PatchEntry>::iterator iterEntry);

		int selection, currentItem;
		std::vector<PatchEngine::PatchEntry> tempEntries;
		std::vector<PatchEngine::PatchEntry>::iterator itCurEntry;

};