impr: Replace various fixed-size boxes with dynamic ones
This commit is contained in:
parent
f49b5efac4
commit
924b4a9436
@ -270,6 +270,9 @@ namespace ImGui {
|
|||||||
|
|
||||||
void TextOverlay(const char *text, ImVec2 pos);
|
void TextOverlay(const char *text, ImVec2 pos);
|
||||||
|
|
||||||
|
bool BeginBox();
|
||||||
|
void EndBox();
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
constexpr ImGuiDataType getImGuiDataType() {
|
constexpr ImGuiDataType getImGuiDataType() {
|
||||||
if constexpr (std::same_as<T, u8>) return ImGuiDataType_U8;
|
if constexpr (std::same_as<T, u8>) return ImGuiDataType_U8;
|
||||||
|
@ -821,4 +821,18 @@ namespace ImGui {
|
|||||||
drawList->AddText(textPos, ImGui::GetColorU32(ImGuiCol_Text), text);
|
drawList->AddText(textPos, ImGui::GetColorU32(ImGuiCol_Text), text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BeginBox() {
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2(5, 5));
|
||||||
|
auto result = ImGui::BeginTable("##box", 1, ImGuiTableFlags_BordersOuter | ImGuiTableFlags_SizingStretchSame);
|
||||||
|
ImGui::TableNextRow();
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EndBox() {
|
||||||
|
ImGui::EndTable();
|
||||||
|
ImGui::PopStyleVar();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -115,7 +115,7 @@ namespace hex::plugin::builtin {
|
|||||||
this->m_mode = cs_mode(0);
|
this->m_mode = cs_mode(0);
|
||||||
|
|
||||||
// Draw sub-settings for each architecture
|
// Draw sub-settings for each architecture
|
||||||
if (ImGui::BeginChild("modes", ImVec2(0, ImGui::GetTextLineHeightWithSpacing() * 6), true, ImGuiWindowFlags_AlwaysAutoResize)) {
|
if (ImGui::BeginBox()) {
|
||||||
|
|
||||||
// Draw endian radio buttons. This setting is available for all architectures
|
// Draw endian radio buttons. This setting is available for all architectures
|
||||||
static int littleEndian = true;
|
static int littleEndian = true;
|
||||||
@ -374,8 +374,9 @@ namespace hex::plugin::builtin {
|
|||||||
this->m_mode = cs_mode(0);
|
this->m_mode = cs_mode(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::EndBox();
|
||||||
}
|
}
|
||||||
ImGui::EndChild();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw disassemble button
|
// Draw disassemble button
|
||||||
|
@ -67,11 +67,7 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
firstSubCategory = false;
|
firstSubCategory = false;
|
||||||
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, scaled({5, 5}));
|
if (ImGui::BeginBox()) {
|
||||||
if (ImGui::BeginTable("##subCategory", 1, ImGuiTableFlags_BordersOuter | ImGuiTableFlags_SizingStretchSame)) {
|
|
||||||
ImGui::TableNextRow();
|
|
||||||
ImGui::TableNextColumn();
|
|
||||||
|
|
||||||
for (auto &setting : subCategory.entries) {
|
for (auto &setting : subCategory.entries) {
|
||||||
ImGui::BeginDisabled(!setting.widget->isEnabled());
|
ImGui::BeginDisabled(!setting.widget->isEnabled());
|
||||||
bool settingChanged = setting.widget->draw(LangEntry(setting.unlocalizedName));
|
bool settingChanged = setting.widget->draw(LangEntry(setting.unlocalizedName));
|
||||||
@ -102,9 +98,8 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::EndTable();
|
ImGui::EndBox();
|
||||||
}
|
}
|
||||||
ImGui::PopStyleVar();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user