| 149 | |
| 150 | |
| 151 | void InputPanel::load_controller(const EmulatedControllerPtr& controller) |
| 152 | { |
| 153 | reset_configuration(); |
| 154 | if(!controller) |
| 155 | { |
| 156 | return; |
| 157 | } |
| 158 | |
| 159 | if(controller->get_controllers().empty()) |
| 160 | { |
| 161 | return; |
| 162 | } |
| 163 | |
| 164 | wxWindowUpdateLocker lock(this); |
| 165 | for (auto* child : this->GetChildren()) |
| 166 | { |
| 167 | const auto text = dynamic_cast<wxTextCtrl*>(child); |
| 168 | if (text == nullptr) |
| 169 | continue; |
| 170 | |
| 171 | |
| 172 | const auto mapping = reinterpret_cast<sint64>(text->GetClientData()); |
| 173 | if (mapping <= 0) |
| 174 | continue; |
| 175 | |
| 176 | auto button_name = controller->get_mapping_name(mapping); |
| 177 | #if BOOST_OS_WINDOWS |
| 178 | text->SetLabelText(button_name); |
| 179 | #else |
| 180 | // SetLabelText doesn't seem to work here for some reason on wxGTK |
| 181 | text->ChangeValue(button_name); |
| 182 | #endif |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | void InputPanel::set_selected_controller(const EmulatedControllerPtr& emulated_controller, const ControllerPtr& controller) |
| 187 | { |
no test coverage detected