ocornut / imgui

Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
MIT License
57.74k stars 9.9k forks source link

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

Open SrinSS01 opened 1 month ago

SrinSS01 commented 1 month ago

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

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 commented 1 month ago

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 commented 1 month ago

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.