Skip to content

Commit bd7d372

Browse files
committed
Update imgui and imgui_test_engine (v1.91.7 WIP) / Fix #295, cf ocornut/imgui#8242
Many thanks to ocornut for his help!
1 parent 8ae753e commit bd7d372

File tree

6 files changed

+142
-94
lines changed

6 files changed

+142
-94
lines changed

bindings/imgui_bundle/imgui/__init__.pyi

Lines changed: 52 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ ImVec4Like = Union[ImVec4, Tuple[int | float, int | float, int | float, int | fl
342342
##################################################
343343
# <litgen_stub> // Autogenerated code below! Do not edit!
344344
#################### <generated_from:imgui.h> ####################
345-
# dear imgui, v1.91.5
345+
# dear imgui, v1.91.7 WIP
346346
# (headers)
347347

348348
# Help:
@@ -1414,6 +1414,7 @@ def text_link_open_url(label: str, url: Optional[str] = None) -> None:
14141414
# - Read about ImTextureID here: https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples
14151415
# - 'uv0' and 'uv1' are texture coordinates. Read about them from the same link above.
14161416
# - Note that Image() may add +2.0 to provided size if a border is visible, ImageButton() adds style.FramePadding*2.0 to provided size.
1417+
# - ImageButton() draws a background based on regular Button() color + optionally an inner background if specified.
14171418
# 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 */
14181419
def image(
14191420
user_texture_id: ImTextureID,
@@ -1991,6 +1992,7 @@ def is_item_toggled_selection() -> bool:
19911992

19921993
# Widgets: List Boxes
19931994
# - This is essentially a thin wrapper to using BeginChild/EndChild with the ImGuiChildFlags_FrameStyle flag for stylistic changes + displaying a label.
1995+
# - If you don't need a label you can probably simply use BeginChild() with the ImGuiChildFlags_FrameStyle flag for the same result.
19941996
# - You can submit contents and manage your selection state however you want it, by creating e.g. Selectable() or any other items.
19951997
# - 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.
19961998
# - 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
@@ -3288,27 +3290,33 @@ class InputTextFlags_(enum.Enum):
32883290
enum.auto()
32893291
) # (= 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().
32903292

3293+
# Elide display / Alignment
3294+
# ImGuiInputTextFlags_ElideLeft = 1 << 17, /* original C++ signature */
3295+
elide_left = (
3296+
enum.auto()
3297+
) # (= 1 << 17) # When text doesn't fit, elide left side to ensure right side stays visible. Useful for path/filenames. Single-line only!
3298+
32913299
# Callback features
3292-
# ImGuiInputTextFlags_CallbackCompletion = 1 << 17, /* original C++ signature */
3293-
callback_completion = enum.auto() # (= 1 << 17) # Callback on pressing TAB (for completion handling)
3294-
# ImGuiInputTextFlags_CallbackHistory = 1 << 18, /* original C++ signature */
3295-
callback_history = enum.auto() # (= 1 << 18) # Callback on pressing Up/Down arrows (for history handling)
3296-
# ImGuiInputTextFlags_CallbackAlways = 1 << 19, /* original C++ signature */
3300+
# ImGuiInputTextFlags_CallbackCompletion = 1 << 18, /* original C++ signature */
3301+
callback_completion = enum.auto() # (= 1 << 18) # Callback on pressing TAB (for completion handling)
3302+
# ImGuiInputTextFlags_CallbackHistory = 1 << 19, /* original C++ signature */
3303+
callback_history = enum.auto() # (= 1 << 19) # Callback on pressing Up/Down arrows (for history handling)
3304+
# ImGuiInputTextFlags_CallbackAlways = 1 << 20, /* original C++ signature */
32973305
callback_always = (
32983306
enum.auto()
3299-
) # (= 1 << 19) # Callback on each iteration. User code may query cursor position, modify text buffer.
3300-
# ImGuiInputTextFlags_CallbackCharFilter = 1 << 20, /* original C++ signature */
3307+
) # (= 1 << 20) # Callback on each iteration. User code may query cursor position, modify text buffer.
3308+
# ImGuiInputTextFlags_CallbackCharFilter = 1 << 21, /* original C++ signature */
33013309
callback_char_filter = (
33023310
enum.auto()
3303-
) # (= 1 << 20) # Callback on character inputs to replace or discard them. Modify 'EventChar' to replace or discard, or return 1 in callback to discard.
3304-
# ImGuiInputTextFlags_CallbackResize = 1 << 21, /* original C++ signature */
3311+
) # (= 1 << 21) # Callback on character inputs to replace or discard them. Modify 'EventChar' to replace or discard, or return 1 in callback to discard.
3312+
# ImGuiInputTextFlags_CallbackResize = 1 << 22, /* original C++ signature */
33053313
callback_resize = (
33063314
enum.auto()
3307-
) # (= 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)
3308-
# ImGuiInputTextFlags_CallbackEdit = 1 << 22, /* original C++ signature */
3315+
) # (= 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)
3316+
# ImGuiInputTextFlags_CallbackEdit = 1 << 23, /* original C++ signature */
33093317
callback_edit = (
33103318
enum.auto()
3311-
) # (= 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)
3319+
) # (= 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)
33123320

33133321
# Obsolete names
33143322
# ImGuiInputTextFlags_AlwaysInsertMode = ImGuiInputTextFlags_AlwaysOverwrite // [renamed in 1.82] name was not matching behavior
@@ -4719,6 +4727,10 @@ class SliderFlags_(enum.Enum):
47194727
clamp_zero_range = (
47204728
enum.auto()
47214729
) # (= 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.
4730+
# ImGuiSliderFlags_NoSpeedTweaks = 1 << 11, /* original C++ signature */
4731+
no_speed_tweaks = (
4732+
enum.auto()
4733+
) # (= 1 << 11) # Disable keyboard modifiers altering tweak speed. Useful if you want to alter tweak speed yourself based on your own logic.
47224734
# ImGuiSliderFlags_AlwaysClamp = ImGuiSliderFlags_ClampOnInput | ImGuiSliderFlags_ClampZeroRange, /* original C++ signature */
47234735
always_clamp = enum.auto() # (= SliderFlags_ClampOnInput | SliderFlags_ClampZeroRange)
47244736
# ImGuiSliderFlags_InvalidMask_ = 0x7000000F, /* original C++ signature */
@@ -8589,6 +8601,7 @@ class IO:
85898601
# (the imgui_impl_xxxx backend files are setting those up for you)
85908602
# ------------------------------------------------------------------
85918603

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

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

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

9934-
# ImDrawList(ImDrawListSharedData* shared_data) { memset(this, 0, sizeof(*this)); _Data = shared_data; } /* original C++ signature */
9948+
# IMGUI_API ImDrawList(ImDrawListSharedData* shared_data); /* original C++ signature */
99359949
def __init__(self, shared_data: ImDrawListSharedData) -> None:
9936-
"""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)"""
9950+
"""If you want to create ImDrawList instances, pass them ImGui::GetDrawListSharedData().
9951+
(advanced: you may create and use your own ImDrawListSharedData so you can use ImDrawList without ImGui, but that's more involved)
9952+
"""
99379953
pass
99389954
# IMGUI_API void PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect = false); /* original C++ signature */
99399955
def push_clip_rect(
@@ -10395,11 +10411,9 @@ class ImFontConfig:
1039510411
# int OversampleV; /* original C++ signature */
1039610412
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.
1039710413
# bool PixelSnapH; /* original C++ signature */
10398-
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.
10414+
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.
1039910415
# ImVec2 GlyphExtraSpacing; /* original C++ signature */
10400-
glyph_extra_spacing: (
10401-
ImVec2 # 0, 0 // Extra spacing (in pixels) between glyphs. Only X axis is supported for now.
10402-
)
10416+
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.
1040310417
# ImVec2 GlyphOffset; /* original C++ signature */
1040410418
glyph_offset: ImVec2 # 0, 0 // Offset all glyphs from this font input.
1040510419
# float GlyphMinAdvanceX; /* original C++ signature */
@@ -10415,7 +10429,7 @@ class ImFontConfig:
1041510429
# float RasterizerDensity; /* original C++ signature */
1041610430
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.
1041710431
# ImWchar EllipsisChar; /* original C++ signature */
10418-
ellipsis_char: ImWchar # -1 // Explicitly specify unicode codepoint of ellipsis character. When fonts are being merged first specified ellipsis will be used.
10432+
ellipsis_char: ImWchar # 0 // Explicitly specify unicode codepoint of ellipsis character. When fonts are being merged first specified ellipsis will be used.
1041910433

1042010434
# [Internal]
1042110435
# ImFont* DstFont; /* original C++ signature */
@@ -10531,21 +10545,23 @@ class ImFontGlyphRangesBuilder:
1053110545
class ImFontAtlasCustomRect:
1053210546
"""See ImFontAtlas::AddCustomRectXXX functions."""
1053310547

10534-
# unsigned short Width, /* original C++ signature */
10535-
width: int # Input // Desired rectangle dimension
10536-
# Height; /* original C++ signature */
10537-
height: int # Input // Desired rectangle dimension
1053810548
# unsigned short X, /* original C++ signature */
1053910549
x: int # Output // Packed position in Atlas
1054010550
# Y; /* original C++ signature */
1054110551
y: int # Output // Packed position in Atlas
10552+
10553+
# [Internal]
10554+
# unsigned short Width, /* original C++ signature */
10555+
width: int # Input // Desired rectangle dimension
10556+
# Height; /* original C++ signature */
10557+
height: int # Input // Desired rectangle dimension
1054210558
# float GlyphAdvanceX; /* original C++ signature */
1054310559
glyph_advance_x: float # Input // For custom font glyphs only: glyph xadvance
1054410560
# ImVec2 GlyphOffset; /* original C++ signature */
1054510561
glyph_offset: ImVec2 # Input // For custom font glyphs only: glyph display offset
1054610562
# ImFont* Font; /* original C++ signature */
1054710563
font: ImFont # Input // For custom font glyphs only: target font
10548-
# ImFontAtlasCustomRect() { Width = Height = 0; X = Y = 0xFFFF; GlyphID = 0; GlyphColored = 0; GlyphAdvanceX = 0.0f; GlyphOffset = ImVec2(0, 0); Font = NULL; } /* original C++ signature */
10564+
# ImFontAtlasCustomRect() { X = Y = 0xFFFF; Width = Height = 0; GlyphID = 0; GlyphColored = 0; GlyphAdvanceX = 0.0f; GlyphOffset = ImVec2(0, 0); Font = NULL; } /* original C++ signature */
1054910565
def __init__(self) -> None:
1055010566
pass
1055110567
# bool IsPacked() const { return X != 0xFFFF; } /* original C++ signature */
@@ -10764,7 +10780,7 @@ class ImFontAtlas:
1076410780
# int TexDesiredWidth; /* original C++ signature */
1076510781
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.
1076610782
# int TexGlyphPadding; /* original C++ signature */
10767-
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).
10783+
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).
1076810784
# bool Locked; /* original C++ signature */
1076910785
locked: bool # Marked as Locked by ImGui::NewFrame() so attempt to modify the atlas will assert.
1077010786
# void* UserData; /* original C++ signature */
@@ -10812,35 +10828,36 @@ class ImFont:
1081210828
ImFontAtlas automatically loads a default embedded font for you when you call GetTexDataAsAlpha8() or GetTexDataAsRGBA32().
1081310829
"""
1081410830

10815-
# Members: Hot ~20/24 bytes (for CalcTextSize)
10831+
# [Internal] Members: Hot ~20/24 bytes (for CalcTextSize)
1081610832
# ImVector<float> IndexAdvanceX; /* original C++ signature */
1081710833
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).
1081810834
# float FallbackAdvanceX; /* original C++ signature */
1081910835
fallback_advance_x: float # 4 // out // = FallbackGlyph->AdvanceX
1082010836
# float FontSize; /* original C++ signature */
1082110837
font_size: float # 4 // in // // Height of characters/line, set during loading (don't change after loading)
1082210838

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

10831-
# Members: Cold ~32/40 bytes
10847+
# [Internal] Members: Cold ~32/40 bytes
10848+
# Conceptually ConfigData[] is the list of font sources merged to create this font.
1083210849
# ImFontAtlas* ContainerAtlas; /* original C++ signature */
1083310850
container_atlas: ImFontAtlas # 4-8 // out // // What we has been loaded into
1083410851
# const ImFontConfig* ConfigData; /* original C++ signature */
10835-
config_data: ImFontConfig # 4-8 // in // // Pointer within ContainerAtlas->ConfigData # (const)
10852+
config_data: ImFontConfig # 4-8 // in // // Pointer within ContainerAtlas->ConfigData to ConfigDataCount instances # (const)
1083610853
# short ConfigDataCount; /* original C++ signature */
1083710854
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.
10838-
# ImWchar FallbackChar; /* original C++ signature */
10839-
fallback_char: ImWchar # 2 // out // = FFFD/'?' // Character used if a glyph isn't found.
10840-
# ImWchar EllipsisChar; /* original C++ signature */
10841-
ellipsis_char: ImWchar # 2 // out // = '...'/'.'// Character used for ellipsis rendering.
1084210855
# short EllipsisCharCount; /* original C++ signature */
1084310856
ellipsis_char_count: int # 1 // out // 1 or 3
10857+
# ImWchar EllipsisChar; /* original C++ signature */
10858+
ellipsis_char: ImWchar # 2-4 // out // = '...'/'.'// Character used for ellipsis rendering.
10859+
# ImWchar FallbackChar; /* original C++ signature */
10860+
fallback_char: ImWchar # 2-4 // out // = FFFD/'?' // Character used if a glyph isn't found.
1084410861
# float EllipsisWidth; /* original C++ signature */
1084510862
ellipsis_width: float # 4 // out // Width
1084610863
# float EllipsisCharStep; /* original C++ signature */

0 commit comments

Comments
 (0)