Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use ImGui rounding style for ImGui::MenuItems? #7589

Open
SrinSS01 opened this issue May 15, 2024 · 2 comments
Open

How to use ImGui rounding style for ImGui::MenuItems? #7589

SrinSS01 opened this issue May 15, 2024 · 2 comments
Labels
menus menu bars, menu items style

Comments

@SrinSS01
Copy link

SrinSS01 commented May 15, 2024

Version/Branch of Dear ImGui:

Version 1.90.6, Branch: master

Back-ends:

imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp

Compiler, OS:

Windows 11 + emscripten GCC

Full config/build information:

image
image

Details:

How to use ImGui rounding style for ImGui::MenuItems?

I am using ImGui in web browser through emscripten.
while searching through the rounding style vars, the only ones available are

  • ImGuiStyleVar_WindowRounding
  • ImGuiStyleVar_ChildRounding
  • ImGuiStyleVar_PopupRounding
  • ImGuiStyleVar_FrameRounding
  • ImGuiStyleVar_ScrollbarRounding
  • ImGuiStyleVar_GrabRounding
  • ImGuiStyleVar_TabRounding

I was rendering an ImGui Menu item and was wondering how to enable rounding effect for each Items
The popup window is having rounded corners but the items inside it are still sharp edges which makes it look kinda odd, you can refer to the attached screenshot.

I tried all the style vars but none are showing any effects.

Any idea how to make rounded Menu items?

Screenshots/Video:

image

Minimal, Complete and Verifiable Example code:

// Here's some code anyone can copy and paste to reproduce your issue
ImGuiStyle& style = ImGui::GetStyle();
        
  style.PopupRounding = 9;
  if (ImGui::BeginMainMenuBar()) {
      if (ImGui::BeginMenu("File")) {
          ImGui::MenuItem("Test", "Ctrl+T");
          ImGui::MenuItem("Test", "Ctrl+T");
          ImGui::MenuItem("Test", "Ctrl+T");
          ImGui::MenuItem("Test", "Ctrl+T");
          ImGui::EndMenu();
      }
      ImGui::EndMainMenuBar();
  }
@ocornut ocornut added style menus menu bars, menu items labels May 15, 2024
@ocornut
Copy link
Owner

ocornut commented May 15, 2024

We don't support rounding Menu Items or Selectables.
One reason is Selectables are meant to fill space without gaps. Another reason is that I have an idea in mind for a future more general-purpose Selectable API which may make it more difficult to implement if rounded.

I suppose menu items, even though they are selectable, may not need to cater for those restrictions and we could lift them for Menu Items. However if your aim is to make everything round you are not going to be able to do it with selectables.

Full config/build information:

(FYI, there is a "Copy to clipboard" button in that About window.)

@SrinSS01
Copy link
Author

Thanks for the update. I don't require round effect to selectables in general, I would appreciate if only Menu items can have that feature.

(FYI, there is a "Copy to clipboard" button in that About window.)

In ImGui glfw opengl3 implementation with emscripten, copy to clipboard doesn't seem to be working from the browser for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
menus menu bars, menu items style
Projects
None yet
Development

No branches or pull requests

2 participants