Add private methods to get the selected preset name(s).

This commit is contained in:
Joseph Lenox 2018-11-18 11:40:06 -06:00 committed by Joseph Lenox
parent 378330d747
commit df20d5a8de
2 changed files with 23 additions and 0 deletions

View File

@ -127,6 +127,23 @@ bool PresetChooser::prompt_unsaved_changes() {
return true;
}
std::vector<wxString> PresetChooser::_get_selected_presets(preset_t group) const {
const auto& choosers { this->preset_choosers[get_preset(group)] };
std::vector<wxString> selected;
selected.reserve(choosers.size());
for (auto* chooser : choosers) {
selected.push_back(chooser->GetString(chooser->GetSelection()));
}
return selected;
}
wxString PresetChooser::_get_selected_preset(preset_t group, size_t index) const {
auto selected { this->_get_selected_presets(group) };
if (index > selected.size()) { return wxString(""); }
return selected.at(index);
}
void PresetChooser::_on_change_combobox(preset_t preset, wxBitmapComboBox* choice) {
// Prompt for unsaved changes and undo selections if cancelled and return early

View File

@ -79,6 +79,12 @@ private:
void _on_select_preset(preset_t preset);
/// Return the vector of strings representing the selected preset names.
std::vector<wxString> _get_selected_presets(preset_t group) const;
/// Fetch the preset name corresponding to the chooser index
wxString _get_selected_preset(preset_t group, size_t index) const;
};
}} // Slic3r::GUI