Skip to content

Commit

Permalink
Update imgui and imgui_test_engine (v1.91.7 WIP) / Fix #295, cf ocorn…
Browse files Browse the repository at this point in the history
…ut/imgui#8242

Many thanks to ocornut for his help!
  • Loading branch information
pthom committed Dec 18, 2024
1 parent 8ae753e commit bd7d372
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 94 deletions.
87 changes: 52 additions & 35 deletions bindings/imgui_bundle/imgui/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ ImVec4Like = Union[ImVec4, Tuple[int | float, int | float, int | float, int | fl
##################################################
# <litgen_stub> // Autogenerated code below! Do not edit!
#################### <generated_from:imgui.h> ####################
# dear imgui, v1.91.5
# dear imgui, v1.91.7 WIP
# (headers)

# Help:
Expand Down Expand Up @@ -1414,6 +1414,7 @@ def text_link_open_url(label: str, url: Optional[str] = None) -> None:
# - Read about ImTextureID here: https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples
# - 'uv0' and 'uv1' are texture coordinates. Read about them from the same link above.
# - Note that Image() may add +2.0 to provided size if a border is visible, ImageButton() adds style.FramePadding*2.0 to provided size.
# - ImageButton() draws a background based on regular Button() color + optionally an inner background if specified.
# IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2& image_size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), const ImVec4& tint_col = ImVec4(1, 1, 1, 1), const ImVec4& border_col = ImVec4(0, 0, 0, 0)); /* original C++ signature */
def image(
user_texture_id: ImTextureID,
Expand Down Expand Up @@ -1991,6 +1992,7 @@ def is_item_toggled_selection() -> bool:

# Widgets: List Boxes
# - This is essentially a thin wrapper to using BeginChild/EndChild with the ImGuiChildFlags_FrameStyle flag for stylistic changes + displaying a label.
# - If you don't need a label you can probably simply use BeginChild() with the ImGuiChildFlags_FrameStyle flag for the same result.
# - You can submit contents and manage your selection state however you want it, by creating e.g. Selectable() or any other items.
# - The simplified/old ListBox() api are helpers over BeginListBox()/EndListBox() which are kept available for convenience purpose. This is analoguous to how Combos are created.
# - Choose frame width: size.x > 0.0: custom / size.x < 0.0 or -FLT_MIN: right-align / size.x = 0.0 (default): use current ItemWidth
Expand Down Expand Up @@ -3288,27 +3290,33 @@ class InputTextFlags_(enum.Enum):
enum.auto()
) # (= 1 << 16) # Disable undo/redo. Note that input text owns the text data while active, if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID().

# Elide display / Alignment
# ImGuiInputTextFlags_ElideLeft = 1 << 17, /* original C++ signature */
elide_left = (
enum.auto()
) # (= 1 << 17) # When text doesn't fit, elide left side to ensure right side stays visible. Useful for path/filenames. Single-line only!

# Callback features
# ImGuiInputTextFlags_CallbackCompletion = 1 << 17, /* original C++ signature */
callback_completion = enum.auto() # (= 1 << 17) # Callback on pressing TAB (for completion handling)
# ImGuiInputTextFlags_CallbackHistory = 1 << 18, /* original C++ signature */
callback_history = enum.auto() # (= 1 << 18) # Callback on pressing Up/Down arrows (for history handling)
# ImGuiInputTextFlags_CallbackAlways = 1 << 19, /* original C++ signature */
# ImGuiInputTextFlags_CallbackCompletion = 1 << 18, /* original C++ signature */
callback_completion = enum.auto() # (= 1 << 18) # Callback on pressing TAB (for completion handling)
# ImGuiInputTextFlags_CallbackHistory = 1 << 19, /* original C++ signature */
callback_history = enum.auto() # (= 1 << 19) # Callback on pressing Up/Down arrows (for history handling)
# ImGuiInputTextFlags_CallbackAlways = 1 << 20, /* original C++ signature */
callback_always = (
enum.auto()
) # (= 1 << 19) # Callback on each iteration. User code may query cursor position, modify text buffer.
# ImGuiInputTextFlags_CallbackCharFilter = 1 << 20, /* original C++ signature */
) # (= 1 << 20) # Callback on each iteration. User code may query cursor position, modify text buffer.
# ImGuiInputTextFlags_CallbackCharFilter = 1 << 21, /* original C++ signature */
callback_char_filter = (
enum.auto()
) # (= 1 << 20) # Callback on character inputs to replace or discard them. Modify 'EventChar' to replace or discard, or return 1 in callback to discard.
# ImGuiInputTextFlags_CallbackResize = 1 << 21, /* original C++ signature */
) # (= 1 << 21) # Callback on character inputs to replace or discard them. Modify 'EventChar' to replace or discard, or return 1 in callback to discard.
# ImGuiInputTextFlags_CallbackResize = 1 << 22, /* original C++ signature */
callback_resize = (
enum.auto()
) # (= 1 << 21) # Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. Notify when the string wants to be resized (for string types which hold a cache of their Size). You will be provided a new BufSize in the callback and NEED to honor it. (see misc/cpp/imgui_stdlib.h for an example of using this)
# ImGuiInputTextFlags_CallbackEdit = 1 << 22, /* original C++ signature */
) # (= 1 << 22) # Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. Notify when the string wants to be resized (for string types which hold a cache of their Size). You will be provided a new BufSize in the callback and NEED to honor it. (see misc/cpp/imgui_stdlib.h for an example of using this)
# ImGuiInputTextFlags_CallbackEdit = 1 << 23, /* original C++ signature */
callback_edit = (
enum.auto()
) # (= 1 << 22) # Callback on any edit (note that InputText() already returns True on edit, the callback is useful mainly to manipulate the underlying buffer while focus is active)
) # (= 1 << 23) # Callback on any edit (note that InputText() already returns True on edit, the callback is useful mainly to manipulate the underlying buffer while focus is active)

# Obsolete names
# ImGuiInputTextFlags_AlwaysInsertMode = ImGuiInputTextFlags_AlwaysOverwrite // [renamed in 1.82] name was not matching behavior
Expand Down Expand Up @@ -4719,6 +4727,10 @@ class SliderFlags_(enum.Enum):
clamp_zero_range = (
enum.auto()
) # (= 1 << 10) # Clamp even if min==max==0.0. Otherwise due to legacy reason DragXXX functions don't clamp with those values. When your clamping limits are dynamic you almost always want to use it.
# ImGuiSliderFlags_NoSpeedTweaks = 1 << 11, /* original C++ signature */
no_speed_tweaks = (
enum.auto()
) # (= 1 << 11) # Disable keyboard modifiers altering tweak speed. Useful if you want to alter tweak speed yourself based on your own logic.
# ImGuiSliderFlags_AlwaysClamp = ImGuiSliderFlags_ClampOnInput | ImGuiSliderFlags_ClampZeroRange, /* original C++ signature */
always_clamp = enum.auto() # (= SliderFlags_ClampOnInput | SliderFlags_ClampZeroRange)
# ImGuiSliderFlags_InvalidMask_ = 0x7000000F, /* original C++ signature */
Expand Down Expand Up @@ -8589,6 +8601,7 @@ class IO:
# (the imgui_impl_xxxx backend files are setting those up for you)
# ------------------------------------------------------------------

# Nowadays those would be stored in ImGuiPlatformIO but we are leaving them here for legacy reasons.
# Optional: Platform/Renderer backend name (informational only! will be displayed in About Window) + User data for backend/wrappers to store their own stuff.
# const char* BackendPlatformName; /* original C++ signature */
backend_platform_name: str # = None # (const)
Expand Down Expand Up @@ -9317,7 +9330,8 @@ class ListClipper:
# - Add '#define IMGUI_DEFINE_MATH_OPERATORS' before including this file (or in imconfig.h) to access courtesy maths operators for ImVec2 and ImVec4.

# Helpers macros to generate 32-bit encoded colors
# User can declare their own format by #defining the 5 _SHIFT/_MASK macros in their imconfig file.
# - User can declare their own format by #defining the 5 _SHIFT/_MASK macros in their imconfig file.
# - Any setting other than the default will need custom backend support. The only standard backend that supports anything else than the default is DirectX9.

class ImColor:
"""Helper: ImColor() implicitly converts colors to either ImU32 (packed 4x1 byte) or ImVec4 (4x1 float)
Expand Down Expand Up @@ -9931,9 +9945,11 @@ class ImDrawList:
# const char* _OwnerName; /* original C++ signature */
_owner_name: str # Pointer to owner window's name for debugging # (const)

# ImDrawList(ImDrawListSharedData* shared_data) { memset(this, 0, sizeof(*this)); _Data = shared_data; } /* original C++ signature */
# IMGUI_API ImDrawList(ImDrawListSharedData* shared_data); /* original C++ signature */
def __init__(self, shared_data: ImDrawListSharedData) -> None:
"""If you want to create ImDrawList instances, pass them ImGui::GetDrawListSharedData() or create and use your own ImDrawListSharedData (so you can use ImDrawList without ImGui)"""
"""If you want to create ImDrawList instances, pass them ImGui::GetDrawListSharedData().
(advanced: you may create and use your own ImDrawListSharedData so you can use ImDrawList without ImGui, but that's more involved)
"""
pass
# IMGUI_API void PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect = false); /* original C++ signature */
def push_clip_rect(
Expand Down Expand Up @@ -10395,11 +10411,9 @@ class ImFontConfig:
# int OversampleV; /* original C++ signature */
oversample_v: int # 1 // Rasterize at higher quality for sub-pixel positioning. This is not really useful as we don't use sub-pixel positions on the Y axis.
# bool PixelSnapH; /* original C++ signature */
pixel_snap_h: bool # False // Align every glyph to pixel boundary. Useful e.g. if you are merging a non-pixel aligned font with the default font. If enabled, you can set OversampleH/V to 1.
pixel_snap_h: bool # False // Align every glyph AdvanceX to pixel boundaries. Useful e.g. if you are merging a non-pixel aligned font with the default font. If enabled, you can set OversampleH/V to 1.
# ImVec2 GlyphExtraSpacing; /* original C++ signature */
glyph_extra_spacing: (
ImVec2 # 0, 0 // Extra spacing (in pixels) between glyphs. Only X axis is supported for now.
)
glyph_extra_spacing: ImVec2 # 0, 0 // Extra spacing (in pixels) between glyphs when rendered: essentially add to glyph->AdvanceX. Only X axis is supported for now.
# ImVec2 GlyphOffset; /* original C++ signature */
glyph_offset: ImVec2 # 0, 0 // Offset all glyphs from this font input.
# float GlyphMinAdvanceX; /* original C++ signature */
Expand All @@ -10415,7 +10429,7 @@ class ImFontConfig:
# float RasterizerDensity; /* original C++ signature */
rasterizer_density: float # 1.0 // DPI scale for rasterization, not altering other font metrics: make it easy to swap between e.g. a 100% and a 400% fonts for a zooming display. IMPORTANT: If you increase this it is expected that you increase font scale accordingly, otherwise quality may look lowered.
# ImWchar EllipsisChar; /* original C++ signature */
ellipsis_char: ImWchar # -1 // Explicitly specify unicode codepoint of ellipsis character. When fonts are being merged first specified ellipsis will be used.
ellipsis_char: ImWchar # 0 // Explicitly specify unicode codepoint of ellipsis character. When fonts are being merged first specified ellipsis will be used.

# [Internal]
# ImFont* DstFont; /* original C++ signature */
Expand Down Expand Up @@ -10531,21 +10545,23 @@ class ImFontGlyphRangesBuilder:
class ImFontAtlasCustomRect:
"""See ImFontAtlas::AddCustomRectXXX functions."""

# unsigned short Width, /* original C++ signature */
width: int # Input // Desired rectangle dimension
# Height; /* original C++ signature */
height: int # Input // Desired rectangle dimension
# unsigned short X, /* original C++ signature */
x: int # Output // Packed position in Atlas
# Y; /* original C++ signature */
y: int # Output // Packed position in Atlas

# [Internal]
# unsigned short Width, /* original C++ signature */
width: int # Input // Desired rectangle dimension
# Height; /* original C++ signature */
height: int # Input // Desired rectangle dimension
# float GlyphAdvanceX; /* original C++ signature */
glyph_advance_x: float # Input // For custom font glyphs only: glyph xadvance
# ImVec2 GlyphOffset; /* original C++ signature */
glyph_offset: ImVec2 # Input // For custom font glyphs only: glyph display offset
# ImFont* Font; /* original C++ signature */
font: ImFont # Input // For custom font glyphs only: target font
# ImFontAtlasCustomRect() { Width = Height = 0; X = Y = 0xFFFF; GlyphID = 0; GlyphColored = 0; GlyphAdvanceX = 0.0f; GlyphOffset = ImVec2(0, 0); Font = NULL; } /* original C++ signature */
# ImFontAtlasCustomRect() { X = Y = 0xFFFF; Width = Height = 0; GlyphID = 0; GlyphColored = 0; GlyphAdvanceX = 0.0f; GlyphOffset = ImVec2(0, 0); Font = NULL; } /* original C++ signature */
def __init__(self) -> None:
pass
# bool IsPacked() const { return X != 0xFFFF; } /* original C++ signature */
Expand Down Expand Up @@ -10764,7 +10780,7 @@ class ImFontAtlas:
# int TexDesiredWidth; /* original C++ signature */
tex_desired_width: int # Texture width desired by user before Build(). Must be a power-of-two. If have many glyphs your graphics API have texture size restrictions you may want to increase texture width to decrease height.
# int TexGlyphPadding; /* original C++ signature */
tex_glyph_padding: int # Padding between glyphs within texture in pixels. Defaults to 1. If your rendering method doesn't rely on bilinear filtering you may set this to 0 (will also need to set AntiAliasedLinesUseTex = False).
tex_glyph_padding: int # FIXME: Should be called "TexPackPadding". Padding between glyphs within texture in pixels. Defaults to 1. If your rendering method doesn't rely on bilinear filtering you may set this to 0 (will also need to set AntiAliasedLinesUseTex = False).
# bool Locked; /* original C++ signature */
locked: bool # Marked as Locked by ImGui::NewFrame() so attempt to modify the atlas will assert.
# void* UserData; /* original C++ signature */
Expand Down Expand Up @@ -10812,35 +10828,36 @@ class ImFont:
ImFontAtlas automatically loads a default embedded font for you when you call GetTexDataAsAlpha8() or GetTexDataAsRGBA32().
"""

# Members: Hot ~20/24 bytes (for CalcTextSize)
# [Internal] Members: Hot ~20/24 bytes (for CalcTextSize)
# ImVector<float> IndexAdvanceX; /* original C++ signature */
index_advance_x: ImVector_float # 12-16 // out // // Sparse. Glyphs->AdvanceX in a directly indexable way (cache-friendly for CalcTextSize functions which only this info, and are often bottleneck in large UI).
# float FallbackAdvanceX; /* original C++ signature */
fallback_advance_x: float # 4 // out // = FallbackGlyph->AdvanceX
# float FontSize; /* original C++ signature */
font_size: float # 4 // in // // Height of characters/line, set during loading (don't change after loading)

# Members: Hot ~28/40 bytes (for CalcTextSize + render loop)
# [Internal] Members: Hot ~28/40 bytes (for RenderText loop)
# ImVector<ImWchar> IndexLookup; /* original C++ signature */
index_lookup: ImVector_ImWchar # 12-16 // out // // Sparse. Index glyphs by Unicode code-point.
# ImVector<ImFontGlyph> Glyphs; /* original C++ signature */
glyphs: ImVector_ImFontGlyph # 12-16 // out // // All glyphs.
# const ImFontGlyph* FallbackGlyph; /* original C++ signature */
fallback_glyph: ImFontGlyph # 4-8 // out // = FindGlyph(FontFallbackChar) # (const)

# Members: Cold ~32/40 bytes
# [Internal] Members: Cold ~32/40 bytes
# Conceptually ConfigData[] is the list of font sources merged to create this font.
# ImFontAtlas* ContainerAtlas; /* original C++ signature */
container_atlas: ImFontAtlas # 4-8 // out // // What we has been loaded into
# const ImFontConfig* ConfigData; /* original C++ signature */
config_data: ImFontConfig # 4-8 // in // // Pointer within ContainerAtlas->ConfigData # (const)
config_data: ImFontConfig # 4-8 // in // // Pointer within ContainerAtlas->ConfigData to ConfigDataCount instances # (const)
# short ConfigDataCount; /* original C++ signature */
config_data_count: int # 2 // in // ~ 1 // Number of ImFontConfig involved in creating this font. Bigger than 1 when merging multiple font sources into one ImFont.
# ImWchar FallbackChar; /* original C++ signature */
fallback_char: ImWchar # 2 // out // = FFFD/'?' // Character used if a glyph isn't found.
# ImWchar EllipsisChar; /* original C++ signature */
ellipsis_char: ImWchar # 2 // out // = '...'/'.'// Character used for ellipsis rendering.
# short EllipsisCharCount; /* original C++ signature */
ellipsis_char_count: int # 1 // out // 1 or 3
# ImWchar EllipsisChar; /* original C++ signature */
ellipsis_char: ImWchar # 2-4 // out // = '...'/'.'// Character used for ellipsis rendering.
# ImWchar FallbackChar; /* original C++ signature */
fallback_char: ImWchar # 2-4 // out // = FFFD/'?' // Character used if a glyph isn't found.
# float EllipsisWidth; /* original C++ signature */
ellipsis_width: float # 4 // out // Width
# float EllipsisCharStep; /* original C++ signature */
Expand Down
Loading

0 comments on commit bd7d372

Please sign in to comment.