Skip to content

Commit

Permalink
update imgui bindings: fix #159
Browse files Browse the repository at this point in the history
  • Loading branch information
pthom committed Dec 26, 2023
1 parent ccc388d commit 5b7dc2a
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 48 deletions.
31 changes: 20 additions & 11 deletions bindings/imgui_bundle/imgui/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,13 @@ INDEX_SIZE: int
# A single decoded U16 character/code point. We encode them as multi bytes UTF-8 when used in strings.

# Callback and functions types
# #ifdef IMGUI_BUNDLE_PYTHON_API
#
# Callback function for ImGui::SetNextWindowSizeConstraints()
# #else
#
# #endif
#

class ImVec2:
# float x, /* original C++ signature */
Expand Down Expand Up @@ -7923,9 +7930,9 @@ class IO:
# float IniSavingRate; /* original C++ signature */
ini_saving_rate: float # = 5.0 // Minimum time between saving positions/sizes to .ini file, in seconds.
# const char* IniFilename; /* original C++ signature */
ini_filename: str # = "imgui.ini" // Path to .ini file (important: default "imgui.ini" is relative to current working dir!). Set None to disable automatic .ini loading/saving or if you want to manually call LoadIniSettingsXXX() / SaveIniSettingsXXX() functions.
ini_filename: str # = "imgui.ini" // Path to .ini file (important: default "imgui.ini" is relative to current working dir!). Set None to disable automatic .ini loading/saving or if you want to manually call LoadIniSettingsXXX() / SaveIniSettingsXXX() functions. # (const)
# const char* LogFilename; /* original C++ signature */
log_filename: str # = "imgui_log.txt"// Path to .log file (default parameter to ImGui::LogToFile when no file is specified).
log_filename: str # = "imgui_log.txt"// Path to .log file (default parameter to ImGui::LogToFile when no file is specified). # (const)
# void* UserData; /* original C++ signature */
user_data: Any # = None // Store your own data.

Expand Down Expand Up @@ -8023,9 +8030,9 @@ class IO:

# 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
backend_platform_name: str # = None # (const)
# const char* BackendRendererName; /* original C++ signature */
backend_renderer_name: str # = None
backend_renderer_name: str # = None # (const)
# void* BackendPlatformUserData; /* original C++ signature */
backend_platform_user_data: Any # = None // User data for platform backend
# void* BackendRendererUserData; /* original C++ signature */
Expand Down Expand Up @@ -8298,6 +8305,8 @@ class InputTextCallbackData:
event_char: ImWchar # Character input // Read-write // [CharFilter] Replace character with another one, or set to zero to drop. return 1 is equivalent to setting EventChar=0;
# ImGuiKey EventKey; /* original C++ signature */
event_key: Key # Key pressed (Up/Down/TAB) // Read-only // [Completion,History]
# char* Buf; /* original C++ signature */
buf: char # Text buffer // Read-write // [Resize] Can replace pointer / [Completion,History,Always] Only write to pointed data, don't replace the actual pointer! # (read-only)
# int BufTextLen; /* original C++ signature */
buf_text_len: int # Text length (in bytes) // Read-write // [Resize,Completion,History,Always] Exclude zero-terminator storage. In C land: == strlen(some_text), in C++ land: string.length()
# int BufSize; /* original C++ signature */
Expand Down Expand Up @@ -8464,7 +8473,7 @@ class TableSortSpecs:
"""

# const ImGuiTableColumnSortSpecs* Specs; /* original C++ signature */
specs: TableColumnSortSpecs # Pointer to sort spec array.
specs: TableColumnSortSpecs # Pointer to sort spec array. # (const)
# int SpecsCount; /* original C++ signature */
specs_count: int # Sort spec count. Most often 1. May be > 1 when ImGuiTableFlags_SortMulti is enabled. May be == 0 when ImGuiTableFlags_SortTristate is enabled.
# bool SpecsDirty; /* original C++ signature */
Expand Down Expand Up @@ -8533,9 +8542,9 @@ class TextFilter:
"""[Internal]"""

# const char* b; /* original C++ signature */
b: str
b: str # (const)
# const char* e; /* original C++ signature */
e: str
e: str # (const)

# ImGuiTextRange() { b = e = NULL; } /* original C++ signature */
@overload
Expand Down Expand Up @@ -9057,7 +9066,7 @@ class ImDrawList:
# ImDrawListSharedData* _Data; /* original C++ signature */
_data: ImDrawListSharedData # Pointer to shared draw data (you can use ImGui::GetDrawListSharedData() to get the one from current ImGui context)
# const char* _OwnerName; /* original C++ signature */
_owner_name: str # Pointer to owner window's name for debugging
_owner_name: str # Pointer to owner window's name for debugging # (const)
# ImDrawVert* _VtxWritePtr; /* original C++ signature */
_vtx_write_ptr: ImDrawVert # [Internal] point within VtxBuffer.Data after each add command (to avoid using the ImVector<> operators too much)
# ImDrawIdx* _IdxWritePtr; /* original C++ signature */
Expand Down Expand Up @@ -9986,7 +9995,7 @@ class ImFontAtlas:

# [Internal] Font builder
# const ImFontBuilderIO* FontBuilderIO; /* original C++ signature */
font_builder_io: ImFontBuilderIO # Opaque interface to a font builder (default to stb_truetype, can be changed to use FreeType by defining IMGUI_ENABLE_FREETYPE).
font_builder_io: ImFontBuilderIO # Opaque interface to a font builder (default to stb_truetype, can be changed to use FreeType by defining IMGUI_ENABLE_FREETYPE). # (const)
# unsigned int FontBuilderFlags; /* original C++ signature */
font_builder_flags: int # Shared flags (for all fonts) for custom font builder. THIS IS BUILD IMPLEMENTATION DEPENDENT. Per-font override is also available in ImFontConfig.

Expand Down Expand Up @@ -10019,13 +10028,13 @@ class ImFont:
# 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)
fallback_glyph: ImFontGlyph # 4-8 // out // = FindGlyph(FontFallbackChar) # (const)

# Members: Cold ~32/40 bytes
# 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
config_data: ImFontConfig # 4-8 // in // // Pointer within ContainerAtlas->ConfigData # (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 */
Expand Down
66 changes: 34 additions & 32 deletions bindings/imgui_bundle/imgui/internal.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ class ImDrawListSharedData:
# ImU8 CircleSegmentCounts[64]; /* original C++ signature */
circle_segment_counts: np.ndarray # ndarray[type=ImU8, size=64] # Precomputed segment count for given radius before we calculate it dynamically (to avoid calculation overhead)
# const ImVec4* TexUvLines; /* original C++ signature */
tex_uv_lines: ImVec4 # UV of anti-aliased lines in the atlas
tex_uv_lines: ImVec4 # UV of anti-aliased lines in the atlas # (const)

# ImDrawListSharedData(); /* original C++ signature */
def __init__(self) -> None:
Expand Down Expand Up @@ -1240,11 +1240,11 @@ class DataTypeInfo:
# size_t Size; /* original C++ signature */
size: int # Size in bytes
# const char* Name; /* original C++ signature */
name: str # Short descriptive name for the type, for debugging
name: str # Short descriptive name for the type, for debugging # (const)
# const char* PrintFmt; /* original C++ signature */
print_fmt: str # Default printf format for the type
print_fmt: str # Default printf format for the type # (const)
# const char* ScanFmt; /* original C++ signature */
scan_fmt: str # Default scanf format for the type
scan_fmt: str # Default scanf format for the type # (const)
# ImGuiDataTypeInfo(size_t Size = size_t()); /* original C++ signature */
def __init__(self, size: int = int()) -> None:
"""Auto-generated default constructor with named params"""
Expand Down Expand Up @@ -2353,7 +2353,7 @@ class TypingSelectRequest:
# int SearchBufferLen; /* original C++ signature */
search_buffer_len: int
# const char* SearchBuffer; /* original C++ signature */
search_buffer: str # Search buffer contents (use full string. unless SingleCharMode is set, in which case use SingleCharSize).
search_buffer: str # Search buffer contents (use full string. unless SingleCharMode is set, in which case use SingleCharSize). # (const)
# bool SelectRequest; /* original C++ signature */
select_request: bool # Set when buffer was modified this frame, requesting a selection.
# bool SingleCharMode; /* original C++ signature */
Expand Down Expand Up @@ -2880,7 +2880,7 @@ class WindowSettings:

class SettingsHandler:
# const char* TypeName; /* original C++ signature */
type_name: str # Short description stored in .ini file. Disallowed characters: '[' ']'
type_name: str # Short description stored in .ini file. Disallowed characters: '[' ']' # (const)
# ImGuiID TypeHash; /* original C++ signature */
type_hash: ID # == ImHashStr(TypeName)
# void* UserData; /* original C++ signature */
Expand Down Expand Up @@ -2927,7 +2927,7 @@ class LocEntry:
# ImGuiLocKey Key; /* original C++ signature */
key: LocKey
# const char* Text; /* original C++ signature */
text: str
text: str # (const)
# ImGuiLocEntry(ImGuiLocKey Key = ImGuiLocKey()); /* original C++ signature */
def __init__(self, key: LocKey = LocKey()) -> None:
"""Auto-generated default constructor with named params"""
Expand Down Expand Up @@ -3620,9 +3620,9 @@ class Context:
# ImGuiTextBuffer LogBuffer; /* original C++ signature */
log_buffer: TextBuffer # Accumulation buffer when log to clipboard. This is pointer so our GImGui static constructor doesn't call heap allocators.
# const char* LogNextPrefix; /* original C++ signature */
log_next_prefix: str
log_next_prefix: str # (const)
# const char* LogNextSuffix; /* original C++ signature */
log_next_suffix: str
log_next_suffix: str # (const)
# float LogLinePosY; /* original C++ signature */
log_line_pos_y: float
# bool LogLineFirstItem; /* original C++ signature */
Expand Down Expand Up @@ -3684,7 +3684,7 @@ class Context:
# {
# IO.Ctx = this;
# InputTextState.Ctx = this;
# // _SRCML_EMPTY_LINE_
#
# Initialized = false;
# ConfigFlagsCurrFrame = ConfigFlagsLastFrame = ImGuiConfigFlags_None;
# FontAtlasOwnedByContext = shared_font_atlas ? false : true;
Expand All @@ -3698,10 +3698,10 @@ class Context:
# GcCompactAll = false;
# TestEngineHookItems = false;
# TestEngine = NULL;
# // _SRCML_EMPTY_LINE_
#
# InputEventsNextMouseSource = ImGuiMouseSource_Mouse;
# InputEventsNextEventId = 1;
# // _SRCML_EMPTY_LINE_
#
# WindowsActiveCount = 0;
# CurrentWindow = NULL;
# HoveredWindow = NULL;
Expand All @@ -3710,7 +3710,7 @@ class Context:
# WheelingWindow = NULL;
# WheelingWindowStartFrame = WheelingWindowScrolledFrame = -1;
# WheelingWindowReleaseTimer = 0.0f;
# // _SRCML_EMPTY_LINE_
#
# DebugHookIdInfo = 0;
# HoveredId = HoveredIdPreviousFrame = 0;
# HoveredIdAllowOverlap = false;
Expand All @@ -3735,25 +3735,25 @@ class Context:
# ActiveIdPreviousFrameWindow = NULL;
# LastActiveId = 0;
# LastActiveIdTimer = 0.0f;
# // _SRCML_EMPTY_LINE_
#
# ActiveIdUsingNavDirMask = 0x00;
# ActiveIdUsingAllKeyboardKeys = false;
# #ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
# ActiveIdUsingNavInputMask = 0x00;
# #endif
# // _SRCML_EMPTY_LINE_
#
# CurrentFocusScopeId = 0;
# CurrentItemFlags = ImGuiItemFlags_None;
# DebugShowGroupRects = false;
# BeginMenuCount = 0;
# // _SRCML_EMPTY_LINE_
#
# CurrentDpiScale = 0.0f;
# CurrentViewport = NULL;
# MouseViewport = MouseLastHoveredViewport = NULL;
# PlatformLastFocusedViewportId = 0;
# ViewportCreatedCount = PlatformWindowsCreatedCount = 0;
# ViewportFocusedStampCount = 0;
# // _SRCML_EMPTY_LINE_
#
# NavWindow = NULL;
# NavId = NavFocusScopeId = NavActivateId = NavActivateDownId = NavActivatePressedId = 0;
# NavJustMovedToId = NavJustMovedToFocusScopeId = NavNextActivateId = 0;
Expand All @@ -3779,15 +3779,15 @@ class Context:
# NavScoringDebugCount = 0;
# NavTabbingDir = 0;
# NavTabbingCounter = 0;
# // _SRCML_EMPTY_LINE_
#
# ConfigNavWindowingKeyNext = ImGuiMod_Ctrl | ImGuiKey_Tab;
# ConfigNavWindowingKeyPrev = ImGuiMod_Ctrl | ImGuiMod_Shift | ImGuiKey_Tab;
# NavWindowingTarget = NavWindowingTargetAnim = NavWindowingListWindow = NULL;
# NavWindowingTimer = NavWindowingHighlightAlpha = 0.0f;
# NavWindowingToggleLayer = false;
# // _SRCML_EMPTY_LINE_
#
# DimBgRatio = 0.0f;
# // _SRCML_EMPTY_LINE_
#
# DragDropActive = DragDropWithinSource = DragDropWithinTarget = false;
# DragDropSourceFlags = ImGuiDragDropFlags_None;
# DragDropSourceFrameCount = -1;
Expand All @@ -3799,19 +3799,19 @@ class Context:
# DragDropAcceptFrameCount = -1;
# DragDropHoldJustPressedId = 0;
# memset(DragDropPayloadBufLocal, 0, sizeof(DragDropPayloadBufLocal));
# // _SRCML_EMPTY_LINE_
#
# ClipperTempDataStacked = 0;
# // _SRCML_EMPTY_LINE_
#
# CurrentTable = NULL;
# TablesTempDataStacked = 0;
# CurrentTabBar = NULL;
# // _SRCML_EMPTY_LINE_
#
# HoverItemDelayId = HoverItemDelayIdPreviousFrame = HoverItemUnlockedStationaryId = HoverWindowUnlockedStationaryId = 0;
# HoverItemDelayTimer = HoverItemDelayClearTimer = 0.0f;
# // _SRCML_EMPTY_LINE_
#
# MouseCursor = ImGuiMouseCursor_Arrow;
# MouseStationaryTimer = 0.0f;
# // _SRCML_EMPTY_LINE_
#
# TempInputId = 0;
# ColorEditOptions = ImGuiColorEditFlags_DefaultOptions_;
# ColorEditCurrentID = ColorEditSavedID = 0;
Expand All @@ -3829,19 +3829,19 @@ class Context:
# DisabledStackSize = 0;
# LockMarkEdited = 0;
# TooltipOverrideCount = 0;
# // _SRCML_EMPTY_LINE_
#
# PlatformImeData.InputPos = ImVec2(0.0f, 0.0f);
# PlatformImeDataPrev.InputPos = ImVec2(-1.0f, -1.0f); // Different to ensure initial submission
# PlatformImeViewport = 0;
# // _SRCML_EMPTY_LINE_
#
# DockNodeWindowMenuHandler = NULL;
# // _SRCML_EMPTY_LINE_
#
# SettingsLoaded = false;
# SettingsDirtyTimer = 0.0f;
# HookIdNext = 0;
# // _SRCML_EMPTY_LINE_
#
# memset(LocalizationTable, 0, sizeof(LocalizationTable));
# // _SRCML_EMPTY_LINE_
#
# LogEnabled = false;
# LogType = ImGuiLogType_None;
# LogNextPrefix = LogNextSuffix = NULL;
Expand All @@ -3850,7 +3850,7 @@ class Context:
# LogLineFirstItem = false;
# LogDepthRef = 0;
# LogDepthToExpand = LogDepthToExpandDefault = 2;
# // _SRCML_EMPTY_LINE_
#
# DebugLogFlags = ImGuiDebugLogFlags_OutputToTTY;
# DebugLocateId = 0;
# DebugLogClipperAutoDisableFrames = 0;
Expand All @@ -3860,7 +3860,7 @@ class Context:
# DebugItemPickerMouseButton = ImGuiMouseButton_Left;
# DebugItemPickerBreakId = 0;
# DebugHoveredDockNode = NULL;
# // _SRCML_EMPTY_LINE_
#
# memset(FramerateSecPerFrame, 0, sizeof(FramerateSecPerFrame));
# FramerateSecPerFrameIdx = FramerateSecPerFrameCount = 0;
# FramerateSecPerFrameAccum = 0.0f;
Expand Down Expand Up @@ -4005,6 +4005,8 @@ class Window:

# ImGuiContext* Ctx; /* original C++ signature */
ctx: Context # Parent UI context (needs to be set explicitly by parent).
# char* Name; /* original C++ signature */
name: char # Window name, owned by the window. # (read-only)
# ImGuiID ID; /* original C++ signature */
id_: ID # == ImHashStr(Name)
# ImGuiWindowFlags Flags, /* original C++ signature */
Expand Down
8 changes: 4 additions & 4 deletions bindings/imgui_bundle/imgui/test_engine.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ class TestEngineIO:
# Options: Export
# While you can manually call ImGuiTestEngine_Export(), registering filename/format here ensure the crash handler will always export if application crash.
# const char* ExportResultsFilename = NULL; /* original C++ signature */
export_results_filename: str = None
export_results_filename: str = None # (const)

# Options: Sanity Checks
# bool CheckDrawDataIntegrity = false; /* original C++ signature */
Expand Down Expand Up @@ -896,7 +896,7 @@ class TestActionFilter:
# int MaxPasses; /* original C++ signature */
max_passes: int
# const int* MaxItemCountPerDepth; /* original C++ signature */
max_item_count_per_depth: int
max_item_count_per_depth: int # (const)
# ImGuiItemStatusFlags RequireAllStatusFlags; /* original C++ signature */
require_all_status_flags: ItemStatusFlags
# ImGuiItemStatusFlags RequireAnyStatusFlags; /* original C++ signature */
Expand Down Expand Up @@ -2049,10 +2049,10 @@ class TestFindByLabelTask:
# int InSuffixDepth = 0; /* original C++ signature */
in_suffix_depth: int = 0 # Number of labels in a path, after unknown base ID (for "hello/**/foo/bar" it would be 2)
# const char* InSuffix = NULL; /* original C++ signature */
in_suffix: str = None # A label string which appears on ID stack after unknown base ID (for "hello/**/foo/bar" it would be "foo/bar")
in_suffix: str = None # A label string which appears on ID stack after unknown base ID (for "hello/**/foo/bar" it would be "foo/bar") # (const)
# const char* InSuffixLastItem = NULL; /* original C++ signature */
in_suffix_last_item: str = (
None # A last label string (for "hello/**/foo/bar" it would be "bar")
None # A last label string (for "hello/**/foo/bar" it would be "bar") # (const)
)
# ImGuiID InSuffixLastItemHash = 0; /* original C++ signature */
in_suffix_last_item_hash: ID = 0
Expand Down
Loading

0 comments on commit 5b7dc2a

Please sign in to comment.