You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please consider to include these API improvements which I think are generally useful.
1. Negative size calculation
I often use the negative size feature to request size expansion to the right/bottom edge. Some widgets (such as Table or Selectable/sizeY) already expand when specifying zero size because it's their default behavior. But zero value often means different behavior for other widgets such as Button or InputText. So if one wants to request expansion reliably the best way is to pass -1. Unfortunately -1 will leave one pixel gap. That may not be noticeable by the user but I wonder why the size calculation doesn't use +1 term to compensate for it?
2. IsItemContextMenuClicked
Simple helper to implement context menus. This would be a shortcut to ImGui::IsMouseReleased(ImGuiPopupFlags_MouseButtonDefault_) && ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup); which I find too long to remember.
3. IsCurrentItemDisabled
It's useful to know we are inside a ImGuiItemFlags_Disabled block. For example the property grid shows modified properties in bold font but if the property is disabled it should use a regular font. This currently requires internal API usage: ImGui::GetCurrentContext()->CurrentItemFlags & ImGuiItemFlags_Disabled
4. Spacing(value = 0)
Both SameLine() and Indent() allow to specify the exact gap value. It would be nice for Spacing to allow the same so one doesn't need to call it repeatedly for spacing multiplies. There isn't a way to specify non-default spacing other than use SetCursorY.
Sometimes there is a need to ignore window padding for few items but not all. For example a ModalPopup may contain a Child with different color in the middle but all widgets in Child and outside should otherwise respect same window padding values. It would be easier to Push/Pop instead of setting ModalPopup WindowPadding to zero then lay down 3 Children which specify original WindowPading again. I have implemented it but instead of simply pushing the StyleVar value the code modifies ClipRect, WorkRect, CursorScreenPos directly.
6. GetFontByName(name)
I find it easier to give loaded fonts names through ImFontConfig::Name then access the font by its name e.g. GetFontByName("H1") instead of keeping ImFont pointers somewhere and pass them around.
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
No response
The text was updated successfully, but these errors were encountered:
Version/Branch of Dear ImGui:
1.91.6 docking
Back-ends:
opengl3, glfw
Compiler, OS:
windows 10 + msvc 2022
Full config/build information:
No response
Details:
Please consider to include these API improvements which I think are generally useful.
1. Negative size calculation
I often use the negative size feature to request size expansion to the right/bottom edge. Some widgets (such as
Table
orSelectable
/sizeY) already expand when specifying zero size because it's their default behavior. But zero value often means different behavior for other widgets such asButton
orInputText
. So if one wants to request expansion reliably the best way is to pass -1. Unfortunately -1 will leave one pixel gap. That may not be noticeable by the user but I wonder why the size calculation doesn't use +1 term to compensate for it?2. IsItemContextMenuClicked
Simple helper to implement context menus. This would be a shortcut to
ImGui::IsMouseReleased(ImGuiPopupFlags_MouseButtonDefault_) && ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup);
which I find too long to remember.3. IsCurrentItemDisabled
It's useful to know we are inside a
ImGuiItemFlags_Disabled
block. For example the property grid shows modified properties in bold font but if the property is disabled it should use a regular font. This currently requires internal API usage:ImGui::GetCurrentContext()->CurrentItemFlags & ImGuiItemFlags_Disabled
4. Spacing(value = 0)
Both
SameLine()
andIndent()
allow to specify the exact gap value. It would be nice forSpacing
to allow the same so one doesn't need to call it repeatedly for spacing multiplies. There isn't a way to specify non-default spacing other than useSetCursorY
.5. SetNextWindowIgnorePadding / Push/Pop/IgnoreWindowPadding
Sometimes there is a need to ignore window padding for few items but not all. For example a ModalPopup may contain a
Child
with different color in the middle but all widgets in Child and outside should otherwise respect same window padding values. It would be easier to Push/Pop instead of setting ModalPopup WindowPadding to zero then lay down 3 Children which specify original WindowPading again. I have implemented it but instead of simply pushing the StyleVar value the code modifies ClipRect, WorkRect, CursorScreenPos directly.6. GetFontByName(name)
I find it easier to give loaded fonts names through
ImFontConfig::Name
then access the font by its name e.g.GetFontByName("H1")
instead of keepingImFont
pointers somewhere and pass them around.Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
No response
The text was updated successfully, but these errors were encountered: