1
0
mirror of synced 2025-01-25 15:53:43 +01:00

impr: Added hints to various input fields

This commit is contained in:
WerWolv 2024-12-23 23:16:55 +01:00
parent 382599dcf6
commit bfddf24204
4 changed files with 11 additions and 5 deletions

View File

@ -282,6 +282,7 @@ namespace ImGuiExt {
}
bool InputTextIcon(const char* label, const char *icon, std::string &buffer, ImGuiInputTextFlags flags = ImGuiInputTextFlags_None);
bool InputTextIconHint(const char* label, const char *icon, const char *hint, std::string &buffer, ImGuiInputTextFlags flags = ImGuiInputTextFlags_None);
bool InputScalarCallback(const char* label, ImGuiDataType data_type, void* p_data, const char* format, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data);

View File

@ -969,11 +969,14 @@ namespace ImGuiExt {
}
bool InputTextIcon(const char *label, const char *icon, std::string &buffer, ImGuiInputTextFlags flags) {
return InputTextIconHint(label, icon, nullptr, buffer, flags);
}
bool InputTextIconHint(const char* label, const char *icon, const char *hint, std::string &buffer, ImGuiInputTextFlags flags) {
auto window = GetCurrentWindow();
const ImGuiID id = window->GetID(label);
const ImGuiStyle &style = GImGui->Style;
const ImVec2 label_size = CalcTextSize(label, nullptr, true);
const ImVec2 icon_frame_size = CalcTextSize(icon) + style.FramePadding * 2.0F;
const ImVec2 frame_size = CalcItemSize(ImVec2(0, 0), icon_frame_size.x, label_size.y + style.FramePadding.y * 2.0F);

View File

@ -694,6 +694,8 @@ namespace hex::plugin::builtin {
ImGui::EndCombo();
}
ImGui::NewLine();
if (ImGui::CollapsingHeader("hex.builtin.view.find.strings.match_settings"_lang)) {
ImGui::Checkbox("hex.builtin.view.find.strings.null_term"_lang, &settings.nullTermination);
@ -716,7 +718,7 @@ namespace hex::plugin::builtin {
mode = SearchSettings::Mode::Sequence;
ImGuiExt::InputTextIcon("hex.ui.common.value"_lang, ICON_VS_SYMBOL_KEY, settings.sequence);
ImGuiExt::InputTextIconHint("hex.ui.common.value"_lang, ICON_VS_SYMBOL_KEY, "String", settings.sequence);
if (ImGui::BeginCombo("hex.ui.common.type"_lang, StringTypes[std::to_underlying(settings.type)].c_str())) {
for (size_t i = 0; i < StringTypes.size() - 2; i++) {
@ -757,7 +759,7 @@ namespace hex::plugin::builtin {
ImGui::NewLine();
ImGuiExt::InputTextIcon("hex.builtin.view.find.regex.pattern"_lang, ICON_VS_REGEX, settings.pattern);
ImGuiExt::InputTextIconHint("hex.builtin.view.find.regex.pattern"_lang, ICON_VS_REGEX, "[A-Za-z]{2}\\d{3}", settings.pattern);
try {
boost::regex regex(settings.pattern);
@ -778,7 +780,7 @@ namespace hex::plugin::builtin {
mode = SearchSettings::Mode::BinaryPattern;
ImGuiExt::InputTextIcon("hex.builtin.view.find.binary_pattern"_lang, ICON_VS_SYMBOL_NAMESPACE, settings.input);
ImGuiExt::InputTextIconHint("hex.builtin.view.find.binary_pattern"_lang, ICON_VS_SYMBOL_NAMESPACE, "AA BB ?? ?D \"XYZ\"", settings.input);
constexpr static u32 min = 1, max = 0x1000;
ImGui::SliderScalar("hex.builtin.view.find.binary_pattern.alignment"_lang, ImGuiDataType_U32, &settings.alignment, &min, &max);

View File

@ -194,7 +194,7 @@ namespace hex::plugin::hashes {
ImGui::EndDisabled();
ImGui::SameLine();
ImGuiExt::HelpHover("hex.hashes.view.hashes.hover_info"_lang);
ImGuiExt::HelpHover("hex.hashes.view.hashes.hover_info"_lang, ICON_VS_INFO);
if (ImGui::BeginTable("##hashes", 4, ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Borders | ImGuiTableFlags_ScrollY)) {
ImGui::TableSetupColumn("hex.hashes.view.hashes.table.name"_lang);