4
4
#include < wx/stattext.h>
5
5
#include < wx/statline.h>
6
6
#include < wx/textctrl.h>
7
- #include < wx/slider.h>
8
7
9
- #include " gui/helpers/wxControlObject.h"
10
8
#include " input/emulated/ProController.h"
11
9
#include " gui/helpers/wxHelpers.h"
12
10
#include " gui/components/wxInputDraw.h"
@@ -30,16 +28,7 @@ ProControllerInputPanel::ProControllerInputPanel(wxWindow* parent)
30
28
for (auto id : g_kFirstColumnItems)
31
29
{
32
30
row++;
33
-
34
- main_sizer->Add (new wxStaticText (this , wxID_ANY, to_wxString (ProController::get_button_name (id))), wxGBPosition (row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5 );
35
-
36
- auto text_ctrl = new wxTextCtrl (this , wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
37
- text_ctrl->SetClientData ((void *)id);
38
- text_ctrl->SetMinSize (wxSize (150 , -1 ));
39
- text_ctrl->SetEditable (false );
40
- text_ctrl->SetBackgroundColour (kKeyColourNormalMode );
41
- bind_hotkey_events (text_ctrl);
42
- main_sizer->Add (text_ctrl, wxGBPosition (row, column + 1 ), wxDefaultSpan, wxALL | wxEXPAND, 5 );
31
+ add_button_row (main_sizer, row, column, id);
43
32
}
44
33
45
34
// ////////////////////////////////////////////////////////////////
@@ -56,16 +45,7 @@ ProControllerInputPanel::ProControllerInputPanel(wxWindow* parent)
56
45
for (auto id : g_kSecondColumnItems)
57
46
{
58
47
row++;
59
-
60
- main_sizer->Add (new wxStaticText (this , wxID_ANY, to_wxString (ProController::get_button_name (id))), wxGBPosition (row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5 );
61
-
62
- auto text_ctrl = new wxTextCtrl (this , wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
63
- text_ctrl->SetClientData ((void *)id);
64
- text_ctrl->SetMinSize (wxSize (150 , -1 ));
65
- text_ctrl->SetEditable (false );
66
- text_ctrl->SetBackgroundColour (kKeyColourNormalMode );
67
- bind_hotkey_events (text_ctrl);
68
- main_sizer->Add (text_ctrl, wxGBPosition (row, column + 1 ), wxDefaultSpan, wxALL | wxEXPAND, 5 );
48
+ add_button_row (main_sizer, row, column, id);
69
49
}
70
50
71
51
row++;
@@ -88,16 +68,7 @@ ProControllerInputPanel::ProControllerInputPanel(wxWindow* parent)
88
68
for (auto id : g_kThirdColumnItems)
89
69
{
90
70
row++;
91
-
92
- main_sizer->Add (new wxStaticText (this , wxID_ANY, to_wxString (ProController::get_button_name (id))), wxGBPosition (row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5 );
93
-
94
- auto text_ctrl = new wxTextCtrl (this , wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
95
- text_ctrl->SetClientData ((void *)id);
96
- text_ctrl->SetMinSize (wxSize (150 , -1 ));
97
- text_ctrl->SetEditable (false );
98
- text_ctrl->SetBackgroundColour (kKeyColourNormalMode );
99
- bind_hotkey_events (text_ctrl);
100
- main_sizer->Add (text_ctrl, wxGBPosition (row, column + 1 ), wxDefaultSpan, wxALL | wxEXPAND, 5 );
71
+ add_button_row (main_sizer, row, column, id);
101
72
}
102
73
103
74
row++;
@@ -120,24 +91,28 @@ ProControllerInputPanel::ProControllerInputPanel(wxWindow* parent)
120
91
for (auto id : g_kFourthRowItems)
121
92
{
122
93
row++;
123
-
124
- main_sizer->Add (new wxStaticText (this , wxID_ANY, to_wxString (ProController::get_button_name (id))), wxGBPosition (row, column), wxDefaultSpan, wxALL | wxALIGN_CENTER_VERTICAL, 5 );
125
-
126
- auto text_ctrl = new wxTextCtrl (this , wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
127
- text_ctrl->SetClientData ((void *)id);
128
- text_ctrl->SetMinSize (wxSize (150 , -1 ));
129
- text_ctrl->SetEditable (false );
130
- text_ctrl->SetBackgroundColour (kKeyColourNormalMode );
131
- bind_hotkey_events (text_ctrl);
132
- main_sizer->Add (text_ctrl, wxGBPosition (row, column + 1 ), wxDefaultSpan, wxALL | wxEXPAND, 5 );
94
+ add_button_row (main_sizer, row, column, id);
133
95
}
134
96
135
97
// ////////////////////////////////////////////////////////////////
136
98
137
- // LoadController(controller);
138
-
139
99
SetSizerAndFit (main_sizer);
140
- // wxWindow::Show(show);
100
+ }
101
+
102
+ void ProControllerInputPanel::add_button_row (wxGridBagSizer *sizer, sint32 row, sint32 column, const ProController::ButtonId &button_id) {
103
+ sizer->Add (
104
+ new wxStaticText (this , wxID_ANY, wxGetTranslation (to_wxString (ProController::get_button_name (button_id)))),
105
+ wxGBPosition (row, column),
106
+ wxDefaultSpan,
107
+ wxALL | wxALIGN_CENTER_VERTICAL, 5 );
108
+
109
+ auto text_ctrl = new wxTextCtrl (this , wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
110
+ text_ctrl->SetClientData ((void *)button_id);
111
+ text_ctrl->SetMinSize (wxSize (150 , -1 ));
112
+ text_ctrl->SetEditable (false );
113
+ text_ctrl->SetBackgroundColour (kKeyColourNormalMode );
114
+ bind_hotkey_events (text_ctrl);
115
+ sizer->Add (text_ctrl, wxGBPosition (row, column + 1 ), wxDefaultSpan, wxALL | wxEXPAND, 5 );
141
116
}
142
117
143
118
void ProControllerInputPanel::on_timer (const EmulatedControllerPtr& emulated_controller,
0 commit comments