Implemented cursor movement inside SearchComboPopup

+ Added checkboxes for editing of the option's name (include "Group"/"Category" or not)
+ some code refactoring
This commit is contained in:
YuSanka 2020-04-14 17:54:15 +02:00
parent 167f7cf5de
commit 45147d887b
7 changed files with 152 additions and 50 deletions

View file

@ -24,6 +24,7 @@
#include "libslic3r/Utils.hpp"
#include "3DScene.hpp"
#include "GUI.hpp"
#include "I18N.hpp"
namespace Slic3r {
namespace GUI {
@ -538,7 +539,8 @@ static bool selectable(const char* label, bool selected, ImGuiSelectableFlags fl
return pressed;
}
void ImGuiWrapper::search_list(const ImVec2& size_, bool (*items_getter)(int, const char**), char* search_str, size_t& selected, bool& edited)
void ImGuiWrapper::search_list(const ImVec2& size_, bool (*items_getter)(int, const char**), char* search_str,
bool& category, bool& group, size_t& selected, bool& edited, bool& check_changed)
{
// ImGui::ListBoxHeader("", size);
{
@ -604,6 +606,23 @@ void ImGuiWrapper::search_list(const ImVec2& size_, bool (*items_getter)(int, co
}
ImGui::ListBoxFooter();
// add checkboxes for show/hide Categories and Groups
text(_L("Use for search")+":");
ImGui::SameLine();
bool cat = category;
checkbox(_L("Category"), cat);
if (ImGui::IsItemClicked()) {
category = !category;
check_changed = true;
}
ImGui::SameLine();
bool gr = group;
checkbox(_L("Group"), gr);
if (ImGui::IsItemClicked()) {
group = !group;
check_changed = true;
}
}
void ImGuiWrapper::disabled_begin(bool disabled)