1
0
mirror of synced 2025-01-10 21:41:53 +01:00

impr: Added icons to more context menus

This commit is contained in:
WerWolv 2024-12-31 00:45:47 +01:00
parent ff2b58e8a3
commit 67a9f314cc
7 changed files with 12 additions and 11 deletions

View File

@ -30,6 +30,7 @@ namespace hex::prv {
struct MenuEntry {
std::string name;
const char *icon;
std::function<void()> callback;
};

View File

@ -180,13 +180,13 @@ namespace hex::plugin::builtin {
FileProvider::MenuEntry loadMenuItem;
if (m_loadedIntoMemory)
loadMenuItem = { "hex.builtin.provider.file.menu.direct_access"_lang, [this] { this->convertToDirectAccess(); } };
loadMenuItem = { "hex.builtin.provider.file.menu.direct_access"_lang, ICON_VS_ARROW_SWAP, [this] { this->convertToDirectAccess(); } };
else
loadMenuItem = { "hex.builtin.provider.file.menu.into_memory"_lang, [this] { this->convertToMemoryFile(); } };
loadMenuItem = { "hex.builtin.provider.file.menu.into_memory"_lang, ICON_VS_ARROW_SWAP, [this] { this->convertToMemoryFile(); } };
return {
{ "hex.builtin.provider.file.menu.open_folder"_lang, [this] { fs::openFolderWithSelectionExternal(m_path); } },
{ "hex.builtin.provider.file.menu.open_file"_lang, [this] { fs::openFileExternal(m_path); } },
{ "hex.builtin.provider.file.menu.open_folder"_lang, ICON_VS_FOLDER_OPENED, [this] { fs::openFolderWithSelectionExternal(m_path); } },
{ "hex.builtin.provider.file.menu.open_file"_lang, ICON_VS_FILE, [this] { fs::openFileExternal(m_path); } },
loadMenuItem
};
}

View File

@ -78,7 +78,7 @@ namespace hex::plugin::builtin {
std::vector<MemoryFileProvider::MenuEntry> MemoryFileProvider::getMenuEntries() {
return {
MenuEntry { Lang("hex.builtin.provider.mem_file.rename"), [this] { this->renameFile(); } }
MenuEntry { Lang("hex.builtin.provider.mem_file.rename"), ICON_VS_TAG, [this] { this->renameFile(); } }
};
}

View File

@ -166,7 +166,7 @@ namespace hex::plugin::builtin {
std::vector<prv::Provider::MenuEntry> ViewProvider::getMenuEntries() {
return {
MenuEntry { Lang("hex.builtin.provider.rename"), [this] { this->renameFile(); } }
MenuEntry { Lang("hex.builtin.provider.rename"), ICON_VS_TAG, [this] { this->renameFile(); } }
};
}

View File

@ -320,7 +320,7 @@ namespace hex::plugin::builtin::recent {
}
if (ImGui::BeginPopup(popupID.c_str())) {
if (ImGui::MenuItem("hex.ui.common.remove"_lang)) {
if (ImGui::MenuItemEx("hex.ui.common.remove"_lang, ICON_VS_REMOVE)) {
shouldRemove = true;
}
ImGui::EndPopup();

View File

@ -317,7 +317,7 @@ namespace hex::plugin::builtin {
static void drawProviderContextMenu(prv::Provider *provider) {
for (const auto &menuEntry : provider->getMenuEntries()) {
if (ImGui::MenuItem(menuEntry.name.c_str())) {
if (ImGui::MenuItemEx(menuEntry.name.c_str(), menuEntry.icon)) {
menuEntry.callback();
}
}

View File

@ -601,11 +601,11 @@ namespace hex::plugin::builtin {
}
if (ImGui::BeginPopup("FindContextMenu")) {
if (ImGui::MenuItem("hex.builtin.view.find.context.copy"_lang))
if (ImGui::MenuItemEx("hex.builtin.view.find.context.copy"_lang, ICON_VS_COPY))
ImGui::SetClipboardText(value.c_str());
if (ImGui::MenuItem("hex.builtin.view.find.context.copy_demangle"_lang))
if (ImGui::MenuItemEx("hex.builtin.view.find.context.copy_demangle"_lang, ICON_VS_FILES))
ImGui::SetClipboardText(hex::plugin::builtin::demangle(value).c_str());
if (ImGui::BeginMenu("hex.builtin.view.find.context.replace"_lang)) {
if (ImGui::BeginMenuEx("hex.builtin.view.find.context.replace"_lang, ICON_VS_REPLACE)) {
if (ImGui::BeginTabBar("##replace_tabs")) {
if (ImGui::BeginTabItem("hex.builtin.view.find.context.replace.hex"_lang)) {
ImGuiExt::InputTextIcon("##replace_input", ICON_VS_SYMBOL_NAMESPACE, m_replaceBuffer);