parent
c8fc1829d0
commit
f7ada78e32
@ -81,6 +81,9 @@ Other Changes:
|
|||||||
- Amended context menu right-click opening code to check that the right-click
|
- Amended context menu right-click opening code to check that the right-click
|
||||||
hasn't been owned by another items. This is more correct and also necessary
|
hasn't been owned by another items. This is more correct and also necessary
|
||||||
to avoid Drags/Sliders cancelling also triggering a cancel menu. (#8564, #9534)
|
to avoid Drags/Sliders cancelling also triggering a cancel menu. (#8564, #9534)
|
||||||
|
- ImGuiTextFilter:
|
||||||
|
- Added `DrawWithHint()` function. (#6206, #6395, #6447)
|
||||||
|
- Added a "incl,-excl" hint by default when the search field is empty. (#6206, #6395, #6447)
|
||||||
- Style:
|
- Style:
|
||||||
- Inverted `ImGuiCol_TitleBgXXX` colors for `StyleColorsLight()` so that the selected
|
- Inverted `ImGuiCol_TitleBgXXX` colors for `StyleColorsLight()` so that the selected
|
||||||
window title bar appears brighter.
|
window title bar appears brighter.
|
||||||
|
|||||||
@ -3105,7 +3105,13 @@ bool ImGuiTextFilter::Draw(const char* label, float width)
|
|||||||
{
|
{
|
||||||
if (width != 0.0f)
|
if (width != 0.0f)
|
||||||
ImGui::SetNextItemWidth(width);
|
ImGui::SetNextItemWidth(width);
|
||||||
bool value_changed = ImGui::InputText(label, InputBuf, IM_COUNTOF(InputBuf));
|
return DrawWithHint(label);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use ImGui::SetNextItemWidth() manually if you want to use this.
|
||||||
|
bool ImGuiTextFilter::DrawWithHint(const char* label, const char* hint)
|
||||||
|
{
|
||||||
|
bool value_changed = ImGui::InputTextWithHint(label, hint, InputBuf, IM_COUNTOF(InputBuf));
|
||||||
if (value_changed)
|
if (value_changed)
|
||||||
Build();
|
Build();
|
||||||
return value_changed;
|
return value_changed;
|
||||||
|
|||||||
3
imgui.h
3
imgui.h
@ -2795,7 +2795,8 @@ struct ImGuiTextFilter
|
|||||||
inline bool IsActive() const { return Filters.Size != 0; } // Useful if you need e.g. an alternative code-path when there are no filters
|
inline bool IsActive() const { return Filters.Size != 0; } // Useful if you need e.g. an alternative code-path when there are no filters
|
||||||
|
|
||||||
// Helper to call InputText() + Build() when buffer is changed.
|
// Helper to call InputText() + Build() when buffer is changed.
|
||||||
IMGUI_API bool Draw(const char* label = "Filter (inc,-exc)", float width = 0.0f);
|
IMGUI_API bool Draw(const char* label = "Filter", float width = 0.0f);
|
||||||
|
IMGUI_API bool DrawWithHint(const char* label = "Filter", const char* hint = "incl,-excl");
|
||||||
|
|
||||||
// [Internal] Don't use! Will be replaced with ImStrv.
|
// [Internal] Don't use! Will be replaced with ImStrv.
|
||||||
struct ImGuiTextRange
|
struct ImGuiTextRange
|
||||||
|
|||||||
@ -1452,7 +1452,8 @@ static void DemoWindowWidgetsComboBoxes()
|
|||||||
filter.Clear();
|
filter.Clear();
|
||||||
}
|
}
|
||||||
ImGui::SetNextItemShortcut(ImGuiMod_Ctrl | ImGuiKey_F);
|
ImGui::SetNextItemShortcut(ImGuiMod_Ctrl | ImGuiKey_F);
|
||||||
filter.Draw("##Filter", -FLT_MIN);
|
ImGui::SetNextItemWidth(-FLT_MIN);
|
||||||
|
filter.DrawWithHint("##Filter", "Filter (incl,-excl)");
|
||||||
|
|
||||||
for (int n = 0; n < IM_COUNTOF(items); n++)
|
for (int n = 0; n < IM_COUNTOF(items); n++)
|
||||||
{
|
{
|
||||||
@ -3945,7 +3946,8 @@ static void DemoWindowWidgetsTextFilter()
|
|||||||
" \"xxx\" display lines containing \"xxx\"\n"
|
" \"xxx\" display lines containing \"xxx\"\n"
|
||||||
" \"xxx,yyy\" display lines containing \"xxx\" or \"yyy\"\n"
|
" \"xxx,yyy\" display lines containing \"xxx\" or \"yyy\"\n"
|
||||||
" \"-xxx\" hide lines containing \"xxx\"");
|
" \"-xxx\" hide lines containing \"xxx\"");
|
||||||
filter.Draw();
|
ImGui::SetNextItemWidth(-FLT_MIN);
|
||||||
|
filter.DrawWithHint("##Filter", "Filter (incl,-excl)");
|
||||||
const char* lines[] = { "aaa1.c", "bbb1.c", "ccc1.c", "aaa2.cpp", "bbb2.cpp", "ccc2.cpp", "abc.h", "hello, world" };
|
const char* lines[] = { "aaa1.c", "bbb1.c", "ccc1.c", "aaa2.cpp", "bbb2.cpp", "ccc2.cpp", "abc.h", "hello, world" };
|
||||||
for (int i = 0; i < IM_COUNTOF(lines); i++)
|
for (int i = 0; i < IM_COUNTOF(lines); i++)
|
||||||
if (filter.PassFilter(lines[i]))
|
if (filter.PassFilter(lines[i]))
|
||||||
@ -8820,9 +8822,6 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
SameLine(); SetNextItemWidth(GetFontSize() * 10); Combo("##output_type", &output_dest, "To Clipboard\0To TTY\0");
|
SameLine(); SetNextItemWidth(GetFontSize() * 10); Combo("##output_type", &output_dest, "To Clipboard\0To TTY\0");
|
||||||
SameLine(); Checkbox("Only Modified Colors", &output_only_modified);
|
SameLine(); Checkbox("Only Modified Colors", &output_only_modified);
|
||||||
|
|
||||||
static ImGuiTextFilter filter;
|
|
||||||
filter.Draw("Filter colors", GetFontSize() * 16);
|
|
||||||
|
|
||||||
static ImGuiColorEditFlags alpha_flags = 0;
|
static ImGuiColorEditFlags alpha_flags = 0;
|
||||||
if (RadioButton("Opaque", alpha_flags == ImGuiColorEditFlags_AlphaOpaque)) { alpha_flags = ImGuiColorEditFlags_AlphaOpaque; } SameLine();
|
if (RadioButton("Opaque", alpha_flags == ImGuiColorEditFlags_AlphaOpaque)) { alpha_flags = ImGuiColorEditFlags_AlphaOpaque; } SameLine();
|
||||||
if (RadioButton("Alpha", alpha_flags == ImGuiColorEditFlags_None)) { alpha_flags = ImGuiColorEditFlags_None; } SameLine();
|
if (RadioButton("Alpha", alpha_flags == ImGuiColorEditFlags_None)) { alpha_flags = ImGuiColorEditFlags_None; } SameLine();
|
||||||
@ -8832,6 +8831,10 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
"Left-click on color square to open color picker,\n"
|
"Left-click on color square to open color picker,\n"
|
||||||
"Right-click to open edit options menu.");
|
"Right-click to open edit options menu.");
|
||||||
|
|
||||||
|
static ImGuiTextFilter filter;
|
||||||
|
SetNextItemWidth(-FLT_MIN);
|
||||||
|
filter.DrawWithHint("##FilterColors", "Filter Colors (incl,-excl)");
|
||||||
|
|
||||||
SetNextWindowSizeConstraints(ImVec2(0.0f, GetTextLineHeightWithSpacing() * 10), ImVec2(FLT_MAX, FLT_MAX));
|
SetNextWindowSizeConstraints(ImVec2(0.0f, GetTextLineHeightWithSpacing() * 10), ImVec2(FLT_MAX, FLT_MAX));
|
||||||
BeginChild("##colors", ImVec2(0, 0), ImGuiChildFlags_Borders | ImGuiChildFlags_NavFlattened, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_AlwaysHorizontalScrollbar);
|
BeginChild("##colors", ImVec2(0, 0), ImGuiChildFlags_Borders | ImGuiChildFlags_NavFlattened, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_AlwaysHorizontalScrollbar);
|
||||||
PushItemWidth(GetFontSize() * -12);
|
PushItemWidth(GetFontSize() * -12);
|
||||||
@ -9244,7 +9247,10 @@ struct ExampleAppConsole
|
|||||||
if (ImGui::Button("Options"))
|
if (ImGui::Button("Options"))
|
||||||
ImGui::OpenPopup("Options");
|
ImGui::OpenPopup("Options");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
Filter.Draw("Filter (\"incl,-excl\") (\"error\")", 180);
|
|
||||||
|
ImGui::SetNextItemShortcut(ImGuiMod_Ctrl | ImGuiKey_F, ImGuiInputFlags_Tooltip);
|
||||||
|
ImGui::SetNextItemWidth(-FLT_MIN);
|
||||||
|
Filter.DrawWithHint("##Filter", "Filter (incl,-excl)");
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
// Reserve enough left-over height for 1 separator + 1 input text
|
// Reserve enough left-over height for 1 separator + 1 input text
|
||||||
@ -9579,7 +9585,8 @@ struct ExampleAppLog
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
bool copy = ImGui::Button("Copy");
|
bool copy = ImGui::Button("Copy");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
Filter.Draw("Filter", -100.0f);
|
ImGui::SetNextItemWidth(-FLT_MIN);
|
||||||
|
Filter.DrawWithHint("##Filter", "Filter (incl,-excl)");
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user