mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Style: Allow style.WindowMenuButtonPosition to be set to ImGuiDir_None to hide the collapse button. (#2634, #2639)
+ Fix #2775
This commit is contained in:
parent
3b014d0c31
commit
b48dc067ae
@ -50,6 +50,7 @@ Other Changes:
|
|||||||
- SliderScalar: Improved assert when using U32 or U64 types with a large v_max value. (#2765) [@loicmouton]
|
- SliderScalar: Improved assert when using U32 or U64 types with a large v_max value. (#2765) [@loicmouton]
|
||||||
- DragInt, DragFloat, DragScalar: Using (v_min > v_max) allows locking any edit to the value.
|
- DragInt, DragFloat, DragScalar: Using (v_min > v_max) allows locking any edit to the value.
|
||||||
- DragScalar: Fixed dragging of unsigned values on ARM cpu. (#2780) [@dBagrat]
|
- DragScalar: Fixed dragging of unsigned values on ARM cpu. (#2780) [@dBagrat]
|
||||||
|
- Style: Allow style.WindowMenuButtonPosition to be set to ImGuiDir_None to hide the collapse button. (#2634, #2639)
|
||||||
- Font: Better ellipsis drawing implementation. Instead of drawing three pixel-ey dots (which was glaringly
|
- Font: Better ellipsis drawing implementation. Instead of drawing three pixel-ey dots (which was glaringly
|
||||||
unfitting with many types of fonts) we first attempt to find a standard ellipsis glyphs within the loaded set.
|
unfitting with many types of fonts) we first attempt to find a standard ellipsis glyphs within the loaded set.
|
||||||
Otherwise we render ellipsis using '.' from the font from where we trim excessive spacing to make it as narrow
|
Otherwise we render ellipsis using '.' from the font from where we trim excessive spacing to make it as narrow
|
||||||
|
@ -3692,7 +3692,7 @@ static void NewFrameSanityChecks()
|
|||||||
IM_ASSERT(g.Style.CurveTessellationTol > 0.0f && "Invalid style setting!");
|
IM_ASSERT(g.Style.CurveTessellationTol > 0.0f && "Invalid style setting!");
|
||||||
IM_ASSERT(g.Style.Alpha >= 0.0f && g.Style.Alpha <= 1.0f && "Invalid style setting. Alpha cannot be negative (allows us to avoid a few clamps in color computations)!");
|
IM_ASSERT(g.Style.Alpha >= 0.0f && g.Style.Alpha <= 1.0f && "Invalid style setting. Alpha cannot be negative (allows us to avoid a few clamps in color computations)!");
|
||||||
IM_ASSERT(g.Style.WindowMinSize.x >= 1.0f && g.Style.WindowMinSize.y >= 1.0f && "Invalid style setting.");
|
IM_ASSERT(g.Style.WindowMinSize.x >= 1.0f && g.Style.WindowMinSize.y >= 1.0f && "Invalid style setting.");
|
||||||
IM_ASSERT(g.Style.WindowMenuButtonPosition == ImGuiDir_Left || g.Style.WindowMenuButtonPosition == ImGuiDir_Right);
|
IM_ASSERT(g.Style.WindowMenuButtonPosition == ImGuiDir_None || g.Style.WindowMenuButtonPosition == ImGuiDir_Left || g.Style.WindowMenuButtonPosition == ImGuiDir_Right);
|
||||||
for (int n = 0; n < ImGuiKey_COUNT; n++)
|
for (int n = 0; n < ImGuiKey_COUNT; n++)
|
||||||
IM_ASSERT(g.IO.KeyMap[n] >= -1 && g.IO.KeyMap[n] < IM_ARRAYSIZE(g.IO.KeysDown) && "io.KeyMap[] contains an out of bound value (need to be 0..512, or -1 for unmapped key)");
|
IM_ASSERT(g.IO.KeyMap[n] >= -1 && g.IO.KeyMap[n] < IM_ARRAYSIZE(g.IO.KeysDown) && "io.KeyMap[] contains an out of bound value (need to be 0..512, or -1 for unmapped key)");
|
||||||
|
|
||||||
@ -5314,7 +5314,7 @@ void ImGui::RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& titl
|
|||||||
ImGuiWindowFlags flags = window->Flags;
|
ImGuiWindowFlags flags = window->Flags;
|
||||||
|
|
||||||
const bool has_close_button = (p_open != NULL);
|
const bool has_close_button = (p_open != NULL);
|
||||||
const bool has_collapse_button = !(flags & ImGuiWindowFlags_NoCollapse);
|
const bool has_collapse_button = !(flags & ImGuiWindowFlags_NoCollapse) && (style.WindowMenuButtonPosition != ImGuiDir_None);
|
||||||
|
|
||||||
// Close & Collapse button are on the Menu NavLayer and don't default focus (unless there's nothing else on that layer)
|
// Close & Collapse button are on the Menu NavLayer and don't default focus (unless there's nothing else on that layer)
|
||||||
const ImGuiItemFlags item_flags_backup = window->DC.ItemFlags;
|
const ImGuiItemFlags item_flags_backup = window->DC.ItemFlags;
|
||||||
|
2
imgui.h
2
imgui.h
@ -1289,7 +1289,7 @@ struct ImGuiStyle
|
|||||||
float WindowBorderSize; // Thickness of border around windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly).
|
float WindowBorderSize; // Thickness of border around windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly).
|
||||||
ImVec2 WindowMinSize; // Minimum window size. This is a global setting. If you want to constraint individual windows, use SetNextWindowSizeConstraints().
|
ImVec2 WindowMinSize; // Minimum window size. This is a global setting. If you want to constraint individual windows, use SetNextWindowSizeConstraints().
|
||||||
ImVec2 WindowTitleAlign; // Alignment for title bar text. Defaults to (0.0f,0.5f) for left-aligned,vertically centered.
|
ImVec2 WindowTitleAlign; // Alignment for title bar text. Defaults to (0.0f,0.5f) for left-aligned,vertically centered.
|
||||||
ImGuiDir WindowMenuButtonPosition; // Side of the collapsing/docking button in the title bar (left/right). Defaults to ImGuiDir_Left.
|
ImGuiDir WindowMenuButtonPosition; // Side of the collapsing/docking button in the title bar (None/Left/Right). Defaults to ImGuiDir_Left.
|
||||||
float ChildRounding; // Radius of child window corners rounding. Set to 0.0f to have rectangular windows.
|
float ChildRounding; // Radius of child window corners rounding. Set to 0.0f to have rectangular windows.
|
||||||
float ChildBorderSize; // Thickness of border around child windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly).
|
float ChildBorderSize; // Thickness of border around child windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly).
|
||||||
float PopupRounding; // Radius of popup window corners rounding. (Note that tooltip windows use WindowRounding)
|
float PopupRounding; // Radius of popup window corners rounding. (Note that tooltip windows use WindowRounding)
|
||||||
|
@ -3195,7 +3195,9 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
ImGui::SliderFloat("TabRounding", &style.TabRounding, 0.0f, 12.0f, "%.0f");
|
ImGui::SliderFloat("TabRounding", &style.TabRounding, 0.0f, 12.0f, "%.0f");
|
||||||
ImGui::Text("Alignment");
|
ImGui::Text("Alignment");
|
||||||
ImGui::SliderFloat2("WindowTitleAlign", (float*)&style.WindowTitleAlign, 0.0f, 1.0f, "%.2f");
|
ImGui::SliderFloat2("WindowTitleAlign", (float*)&style.WindowTitleAlign, 0.0f, 1.0f, "%.2f");
|
||||||
ImGui::Combo("WindowMenuButtonPosition", (int*)&style.WindowMenuButtonPosition, "Left\0Right\0");
|
int window_menu_button_position = style.WindowMenuButtonPosition + 1;
|
||||||
|
if (ImGui::Combo("WindowMenuButtonPosition", (int*)&window_menu_button_position, "None\0Left\0Right\0"))
|
||||||
|
style.WindowMenuButtonPosition = window_menu_button_position - 1;
|
||||||
ImGui::Combo("ColorButtonPosition", (int*)&style.ColorButtonPosition, "Left\0Right\0");
|
ImGui::Combo("ColorButtonPosition", (int*)&style.ColorButtonPosition, "Left\0Right\0");
|
||||||
ImGui::SliderFloat2("ButtonTextAlign", (float*)&style.ButtonTextAlign, 0.0f, 1.0f, "%.2f"); ImGui::SameLine(); HelpMarker("Alignment applies when a button is larger than its text content.");
|
ImGui::SliderFloat2("ButtonTextAlign", (float*)&style.ButtonTextAlign, 0.0f, 1.0f, "%.2f"); ImGui::SameLine(); HelpMarker("Alignment applies when a button is larger than its text content.");
|
||||||
ImGui::SliderFloat2("SelectableTextAlign", (float*)&style.SelectableTextAlign, 0.0f, 1.0f, "%.2f"); ImGui::SameLine(); HelpMarker("Alignment applies when a selectable is larger than its text content.");
|
ImGui::SliderFloat2("SelectableTextAlign", (float*)&style.SelectableTextAlign, 0.0f, 1.0f, "%.2f"); ImGui::SameLine(); HelpMarker("Alignment applies when a selectable is larger than its text content.");
|
||||||
@ -3284,7 +3286,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
ImGui::InputFloat("Font offset", &font->DisplayOffset.y, 1, 1, "%.0f");
|
ImGui::InputFloat("Font offset", &font->DisplayOffset.y, 1, 1, "%.0f");
|
||||||
ImGui::Text("Ascent: %f, Descent: %f, Height: %f", font->Ascent, font->Descent, font->Ascent - font->Descent);
|
ImGui::Text("Ascent: %f, Descent: %f, Height: %f", font->Ascent, font->Descent, font->Ascent - font->Descent);
|
||||||
ImGui::Text("Fallback character: '%c' (U+%04X)", font->FallbackChar, font->FallbackChar);
|
ImGui::Text("Fallback character: '%c' (U+%04X)", font->FallbackChar, font->FallbackChar);
|
||||||
ImGui::Text("Ellipsis character: '%c' (U+%04X)", font->EllipsisChar);
|
ImGui::Text("Ellipsis character: '%c' (U+%04X)", font->EllipsisChar, font->EllipsisChar);
|
||||||
const float surface_sqrt = sqrtf((float)font->MetricsTotalSurface);
|
const float surface_sqrt = sqrtf((float)font->MetricsTotalSurface);
|
||||||
ImGui::Text("Texture surface: %d pixels (approx) ~ %dx%d", font->MetricsTotalSurface, (int)surface_sqrt, (int)surface_sqrt);
|
ImGui::Text("Texture surface: %d pixels (approx) ~ %dx%d", font->MetricsTotalSurface, (int)surface_sqrt, (int)surface_sqrt);
|
||||||
for (int config_i = 0; config_i < font->ConfigDataCount; config_i++)
|
for (int config_i = 0; config_i < font->ConfigDataCount; config_i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user