impr: Prettier data inspector edit button
This commit is contained in:
parent
bd59bcda2c
commit
f9073ee8ee
@ -263,6 +263,7 @@ namespace ImGuiExt {
|
||||
|
||||
bool DimmedButton(const char* label, ImVec2 size = ImVec2(0, 0));
|
||||
bool DimmedIconButton(const char *symbol, ImVec4 color, ImVec2 size = ImVec2(0, 0));
|
||||
bool DimmedButtonToggle(const char *icon, bool *v, ImVec2 size);
|
||||
bool DimmedIconToggle(const char *icon, bool *v);
|
||||
|
||||
void TextOverlay(const char *text, ImVec2 pos);
|
||||
|
@ -832,6 +832,26 @@ namespace ImGuiExt {
|
||||
return res;
|
||||
}
|
||||
|
||||
bool DimmedButtonToggle(const char *icon, bool *v, ImVec2 size) {
|
||||
bool pushed = false;
|
||||
bool toggled = false;
|
||||
|
||||
if (*v) {
|
||||
PushStyleColor(ImGuiCol_Border, GetStyleColorVec4(ImGuiCol_ButtonActive));
|
||||
pushed = true;
|
||||
}
|
||||
|
||||
if (DimmedIconButton(icon, GetStyleColorVec4(ImGuiCol_Text), size)) {
|
||||
*v = !*v;
|
||||
toggled = true;
|
||||
}
|
||||
|
||||
if (pushed)
|
||||
PopStyleColor();
|
||||
|
||||
return toggled;
|
||||
}
|
||||
|
||||
bool DimmedIconToggle(const char *icon, bool *v) {
|
||||
bool pushed = false;
|
||||
bool toggled = false;
|
||||
|
@ -330,9 +330,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
if (ImGuiExt::DimmedButton("hex.builtin.common.edit"_lang, ImVec2(ImGui::GetContentRegionAvail().x, 0))) {
|
||||
this->m_tableEditingModeEnabled = !this->m_tableEditingModeEnabled;
|
||||
}
|
||||
ImGuiExt::DimmedButtonToggle("hex.builtin.common.edit"_lang, &this->m_tableEditingModeEnabled, ImVec2(ImGui::GetContentRegionAvail().x, 0));
|
||||
|
||||
ImGui::NewLine();
|
||||
ImGui::Separator();
|
||||
|
Loading…
x
Reference in New Issue
Block a user