Skip to content

Conversation

@Teselka
Copy link
Contributor

@Teselka Teselka commented Nov 3, 2025

Hello! This adds an ability to specify next window/child window border draw flags.

2025-11-04.01-43-33.mp4

Usage example:

 ImGuiWindowFlags window_flags = 0;
 if (!has_title_bar)
     window_flags |= ImGuiWindowFlags_NoTitleBar;
 if (has_menu_bar)
     window_flags |= ImGuiWindowFlags_MenuBar;

 static bool has_top_left_border = false;
 static bool has_bottom_left_border = false;
 static bool has_top_right_border = false;
 static bool has_bottom_right_border = false;

 ImDrawFlags border_draw_flags = 0;
 if (has_top_left_border)
     border_draw_flags |= ImDrawFlags_RoundCornersTopLeft;
 if (has_bottom_left_border)
     border_draw_flags |= ImDrawFlags_RoundCornersBottomLeft;
 if (has_top_right_border)
     border_draw_flags |= ImDrawFlags_RoundCornersTopRight;
 if (has_bottom_right_border)
     border_draw_flags |= ImDrawFlags_RoundCornersBottomRight;

 ImGui::SetNextWindowBorderDrawFlags(border_draw_flags);
 ImGui::Begin("Borders Test", 0, window_flags);

 ImGui::Checkbox("Title Bar", &has_title_bar);
 ImGui::Checkbox("Menu Bar", &has_menu_bar);

 ImGui::Checkbox("Top Left", &has_top_left_border);
 ImGui::Checkbox("Bottom Left", &has_bottom_left_border);
 ImGui::Checkbox("Top Right", &has_top_right_border);
 ImGui::Checkbox("Bottom Right", &has_bottom_right_border);

 ImGui::SetNextWindowBorderDrawFlags(border_draw_flags);
 ImGui::BeginChild("Child", ImGui::GetContentRegionAvail(), ImGuiChildFlags_Borders);

 ImGui::TextUnformatted("Child Text!");

 ImGui::EndChild();

Signed-off-by: Teselka <tesla1999savin@gmail.com>
Signed-off-by: Teselka <tesla1999savin@gmail.com>
@ocornut
Copy link
Owner

ocornut commented Nov 3, 2025

What’s your use case? Why do you need that?
Why not simply disabling the window border and draw one yourself after Begin() ?

@ocornut ocornut added the style label Nov 3, 2025
@Teselka
Copy link
Contributor Author

Teselka commented Nov 4, 2025

What’s your use case? Why do you need that? Why not simply disabling the window border and draw one yourself after Begin() ?

I'm rendering child window with rounded borders and i want to make specific corner not rounded (in my case left bottom one), drawing it manually every time is not really handful for me

image

@ocornut
Copy link
Owner

ocornut commented Nov 4, 2025

it manually every time is not really handful for me

I don’t understand what you mean. Isn’t that a single AddRect call to add?

@Teselka
Copy link
Contributor Author

Teselka commented Nov 4, 2025

it manually every time is not really handful for me

I don’t understand what you mean. Isn’t that a single AddRect call to add?

Actually yes + query position/size after Begin(), but you can't do this with root windows

@ocornut
Copy link
Owner

ocornut commented Nov 4, 2025

Well do you have a use case for root windows?

API wise it would make more sense to store this inside the Style struct, e.g. style.WindowRoundingFlags, no reason to introduce ImGuiNextWindowDataFlags_HasBorderDrawFlags, SetNextWindowBorderDrawFlags().

@Teselka
Copy link
Contributor Author

Teselka commented Nov 5, 2025

I agree that it makes more sense to make it a style variable and i guess if nobody needs this one except for me it's not needed to be a part of the imgui

@Teselka Teselka closed this Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants