rigImGui 0.1.1
RigKit pack API - rigImGui
Loading...
Searching...
No Matches
UiDpi.h File Reference
#include <imgui.h>
#include <algorithm>
#include <cmath>
Include dependency graph for UiDpi.h:
This graph shows which files directly or indirectly include this file:

Functions

float rigkit::uiDpi ()
 Live ImGui content scale after Mui::applyDpiStyle.
float rigkit::uiPx (float design)
 Design (1x) size to ImGui/Display units.
ImVec2 rigkit::uiSize (float designW, float designH)
 Design width/height to ImGui/Display ImVec2.
ImVec2 rigkit::uiClampToWork (ImVec2 size, float padDesign=40.f)
 Clamp a display size into the main viewport work area.
ImVec2 rigkit::uiHitSize (ImVec2 size)
 Size for an InvisibleButton hit box, never zero on either axis.
void rigkit::uiWindowSize (int designW, int designH, int &outW, int &outH, float padDesign=40.f)
 Design size to int window size, clamped to the work area.
float rigkit::chromeMenuBarCursorX ()
 Cursor X for host menu items (before BeginMenu's half-ItemSpacing nudge).
float rigkit::chromeBarPadX ()
 Left inset for status-bar / unframed chrome text.
float rigkit::uiTextButtonWidth (const char *label)
 Frame width of a text button, including padding.
bool rigkit::uiSameLineIfFits (float nextWidth)
 SameLine only when the rest of the row can hold nextWidth.
float rigkit::uiWidthMinus (float reserved)
 Remaining row width after reserving reserved (never below 1).

Function Documentation

◆ chromeBarPadX()

float rigkit::chromeBarPadX ( )
inline

Left inset for status-bar / unframed chrome text.

Matches the File label after BeginMenu's half-ItemSpacing nudge.

◆ chromeMenuBarCursorX()

float rigkit::chromeMenuBarCursorX ( )
inline

Cursor X for host menu items (before BeginMenu's half-ItemSpacing nudge).

BeginMenu (horizontal) then adds ItemSpacing.x / 2 so the File label sits at chromeBarPadX().

◆ uiClampToWork()

ImVec2 rigkit::uiClampToWork ( ImVec2 size,
float padDesign = 40.f )
inline

Clamp a display size into the main viewport work area.

Parameters
sizeDisplay-unit size (already passed through uiPx / uiSize).
padDesignMargin from work edges in 1x design units.

◆ uiDpi()

float rigkit::uiDpi ( )
inline

Live ImGui content scale after Mui::applyDpiStyle.

Reads style.FontScaleDpi - no stored mirror. Valid inside an ImGui frame; returns 1 when there is no context or the scale is unset/tiny.

◆ uiHitSize()

ImVec2 rigkit::uiHitSize ( ImVec2 size)
inline

Size for an InvisibleButton hit box, never zero on either axis.

A docked panel measures zero while a layout settles - restoring a layout saved on a wider screen is enough to do it - and InvisibleButton asserts on a zero dimension. One pixel keeps the hit box alive until the panel has room again.

◆ uiSameLineIfFits()

bool rigkit::uiSameLineIfFits ( float nextWidth)
inline

SameLine only when the rest of the row can hold nextWidth.

Narrow docks clip SameLine buttons; stack them instead.