diff --git a/Makefile b/Makefile index df1a7a9da..b2820a659 100644 --- a/Makefile +++ b/Makefile @@ -17,18 +17,20 @@ setup: # $2: include path (of header file) # $3: definitions.json filepath # $4: structs_and_enums.json filepath -# $5: additional agruments to codegen call (e.g. -r option) +# $5: typedefs_dict.json filepath +# $6: additional agruments to codegen call (e.g. -r option) define generate @echo "Generating for $(1)" - ./codegen -p $(1) -i $(2) -d $(3) -e $(4) $(5) + ./codegen -p $(1) -i $(2) -d $(3) -e $(4) -t $(5) $(6) go run mvdan.cc/gofumpt@latest -w $(1)_enums.go - go run mvdan.cc/gofumpt@latest -w $(1)_structs.go go run mvdan.cc/gofumpt@latest -w $(1)_funcs.go + go run mvdan.cc/gofumpt@latest -w $(1)_typedefs.go go run golang.org/x/tools/cmd/goimports@latest -w $(1)_funcs.go + go run golang.org/x/tools/cmd/goimports@latest -w $(1)_typedefs.go endef define cimgui - $(call generate,cimgui,cimgui/cimgui.h,cimgui/cimgui_templates/definitions.json,cimgui/cimgui_templates/structs_and_enums.json) + $(call generate,cimgui,cimgui/cimgui.h,cimgui/cimgui_templates/definitions.json,cimgui/cimgui_templates/structs_and_enums.json, cimgui/cimgui_templates/typedefs_dict.json) endef ## cimgui: generate cimgui binding @@ -37,7 +39,7 @@ cimgui: setup $(call cimgui) define cimplot - $(call generate,cimplot,cimgui/cimplot.h,cimgui/cimplot_templates/definitions.json,cimgui/cimplot_templates/structs_and_enums.json,-r cimgui/cimgui_templates/structs_and_enums.json) + $(call generate,cimplot,cimgui/cimplot.h,cimgui/cimplot_templates/definitions.json,cimgui/cimplot_templates/structs_and_enums.json,cimgui/cimplot_templates/typedefs_dict.json,-r cimgui/cimgui_templates/structs_and_enums.json -rt cimgui/cimgui_templates/typedefs_dict.json) endef ## cimplot: generate implot binding @@ -46,7 +48,7 @@ cimplot: setup $(call cimplot) define cimnodes - $(call generate,cimnodes,cimgui/cimnodes.h,cimgui/cimnodes_templates/definitions.json,cimgui/cimnodes_templates/structs_and_enums.json,-r cimgui/cimgui_templates/structs_and_enums.json) + $(call generate,cimnodes,cimgui/cimnodes.h,cimgui/cimnodes_templates/definitions.json,cimgui/cimnodes_templates/structs_and_enums.json,cimgui/cimnodes_templates/typedefs_dict.json,-r cimgui/cimgui_templates/structs_and_enums.json -rt cimgui/cimgui_templates/typedefs_dict.json) endef ## cimnodes: generate imnodes binding @@ -55,7 +57,7 @@ cimnodes: setup $(call cimnodes) define cimmarkdown - $(call generate,cimmarkdown,cimgui/cimmarkdown.h,cimgui/cimmarkdown_templates/definitions.json,cimgui/cimmarkdown_templates/structs_and_enums.json,-r cimgui/cimgui_templates/structs_and_enums.json) + $(call generate,cimmarkdown,cimgui/cimmarkdown.h,cimgui/cimmarkdown_templates/definitions.json,cimgui/cimmarkdown_templates/structs_and_enums.json,cimgui/cimmarkdown_templates/typedefs_dict.json,-r cimgui/cimgui_templates/structs_and_enums.json -rt cimgui/cimgui_templates/typedefs_dict.json) endef ## cimmarkdown: generate immarkdown binding diff --git a/cimgui.go b/cimgui.go index 3a501c577..c14d5c2f8 100644 --- a/cimgui.go +++ b/cimgui.go @@ -3,7 +3,7 @@ package imgui // #cgo CPPFLAGS: -DCIMGUI_DEFINE_ENUMS_AND_STRUCTS // #cgo CXXFLAGS: --std=c++11 // #cgo amd64,linux LDFLAGS: ${SRCDIR}/lib/linux/x64/cimgui.a -// #cgo linux CXXFLAGS: -Wno-changes-meaning -fpermissive +// #cgo linux CXXFLAGS: -Wno-changes-meaning -Wno-invalid-conversion -fpermissive // #cgo amd64,windows LDFLAGS: -L${SRCDIR}/lib/windows/x64 -l:cimgui.a // #cgo amd64,darwin LDFLAGS: ${SRCDIR}/lib/macos/x64/cimgui.a // #cgo arm64,darwin LDFLAGS: ${SRCDIR}/lib/macos/arm64/cimgui.a diff --git a/cimgui_funcs.go b/cimgui_funcs.go index 029ed48f9..5db392bbe 100644 --- a/cimgui_funcs.go +++ b/cimgui_funcs.go @@ -81,7 +81,7 @@ func (self *DrawCmd) TexID() TextureID { defer func() { selfFin() }() - return TextureID(C.ImDrawCmd_GetTexID(selfArg)) + return *newTextureIDFromC(func() *C.ImTextureID { result := C.ImDrawCmd_GetTexID(selfArg); return &result }()) } // Also ensure our padding fields are zeroed @@ -305,9 +305,11 @@ func (self *DrawList) AddEllipseFilledV(center Vec2, radius_x float32, radius_y // col: 4294967295 func (self *DrawList) AddImageV(user_texture_id TextureID, p_min Vec2, p_max Vec2, uv_min Vec2, uv_max Vec2, col uint32) { selfArg, selfFin := self.handle() - C.ImDrawList_AddImage(selfArg, C.ImTextureID(user_texture_id), p_min.toC(), p_max.toC(), uv_min.toC(), uv_max.toC(), C.ImU32(col)) + user_texture_idArg, user_texture_idFin := user_texture_id.c() + C.ImDrawList_AddImage(selfArg, user_texture_idArg, p_min.toC(), p_max.toC(), uv_min.toC(), uv_max.toC(), C.ImU32(col)) selfFin() + user_texture_idFin() } // AddImageQuadV parameter default value hint: @@ -318,18 +320,22 @@ func (self *DrawList) AddImageV(user_texture_id TextureID, p_min Vec2, p_max Vec // col: 4294967295 func (self *DrawList) AddImageQuadV(user_texture_id TextureID, p1 Vec2, p2 Vec2, p3 Vec2, p4 Vec2, uv1 Vec2, uv2 Vec2, uv3 Vec2, uv4 Vec2, col uint32) { selfArg, selfFin := self.handle() - C.ImDrawList_AddImageQuad(selfArg, C.ImTextureID(user_texture_id), p1.toC(), p2.toC(), p3.toC(), p4.toC(), uv1.toC(), uv2.toC(), uv3.toC(), uv4.toC(), C.ImU32(col)) + user_texture_idArg, user_texture_idFin := user_texture_id.c() + C.ImDrawList_AddImageQuad(selfArg, user_texture_idArg, p1.toC(), p2.toC(), p3.toC(), p4.toC(), uv1.toC(), uv2.toC(), uv3.toC(), uv4.toC(), C.ImU32(col)) selfFin() + user_texture_idFin() } // AddImageRoundedV parameter default value hint: // flags: 0 func (self *DrawList) AddImageRoundedV(user_texture_id TextureID, p_min Vec2, p_max Vec2, uv_min Vec2, uv_max Vec2, col uint32, rounding float32, flags DrawFlags) { selfArg, selfFin := self.handle() - C.ImDrawList_AddImageRounded(selfArg, C.ImTextureID(user_texture_id), p_min.toC(), p_max.toC(), uv_min.toC(), uv_max.toC(), C.ImU32(col), C.float(rounding), C.ImDrawFlags(flags)) + user_texture_idArg, user_texture_idFin := user_texture_id.c() + C.ImDrawList_AddImageRounded(selfArg, user_texture_idArg, p_min.toC(), p_max.toC(), uv_min.toC(), uv_max.toC(), C.ImU32(col), C.float(rounding), C.ImDrawFlags(flags)) selfFin() + user_texture_idFin() } // AddLineV parameter default value hint: @@ -673,13 +679,6 @@ func (self *DrawList) PrimVtx(pos Vec2, uv Vec2, col uint32) { selfFin() } -func (self *DrawList) PrimWriteIdx(idx DrawIdx) { - selfArg, selfFin := self.handle() - C.ImDrawList_PrimWriteIdx(selfArg, C.ImDrawIdx(idx)) - - selfFin() -} - func (self *DrawList) PrimWriteVtx(pos Vec2, uv Vec2, col uint32) { selfArg, selfFin := self.handle() C.ImDrawList_PrimWriteVtx(selfArg, pos.toC(), uv.toC(), C.ImU32(col)) @@ -706,9 +705,11 @@ func (self *DrawList) PushClipRectFullScreen() { func (self *DrawList) PushTextureID(texture_id TextureID) { selfArg, selfFin := self.handle() - C.ImDrawList_PushTextureID(selfArg, C.ImTextureID(texture_id)) + texture_idArg, texture_idFin := texture_id.c() + C.ImDrawList_PushTextureID(selfArg, texture_idArg) selfFin() + texture_idFin() } func (self *DrawList) CalcCircleAutoSegmentCount(radius float32) int32 { @@ -893,7 +894,7 @@ func (self *FontAtlas) AddFontFromMemoryCompressedBase85TTFV(compressed_font_dat // AddFontFromMemoryCompressedTTFV parameter default value hint: // font_cfg: NULL // glyph_ranges: NULL -func (self *FontAtlas) AddFontFromMemoryCompressedTTFV(compressed_font_data unsafe.Pointer, compressed_font_data_size int32, size_pixels float32, font_cfg *FontConfig, glyph_ranges *Wchar) *Font { +func (self *FontAtlas) AddFontFromMemoryCompressedTTFV(compressed_font_data uintptr, compressed_font_data_size int32, size_pixels float32, font_cfg *FontConfig, glyph_ranges *Wchar) *Font { selfArg, selfFin := self.handle() font_cfgArg, font_cfgFin := font_cfg.handle() @@ -901,24 +902,22 @@ func (self *FontAtlas) AddFontFromMemoryCompressedTTFV(compressed_font_data unsa selfFin() font_cfgFin() }() - return newFontFromC(C.ImFontAtlas_AddFontFromMemoryCompressedTTF(selfArg, (compressed_font_data), C.int(compressed_font_data_size), C.float(size_pixels), font_cfgArg, (*C.ImWchar)(glyph_ranges))) + return newFontFromC(C.wrap_ImFontAtlas_AddFontFromMemoryCompressedTTFV(selfArg, C.uintptr_t(compressed_font_data), C.int(compressed_font_data_size), C.float(size_pixels), font_cfgArg, (*C.ImWchar)(glyph_ranges))) } // Note: Transfer ownership of 'ttf_data' to ImFontAtlas! Will be deleted after destruction of the atlas. Set font_cfg->FontDataOwnedByAtlas=false to keep ownership of your data and it won't be freed. // AddFontFromMemoryTTFV parameter default value hint: // font_cfg: NULL // glyph_ranges: NULL -func (self *FontAtlas) AddFontFromMemoryTTFV(font_data unsafe.Pointer, font_data_size int32, size_pixels float32, font_cfg *FontConfig, glyph_ranges *Wchar) *Font { +func (self *FontAtlas) AddFontFromMemoryTTFV(font_data uintptr, font_data_size int32, size_pixels float32, font_cfg *FontConfig, glyph_ranges *Wchar) *Font { selfArg, selfFin := self.handle() - font_dataArg, font_dataFin := WrapVoidPtr(font_data) font_cfgArg, font_cfgFin := font_cfg.handle() defer func() { selfFin() - font_dataFin() font_cfgFin() }() - return newFontFromC(C.ImFontAtlas_AddFontFromMemoryTTF(selfArg, font_dataArg, C.int(font_data_size), C.float(size_pixels), font_cfgArg, (*C.ImWchar)(glyph_ranges))) + return newFontFromC(C.wrap_ImFontAtlas_AddFontFromMemoryTTFV(selfArg, C.uintptr_t(font_data), C.int(font_data_size), C.float(size_pixels), font_cfgArg, (*C.ImWchar)(glyph_ranges))) } // Build pixels data. This is called automatically for you by the GetTexData*** functions. @@ -1127,9 +1126,11 @@ func (self *FontAtlas) IsBuilt() bool { func (self *FontAtlas) SetTexID(id TextureID) { selfArg, selfFin := self.handle() - C.ImFontAtlas_SetTexID(selfArg, C.ImTextureID(id)) + idArg, idFin := id.c() + C.ImFontAtlas_SetTexID(selfArg, idArg) selfFin() + idFin() } func (self *FontAtlas) Destroy() { @@ -1453,15 +1454,13 @@ func (self *Context) Destroy() { selfFin() } -func (self *DataVarInfo) InternalVarPtr(parent unsafe.Pointer) unsafe.Pointer { +func (self *DataVarInfo) InternalVarPtr(parent uintptr) uintptr { selfArg, selfFin := self.handle() - parentArg, parentFin := WrapVoidPtr(parent) defer func() { selfFin() - parentFin() }() - return unsafe.Pointer(C.ImGuiDataVarInfo_GetVarPtr(selfArg, parentArg)) + return uintptr(C.wrap_ImGuiDataVarInfo_GetVarPtr(selfArg, C.uintptr_t(parent))) } func InternalNewDockContext() *DockContext { @@ -1476,7 +1475,12 @@ func (self *DockContext) Destroy() { } func InternalNewDockNode(id ID) *DockNode { - return newDockNodeFromC(C.ImGuiDockNode_ImGuiDockNode(C.ImGuiID(id))) + idArg, idFin := id.c() + + defer func() { + idFin() + }() + return newDockNodeFromC(C.ImGuiDockNode_ImGuiDockNode(idArg)) } func (self *DockNode) InternalIsCentralNode() bool { @@ -1673,9 +1677,11 @@ func (self *IO) AddMouseSourceEvent(source MouseSource) { // Queue a mouse hovered viewport. Requires backend to set ImGuiBackendFlags_HasMouseHoveredViewport to call this (for multi-viewport support). func (self *IO) AddMouseViewportEvent(id ID) { selfArg, selfFin := self.handle() - C.ImGuiIO_AddMouseViewportEvent(selfArg, C.ImGuiID(id)) + idArg, idFin := id.c() + C.ImGuiIO_AddMouseViewportEvent(selfArg, idArg) selfFin() + idFin() } // Queue a mouse wheel update. wheel_y<0: scroll down, wheel_y>0: scroll up, wheel_x<0: scroll right, wheel_x>0: scroll left. @@ -2283,13 +2289,8 @@ func InternalNewPtrOrIndexInt(index int32) *PtrOrIndex { return newPtrOrIndexFromC(C.ImGuiPtrOrIndex_ImGuiPtrOrIndex_Int(C.int(index))) } -func InternalNewPtrOrIndexPtr(ptr unsafe.Pointer) *PtrOrIndex { - ptrArg, ptrFin := WrapVoidPtr(ptr) - - defer func() { - ptrFin() - }() - return newPtrOrIndexFromC(C.ImGuiPtrOrIndex_ImGuiPtrOrIndex_Ptr(ptrArg)) +func InternalNewPtrOrIndexPtr(ptr uintptr) *PtrOrIndex { + return newPtrOrIndexFromC(C.wrap_ImGuiPtrOrIndex_ImGuiPtrOrIndex_Ptr(C.uintptr_t(ptr))) } func (self *PtrOrIndex) Destroy() { @@ -2362,20 +2363,30 @@ func (self *StackTool) Destroy() { } func NewStoragePairFloat(_key ID, _val_f float32) *StoragePair { - return newStoragePairFromC(C.ImGuiStoragePair_ImGuiStoragePair_Float(C.ImGuiID(_key), C.float(_val_f))) + _keyArg, _keyFin := _key.c() + + defer func() { + _keyFin() + }() + return newStoragePairFromC(C.ImGuiStoragePair_ImGuiStoragePair_Float(_keyArg, C.float(_val_f))) } func NewStoragePairInt(_key ID, _val_i int32) *StoragePair { - return newStoragePairFromC(C.ImGuiStoragePair_ImGuiStoragePair_Int(C.ImGuiID(_key), C.int(_val_i))) + _keyArg, _keyFin := _key.c() + + defer func() { + _keyFin() + }() + return newStoragePairFromC(C.ImGuiStoragePair_ImGuiStoragePair_Int(_keyArg, C.int(_val_i))) } -func NewStoragePairPtr(_key ID, _val_p unsafe.Pointer) *StoragePair { - _val_pArg, _val_pFin := WrapVoidPtr(_val_p) +func NewStoragePairPtr(_key ID, _val_p uintptr) *StoragePair { + _keyArg, _keyFin := _key.c() defer func() { - _val_pFin() + _keyFin() }() - return newStoragePairFromC(C.ImGuiStoragePair_ImGuiStoragePair_Ptr(C.ImGuiID(_key), _val_pArg)) + return newStoragePairFromC(C.wrap_ImGuiStoragePair_ImGuiStoragePair_Ptr(_keyArg, C.uintptr_t(_val_p))) } func (self *StoragePair) Destroy() { @@ -2403,65 +2414,77 @@ func (self *Storage) Clear() { // default_val: false func (self *Storage) BoolV(key ID, default_val bool) bool { selfArg, selfFin := self.handle() + keyArg, keyFin := key.c() defer func() { selfFin() + keyFin() }() - return C.ImGuiStorage_GetBool(selfArg, C.ImGuiID(key), C.bool(default_val)) == C.bool(true) + return C.ImGuiStorage_GetBool(selfArg, keyArg, C.bool(default_val)) == C.bool(true) } // FloatV parameter default value hint: // default_val: 0.0f func (self *Storage) FloatV(key ID, default_val float32) float32 { selfArg, selfFin := self.handle() + keyArg, keyFin := key.c() defer func() { selfFin() + keyFin() }() - return float32(C.ImGuiStorage_GetFloat(selfArg, C.ImGuiID(key), C.float(default_val))) + return float32(C.ImGuiStorage_GetFloat(selfArg, keyArg, C.float(default_val))) } // FloatRefV parameter default value hint: // default_val: 0.0f func (self *Storage) FloatRefV(key ID, default_val float32) *float32 { selfArg, selfFin := self.handle() + keyArg, keyFin := key.c() defer func() { selfFin() + keyFin() }() - return (*float32)(C.ImGuiStorage_GetFloatRef(selfArg, C.ImGuiID(key), C.float(default_val))) + return (*float32)(C.ImGuiStorage_GetFloatRef(selfArg, keyArg, C.float(default_val))) } // IntV parameter default value hint: // default_val: 0 func (self *Storage) IntV(key ID, default_val int32) int32 { selfArg, selfFin := self.handle() + keyArg, keyFin := key.c() defer func() { selfFin() + keyFin() }() - return int32(C.ImGuiStorage_GetInt(selfArg, C.ImGuiID(key), C.int(default_val))) + return int32(C.ImGuiStorage_GetInt(selfArg, keyArg, C.int(default_val))) } // IntRefV parameter default value hint: // default_val: 0 func (self *Storage) IntRefV(key ID, default_val int32) *int32 { selfArg, selfFin := self.handle() + keyArg, keyFin := key.c() defer func() { selfFin() + keyFin() }() - return (*int32)(C.ImGuiStorage_GetIntRef(selfArg, C.ImGuiID(key), C.int(default_val))) + return (*int32)(C.ImGuiStorage_GetIntRef(selfArg, keyArg, C.int(default_val))) } // default_val is NULL -func (self *Storage) VoidPtr(key ID) unsafe.Pointer { +func (self *Storage) VoidPtr(key ID) uintptr { selfArg, selfFin := self.handle() + keyArg, keyFin := key.c() defer func() { selfFin() + keyFin() }() - return unsafe.Pointer(C.ImGuiStorage_GetVoidPtr(selfArg, C.ImGuiID(key))) + return uintptr(C.wrap_ImGuiStorage_GetVoidPtr(selfArg, keyArg)) } func (self *Storage) SetAllInt(val int32) { @@ -2473,32 +2496,38 @@ func (self *Storage) SetAllInt(val int32) { func (self *Storage) SetBool(key ID, val bool) { selfArg, selfFin := self.handle() - C.ImGuiStorage_SetBool(selfArg, C.ImGuiID(key), C.bool(val)) + keyArg, keyFin := key.c() + C.ImGuiStorage_SetBool(selfArg, keyArg, C.bool(val)) selfFin() + keyFin() } func (self *Storage) SetFloat(key ID, val float32) { selfArg, selfFin := self.handle() - C.ImGuiStorage_SetFloat(selfArg, C.ImGuiID(key), C.float(val)) + keyArg, keyFin := key.c() + C.ImGuiStorage_SetFloat(selfArg, keyArg, C.float(val)) selfFin() + keyFin() } func (self *Storage) SetInt(key ID, val int32) { selfArg, selfFin := self.handle() - C.ImGuiStorage_SetInt(selfArg, C.ImGuiID(key), C.int(val)) + keyArg, keyFin := key.c() + C.ImGuiStorage_SetInt(selfArg, keyArg, C.int(val)) selfFin() + keyFin() } -func (self *Storage) SetVoidPtr(key ID, val unsafe.Pointer) { +func (self *Storage) SetVoidPtr(key ID, val uintptr) { selfArg, selfFin := self.handle() - valArg, valFin := WrapVoidPtr(val) - C.ImGuiStorage_SetVoidPtr(selfArg, C.ImGuiID(key), valArg) + keyArg, keyFin := key.c() + C.wrap_ImGuiStorage_SetVoidPtr(selfArg, keyArg, C.uintptr_t(val)) selfFin() - valFin() + keyFin() } func InternalNewStyleModFloat(idx StyleVar, v float32) *StyleMod { @@ -3089,7 +3118,7 @@ func (self *Window) InternalIDFromRectangle(r_abs Rect) ID { defer func() { selfFin() }() - return ID(C.ImGuiWindow_GetIDFromRectangle(selfArg, r_abs.toC())) + return *newIDFromC(func() *C.ImGuiID { result := C.ImGuiWindow_GetIDFromRectangle(selfArg, r_abs.toC()); return &result }()) } func (self *Window) InternalIDInt(n int32) ID { @@ -3098,16 +3127,16 @@ func (self *Window) InternalIDInt(n int32) ID { defer func() { selfFin() }() - return ID(C.ImGuiWindow_GetID_Int(selfArg, C.int(n))) + return *newIDFromC(func() *C.ImGuiID { result := C.ImGuiWindow_GetID_Int(selfArg, C.int(n)); return &result }()) } -func (self *Window) InternalIDPtr(ptr unsafe.Pointer) ID { +func (self *Window) InternalIDPtr(ptr uintptr) ID { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return ID(C.ImGuiWindow_GetID_Ptr(selfArg, (ptr))) + return *newIDFromC(func() *C.ImGuiID { result := C.wrap_ImGuiWindow_GetID_Ptr(selfArg, C.uintptr_t(ptr)); return &result }()) } // InternalIDStrV parameter default value hint: @@ -3122,7 +3151,7 @@ func (self *Window) InternalIDStrV(str string, str_end string) ID { strFin() str_endFin() }() - return ID(C.ImGuiWindow_GetID_Str(selfArg, strArg, str_endArg)) + return *newIDFromC(func() *C.ImGuiID { result := C.ImGuiWindow_GetID_Str(selfArg, strArg, str_endArg); return &result }()) } func InternalNewWindow(context *Context, name string) *Window { @@ -3480,7 +3509,10 @@ func AcceptDragDropPayloadV(typeArg string, flags DragDropFlags) *Payload { // Activate an item by ID (button, checkbox, tree node etc.). Activation is queued and processed on the next frame when the item is encountered again. func InternalActivateItemByID(id ID) { - C.igActivateItemByID(C.ImGuiID(id)) + idArg, idFin := id.c() + C.igActivateItemByID(idArg) + + idFin() } func InternalAddContextHook(context *Context, hook *ContextHook) ID { @@ -3491,7 +3523,7 @@ func InternalAddContextHook(context *Context, hook *ContextHook) ID { contextFin() hookFin() }() - return ID(C.igAddContextHook(contextArg, hookArg)) + return *newIDFromC(func() *C.ImGuiID { result := C.igAddContextHook(contextArg, hookArg); return &result }()) } func InternalAddSettingsHandler(handler *SettingsHandler) { @@ -3543,18 +3575,25 @@ func BeginV(name string, p_open *bool, flags WindowFlags) bool { func InternalBeginChildEx(name string, id ID, size_arg Vec2, border bool, flags WindowFlags) bool { nameArg, nameFin := WrapString(name) + idArg, idFin := id.c() defer func() { nameFin() + idFin() }() - return C.igBeginChildEx(nameArg, C.ImGuiID(id), size_arg.toC(), C.bool(border), C.ImGuiWindowFlags(flags)) == C.bool(true) + return C.igBeginChildEx(nameArg, idArg, size_arg.toC(), C.bool(border), C.ImGuiWindowFlags(flags)) == C.bool(true) } // helper to create a child window / scrolling region that looks like a normal widget frame // BeginChildFrameV parameter default value hint: // flags: 0 func BeginChildFrameV(id ID, size Vec2, flags WindowFlags) bool { - return C.igBeginChildFrame(C.ImGuiID(id), size.toC(), C.ImGuiWindowFlags(flags)) == C.bool(true) + idArg, idFin := id.c() + + defer func() { + idFin() + }() + return C.igBeginChildFrame(idArg, size.toC(), C.ImGuiWindowFlags(flags)) == C.bool(true) } // BeginChildIDV parameter default value hint: @@ -3562,7 +3601,12 @@ func BeginChildFrameV(id ID, size Vec2, flags WindowFlags) bool { // border: false // flags: 0 func BeginChildIDV(id ID, size Vec2, border bool, flags WindowFlags) bool { - return C.igBeginChild_ID(C.ImGuiID(id), size.toC(), C.bool(border), C.ImGuiWindowFlags(flags)) == C.bool(true) + idArg, idFin := id.c() + + defer func() { + idFin() + }() + return C.igBeginChild_ID(idArg, size.toC(), C.bool(border), C.ImGuiWindowFlags(flags)) == C.bool(true) } // BeginChildStrV parameter default value hint: @@ -3602,7 +3646,12 @@ func BeginComboV(label string, preview_value string, flags ComboFlags) bool { } func InternalBeginComboPopup(popup_id ID, bb Rect, flags ComboFlags) bool { - return C.igBeginComboPopup(C.ImGuiID(popup_id), bb.toC(), C.ImGuiComboFlags(flags)) == C.bool(true) + popup_idArg, popup_idFin := popup_id.c() + + defer func() { + popup_idFin() + }() + return C.igBeginComboPopup(popup_idArg, bb.toC(), C.ImGuiComboFlags(flags)) == C.bool(true) } func InternalBeginComboPreview() bool { @@ -3651,7 +3700,12 @@ func BeginDragDropTarget() bool { } func InternalBeginDragDropTargetCustom(bb Rect, id ID) bool { - return C.igBeginDragDropTargetCustom(bb.toC(), C.ImGuiID(id)) == C.bool(true) + idArg, idFin := id.c() + + defer func() { + idFin() + }() + return C.igBeginDragDropTargetCustom(bb.toC(), idArg) == C.bool(true) } // lock horizontal starting position @@ -3763,7 +3817,12 @@ func BeginPopupContextWindowV(str_id string, popup_flags PopupFlags) bool { } func InternalBeginPopupEx(id ID, extra_flags WindowFlags) bool { - return C.igBeginPopupEx(C.ImGuiID(id), C.ImGuiWindowFlags(extra_flags)) == C.bool(true) + idArg, idFin := id.c() + + defer func() { + idFin() + }() + return C.igBeginPopupEx(idArg, C.ImGuiWindowFlags(extra_flags)) == C.bool(true) } // return true if the modal is open, and you can start outputting to it. @@ -3836,11 +3895,13 @@ func BeginTableV(str_id string, column int32, flags TableFlags, outer_size Vec2, // inner_width: 0.0f func InternalBeginTableExV(name string, id ID, columns_count int32, flags TableFlags, outer_size Vec2, inner_width float32) bool { nameArg, nameFin := WrapString(name) + idArg, idFin := id.c() defer func() { nameFin() + idFin() }() - return C.igBeginTableEx(nameArg, C.ImGuiID(id), C.int(columns_count), C.ImGuiTableFlags(flags), outer_size.toC(), C.float(inner_width)) == C.bool(true) + return C.igBeginTableEx(nameArg, idArg, C.int(columns_count), C.ImGuiTableFlags(flags), outer_size.toC(), C.float(inner_width)) == C.bool(true) } // begin/append a tooltip window. @@ -3921,14 +3982,16 @@ func ButtonV(label string, size Vec2) bool { // InternalButtonBehaviorV parameter default value hint: // flags: 0 func InternalButtonBehaviorV(bb Rect, id ID, out_hovered *bool, out_held *bool, flags ButtonFlags) bool { + idArg, idFin := id.c() out_hoveredArg, out_hoveredFin := WrapBool(out_hovered) out_heldArg, out_heldFin := WrapBool(out_held) defer func() { + idFin() out_hoveredFin() out_heldFin() }() - return C.igButtonBehavior(bb.toC(), C.ImGuiID(id), out_hoveredArg, out_heldArg, C.ImGuiButtonFlags(flags)) == C.bool(true) + return C.igButtonBehavior(bb.toC(), idArg, out_hoveredArg, out_heldArg, C.ImGuiButtonFlags(flags)) == C.bool(true) } // InternalButtonExV parameter default value hint: @@ -4088,7 +4151,12 @@ func InternalClearWindowSettings(name string) { } func InternalCloseButton(id ID, pos Vec2) bool { - return C.igCloseButton(C.ImGuiID(id), pos.toC()) == C.bool(true) + idArg, idFin := id.c() + + defer func() { + idFin() + }() + return C.igCloseButton(idArg, pos.toC()) == C.bool(true) } // manually close the popup we have begin-ed into. @@ -4112,12 +4180,14 @@ func InternalClosePopupsOverWindow(ref_window *Window, restore_focus_to_window_u } func InternalCollapseButton(id ID, pos Vec2, dock_node *DockNode) bool { + idArg, idFin := id.c() dock_nodeArg, dock_nodeFin := dock_node.handle() defer func() { + idFin() dock_nodeFin() }() - return C.igCollapseButton(C.ImGuiID(id), pos.toC(), dock_nodeArg) == C.bool(true) + return C.igCollapseButton(idArg, pos.toC(), dock_nodeArg) == C.bool(true) } // when 'p_visible != NULL': if '*p_visible==true' display an additional small close button on upper right of the header which will set the bool to false when clicked, if '*p_visible==false' don't display the header. @@ -4334,6 +4404,15 @@ func ComboStrarrV(label string, current_item *int32, items []string, items_count return C.igCombo_Str_arr(labelArg, current_itemArg, itemsArg, C.int(items_count), C.int(popup_max_height_in_items)) == C.bool(true) } +func InternalConvertShortcutMod(key_chord KeyChord) KeyChord { + key_chordArg, key_chordFin := key_chord.c() + + defer func() { + key_chordFin() + }() + return *newKeyChordFromC(func() *C.ImGuiKeyChord { result := C.igConvertShortcutMod(key_chordArg); return &result }()) +} + func InternalConvertSingleModFlagToKey(ctx *Context, key Key) Key { ctxArg, ctxFin := ctx.handle() @@ -4363,40 +4442,30 @@ func InternalCreateNewWindowSettings(name string) *WindowSettings { return newWindowSettingsFromC(C.igCreateNewWindowSettings(nameArg)) } -func InternalDataTypeApplyFromText(buf string, data_type DataType, p_data unsafe.Pointer, format string) bool { +func InternalDataTypeApplyFromText(buf string, data_type DataType, p_data uintptr, format string) bool { bufArg, bufFin := WrapString(buf) - p_dataArg, p_dataFin := WrapVoidPtr(p_data) formatArg, formatFin := WrapString(format) defer func() { bufFin() - p_dataFin() formatFin() }() - return C.igDataTypeApplyFromText(bufArg, C.ImGuiDataType(data_type), p_dataArg, formatArg) == C.bool(true) + return C.wrap_igDataTypeApplyFromText(bufArg, C.ImGuiDataType(data_type), C.uintptr_t(p_data), formatArg) == C.bool(true) } -func InternalDataTypeApplyOp(data_type DataType, op int32, output unsafe.Pointer, arg_1 unsafe.Pointer, arg_2 unsafe.Pointer) { - outputArg, outputFin := WrapVoidPtr(output) - C.igDataTypeApplyOp(C.ImGuiDataType(data_type), C.int(op), outputArg, (arg_1), (arg_2)) - - outputFin() +func InternalDataTypeApplyOp(data_type DataType, op int32, output uintptr, arg_1 uintptr, arg_2 uintptr) { + C.wrap_igDataTypeApplyOp(C.ImGuiDataType(data_type), C.int(op), C.uintptr_t(output), C.uintptr_t(arg_1), C.uintptr_t(arg_2)) } -func InternalDataTypeClamp(data_type DataType, p_data unsafe.Pointer, p_min unsafe.Pointer, p_max unsafe.Pointer) bool { - p_dataArg, p_dataFin := WrapVoidPtr(p_data) - - defer func() { - p_dataFin() - }() - return C.igDataTypeClamp(C.ImGuiDataType(data_type), p_dataArg, (p_min), (p_max)) == C.bool(true) +func InternalDataTypeClamp(data_type DataType, p_data uintptr, p_min uintptr, p_max uintptr) bool { + return C.wrap_igDataTypeClamp(C.ImGuiDataType(data_type), C.uintptr_t(p_data), C.uintptr_t(p_min), C.uintptr_t(p_max)) == C.bool(true) } -func InternalDataTypeCompare(data_type DataType, arg_1 unsafe.Pointer, arg_2 unsafe.Pointer) int32 { - return int32(C.igDataTypeCompare(C.ImGuiDataType(data_type), (arg_1), (arg_2))) +func InternalDataTypeCompare(data_type DataType, arg_1 uintptr, arg_2 uintptr) int32 { + return int32(C.wrap_igDataTypeCompare(C.ImGuiDataType(data_type), C.uintptr_t(arg_1), C.uintptr_t(arg_2))) } -func InternalDataTypeFormatString(buf string, buf_size int32, data_type DataType, p_data unsafe.Pointer, format string) int32 { +func InternalDataTypeFormatString(buf string, buf_size int32, data_type DataType, p_data uintptr, format string) int32 { bufArg, bufFin := WrapString(buf) formatArg, formatFin := WrapString(format) @@ -4404,7 +4473,7 @@ func InternalDataTypeFormatString(buf string, buf_size int32, data_type DataType bufFin() formatFin() }() - return int32(C.igDataTypeFormatString(bufArg, C.int(buf_size), C.ImGuiDataType(data_type), (p_data), formatArg)) + return int32(C.wrap_igDataTypeFormatString(bufArg, C.int(buf_size), C.ImGuiDataType(data_type), C.uintptr_t(p_data), formatArg)) } func InternalDataTypeGetInfo(data_type DataType) *DataTypeInfo { @@ -4439,18 +4508,27 @@ func InternalDebugDrawLineExtentsV(col uint32) { C.igDebugDrawLineExtents(C.ImU32(col)) } -func InternalDebugHookIdInfo(id ID, data_type DataType, data_id unsafe.Pointer, data_id_end unsafe.Pointer) { - C.igDebugHookIdInfo(C.ImGuiID(id), C.ImGuiDataType(data_type), (data_id), (data_id_end)) +func InternalDebugHookIdInfo(id ID, data_type DataType, data_id uintptr, data_id_end uintptr) { + idArg, idFin := id.c() + C.wrap_igDebugHookIdInfo(idArg, C.ImGuiDataType(data_type), C.uintptr_t(data_id), C.uintptr_t(data_id_end)) + + idFin() } // Call sparingly: only 1 at the same time! func InternalDebugLocateItem(target_id ID) { - C.igDebugLocateItem(C.ImGuiID(target_id)) + target_idArg, target_idFin := target_id.c() + C.igDebugLocateItem(target_idArg) + + target_idFin() } // Only call on reaction to a mouse Hover: because only 1 at the same time! func InternalDebugLocateItemOnHover(target_id ID) { - C.igDebugLocateItemOnHover(C.ImGuiID(target_id)) + target_idArg, target_idFin := target_id.c() + C.igDebugLocateItemOnHover(target_idArg) + + target_idFin() } func InternalDebugLocateItemResolveWithLastItem() { @@ -4642,7 +4720,15 @@ func DestroyPlatformWindows() { // node_id: 0 // flags: 0 func InternalDockBuilderAddNodeV(node_id ID, flags DockNodeFlags) ID { - return ID(C.igDockBuilderAddNode(C.ImGuiID(node_id), C.ImGuiDockNodeFlags(flags))) + node_idArg, node_idFin := node_id.c() + + defer func() { + node_idFin() + }() + return *newIDFromC(func() *C.ImGuiID { + result := C.igDockBuilderAddNode(node_idArg, C.ImGuiDockNodeFlags(flags)) + return &result + }()) } func InternalDockBuilderCopyWindowSettings(src_name string, dst_name string) { @@ -4656,57 +4742,92 @@ func InternalDockBuilderCopyWindowSettings(src_name string, dst_name string) { func InternalDockBuilderDockWindow(window_name string, node_id ID) { window_nameArg, window_nameFin := WrapString(window_name) - C.igDockBuilderDockWindow(window_nameArg, C.ImGuiID(node_id)) + node_idArg, node_idFin := node_id.c() + C.igDockBuilderDockWindow(window_nameArg, node_idArg) window_nameFin() + node_idFin() } func InternalDockBuilderFinish(node_id ID) { - C.igDockBuilderFinish(C.ImGuiID(node_id)) + node_idArg, node_idFin := node_id.c() + C.igDockBuilderFinish(node_idArg) + + node_idFin() } func InternalDockBuilderGetCentralNode(node_id ID) *DockNode { - return newDockNodeFromC(C.igDockBuilderGetCentralNode(C.ImGuiID(node_id))) + node_idArg, node_idFin := node_id.c() + + defer func() { + node_idFin() + }() + return newDockNodeFromC(C.igDockBuilderGetCentralNode(node_idArg)) } func InternalDockBuilderGetNode(node_id ID) *DockNode { - return newDockNodeFromC(C.igDockBuilderGetNode(C.ImGuiID(node_id))) + node_idArg, node_idFin := node_id.c() + + defer func() { + node_idFin() + }() + return newDockNodeFromC(C.igDockBuilderGetNode(node_idArg)) } // Remove node and all its child, undock all windows func InternalDockBuilderRemoveNode(node_id ID) { - C.igDockBuilderRemoveNode(C.ImGuiID(node_id)) + node_idArg, node_idFin := node_id.c() + C.igDockBuilderRemoveNode(node_idArg) + + node_idFin() } // Remove all split/hierarchy. All remaining docked windows will be re-docked to the remaining root node (node_id). func InternalDockBuilderRemoveNodeChildNodes(node_id ID) { - C.igDockBuilderRemoveNodeChildNodes(C.ImGuiID(node_id)) + node_idArg, node_idFin := node_id.c() + C.igDockBuilderRemoveNodeChildNodes(node_idArg) + + node_idFin() } // InternalDockBuilderRemoveNodeDockedWindowsV parameter default value hint: // clear_settings_refs: true func InternalDockBuilderRemoveNodeDockedWindowsV(node_id ID, clear_settings_refs bool) { - C.igDockBuilderRemoveNodeDockedWindows(C.ImGuiID(node_id), C.bool(clear_settings_refs)) + node_idArg, node_idFin := node_id.c() + C.igDockBuilderRemoveNodeDockedWindows(node_idArg, C.bool(clear_settings_refs)) + + node_idFin() } func InternalDockBuilderSetNodePos(node_id ID, pos Vec2) { - C.igDockBuilderSetNodePos(C.ImGuiID(node_id), pos.toC()) + node_idArg, node_idFin := node_id.c() + C.igDockBuilderSetNodePos(node_idArg, pos.toC()) + + node_idFin() } func InternalDockBuilderSetNodeSize(node_id ID, size Vec2) { - C.igDockBuilderSetNodeSize(C.ImGuiID(node_id), size.toC()) + node_idArg, node_idFin := node_id.c() + C.igDockBuilderSetNodeSize(node_idArg, size.toC()) + + node_idFin() } // Create 2 child nodes in this parent node. func InternalDockBuilderSplitNode(node_id ID, split_dir Dir, size_ratio_for_node_at_dir float32, out_id_at_dir *ID, out_id_at_opposite_dir *ID) ID { - out_id_at_dirArg, out_id_at_dirFin := WrapNumberPtr[C.ImGuiID, ID](out_id_at_dir) - out_id_at_opposite_dirArg, out_id_at_opposite_dirFin := WrapNumberPtr[C.ImGuiID, ID](out_id_at_opposite_dir) + node_idArg, node_idFin := node_id.c() + out_id_at_dirArg, out_id_at_dirFin := out_id_at_dir.handle() + out_id_at_opposite_dirArg, out_id_at_opposite_dirFin := out_id_at_opposite_dir.handle() defer func() { + node_idFin() out_id_at_dirFin() out_id_at_opposite_dirFin() }() - return ID(C.igDockBuilderSplitNode(C.ImGuiID(node_id), C.ImGuiDir(split_dir), C.float(size_ratio_for_node_at_dir), out_id_at_dirArg, out_id_at_opposite_dirArg)) + return *newIDFromC(func() *C.ImGuiID { + result := C.igDockBuilderSplitNode(node_idArg, C.ImGuiDir(split_dir), C.float(size_ratio_for_node_at_dir), out_id_at_dirArg, out_id_at_opposite_dirArg) + return &result + }()) } func InternalDockContextCalcDropPosForDocking(target *Window, target_node *DockNode, payload_window *Window, payload_node *DockNode, split_dir Dir, split_outer bool, out_pos *Vec2) bool { @@ -4729,9 +4850,11 @@ func InternalDockContextCalcDropPosForDocking(target *Window, target_node *DockN // Use root_id==0 to clear all func InternalDockContextClearNodes(ctx *Context, root_id ID, clear_settings_refs bool) { ctxArg, ctxFin := ctx.handle() - C.igDockContextClearNodes(ctxArg, C.ImGuiID(root_id), C.bool(clear_settings_refs)) + root_idArg, root_idFin := root_id.c() + C.igDockContextClearNodes(ctxArg, root_idArg, C.bool(clear_settings_refs)) ctxFin() + root_idFin() } func InternalDockContextEndFrame(ctx *Context) { @@ -4743,11 +4866,13 @@ func InternalDockContextEndFrame(ctx *Context) { func InternalDockContextFindNodeByID(ctx *Context, id ID) *DockNode { ctxArg, ctxFin := ctx.handle() + idArg, idFin := id.c() defer func() { ctxFin() + idFin() }() - return newDockNodeFromC(C.igDockContextFindNodeByID(ctxArg, C.ImGuiID(id))) + return newDockNodeFromC(C.igDockContextFindNodeByID(ctxArg, idArg)) } func InternalDockContextGenNodeID(ctx *Context) ID { @@ -4756,7 +4881,7 @@ func InternalDockContextGenNodeID(ctx *Context) ID { defer func() { ctxFin() }() - return ID(C.igDockContextGenNodeID(ctxArg)) + return *newIDFromC(func() *C.ImGuiID { result := C.igDockContextGenNodeID(ctxArg); return &result }()) } func InternalDockContextInitialize(ctx *Context) { @@ -4882,7 +5007,7 @@ func InternalDockNodeGetWindowMenuButtonId(node *DockNode) ID { defer func() { nodeFin() }() - return ID(C.igDockNodeGetWindowMenuButtonId(nodeArg)) + return *newIDFromC(func() *C.ImGuiID { result := C.igDockNodeGetWindowMenuButtonId(nodeArg); return &result }()) } func InternalDockNodeIsInHierarchyOf(node *DockNode, parent *DockNode) bool { @@ -4912,12 +5037,17 @@ func InternalDockNodeWindowMenuHandlerDefault(ctx *Context, node *DockNode, tab_ // flags: 0 // window_class: NULL func DockSpaceV(id ID, size Vec2, flags DockNodeFlags, window_class *WindowClass) ID { + idArg, idFin := id.c() window_classArg, window_classFin := window_class.handle() defer func() { + idFin() window_classFin() }() - return ID(C.igDockSpace(C.ImGuiID(id), size.toC(), C.ImGuiDockNodeFlags(flags), window_classArg)) + return *newIDFromC(func() *C.ImGuiID { + result := C.igDockSpace(idArg, size.toC(), C.ImGuiDockNodeFlags(flags), window_classArg) + return &result + }()) } // DockSpaceOverViewportV parameter default value hint: @@ -4932,18 +5062,21 @@ func DockSpaceOverViewportV(viewport *Viewport, flags DockNodeFlags, window_clas viewportFin() window_classFin() }() - return ID(C.igDockSpaceOverViewport(viewportArg, C.ImGuiDockNodeFlags(flags), window_classArg)) + return *newIDFromC(func() *C.ImGuiID { + result := C.igDockSpaceOverViewport(viewportArg, C.ImGuiDockNodeFlags(flags), window_classArg) + return &result + }()) } -func InternalDragBehavior(id ID, data_type DataType, p_v unsafe.Pointer, v_speed float32, p_min unsafe.Pointer, p_max unsafe.Pointer, format string, flags SliderFlags) bool { - p_vArg, p_vFin := WrapVoidPtr(p_v) +func InternalDragBehavior(id ID, data_type DataType, p_v uintptr, v_speed float32, p_min uintptr, p_max uintptr, format string, flags SliderFlags) bool { + idArg, idFin := id.c() formatArg, formatFin := WrapString(format) defer func() { - p_vFin() + idFin() formatFin() }() - return C.igDragBehavior(C.ImGuiID(id), C.ImGuiDataType(data_type), p_vArg, C.float(v_speed), (p_min), (p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) + return C.wrap_igDragBehavior(idArg, C.ImGuiDataType(data_type), C.uintptr_t(p_v), C.float(v_speed), C.uintptr_t(p_min), C.uintptr_t(p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) } // If v_min >= v_max we have no bound @@ -5202,17 +5335,15 @@ func DragIntRange2V(label string, v_current_min *int32, v_current_max *int32, v_ // p_max: NULL // format: NULL // flags: 0 -func DragScalarV(label string, data_type DataType, p_data unsafe.Pointer, v_speed float32, p_min unsafe.Pointer, p_max unsafe.Pointer, format string, flags SliderFlags) bool { +func DragScalarV(label string, data_type DataType, p_data uintptr, v_speed float32, p_min uintptr, p_max uintptr, format string, flags SliderFlags) bool { labelArg, labelFin := WrapString(label) - p_dataArg, p_dataFin := WrapVoidPtr(p_data) formatArg, formatFin := WrapString(format) defer func() { labelFin() - p_dataFin() formatFin() }() - return C.igDragScalar(labelArg, C.ImGuiDataType(data_type), p_dataArg, C.float(v_speed), (p_min), (p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) + return C.wrap_igDragScalarV(labelArg, C.ImGuiDataType(data_type), C.uintptr_t(p_data), C.float(v_speed), C.uintptr_t(p_min), C.uintptr_t(p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) } // DragScalarNV parameter default value hint: @@ -5221,17 +5352,15 @@ func DragScalarV(label string, data_type DataType, p_data unsafe.Pointer, v_spee // p_max: NULL // format: NULL // flags: 0 -func DragScalarNV(label string, data_type DataType, p_data unsafe.Pointer, components int32, v_speed float32, p_min unsafe.Pointer, p_max unsafe.Pointer, format string, flags SliderFlags) bool { +func DragScalarNV(label string, data_type DataType, p_data uintptr, components int32, v_speed float32, p_min uintptr, p_max uintptr, format string, flags SliderFlags) bool { labelArg, labelFin := WrapString(label) - p_dataArg, p_dataFin := WrapVoidPtr(p_data) formatArg, formatFin := WrapString(format) defer func() { labelFin() - p_dataFin() formatFin() }() - return C.igDragScalarN(labelArg, C.ImGuiDataType(data_type), p_dataArg, C.int(components), C.float(v_speed), (p_min), (p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) + return C.wrap_igDragScalarNV(labelArg, C.ImGuiDataType(data_type), C.uintptr_t(p_data), C.int(components), C.float(v_speed), C.uintptr_t(p_min), C.uintptr_t(p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) } // add a dummy item of given size. unlike InvisibleButton(), Dummy() won't take the mouse click or be navigable into. @@ -5376,11 +5505,13 @@ func InternalFindHoveredViewportFromPlatformWindowStack(mouse_platform_pos Vec2) func InternalFindOrCreateColumns(window *Window, id ID) *OldColumns { windowArg, windowFin := window.handle() + idArg, idFin := id.c() defer func() { windowFin() + idFin() }() - return newOldColumnsFromC(C.igFindOrCreateColumns(windowArg, C.ImGuiID(id))) + return newOldColumnsFromC(C.igFindOrCreateColumns(windowArg, idArg)) } // Find the optional ## from which we stop displaying text. @@ -5405,21 +5536,26 @@ func InternalFindSettingsHandler(type_name string) *SettingsHandler { // this is a helper for backends. func FindViewportByID(id ID) *Viewport { - return newViewportFromC(C.igFindViewportByID(C.ImGuiID(id))) -} - -// this is a helper for backends. the type platform_handle is decided by the backend (e.g. HWND, MyWindow*, GLFWwindow* etc.) -func FindViewportByPlatformHandle(platform_handle unsafe.Pointer) *Viewport { - platform_handleArg, platform_handleFin := WrapVoidPtr(platform_handle) + idArg, idFin := id.c() defer func() { - platform_handleFin() + idFin() }() - return newViewportFromC(C.igFindViewportByPlatformHandle(platform_handleArg)) + return newViewportFromC(C.igFindViewportByID(idArg)) +} + +// this is a helper for backends. the type platform_handle is decided by the backend (e.g. HWND, MyWindow*, GLFWwindow* etc.) +func FindViewportByPlatformHandle(platform_handle uintptr) *Viewport { + return newViewportFromC(C.wrap_igFindViewportByPlatformHandle(C.uintptr_t(platform_handle))) } func InternalFindWindowByID(id ID) *Window { - return newWindowFromC(C.igFindWindowByID(C.ImGuiID(id))) + idArg, idFin := id.c() + + defer func() { + idFin() + }() + return newWindowFromC(C.igFindWindowByID(idArg)) } func InternalFindWindowByName(name string) *Window { @@ -5441,7 +5577,12 @@ func InternalFindWindowDisplayIndex(window *Window) int32 { } func InternalFindWindowSettingsByID(id ID) *WindowSettings { - return newWindowSettingsFromC(C.igFindWindowSettingsByID(C.ImGuiID(id))) + idArg, idFin := id.c() + + defer func() { + idFin() + }() + return newWindowSettingsFromC(C.igFindWindowSettingsByID(idArg)) } func InternalFindWindowSettingsByWindow(window *Window) *WindowSettings { @@ -5497,7 +5638,7 @@ func InternalGcCompactTransientWindowBuffers(window *Window) { } func InternalActiveID() ID { - return ID(C.igGetActiveID()) + return *newIDFromC(func() *C.ImGuiID { result := C.igGetActiveID(); return &result }()) } // get background draw list for the viewport associated to the current window. this draw list will be the first rendering one. Useful to quickly draw shapes/text behind dear imgui contents. @@ -5583,7 +5724,7 @@ func InternalColumnsID(str_id string, count int32) ID { defer func() { str_idFin() }() - return ID(C.igGetColumnsID(str_idArg, C.int(count))) + return *newIDFromC(func() *C.ImGuiID { result := C.igGetColumnsID(str_idArg, C.int(count)); return &result }()) } // == GetContentRegionMax() - GetCursorPos() @@ -5627,7 +5768,7 @@ func CurrentContext() *Context { // Focus scope we are outputting into, set by PushFocusScope() func InternalCurrentFocusScope() ID { - return ID(C.igGetCurrentFocusScope()) + return *newIDFromC(func() *C.ImGuiID { result := C.igGetCurrentFocusScope(); return &result }()) } func InternalCurrentTabBar() *TabBar { @@ -5712,7 +5853,7 @@ func CurrentDrawListSharedData() *DrawListSharedData { } func InternalFocusID() ID { - return ID(C.igGetFocusID()) + return *newIDFromC(func() *C.ImGuiID { result := C.igGetFocusID(); return &result }()) } // get current font @@ -5777,26 +5918,36 @@ func FrameHeightWithSpacing() float32 { } func InternalHoveredID() ID { - return ID(C.igGetHoveredID()) + return *newIDFromC(func() *C.ImGuiID { result := C.igGetHoveredID(); return &result }()) } func InternalIDWithSeedInt(n int32, seed ID) ID { - return ID(C.igGetIDWithSeed_Int(C.int(n), C.ImGuiID(seed))) + seedArg, seedFin := seed.c() + + defer func() { + seedFin() + }() + return *newIDFromC(func() *C.ImGuiID { result := C.igGetIDWithSeed_Int(C.int(n), seedArg); return &result }()) } func InternalIDWithSeedStr(str_id_begin string, str_id_end string, seed ID) ID { str_id_beginArg, str_id_beginFin := WrapString(str_id_begin) str_id_endArg, str_id_endFin := WrapString(str_id_end) + seedArg, seedFin := seed.c() defer func() { str_id_beginFin() str_id_endFin() + seedFin() }() - return ID(C.igGetIDWithSeed_Str(str_id_beginArg, str_id_endArg, C.ImGuiID(seed))) + return *newIDFromC(func() *C.ImGuiID { + result := C.igGetIDWithSeed_Str(str_id_beginArg, str_id_endArg, seedArg) + return &result + }()) } -func IDPtr(ptr_id unsafe.Pointer) ID { - return ID(C.igGetID_Ptr((ptr_id))) +func IDPtr(ptr_id uintptr) ID { + return *newIDFromC(func() *C.ImGuiID { result := C.wrap_igGetID_Ptr(C.uintptr_t(ptr_id)); return &result }()) } // calculate unique ID (hash of whole ID stack + given parameter). e.g. if you want to query into ImGuiStorage yourself @@ -5806,7 +5957,7 @@ func IDStr(str_id string) ID { defer func() { str_idFin() }() - return ID(C.igGetID_Str(str_idArg)) + return *newIDFromC(func() *C.ImGuiID { result := C.igGetID_Str(str_idArg); return &result }()) } func IDStrStr(str_id_begin string, str_id_end string) ID { @@ -5817,7 +5968,7 @@ func IDStrStr(str_id_begin string, str_id_end string) ID { str_id_beginFin() str_id_endFin() }() - return ID(C.igGetID_StrStr(str_id_beginArg, str_id_endArg)) + return *newIDFromC(func() *C.ImGuiID { result := C.igGetID_StrStr(str_id_beginArg, str_id_endArg); return &result }()) } // access the IO structure (mouse/keyboard/gamepad inputs, time, various configuration options/flags) @@ -5827,7 +5978,12 @@ func CurrentIO() *IO { // Get input text state if active func InternalInputTextState(id ID) *InputTextState { - return newInputTextStateFromC(C.igGetInputTextState(C.ImGuiID(id))) + idArg, idFin := id.c() + + defer func() { + idFin() + }() + return newInputTextStateFromC(C.igGetInputTextState(idArg)) } func InternalItemFlags() ItemFlags { @@ -5836,7 +5992,7 @@ func InternalItemFlags() ItemFlags { // get ID of last item (~~ often same ImGui::GetID(label) beforehand) func ItemID() ID { - return ID(C.igGetItemID()) + return *newIDFromC(func() *C.ImGuiID { result := C.igGetItemID(); return &result }()) } // get lower-right bounding rectangle of the last item (screen space) @@ -5880,9 +6036,11 @@ func InternalItemStatusFlags() ItemStatusFlags { } func InternalKeyChordName(key_chord KeyChord, out_buf string, out_buf_size int32) { + key_chordArg, key_chordFin := key_chord.c() out_bufArg, out_bufFin := WrapString(out_buf) - C.igGetKeyChordName(C.ImGuiKeyChord(key_chord), out_bufArg, C.int(out_buf_size)) + C.igGetKeyChordName(key_chordArg, out_bufArg, C.int(out_buf_size)) + key_chordFin() out_bufFin() } @@ -5921,7 +6079,7 @@ func KeyName(key Key) string { } func InternalKeyOwner(key Key) ID { - return ID(C.igGetKeyOwner(C.ImGuiKey(key))) + return *newIDFromC(func() *C.ImGuiID { result := C.igGetKeyOwner(C.ImGuiKey(key)); return &result }()) } func InternalKeyOwnerData(ctx *Context, key Key) *KeyOwnerData { @@ -6035,7 +6193,12 @@ func ScrollY() float32 { } func InternalShortcutRoutingData(key_chord KeyChord) *KeyRoutingData { - return newKeyRoutingDataFromC(C.igGetShortcutRoutingData(C.ImGuiKeyChord(key_chord))) + key_chordArg, key_chordFin := key_chord.c() + + defer func() { + key_chordFin() + }() + return newKeyRoutingDataFromC(C.igGetShortcutRoutingData(key_chordArg)) } func StateStorage() *Storage { @@ -6152,7 +6315,7 @@ func WindowContentRegionMin() Vec2 { } func WindowDockID() ID { - return ID(C.igGetWindowDockID()) + return *newIDFromC(func() *C.ImGuiID { result := C.igGetWindowDockID(); return &result }()) } func InternalWindowDockNode() *DockNode { @@ -6192,7 +6355,7 @@ func InternalWindowResizeBorderID(window *Window, dir Dir) ID { defer func() { windowFin() }() - return ID(C.igGetWindowResizeBorderID(windowArg, C.ImGuiDir(dir))) + return *newIDFromC(func() *C.ImGuiID { result := C.igGetWindowResizeBorderID(windowArg, C.ImGuiDir(dir)); return &result }()) } // 0..3: corners @@ -6202,7 +6365,7 @@ func InternalWindowResizeCornerID(window *Window, n int32) ID { defer func() { windowFin() }() - return ID(C.igGetWindowResizeCornerID(windowArg, C.int(n))) + return *newIDFromC(func() *C.ImGuiID { result := C.igGetWindowResizeCornerID(windowArg, C.int(n)); return &result }()) } func InternalWindowScrollbarID(window *Window, axis Axis) ID { @@ -6211,7 +6374,7 @@ func InternalWindowScrollbarID(window *Window, axis Axis) ID { defer func() { windowFin() }() - return ID(C.igGetWindowScrollbarID(windowArg, C.ImGuiAxis(axis))) + return *newIDFromC(func() *C.ImGuiID { result := C.igGetWindowScrollbarID(windowArg, C.ImGuiAxis(axis)); return &result }()) } func InternalWindowScrollbarRect(window *Window, axis Axis) Rect { @@ -6387,7 +6550,7 @@ func InternalImExponentialMovingAverage(avg float32, sample float32, n int32) fl // InternalImFileLoadToMemoryV parameter default value hint: // out_file_size: NULL // padding_bytes: 0 -func InternalImFileLoadToMemoryV(filename string, mode string, out_file_size *uint64, padding_bytes int32) unsafe.Pointer { +func InternalImFileLoadToMemoryV(filename string, mode string, out_file_size *uint64, padding_bytes int32) uintptr { filenameArg, filenameFin := WrapString(filename) modeArg, modeFin := WrapString(mode) @@ -6395,7 +6558,7 @@ func InternalImFileLoadToMemoryV(filename string, mode string, out_file_size *ui filenameFin() modeFin() }() - return unsafe.Pointer(C.igImFileLoadToMemory(filenameArg, modeArg, (*C.xulong)(out_file_size), C.int(padding_bytes))) + return uintptr(C.wrap_igImFileLoadToMemoryV(filenameArg, modeArg, (*C.xulong)(out_file_size), C.int(padding_bytes))) } // Decent replacement for floorf() @@ -6443,13 +6606,11 @@ func InternalImFontAtlasBuildInit(atlas *FontAtlas) { atlasFin() } -func InternalImFontAtlasBuildPackCustomRects(atlas *FontAtlas, stbrp_context_opaque unsafe.Pointer) { +func InternalImFontAtlasBuildPackCustomRects(atlas *FontAtlas, stbrp_context_opaque uintptr) { atlasArg, atlasFin := atlas.handle() - stbrp_context_opaqueArg, stbrp_context_opaqueFin := WrapVoidPtr(stbrp_context_opaque) - C.igImFontAtlasBuildPackCustomRects(atlasArg, stbrp_context_opaqueArg) + C.wrap_igImFontAtlasBuildPackCustomRects(atlasArg, C.uintptr_t(stbrp_context_opaque)) atlasFin() - stbrp_context_opaqueFin() } func InternalImFontAtlasBuildRender32bppRectFromString(atlas *FontAtlas, x int32, y int32, w int32, h int32, in_str string, in_marker_char rune, in_marker_pixel_value uint32) { @@ -6516,8 +6677,16 @@ func InternalImFormatStringToTempBuffer(out_buf []string, out_buf_end []string, // InternalImHashDataV parameter default value hint: // seed: 0 -func InternalImHashDataV(data unsafe.Pointer, data_size uint64, seed ID) ID { - return ID(C.igImHashData((data), C.xulong(data_size), C.ImGuiID(seed))) +func InternalImHashDataV(data uintptr, data_size uint64, seed ID) ID { + seedArg, seedFin := seed.c() + + defer func() { + seedFin() + }() + return *newIDFromC(func() *C.ImGuiID { + result := C.wrap_igImHashDataV(C.uintptr_t(data), C.xulong(data_size), seedArg) + return &result + }()) } // InternalImHashStrV parameter default value hint: @@ -6525,11 +6694,13 @@ func InternalImHashDataV(data unsafe.Pointer, data_size uint64, seed ID) ID { // seed: 0 func InternalImHashStrV(data string, data_size uint64, seed ID) ID { dataArg, dataFin := WrapString(data) + seedArg, seedFin := seed.c() defer func() { dataFin() + seedFin() }() - return ID(C.igImHashStr(dataArg, C.xulong(data_size), C.ImGuiID(seed))) + return *newIDFromC(func() *C.ImGuiID { result := C.igImHashStr(dataArg, C.xulong(data_size), seedArg); return &result }()) } func InternalImInvLength(lhs Vec2, fail_value float32) float32 { @@ -7013,7 +7184,10 @@ func InternalImUpperPowerOfTwo(v int32) int32 { // tint_col: ImVec4(1,1,1,1) // border_col: ImVec4(0,0,0,0) func ImageV(user_texture_id TextureID, size Vec2, uv0 Vec2, uv1 Vec2, tint_col Vec4, border_col Vec4) { - C.igImage(C.ImTextureID(user_texture_id), size.toC(), uv0.toC(), uv1.toC(), tint_col.toC(), border_col.toC()) + user_texture_idArg, user_texture_idFin := user_texture_id.c() + C.igImage(user_texture_idArg, size.toC(), uv0.toC(), uv1.toC(), tint_col.toC(), border_col.toC()) + + user_texture_idFin() } // ImageButtonV parameter default value hint: @@ -7023,17 +7197,26 @@ func ImageV(user_texture_id TextureID, size Vec2, uv0 Vec2, uv1 Vec2, tint_col V // tint_col: ImVec4(1,1,1,1) func ImageButtonV(str_id string, user_texture_id TextureID, size Vec2, uv0 Vec2, uv1 Vec2, bg_col Vec4, tint_col Vec4) bool { str_idArg, str_idFin := WrapString(str_id) + user_texture_idArg, user_texture_idFin := user_texture_id.c() defer func() { str_idFin() + user_texture_idFin() }() - return C.igImageButton(str_idArg, C.ImTextureID(user_texture_id), size.toC(), uv0.toC(), uv1.toC(), bg_col.toC(), tint_col.toC()) == C.bool(true) + return C.igImageButton(str_idArg, user_texture_idArg, size.toC(), uv0.toC(), uv1.toC(), bg_col.toC(), tint_col.toC()) == C.bool(true) } // InternalImageButtonExV parameter default value hint: // flags: 0 func InternalImageButtonExV(id ID, texture_id TextureID, size Vec2, uv0 Vec2, uv1 Vec2, bg_col Vec4, tint_col Vec4, flags ButtonFlags) bool { - return C.igImageButtonEx(C.ImGuiID(id), C.ImTextureID(texture_id), size.toC(), uv0.toC(), uv1.toC(), bg_col.toC(), tint_col.toC(), C.ImGuiButtonFlags(flags)) == C.bool(true) + idArg, idFin := id.c() + texture_idArg, texture_idFin := texture_id.c() + + defer func() { + idFin() + texture_idFin() + }() + return C.igImageButtonEx(idArg, texture_idArg, size.toC(), uv0.toC(), uv1.toC(), bg_col.toC(), tint_col.toC(), C.ImGuiButtonFlags(flags)) == C.bool(true) } // move content position toward the right, by indent_w, or style.IndentSpacing if indent_w <= 0 @@ -7235,17 +7418,15 @@ func InputInt4V(label string, v *[4]int32, flags InputTextFlags) bool { // p_step_fast: NULL // format: NULL // flags: 0 -func InputScalarV(label string, data_type DataType, p_data unsafe.Pointer, p_step unsafe.Pointer, p_step_fast unsafe.Pointer, format string, flags InputTextFlags) bool { +func InputScalarV(label string, data_type DataType, p_data uintptr, p_step uintptr, p_step_fast uintptr, format string, flags InputTextFlags) bool { labelArg, labelFin := WrapString(label) - p_dataArg, p_dataFin := WrapVoidPtr(p_data) formatArg, formatFin := WrapString(format) defer func() { labelFin() - p_dataFin() formatFin() }() - return C.igInputScalar(labelArg, C.ImGuiDataType(data_type), p_dataArg, (p_step), (p_step_fast), formatArg, C.ImGuiInputTextFlags(flags)) == C.bool(true) + return C.wrap_igInputScalarV(labelArg, C.ImGuiDataType(data_type), C.uintptr_t(p_data), C.uintptr_t(p_step), C.uintptr_t(p_step_fast), formatArg, C.ImGuiInputTextFlags(flags)) == C.bool(true) } // InputScalarNV parameter default value hint: @@ -7253,21 +7434,22 @@ func InputScalarV(label string, data_type DataType, p_data unsafe.Pointer, p_ste // p_step_fast: NULL // format: NULL // flags: 0 -func InputScalarNV(label string, data_type DataType, p_data unsafe.Pointer, components int32, p_step unsafe.Pointer, p_step_fast unsafe.Pointer, format string, flags InputTextFlags) bool { +func InputScalarNV(label string, data_type DataType, p_data uintptr, components int32, p_step uintptr, p_step_fast uintptr, format string, flags InputTextFlags) bool { labelArg, labelFin := WrapString(label) - p_dataArg, p_dataFin := WrapVoidPtr(p_data) formatArg, formatFin := WrapString(format) defer func() { labelFin() - p_dataFin() formatFin() }() - return C.igInputScalarN(labelArg, C.ImGuiDataType(data_type), p_dataArg, C.int(components), (p_step), (p_step_fast), formatArg, C.ImGuiInputTextFlags(flags)) == C.bool(true) + return C.wrap_igInputScalarNV(labelArg, C.ImGuiDataType(data_type), C.uintptr_t(p_data), C.int(components), C.uintptr_t(p_step), C.uintptr_t(p_step_fast), formatArg, C.ImGuiInputTextFlags(flags)) == C.bool(true) } func InternalInputTextDeactivateHook(id ID) { - C.igInputTextDeactivateHook(C.ImGuiID(id)) + idArg, idFin := id.c() + C.igInputTextDeactivateHook(idArg) + + idFin() } // flexible button behavior without the visuals, frequently useful to build custom behaviors using the public api (along with IsItemActive, IsItemHovered, etc.) @@ -7311,7 +7493,12 @@ func IsAnyMouseDown() bool { } func InternalIsClippedEx(bb Rect, id ID) bool { - return C.igIsClippedEx(bb.toC(), C.ImGuiID(id)) == C.bool(true) + idArg, idFin := id.c() + + defer func() { + idFin() + }() + return C.igIsClippedEx(bb.toC(), idArg) == C.bool(true) } func InternalIsDragDropActive() bool { @@ -7386,7 +7573,12 @@ func IsItemVisible() bool { } func InternalIsKeyDownID(key Key, owner_id ID) bool { - return C.igIsKeyDown_ID(C.ImGuiKey(key), C.ImGuiID(owner_id)) == C.bool(true) + owner_idArg, owner_idFin := owner_id.c() + + defer func() { + owner_idFin() + }() + return C.igIsKeyDown_ID(C.ImGuiKey(key), owner_idArg) == C.bool(true) } // is key being held. @@ -7412,11 +7604,21 @@ func IsKeyPressedBoolV(key Key, repeat bool) bool { // InternalIsKeyPressedIDV parameter default value hint: // flags: 0 func InternalIsKeyPressedIDV(key Key, owner_id ID, flags InputFlags) bool { - return C.igIsKeyPressed_ID(C.ImGuiKey(key), C.ImGuiID(owner_id), C.ImGuiInputFlags(flags)) == C.bool(true) + owner_idArg, owner_idFin := owner_id.c() + + defer func() { + owner_idFin() + }() + return C.igIsKeyPressed_ID(C.ImGuiKey(key), owner_idArg, C.ImGuiInputFlags(flags)) == C.bool(true) } func InternalIsKeyReleasedID(key Key, owner_id ID) bool { - return C.igIsKeyReleased_ID(C.ImGuiKey(key), C.ImGuiID(owner_id)) == C.bool(true) + owner_idArg, owner_idFin := owner_id.c() + + defer func() { + owner_idFin() + }() + return C.igIsKeyReleased_ID(C.ImGuiKey(key), owner_idArg) == C.bool(true) } // was key released (went from Down to !Down)? @@ -7442,7 +7644,12 @@ func IsMouseClickedBoolV(button MouseButton, repeat bool) bool { // InternalIsMouseClickedIDV parameter default value hint: // flags: 0 func InternalIsMouseClickedIDV(button MouseButton, owner_id ID, flags InputFlags) bool { - return C.igIsMouseClicked_ID(C.ImGuiMouseButton(button), C.ImGuiID(owner_id), C.ImGuiInputFlags(flags)) == C.bool(true) + owner_idArg, owner_idFin := owner_id.c() + + defer func() { + owner_idFin() + }() + return C.igIsMouseClicked_ID(C.ImGuiMouseButton(button), owner_idArg, C.ImGuiInputFlags(flags)) == C.bool(true) } // did mouse button double-clicked? Same as GetMouseClickedCount() == 2. (note that a double-click will also report IsMouseClicked() == true) @@ -7451,7 +7658,12 @@ func IsMouseDoubleClicked(button MouseButton) bool { } func InternalIsMouseDownID(button MouseButton, owner_id ID) bool { - return C.igIsMouseDown_ID(C.ImGuiMouseButton(button), C.ImGuiID(owner_id)) == C.bool(true) + owner_idArg, owner_idFin := owner_id.c() + + defer func() { + owner_idFin() + }() + return C.igIsMouseDown_ID(C.ImGuiMouseButton(button), owner_idArg) == C.bool(true) } // is mouse button held? @@ -7496,7 +7708,12 @@ func IsMousePosValidV(mouse_pos *Vec2) bool { } func InternalIsMouseReleasedID(button MouseButton, owner_id ID) bool { - return C.igIsMouseReleased_ID(C.ImGuiMouseButton(button), C.ImGuiID(owner_id)) == C.bool(true) + owner_idArg, owner_idFin := owner_id.c() + + defer func() { + owner_idFin() + }() + return C.igIsMouseReleased_ID(C.ImGuiMouseButton(button), owner_idArg) == C.bool(true) } // did mouse button released? (went from Down to !Down) @@ -7513,7 +7730,12 @@ func InternalIsNamedKeyOrModKey(key Key) bool { } func InternalIsPopupOpenID(id ID, popup_flags PopupFlags) bool { - return C.igIsPopupOpen_ID(C.ImGuiID(id), C.ImGuiPopupFlags(popup_flags)) == C.bool(true) + idArg, idFin := id.c() + + defer func() { + idFin() + }() + return C.igIsPopupOpen_ID(idArg, C.ImGuiPopupFlags(popup_flags)) == C.bool(true) } // return true if the popup is open. @@ -7622,16 +7844,23 @@ func InternalIsWindowWithinBeginStackOf(window *Window, potential_parent *Window // nav_bb: NULL // extra_flags: 0 func InternalItemAddV(bb Rect, id ID, nav_bb *Rect, extra_flags ItemFlags) bool { + idArg, idFin := id.c() nav_bbArg, nav_bbFin := wrap[C.ImRect, *Rect](nav_bb) defer func() { + idFin() nav_bbFin() }() - return C.igItemAdd(bb.toC(), C.ImGuiID(id), nav_bbArg, C.ImGuiItemFlags(extra_flags)) == C.bool(true) + return C.igItemAdd(bb.toC(), idArg, nav_bbArg, C.ImGuiItemFlags(extra_flags)) == C.bool(true) } func InternalItemHoverable(bb Rect, id ID, item_flags ItemFlags) bool { - return C.igItemHoverable(bb.toC(), C.ImGuiID(id), C.ImGuiItemFlags(item_flags)) == C.bool(true) + idArg, idFin := id.c() + + defer func() { + idFin() + }() + return C.igItemHoverable(bb.toC(), idArg, C.ImGuiItemFlags(item_flags)) == C.bool(true) } // FIXME: This is a misleading API since we expect CursorPos to be bb.Min. @@ -7648,7 +7877,10 @@ func InternalItemSizeVec2V(size Vec2, text_baseline_y float32) { } func InternalKeepAliveID(id ID) { - C.igKeepAliveID(C.ImGuiID(id)) + idArg, idFin := id.c() + C.igKeepAliveID(idArg) + + idFin() } // display text+label aligned the same way as value+label widgets @@ -7792,18 +8024,18 @@ func InternalMarkIniSettingsDirtyWindowPtr(window *Window) { // Mark data associated to given item as "edited", used by IsItemDeactivatedAfterEdit() function. func InternalMarkItemEdited(id ID) { - C.igMarkItemEdited(C.ImGuiID(id)) -} + idArg, idFin := id.c() + C.igMarkItemEdited(idArg) -func MemAlloc(size uint64) unsafe.Pointer { - return unsafe.Pointer(C.igMemAlloc(C.xulong(size))) + idFin() } -func MemFree(ptr unsafe.Pointer) { - ptrArg, ptrFin := WrapVoidPtr(ptr) - C.igMemFree(ptrArg) +func MemAlloc(size uint64) uintptr { + return uintptr(C.wrap_igMemAlloc(C.xulong(size))) +} - ptrFin() +func MemFree(ptr uintptr) { + C.wrap_igMemFree(C.uintptr_t(ptr)) } // InternalMenuItemExV parameter default value hint: @@ -7943,7 +8175,10 @@ func NextColumn() { // InternalOpenPopupExV parameter default value hint: // popup_flags: ImGuiPopupFlags_None func InternalOpenPopupExV(id ID, popup_flags PopupFlags) { - C.igOpenPopupEx(C.ImGuiID(id), C.ImGuiPopupFlags(popup_flags)) + idArg, idFin := id.c() + C.igOpenPopupEx(idArg, C.ImGuiPopupFlags(popup_flags)) + + idFin() } // helper to open popup when clicked on last item. Default to ImGuiPopupFlags_MouseButtonRight == 1. (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors) @@ -7961,7 +8196,10 @@ func OpenPopupOnItemClickV(str_id string, popup_flags PopupFlags) { // OpenPopupIDV parameter default value hint: // popup_flags: 0 func OpenPopupIDV(id ID, popup_flags PopupFlags) { - C.igOpenPopup_ID(C.ImGuiID(id), C.ImGuiPopupFlags(popup_flags)) + idArg, idFin := id.c() + C.igOpenPopup_ID(idArg, C.ImGuiPopupFlags(popup_flags)) + + idFin() } // call to mark popup as open (don't call every frame!). @@ -8087,7 +8325,10 @@ func InternalPushColumnsBackground() { } func InternalPushFocusScope(id ID) { - C.igPushFocusScope(C.ImGuiID(id)) + idArg, idFin := id.c() + C.igPushFocusScope(idArg) + + idFin() } // use NULL as a shortcut to push default font @@ -8104,8 +8345,8 @@ func PushIDInt(int_id int32) { } // push pointer into the ID stack (will hash pointer). -func PushIDPtr(ptr_id unsafe.Pointer) { - C.igPushID_Ptr((ptr_id)) +func PushIDPtr(ptr_id uintptr) { + C.wrap_igPushID_Ptr(C.uintptr_t(ptr_id)) } // push string into the ID stack (will hash string). @@ -8141,7 +8382,10 @@ func InternalPushMultiItemsWidths(components int32, width_full float32) { // Push given value as-is at the top of the ID stack (whereas PushID combines old and new hashes) func InternalPushOverrideID(id ID) { - C.igPushOverrideID(C.ImGuiID(id)) + idArg, idFin := id.c() + C.igPushOverrideID(idArg) + + idFin() } // modify a style color. always use this if you modify the style after NewFrame(). @@ -8199,9 +8443,11 @@ func RadioButtonIntPtr(label string, v *int32, v_button int32) bool { func InternalRemoveContextHook(context *Context, hook_to_remove ID) { contextArg, contextFin := context.handle() - C.igRemoveContextHook(contextArg, C.ImGuiID(hook_to_remove)) + hook_to_removeArg, hook_to_removeFin := hook_to_remove.c() + C.igRemoveContextHook(contextArg, hook_to_removeArg) contextFin() + hook_to_removeFin() } func InternalRemoveSettingsHandler(type_name string) { @@ -8288,20 +8534,18 @@ func InternalRenderMouseCursor(pos Vec2, scale float32, mouse_cursor MouseCursor // InternalRenderNavHighlightV parameter default value hint: // flags: ImGuiNavHighlightFlags_TypeDefault func InternalRenderNavHighlightV(bb Rect, id ID, flags NavHighlightFlags) { - C.igRenderNavHighlight(bb.toC(), C.ImGuiID(id), C.ImGuiNavHighlightFlags(flags)) + idArg, idFin := id.c() + C.igRenderNavHighlight(bb.toC(), idArg, C.ImGuiNavHighlightFlags(flags)) + + idFin() } // call in main loop. will call RenderWindow/SwapBuffers platform functions for each secondary viewport which doesn't have the ImGuiViewportFlags_Minimized flag set. May be reimplemented by user for custom rendering needs. // RenderPlatformWindowsDefaultV parameter default value hint: // platform_render_arg: NULL // renderer_render_arg: NULL -func RenderPlatformWindowsDefaultV(platform_render_arg unsafe.Pointer, renderer_render_arg unsafe.Pointer) { - platform_render_argArg, platform_render_argFin := WrapVoidPtr(platform_render_arg) - renderer_render_argArg, renderer_render_argFin := WrapVoidPtr(renderer_render_arg) - C.igRenderPlatformWindowsDefault(platform_render_argArg, renderer_render_argArg) - - platform_render_argFin() - renderer_render_argFin() +func RenderPlatformWindowsDefaultV(platform_render_arg uintptr, renderer_render_arg uintptr) { + C.wrap_igRenderPlatformWindowsDefaultV(C.uintptr_t(platform_render_arg), C.uintptr_t(renderer_render_arg)) } func InternalRenderRectFilledRangeH(draw_list *DrawList, rect Rect, col uint32, x_start_norm float32, x_end_norm float32, rounding float32) { @@ -8453,12 +8697,14 @@ func InternalScrollbar(axis Axis) { } func InternalScrollbarEx(bb Rect, id ID, axis Axis, p_scroll_v *int64, avail_v int64, contents_v int64, flags DrawFlags) bool { + idArg, idFin := id.c() p_scroll_vArg, p_scroll_vFin := WrapNumberPtr[C.ImS64, int64](p_scroll_v) defer func() { + idFin() p_scroll_vFin() }() - return C.igScrollbarEx(bb.toC(), C.ImGuiID(id), C.ImGuiAxis(axis), p_scroll_vArg, C.ImS64(avail_v), C.ImS64(contents_v), C.ImDrawFlags(flags)) == C.bool(true) + return C.igScrollbarEx(bb.toC(), idArg, C.ImGuiAxis(axis), p_scroll_vArg, C.ImS64(avail_v), C.ImS64(contents_v), C.ImDrawFlags(flags)) == C.bool(true) } // "bool selected" carry the selection state (read-only). Selectable() is clicked is returns true so you can modify your selection state. size.x==0.0: use remaining width, size.x>0.0: specify width. size.y==0.0: use label height, size.y>0.0: specify height @@ -8510,18 +8756,22 @@ func SeparatorText(label string) { } func InternalSeparatorTextEx(id ID, label string, label_end string, extra_width float32) { + idArg, idFin := id.c() labelArg, labelFin := WrapString(label) label_endArg, label_endFin := WrapString(label_end) - C.igSeparatorTextEx(C.ImGuiID(id), labelArg, label_endArg, C.float(extra_width)) + C.igSeparatorTextEx(idArg, labelArg, label_endArg, C.float(extra_width)) + idFin() labelFin() label_endFin() } func InternalSetActiveID(id ID, window *Window) { + idArg, idFin := id.c() windowArg, windowFin := window.handle() - C.igSetActiveID(C.ImGuiID(id), windowArg) + C.igSetActiveID(idArg, windowArg) + idFin() windowFin() } @@ -8596,24 +8846,29 @@ func SetCursorScreenPos(pos Vec2) { // type is a user defined string of maximum 32 characters. Strings starting with '_' are reserved for dear imgui internal types. Data is copied and held by imgui. Return true when payload has been accepted. // SetDragDropPayloadV parameter default value hint: // cond: 0 -func SetDragDropPayloadV(typeArg string, data unsafe.Pointer, sz uint64, cond Cond) bool { +func SetDragDropPayloadV(typeArg string, data uintptr, sz uint64, cond Cond) bool { typeArgArg, typeArgFin := WrapString(typeArg) defer func() { typeArgFin() }() - return C.igSetDragDropPayload(typeArgArg, (data), C.xulong(sz), C.ImGuiCond(cond)) == C.bool(true) + return C.wrap_igSetDragDropPayloadV(typeArgArg, C.uintptr_t(data), C.xulong(sz), C.ImGuiCond(cond)) == C.bool(true) } func InternalSetFocusID(id ID, window *Window) { + idArg, idFin := id.c() windowArg, windowFin := window.handle() - C.igSetFocusID(C.ImGuiID(id), windowArg) + C.igSetFocusID(idArg, windowArg) + idFin() windowFin() } func InternalSetHoveredID(id ID) { - C.igSetHoveredID(C.ImGuiID(id)) + idArg, idFin := id.c() + C.igSetHoveredID(idArg) + + idFin() } // make last item the default focused item of a window. @@ -8639,13 +8894,21 @@ func SetItemTooltip(fmt string) { // InternalSetKeyOwnerV parameter default value hint: // flags: 0 func InternalSetKeyOwnerV(key Key, owner_id ID, flags InputFlags) { - C.igSetKeyOwner(C.ImGuiKey(key), C.ImGuiID(owner_id), C.ImGuiInputFlags(flags)) + owner_idArg, owner_idFin := owner_id.c() + C.igSetKeyOwner(C.ImGuiKey(key), owner_idArg, C.ImGuiInputFlags(flags)) + + owner_idFin() } // InternalSetKeyOwnersForKeyChordV parameter default value hint: // flags: 0 func InternalSetKeyOwnersForKeyChordV(key KeyChord, owner_id ID, flags InputFlags) { - C.igSetKeyOwnersForKeyChord(C.ImGuiKeyChord(key), C.ImGuiID(owner_id), C.ImGuiInputFlags(flags)) + keyArg, keyFin := key.c() + owner_idArg, owner_idFin := owner_id.c() + C.igSetKeyOwnersForKeyChord(keyArg, owner_idArg, C.ImGuiInputFlags(flags)) + + keyFin() + owner_idFin() } // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget. Use -1 to access previous widget. @@ -8656,7 +8919,10 @@ func SetKeyboardFocusHereV(offset int32) { } func InternalSetLastItemData(item_id ID, in_flags ItemFlags, status_flags ItemStatusFlags, item_rect Rect) { - C.igSetLastItemData(C.ImGuiID(item_id), C.ImGuiItemFlags(in_flags), C.ImGuiItemStatusFlags(status_flags), item_rect.toC()) + item_idArg, item_idFin := item_id.c() + C.igSetLastItemData(item_idArg, C.ImGuiItemFlags(in_flags), C.ImGuiItemStatusFlags(status_flags), item_rect.toC()) + + item_idFin() } // set desired mouse cursor shape @@ -8665,7 +8931,12 @@ func SetMouseCursor(cursor_type MouseCursor) { } func InternalSetNavID(id ID, nav_layer NavLayer, focus_scope_id ID, rect_rel Rect) { - C.igSetNavID(C.ImGuiID(id), C.ImGuiNavLayer(nav_layer), C.ImGuiID(focus_scope_id), rect_rel.toC()) + idArg, idFin := id.c() + focus_scope_idArg, focus_scope_idFin := focus_scope_id.c() + C.igSetNavID(idArg, C.ImGuiNavLayer(nav_layer), focus_scope_idArg, rect_rel.toC()) + + idFin() + focus_scope_idFin() } func InternalSetNavWindow(window *Window) { @@ -8731,7 +9002,10 @@ func SetNextWindowContentSize(size Vec2) { // SetNextWindowDockIDV parameter default value hint: // cond: 0 func SetNextWindowDockIDV(dock_id ID, cond Cond) { - C.igSetNextWindowDockID(C.ImGuiID(dock_id), C.ImGuiCond(cond)) + dock_idArg, dock_idFin := dock_id.c() + C.igSetNextWindowDockID(dock_idArg, C.ImGuiCond(cond)) + + dock_idFin() } // set next window to be focused / top-most. call before Begin() @@ -8761,7 +9035,10 @@ func SetNextWindowSizeV(size Vec2, cond Cond) { // set next window viewport func SetNextWindowViewport(viewport_id ID) { - C.igSetNextWindowViewport(C.ImGuiID(viewport_id)) + viewport_idArg, viewport_idFin := viewport_id.c() + C.igSetNextWindowViewport(viewport_idArg) + + viewport_idFin() } // adjust scrolling amount to make given position visible. Generally GetCursorStartPos() + offset to compute a valid position. @@ -8834,7 +9111,14 @@ func InternalSetScrollYWindowPtr(window *Window, scroll_y float32) { // owner_id: 0 // flags: 0 func InternalSetShortcutRoutingV(key_chord KeyChord, owner_id ID, flags InputFlags) bool { - return C.igSetShortcutRouting(C.ImGuiKeyChord(key_chord), C.ImGuiID(owner_id), C.ImGuiInputFlags(flags)) == C.bool(true) + key_chordArg, key_chordFin := key_chord.c() + owner_idArg, owner_idFin := owner_id.c() + + defer func() { + key_chordFin() + owner_idFin() + }() + return C.igSetShortcutRouting(key_chordArg, owner_idArg, C.ImGuiInputFlags(flags)) == C.bool(true) } // replace current window storage with our own (if you want to manipulate it yourself, typically clear subsection of it) @@ -8896,9 +9180,11 @@ func InternalSetWindowCollapsedWindowPtrV(window *Window, collapsed bool, cond C func InternalSetWindowDock(window *Window, dock_id ID, cond Cond) { windowArg, windowFin := window.handle() - C.igSetWindowDock(windowArg, C.ImGuiID(dock_id), C.ImGuiCond(cond)) + dock_idArg, dock_idFin := dock_id.c() + C.igSetWindowDock(windowArg, dock_idArg, C.ImGuiCond(cond)) windowFin() + dock_idFin() } // (not recommended) set current window to be focused / top-most. prefer using SetNextWindowFocus(). @@ -9012,7 +9298,14 @@ func InternalShadeVertsLinearUV(draw_list *DrawList, vert_start_idx int32, vert_ // owner_id: 0 // flags: 0 func InternalShortcutV(key_chord KeyChord, owner_id ID, flags InputFlags) bool { - return C.igShortcut(C.ImGuiKeyChord(key_chord), C.ImGuiID(owner_id), C.ImGuiInputFlags(flags)) == C.bool(true) + key_chordArg, key_chordFin := key_chord.c() + owner_idArg, owner_idFin := owner_id.c() + + defer func() { + key_chordFin() + owner_idFin() + }() + return C.igShortcut(key_chordArg, owner_idArg, C.ImGuiInputFlags(flags)) == C.bool(true) } // create About window. display Dear ImGui version, credits and build/system information. @@ -9135,17 +9428,17 @@ func SliderAngleV(label string, v_rad *float32, v_degrees_min float32, v_degrees return C.igSliderAngle(labelArg, v_radArg, C.float(v_degrees_min), C.float(v_degrees_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) } -func InternalSliderBehavior(bb Rect, id ID, data_type DataType, p_v unsafe.Pointer, p_min unsafe.Pointer, p_max unsafe.Pointer, format string, flags SliderFlags, out_grab_bb *Rect) bool { - p_vArg, p_vFin := WrapVoidPtr(p_v) +func InternalSliderBehavior(bb Rect, id ID, data_type DataType, p_v uintptr, p_min uintptr, p_max uintptr, format string, flags SliderFlags, out_grab_bb *Rect) bool { + idArg, idFin := id.c() formatArg, formatFin := WrapString(format) out_grab_bbArg, out_grab_bbFin := wrap[C.ImRect, *Rect](out_grab_bb) defer func() { - p_vFin() + idFin() formatFin() out_grab_bbFin() }() - return C.igSliderBehavior(bb.toC(), C.ImGuiID(id), C.ImGuiDataType(data_type), p_vArg, (p_min), (p_max), formatArg, C.ImGuiSliderFlags(flags), out_grab_bbArg) == C.bool(true) + return C.wrap_igSliderBehavior(bb.toC(), idArg, C.ImGuiDataType(data_type), C.uintptr_t(p_v), C.uintptr_t(p_min), C.uintptr_t(p_max), formatArg, C.ImGuiSliderFlags(flags), out_grab_bbArg) == C.bool(true) } // adjust format to decorate the value with a prefix or a suffix for in-slider labels or unit display. @@ -9328,33 +9621,29 @@ func SliderInt4V(label string, v *[4]int32, v_min int32, v_max int32, format str // SliderScalarV parameter default value hint: // format: NULL // flags: 0 -func SliderScalarV(label string, data_type DataType, p_data unsafe.Pointer, p_min unsafe.Pointer, p_max unsafe.Pointer, format string, flags SliderFlags) bool { +func SliderScalarV(label string, data_type DataType, p_data uintptr, p_min uintptr, p_max uintptr, format string, flags SliderFlags) bool { labelArg, labelFin := WrapString(label) - p_dataArg, p_dataFin := WrapVoidPtr(p_data) formatArg, formatFin := WrapString(format) defer func() { labelFin() - p_dataFin() formatFin() }() - return C.igSliderScalar(labelArg, C.ImGuiDataType(data_type), p_dataArg, (p_min), (p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) + return C.wrap_igSliderScalarV(labelArg, C.ImGuiDataType(data_type), C.uintptr_t(p_data), C.uintptr_t(p_min), C.uintptr_t(p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) } // SliderScalarNV parameter default value hint: // format: NULL // flags: 0 -func SliderScalarNV(label string, data_type DataType, p_data unsafe.Pointer, components int32, p_min unsafe.Pointer, p_max unsafe.Pointer, format string, flags SliderFlags) bool { +func SliderScalarNV(label string, data_type DataType, p_data uintptr, components int32, p_min uintptr, p_max uintptr, format string, flags SliderFlags) bool { labelArg, labelFin := WrapString(label) - p_dataArg, p_dataFin := WrapVoidPtr(p_data) formatArg, formatFin := WrapString(format) defer func() { labelFin() - p_dataFin() formatFin() }() - return C.igSliderScalarN(labelArg, C.ImGuiDataType(data_type), p_dataArg, C.int(components), (p_min), (p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) + return C.wrap_igSliderScalarNV(labelArg, C.ImGuiDataType(data_type), C.uintptr_t(p_data), C.int(components), C.uintptr_t(p_min), C.uintptr_t(p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) } // button with FramePadding=(0,0) to easily embed within text @@ -9377,14 +9666,16 @@ func Spacing() { // hover_visibility_delay: 0.0f // bg_col: 0 func InternalSplitterBehaviorV(bb Rect, id ID, axis Axis, size1 *float32, size2 *float32, min_size1 float32, min_size2 float32, hover_extend float32, hover_visibility_delay float32, bg_col uint32) bool { + idArg, idFin := id.c() size1Arg, size1Fin := WrapNumberPtr[C.float, float32](size1) size2Arg, size2Fin := WrapNumberPtr[C.float, float32](size2) defer func() { + idFin() size1Fin() size2Fin() }() - return C.igSplitterBehavior(bb.toC(), C.ImGuiID(id), C.ImGuiAxis(axis), size1Arg, size2Arg, C.float(min_size1), C.float(min_size2), C.float(hover_extend), C.float(hover_visibility_delay), C.ImU32(bg_col)) == C.bool(true) + return C.igSplitterBehavior(bb.toC(), idArg, C.ImGuiAxis(axis), size1Arg, size2Arg, C.float(min_size1), C.float(min_size2), C.float(hover_extend), C.float(hover_visibility_delay), C.ImU32(bg_col)) == C.bool(true) } func InternalStartMouseMovingWindow(window *Window) { @@ -9462,11 +9753,13 @@ func InternalTabBarFindMostRecentlySelectedTabForActiveWindow(tab_bar *TabBar) * func InternalTabBarFindTabByID(tab_bar *TabBar, tab_id ID) *TabItem { tab_barArg, tab_barFin := tab_bar.handle() + tab_idArg, tab_idFin := tab_id.c() defer func() { tab_barFin() + tab_idFin() }() - return newTabItemFromC(C.igTabBarFindTabByID(tab_barArg, C.ImGuiID(tab_id))) + return newTabItemFromC(C.igTabBarFindTabByID(tab_barArg, tab_idArg)) } func InternalTabBarFindTabByOrder(tab_bar *TabBar, order int32) *TabItem { @@ -9547,9 +9840,11 @@ func InternalTabBarQueueReorderFromMousePos(tab_bar *TabBar, tab *TabItem, mouse func InternalTabBarRemoveTab(tab_bar *TabBar, tab_id ID) { tab_barArg, tab_barFin := tab_bar.handle() - C.igTabBarRemoveTab(tab_barArg, C.ImGuiID(tab_id)) + tab_idArg, tab_idFin := tab_id.c() + C.igTabBarRemoveTab(tab_barArg, tab_idArg) tab_barFin() + tab_idFin() } func InternalTabItemBackground(draw_list *DrawList, bb Rect, flags TabItemFlags, col uint32) { @@ -9615,12 +9910,16 @@ func InternalTabItemEx(tab_bar *TabBar, label string, p_open *bool, flags TabIte func InternalTabItemLabelAndCloseButton(draw_list *DrawList, bb Rect, flags TabItemFlags, frame_padding Vec2, label string, tab_id ID, close_button_id ID, is_contents_visible bool, out_just_closed *bool, out_text_clipped *bool) { draw_listArg, draw_listFin := draw_list.handle() labelArg, labelFin := WrapString(label) + tab_idArg, tab_idFin := tab_id.c() + close_button_idArg, close_button_idFin := close_button_id.c() out_just_closedArg, out_just_closedFin := WrapBool(out_just_closed) out_text_clippedArg, out_text_clippedFin := WrapBool(out_text_clipped) - C.igTabItemLabelAndCloseButton(draw_listArg, bb.toC(), C.ImGuiTabItemFlags(flags), frame_padding.toC(), labelArg, C.ImGuiID(tab_id), C.ImGuiID(close_button_id), C.bool(is_contents_visible), out_just_closedArg, out_text_clippedArg) + C.igTabItemLabelAndCloseButton(draw_listArg, bb.toC(), C.ImGuiTabItemFlags(flags), frame_padding.toC(), labelArg, tab_idArg, close_button_idArg, C.bool(is_contents_visible), out_just_closedArg, out_text_clippedArg) draw_listFin() labelFin() + tab_idFin() + close_button_idFin() out_just_closedFin() out_text_clippedFin() } @@ -9691,7 +9990,12 @@ func InternalTableEndRow(table *Table) { } func InternalTableFindByID(id ID) *Table { - return newTableFromC(C.igTableFindByID(C.ImGuiID(id))) + idArg, idFin := id.c() + + defer func() { + idFin() + }() + return newTableFromC(C.igTableFindByID(idArg)) } func InternalTableFixColumnSortDirection(table *Table, column *TableColumn) { @@ -9793,7 +10097,10 @@ func InternalTableGetColumnResizeIDV(table *Table, column_n int32, instance_no i defer func() { tableFin() }() - return ID(C.igTableGetColumnResizeID(tableArg, C.int(column_n), C.int(instance_no))) + return *newIDFromC(func() *C.ImGuiID { + result := C.igTableGetColumnResizeID(tableArg, C.int(column_n), C.int(instance_no)) + return &result + }()) } func InternalTableGetColumnWidthAuto(table *Table, column *TableColumn) float32 { @@ -9836,7 +10143,7 @@ func InternalTableGetInstanceID(table *Table, instance_no int32) ID { defer func() { tableFin() }() - return ID(C.igTableGetInstanceID(tableArg, C.int(instance_no))) + return *newIDFromC(func() *C.ImGuiID { result := C.igTableGetInstanceID(tableArg, C.int(instance_no)); return &result }()) } func InternalTableGetMaxColumnWidth(table *Table, column_n int32) float32 { @@ -9977,11 +10284,21 @@ func InternalTableSettingsAddSettingsHandler() { } func InternalTableSettingsCreate(id ID, columns_count int32) *TableSettings { - return newTableSettingsFromC(C.igTableSettingsCreate(C.ImGuiID(id), C.int(columns_count))) + idArg, idFin := id.c() + + defer func() { + idFin() + }() + return newTableSettingsFromC(C.igTableSettingsCreate(idArg, C.int(columns_count))) } func InternalTableSettingsFindByID(id ID) *TableSettings { - return newTableSettingsFromC(C.igTableSettingsFindByID(C.ImGuiID(id))) + idArg, idFin := id.c() + + defer func() { + idFin() + }() + return newTableSettingsFromC(C.igTableSettingsFindByID(idArg)) } // TableSetupColumnV parameter default value hint: @@ -9990,9 +10307,11 @@ func InternalTableSettingsFindByID(id ID) *TableSettings { // user_id: 0 func TableSetupColumnV(label string, flags TableColumnFlags, init_width_or_weight float32, user_id ID) { labelArg, labelFin := WrapString(label) - C.igTableSetupColumn(labelArg, C.ImGuiTableColumnFlags(flags), C.float(init_width_or_weight), C.ImGuiID(user_id)) + user_idArg, user_idFin := user_id.c() + C.igTableSetupColumn(labelArg, C.ImGuiTableColumnFlags(flags), C.float(init_width_or_weight), user_idArg) labelFin() + user_idFin() } func InternalTableSetupDrawChannels(table *Table) { @@ -10047,43 +10366,62 @@ func InternalTeleportMousePos(pos Vec2) { } func InternalTempInputIsActive(id ID) bool { - return C.igTempInputIsActive(C.ImGuiID(id)) == C.bool(true) + idArg, idFin := id.c() + + defer func() { + idFin() + }() + return C.igTempInputIsActive(idArg) == C.bool(true) } // InternalTempInputScalarV parameter default value hint: // p_clamp_min: NULL // p_clamp_max: NULL -func InternalTempInputScalarV(bb Rect, id ID, label string, data_type DataType, p_data unsafe.Pointer, format string, p_clamp_min unsafe.Pointer, p_clamp_max unsafe.Pointer) bool { +func InternalTempInputScalarV(bb Rect, id ID, label string, data_type DataType, p_data uintptr, format string, p_clamp_min uintptr, p_clamp_max uintptr) bool { + idArg, idFin := id.c() labelArg, labelFin := WrapString(label) - p_dataArg, p_dataFin := WrapVoidPtr(p_data) formatArg, formatFin := WrapString(format) defer func() { + idFin() labelFin() - p_dataFin() formatFin() }() - return C.igTempInputScalar(bb.toC(), C.ImGuiID(id), labelArg, C.ImGuiDataType(data_type), p_dataArg, formatArg, (p_clamp_min), (p_clamp_max)) == C.bool(true) + return C.wrap_igTempInputScalarV(bb.toC(), idArg, labelArg, C.ImGuiDataType(data_type), C.uintptr_t(p_data), formatArg, C.uintptr_t(p_clamp_min), C.uintptr_t(p_clamp_max)) == C.bool(true) } func InternalTempInputText(bb Rect, id ID, label string, buf string, buf_size int32, flags InputTextFlags) bool { + idArg, idFin := id.c() labelArg, labelFin := WrapString(label) bufArg, bufFin := WrapString(buf) defer func() { + idFin() labelFin() bufFin() }() - return C.igTempInputText(bb.toC(), C.ImGuiID(id), labelArg, bufArg, C.int(buf_size), C.ImGuiInputTextFlags(flags)) == C.bool(true) + return C.igTempInputText(bb.toC(), idArg, labelArg, bufArg, C.int(buf_size), C.ImGuiInputTextFlags(flags)) == C.bool(true) } // Test that key is either not owned, either owned by 'owner_id' func InternalTestKeyOwner(key Key, owner_id ID) bool { - return C.igTestKeyOwner(C.ImGuiKey(key), C.ImGuiID(owner_id)) == C.bool(true) + owner_idArg, owner_idFin := owner_id.c() + + defer func() { + owner_idFin() + }() + return C.igTestKeyOwner(C.ImGuiKey(key), owner_idArg) == C.bool(true) } func InternalTestShortcutRouting(key_chord KeyChord, owner_id ID) bool { - return C.igTestShortcutRouting(C.ImGuiKeyChord(key_chord), C.ImGuiID(owner_id)) == C.bool(true) + key_chordArg, key_chordFin := key_chord.c() + owner_idArg, owner_idFin := owner_id.c() + + defer func() { + key_chordFin() + owner_idFin() + }() + return C.igTestShortcutRouting(key_chordArg, owner_idArg) == C.bool(true) } // formatted text @@ -10146,23 +10484,25 @@ func InternalTranslateWindowsInViewport(viewport *ViewportP, old_pos Vec2, new_p // InternalTreeNodeBehaviorV parameter default value hint: // label_end: NULL func InternalTreeNodeBehaviorV(id ID, flags TreeNodeFlags, label string, label_end string) bool { + idArg, idFin := id.c() labelArg, labelFin := WrapString(label) label_endArg, label_endFin := WrapString(label_end) defer func() { + idFin() labelFin() label_endFin() }() - return C.igTreeNodeBehavior(C.ImGuiID(id), C.ImGuiTreeNodeFlags(flags), labelArg, label_endArg) == C.bool(true) + return C.igTreeNodeBehavior(idArg, C.ImGuiTreeNodeFlags(flags), labelArg, label_endArg) == C.bool(true) } -func TreeNodeExPtr(ptr_id unsafe.Pointer, flags TreeNodeFlags, fmt string) bool { +func TreeNodeExPtr(ptr_id uintptr, flags TreeNodeFlags, fmt string) bool { fmtArg, fmtFin := WrapString(fmt) defer func() { fmtFin() }() - return C.wrap_igTreeNodeEx_Ptr((ptr_id), C.ImGuiTreeNodeFlags(flags), fmtArg) == C.bool(true) + return C.wrap_igTreeNodeEx_Ptr(C.uintptr_t(ptr_id), C.ImGuiTreeNodeFlags(flags), fmtArg) == C.bool(true) } // TreeNodeExStrV parameter default value hint: @@ -10188,22 +10528,30 @@ func TreeNodeExStrStr(str_id string, flags TreeNodeFlags, fmt string) bool { } func InternalTreeNodeSetOpen(id ID, open bool) { - C.igTreeNodeSetOpen(C.ImGuiID(id), C.bool(open)) + idArg, idFin := id.c() + C.igTreeNodeSetOpen(idArg, C.bool(open)) + + idFin() } // Return open state. Consume previous SetNextItemOpen() data, if any. May return true when logging. func InternalTreeNodeUpdateNextOpen(id ID, flags TreeNodeFlags) bool { - return C.igTreeNodeUpdateNextOpen(C.ImGuiID(id), C.ImGuiTreeNodeFlags(flags)) == C.bool(true) + idArg, idFin := id.c() + + defer func() { + idFin() + }() + return C.igTreeNodeUpdateNextOpen(idArg, C.ImGuiTreeNodeFlags(flags)) == C.bool(true) } // " -func TreeNodePtr(ptr_id unsafe.Pointer, fmt string) bool { +func TreeNodePtr(ptr_id uintptr, fmt string) bool { fmtArg, fmtFin := WrapString(fmt) defer func() { fmtFin() }() - return C.wrap_igTreeNode_Ptr((ptr_id), fmtArg) == C.bool(true) + return C.wrap_igTreeNode_Ptr(C.uintptr_t(ptr_id), fmtArg) == C.bool(true) } func TreeNodeStr(label string) bool { @@ -10233,12 +10581,15 @@ func TreePop() { } func InternalTreePushOverrideID(id ID) { - C.igTreePushOverrideID(C.ImGuiID(id)) + idArg, idFin := id.c() + C.igTreePushOverrideID(idArg) + + idFin() } // " -func TreePushPtr(ptr_id unsafe.Pointer) { - C.igTreePush_Ptr((ptr_id)) +func TreePushPtr(ptr_id uintptr) { + C.wrap_igTreePush_Ptr(C.uintptr_t(ptr_id)) } // ~ Indent()+PushId(). Already called by TreeNode() when returning true, but you can call TreePush/TreePop yourself if desired. @@ -10321,17 +10672,15 @@ func VSliderIntV(label string, size Vec2, v *int32, v_min int32, v_max int32, fo // VSliderScalarV parameter default value hint: // format: NULL // flags: 0 -func VSliderScalarV(label string, size Vec2, data_type DataType, p_data unsafe.Pointer, p_min unsafe.Pointer, p_max unsafe.Pointer, format string, flags SliderFlags) bool { +func VSliderScalarV(label string, size Vec2, data_type DataType, p_data uintptr, p_min uintptr, p_max uintptr, format string, flags SliderFlags) bool { labelArg, labelFin := WrapString(label) - p_dataArg, p_dataFin := WrapVoidPtr(p_data) formatArg, formatFin := WrapString(format) defer func() { labelFin() - p_dataFin() formatFin() }() - return C.igVSliderScalar(labelArg, size.toC(), C.ImGuiDataType(data_type), p_dataArg, (p_min), (p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) + return C.wrap_igVSliderScalarV(labelArg, size.toC(), C.ImGuiDataType(data_type), C.uintptr_t(p_data), C.uintptr_t(p_min), C.uintptr_t(p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) } func ValueBool(prefix string, b bool) { @@ -10467,23 +10816,29 @@ func (self *DrawList) AddEllipseFilled(center Vec2, radius_x float32, radius_y f func (self *DrawList) AddImage(user_texture_id TextureID, p_min Vec2, p_max Vec2) { selfArg, selfFin := self.handle() - C.wrap_ImDrawList_AddImage(selfArg, C.ImTextureID(user_texture_id), p_min.toC(), p_max.toC()) + user_texture_idArg, user_texture_idFin := user_texture_id.c() + C.wrap_ImDrawList_AddImage(selfArg, user_texture_idArg, p_min.toC(), p_max.toC()) selfFin() + user_texture_idFin() } func (self *DrawList) AddImageQuad(user_texture_id TextureID, p1 Vec2, p2 Vec2, p3 Vec2, p4 Vec2) { selfArg, selfFin := self.handle() - C.wrap_ImDrawList_AddImageQuad(selfArg, C.ImTextureID(user_texture_id), p1.toC(), p2.toC(), p3.toC(), p4.toC()) + user_texture_idArg, user_texture_idFin := user_texture_id.c() + C.wrap_ImDrawList_AddImageQuad(selfArg, user_texture_idArg, p1.toC(), p2.toC(), p3.toC(), p4.toC()) selfFin() + user_texture_idFin() } func (self *DrawList) AddImageRounded(user_texture_id TextureID, p_min Vec2, p_max Vec2, uv_min Vec2, uv_max Vec2, col uint32, rounding float32) { selfArg, selfFin := self.handle() - C.wrap_ImDrawList_AddImageRounded(selfArg, C.ImTextureID(user_texture_id), p_min.toC(), p_max.toC(), uv_min.toC(), uv_max.toC(), C.ImU32(col), C.float(rounding)) + user_texture_idArg, user_texture_idFin := user_texture_id.c() + C.wrap_ImDrawList_AddImageRounded(selfArg, user_texture_idArg, p_min.toC(), p_max.toC(), uv_min.toC(), uv_max.toC(), C.ImU32(col), C.float(rounding)) selfFin() + user_texture_idFin() } func (self *DrawList) AddLine(p1 Vec2, p2 Vec2, col uint32) { @@ -10639,24 +10994,22 @@ func (self *FontAtlas) AddFontFromMemoryCompressedBase85TTF(compressed_font_data return newFontFromC(C.wrap_ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(selfArg, compressed_font_data_base85Arg, C.float(size_pixels))) } -func (self *FontAtlas) AddFontFromMemoryCompressedTTF(compressed_font_data unsafe.Pointer, compressed_font_data_size int32, size_pixels float32) *Font { +func (self *FontAtlas) AddFontFromMemoryCompressedTTF(compressed_font_data uintptr, compressed_font_data_size int32, size_pixels float32) *Font { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return newFontFromC(C.wrap_ImFontAtlas_AddFontFromMemoryCompressedTTF(selfArg, (compressed_font_data), C.int(compressed_font_data_size), C.float(size_pixels))) + return newFontFromC(C.wrap_ImFontAtlas_AddFontFromMemoryCompressedTTF(selfArg, C.uintptr_t(compressed_font_data), C.int(compressed_font_data_size), C.float(size_pixels))) } -func (self *FontAtlas) AddFontFromMemoryTTF(font_data unsafe.Pointer, font_data_size int32, size_pixels float32) *Font { +func (self *FontAtlas) AddFontFromMemoryTTF(font_data uintptr, font_data_size int32, size_pixels float32) *Font { selfArg, selfFin := self.handle() - font_dataArg, font_dataFin := WrapVoidPtr(font_data) defer func() { selfFin() - font_dataFin() }() - return newFontFromC(C.wrap_ImFontAtlas_AddFontFromMemoryTTF(selfArg, font_dataArg, C.int(font_data_size), C.float(size_pixels))) + return newFontFromC(C.wrap_ImFontAtlas_AddFontFromMemoryTTF(selfArg, C.uintptr_t(font_data), C.int(font_data_size), C.float(size_pixels))) } func (self *FontGlyphRangesBuilder) AddText(text string) { @@ -10726,47 +11079,57 @@ func (self *ListClipper) Begin(items_count int32) { func (self *Storage) Bool(key ID) bool { selfArg, selfFin := self.handle() + keyArg, keyFin := key.c() defer func() { selfFin() + keyFin() }() - return C.wrap_ImGuiStorage_GetBool(selfArg, C.ImGuiID(key)) == C.bool(true) + return C.wrap_ImGuiStorage_GetBool(selfArg, keyArg) == C.bool(true) } func (self *Storage) Float(key ID) float32 { selfArg, selfFin := self.handle() + keyArg, keyFin := key.c() defer func() { selfFin() + keyFin() }() - return float32(C.wrap_ImGuiStorage_GetFloat(selfArg, C.ImGuiID(key))) + return float32(C.wrap_ImGuiStorage_GetFloat(selfArg, keyArg)) } func (self *Storage) FloatRef(key ID) *float32 { selfArg, selfFin := self.handle() + keyArg, keyFin := key.c() defer func() { selfFin() + keyFin() }() - return (*float32)(C.wrap_ImGuiStorage_GetFloatRef(selfArg, C.ImGuiID(key))) + return (*float32)(C.wrap_ImGuiStorage_GetFloatRef(selfArg, keyArg)) } func (self *Storage) Int(key ID) int32 { selfArg, selfFin := self.handle() + keyArg, keyFin := key.c() defer func() { selfFin() + keyFin() }() - return int32(C.wrap_ImGuiStorage_GetInt(selfArg, C.ImGuiID(key))) + return int32(C.wrap_ImGuiStorage_GetInt(selfArg, keyArg)) } func (self *Storage) IntRef(key ID) *int32 { selfArg, selfFin := self.handle() + keyArg, keyFin := key.c() defer func() { selfFin() + keyFin() }() - return (*int32)(C.wrap_ImGuiStorage_GetIntRef(selfArg, C.ImGuiID(key))) + return (*int32)(C.wrap_ImGuiStorage_GetIntRef(selfArg, keyArg)) } func (self *TextBuffer) Append(str string) { @@ -10806,7 +11169,7 @@ func (self *Window) InternalIDStr(str string) ID { selfFin() strFin() }() - return ID(C.wrap_ImGuiWindow_GetID_Str(selfArg, strArg)) + return *newIDFromC(func() *C.ImGuiID { result := C.wrap_ImGuiWindow_GetID_Str(selfArg, strArg); return &result }()) } func AcceptDragDropPayload(typeArg string) *Payload { @@ -10837,11 +11200,21 @@ func Begin(name string) bool { } func BeginChildFrame(id ID, size Vec2) bool { - return C.wrap_igBeginChildFrame(C.ImGuiID(id), size.toC()) == C.bool(true) + idArg, idFin := id.c() + + defer func() { + idFin() + }() + return C.wrap_igBeginChildFrame(idArg, size.toC()) == C.bool(true) } func BeginChildID(id ID) bool { - return C.wrap_igBeginChild_ID(C.ImGuiID(id)) == C.bool(true) + idArg, idFin := id.c() + + defer func() { + idFin() + }() + return C.wrap_igBeginChild_ID(idArg) == C.bool(true) } func BeginChildStr(str_id string) bool { @@ -10967,11 +11340,13 @@ func BeginTable(str_id string, column int32) bool { func InternalBeginTableEx(name string, id ID, columns_count int32) bool { nameArg, nameFin := WrapString(name) + idArg, idFin := id.c() defer func() { nameFin() + idFin() }() - return C.wrap_igBeginTableEx(nameArg, C.ImGuiID(id), C.int(columns_count)) == C.bool(true) + return C.wrap_igBeginTableEx(nameArg, idArg, C.int(columns_count)) == C.bool(true) } func Button(label string) bool { @@ -10984,14 +11359,16 @@ func Button(label string) bool { } func InternalButtonBehavior(bb Rect, id ID, out_hovered *bool, out_held *bool) bool { + idArg, idFin := id.c() out_hoveredArg, out_hoveredFin := WrapBool(out_hovered) out_heldArg, out_heldFin := WrapBool(out_held) defer func() { + idFin() out_hoveredFin() out_heldFin() }() - return C.wrap_igButtonBehavior(bb.toC(), C.ImGuiID(id), out_hoveredArg, out_heldArg) == C.bool(true) + return C.wrap_igButtonBehavior(bb.toC(), idArg, out_hoveredArg, out_heldArg) == C.bool(true) } func InternalButtonEx(label string) bool { @@ -11168,11 +11545,14 @@ func DestroyContext() { } func InternalDockBuilderAddNode() ID { - return ID(C.wrap_igDockBuilderAddNode()) + return *newIDFromC(func() *C.ImGuiID { result := C.wrap_igDockBuilderAddNode(); return &result }()) } func InternalDockBuilderRemoveNodeDockedWindows(node_id ID) { - C.wrap_igDockBuilderRemoveNodeDockedWindows(C.ImGuiID(node_id)) + node_idArg, node_idFin := node_id.c() + C.wrap_igDockBuilderRemoveNodeDockedWindows(node_idArg) + + node_idFin() } func InternalDockContextProcessUndockWindow(ctx *Context, window *Window) { @@ -11185,11 +11565,16 @@ func InternalDockContextProcessUndockWindow(ctx *Context, window *Window) { } func DockSpace(id ID) ID { - return ID(C.wrap_igDockSpace(C.ImGuiID(id))) + idArg, idFin := id.c() + + defer func() { + idFin() + }() + return *newIDFromC(func() *C.ImGuiID { result := C.wrap_igDockSpace(idArg); return &result }()) } func DockSpaceOverViewport() ID { - return ID(C.wrap_igDockSpaceOverViewport()) + return *newIDFromC(func() *C.ImGuiID { result := C.wrap_igDockSpaceOverViewport(); return &result }()) } func DragFloat(label string, v *float32) bool { @@ -11348,26 +11733,22 @@ func DragIntRange2(label string, v_current_min *int32, v_current_max *int32) boo return C.wrap_igDragIntRange2(labelArg, v_current_minArg, v_current_maxArg) == C.bool(true) } -func DragScalar(label string, data_type DataType, p_data unsafe.Pointer) bool { +func DragScalar(label string, data_type DataType, p_data uintptr) bool { labelArg, labelFin := WrapString(label) - p_dataArg, p_dataFin := WrapVoidPtr(p_data) defer func() { labelFin() - p_dataFin() }() - return C.wrap_igDragScalar(labelArg, C.ImGuiDataType(data_type), p_dataArg) == C.bool(true) + return C.wrap_igDragScalar(labelArg, C.ImGuiDataType(data_type), C.uintptr_t(p_data)) == C.bool(true) } -func DragScalarN(label string, data_type DataType, p_data unsafe.Pointer, components int32) bool { +func DragScalarN(label string, data_type DataType, p_data uintptr, components int32) bool { labelArg, labelFin := WrapString(label) - p_dataArg, p_dataFin := WrapVoidPtr(p_data) defer func() { labelFin() - p_dataFin() }() - return C.wrap_igDragScalarN(labelArg, C.ImGuiDataType(data_type), p_dataArg, C.int(components)) == C.bool(true) + return C.wrap_igDragScalarN(labelArg, C.ImGuiDataType(data_type), C.uintptr_t(p_data), C.int(components)) == C.bool(true) } func InternalFindRenderedTextEnd(text string) string { @@ -11413,7 +11794,7 @@ func InternalTypingSelectRequest() *TypingSelectRequest { return newTypingSelectRequestFromC(C.wrap_igGetTypingSelectRequest()) } -func InternalImFileLoadToMemory(filename string, mode string) unsafe.Pointer { +func InternalImFileLoadToMemory(filename string, mode string) uintptr { filenameArg, filenameFin := WrapString(filename) modeArg, modeFin := WrapString(mode) @@ -11421,11 +11802,14 @@ func InternalImFileLoadToMemory(filename string, mode string) unsafe.Pointer { filenameFin() modeFin() }() - return unsafe.Pointer(C.wrap_igImFileLoadToMemory(filenameArg, modeArg)) + return uintptr(C.wrap_igImFileLoadToMemory(filenameArg, modeArg)) } -func InternalImHashData(data unsafe.Pointer, data_size uint64) ID { - return ID(C.wrap_igImHashData((data), C.xulong(data_size))) +func InternalImHashData(data uintptr, data_size uint64) ID { + return *newIDFromC(func() *C.ImGuiID { + result := C.wrap_igImHashData(C.uintptr_t(data), C.xulong(data_size)) + return &result + }()) } func InternalImHashStr(data string) ID { @@ -11434,7 +11818,7 @@ func InternalImHashStr(data string) ID { defer func() { dataFin() }() - return ID(C.wrap_igImHashStr(dataArg)) + return *newIDFromC(func() *C.ImGuiID { result := C.wrap_igImHashStr(dataArg); return &result }()) } func InternalImTextStrFromUtf8(out_buf *Wchar, out_buf_size int32, in_text string, in_text_end string) int32 { @@ -11449,20 +11833,32 @@ func InternalImTextStrFromUtf8(out_buf *Wchar, out_buf_size int32, in_text strin } func Image(user_texture_id TextureID, size Vec2) { - C.wrap_igImage(C.ImTextureID(user_texture_id), size.toC()) + user_texture_idArg, user_texture_idFin := user_texture_id.c() + C.wrap_igImage(user_texture_idArg, size.toC()) + + user_texture_idFin() } func ImageButton(str_id string, user_texture_id TextureID, size Vec2) bool { str_idArg, str_idFin := WrapString(str_id) + user_texture_idArg, user_texture_idFin := user_texture_id.c() defer func() { str_idFin() + user_texture_idFin() }() - return C.wrap_igImageButton(str_idArg, C.ImTextureID(user_texture_id), size.toC()) == C.bool(true) + return C.wrap_igImageButton(str_idArg, user_texture_idArg, size.toC()) == C.bool(true) } func InternalImageButtonEx(id ID, texture_id TextureID, size Vec2, uv0 Vec2, uv1 Vec2, bg_col Vec4, tint_col Vec4) bool { - return C.wrap_igImageButtonEx(C.ImGuiID(id), C.ImTextureID(texture_id), size.toC(), uv0.toC(), uv1.toC(), bg_col.toC(), tint_col.toC()) == C.bool(true) + idArg, idFin := id.c() + texture_idArg, texture_idFin := texture_id.c() + + defer func() { + idFin() + texture_idFin() + }() + return C.wrap_igImageButtonEx(idArg, texture_idArg, size.toC(), uv0.toC(), uv1.toC(), bg_col.toC(), tint_col.toC()) == C.bool(true) } func Indent() { @@ -11610,26 +12006,22 @@ func InputInt4(label string, v *[4]int32) bool { return C.wrap_igInputInt4(labelArg, (*C.int)(&vArg[0])) == C.bool(true) } -func InputScalar(label string, data_type DataType, p_data unsafe.Pointer) bool { +func InputScalar(label string, data_type DataType, p_data uintptr) bool { labelArg, labelFin := WrapString(label) - p_dataArg, p_dataFin := WrapVoidPtr(p_data) defer func() { labelFin() - p_dataFin() }() - return C.wrap_igInputScalar(labelArg, C.ImGuiDataType(data_type), p_dataArg) == C.bool(true) + return C.wrap_igInputScalar(labelArg, C.ImGuiDataType(data_type), C.uintptr_t(p_data)) == C.bool(true) } -func InputScalarN(label string, data_type DataType, p_data unsafe.Pointer, components int32) bool { +func InputScalarN(label string, data_type DataType, p_data uintptr, components int32) bool { labelArg, labelFin := WrapString(label) - p_dataArg, p_dataFin := WrapVoidPtr(p_data) defer func() { labelFin() - p_dataFin() }() - return C.wrap_igInputScalarN(labelArg, C.ImGuiDataType(data_type), p_dataArg, C.int(components)) == C.bool(true) + return C.wrap_igInputScalarN(labelArg, C.ImGuiDataType(data_type), C.uintptr_t(p_data), C.int(components)) == C.bool(true) } func InternalInputTextEx(label string, hint string, buf string, buf_size int32, size_arg Vec2, flags InputTextFlags) bool { @@ -11671,7 +12063,12 @@ func IsKeyPressedBool(key Key) bool { } func InternalIsKeyPressedID(key Key, owner_id ID) bool { - return C.wrap_igIsKeyPressed_ID(C.ImGuiKey(key), C.ImGuiID(owner_id)) == C.bool(true) + owner_idArg, owner_idFin := owner_id.c() + + defer func() { + owner_idFin() + }() + return C.wrap_igIsKeyPressed_ID(C.ImGuiKey(key), owner_idArg) == C.bool(true) } func IsMouseClickedBool(button MouseButton) bool { @@ -11679,7 +12076,12 @@ func IsMouseClickedBool(button MouseButton) bool { } func InternalIsMouseClickedID(button MouseButton, owner_id ID) bool { - return C.wrap_igIsMouseClicked_ID(C.ImGuiMouseButton(button), C.ImGuiID(owner_id)) == C.bool(true) + owner_idArg, owner_idFin := owner_id.c() + + defer func() { + owner_idFin() + }() + return C.wrap_igIsMouseClicked_ID(C.ImGuiMouseButton(button), owner_idArg) == C.bool(true) } func InternalIsMouseDragPastThreshold(button MouseButton) bool { @@ -11725,7 +12127,12 @@ func IsWindowHovered() bool { } func InternalItemAdd(bb Rect, id ID) bool { - return C.wrap_igItemAdd(bb.toC(), C.ImGuiID(id)) == C.bool(true) + idArg, idFin := id.c() + + defer func() { + idFin() + }() + return C.wrap_igItemAdd(bb.toC(), idArg) == C.bool(true) } func InternalItemSizeRect(bb Rect) { @@ -11815,7 +12222,10 @@ func MenuItemBoolPtr(label string, shortcut string, p_selected *bool) bool { } func InternalOpenPopupEx(id ID) { - C.wrap_igOpenPopupEx(C.ImGuiID(id)) + idArg, idFin := id.c() + C.wrap_igOpenPopupEx(idArg) + + idFin() } func OpenPopupOnItemClick() { @@ -11823,7 +12233,10 @@ func OpenPopupOnItemClick() { } func OpenPopupID(id ID) { - C.wrap_igOpenPopup_ID(C.ImGuiID(id)) + idArg, idFin := id.c() + C.wrap_igOpenPopup_ID(idArg) + + idFin() } func OpenPopupStr(str_id string) { @@ -11886,7 +12299,10 @@ func InternalRenderFrameBorder(p_min Vec2, p_max Vec2) { } func InternalRenderNavHighlight(bb Rect, id ID) { - C.wrap_igRenderNavHighlight(bb.toC(), C.ImGuiID(id)) + idArg, idFin := id.c() + C.wrap_igRenderNavHighlight(bb.toC(), idArg) + + idFin() } func RenderPlatformWindowsDefault() { @@ -11980,13 +12396,13 @@ func InternalSeparatorEx(flags SeparatorFlags) { C.wrap_igSeparatorEx(C.ImGuiSeparatorFlags(flags)) } -func SetDragDropPayload(typeArg string, data unsafe.Pointer, sz uint64) bool { +func SetDragDropPayload(typeArg string, data uintptr, sz uint64) bool { typeArgArg, typeArgFin := WrapString(typeArg) defer func() { typeArgFin() }() - return C.wrap_igSetDragDropPayload(typeArgArg, (data), C.xulong(sz)) == C.bool(true) + return C.wrap_igSetDragDropPayload(typeArgArg, C.uintptr_t(data), C.xulong(sz)) == C.bool(true) } func InternalSetItemKeyOwner(key Key) { @@ -11994,11 +12410,19 @@ func InternalSetItemKeyOwner(key Key) { } func InternalSetKeyOwner(key Key, owner_id ID) { - C.wrap_igSetKeyOwner(C.ImGuiKey(key), C.ImGuiID(owner_id)) + owner_idArg, owner_idFin := owner_id.c() + C.wrap_igSetKeyOwner(C.ImGuiKey(key), owner_idArg) + + owner_idFin() } func InternalSetKeyOwnersForKeyChord(key KeyChord, owner_id ID) { - C.wrap_igSetKeyOwnersForKeyChord(C.ImGuiKeyChord(key), C.ImGuiID(owner_id)) + keyArg, keyFin := key.c() + owner_idArg, owner_idFin := owner_id.c() + C.wrap_igSetKeyOwnersForKeyChord(keyArg, owner_idArg) + + keyFin() + owner_idFin() } func SetKeyboardFocusHere() { @@ -12014,7 +12438,10 @@ func SetNextWindowCollapsed(collapsed bool) { } func SetNextWindowDockID(dock_id ID) { - C.wrap_igSetNextWindowDockID(C.ImGuiID(dock_id)) + dock_idArg, dock_idFin := dock_id.c() + C.wrap_igSetNextWindowDockID(dock_idArg) + + dock_idFin() } func SetNextWindowPos(pos Vec2) { @@ -12046,7 +12473,12 @@ func SetScrollHereY() { } func InternalSetShortcutRouting(key_chord KeyChord) bool { - return C.wrap_igSetShortcutRouting(C.ImGuiKeyChord(key_chord)) == C.bool(true) + key_chordArg, key_chordFin := key_chord.c() + + defer func() { + key_chordFin() + }() + return C.wrap_igSetShortcutRouting(key_chordArg) == C.bool(true) } func SetWindowCollapsedBool(collapsed bool) { @@ -12104,7 +12536,12 @@ func InternalSetWindowSizeWindowPtr(window *Window, size Vec2) { } func InternalShortcut(key_chord KeyChord) bool { - return C.wrap_igShortcut(C.ImGuiKeyChord(key_chord)) == C.bool(true) + key_chordArg, key_chordFin := key_chord.c() + + defer func() { + key_chordFin() + }() + return C.wrap_igShortcut(key_chordArg) == C.bool(true) } func ShowAboutWindow() { @@ -12272,37 +12709,35 @@ func SliderInt4(label string, v *[4]int32, v_min int32, v_max int32) bool { return C.wrap_igSliderInt4(labelArg, (*C.int)(&vArg[0]), C.int(v_min), C.int(v_max)) == C.bool(true) } -func SliderScalar(label string, data_type DataType, p_data unsafe.Pointer, p_min unsafe.Pointer, p_max unsafe.Pointer) bool { +func SliderScalar(label string, data_type DataType, p_data uintptr, p_min uintptr, p_max uintptr) bool { labelArg, labelFin := WrapString(label) - p_dataArg, p_dataFin := WrapVoidPtr(p_data) defer func() { labelFin() - p_dataFin() }() - return C.wrap_igSliderScalar(labelArg, C.ImGuiDataType(data_type), p_dataArg, (p_min), (p_max)) == C.bool(true) + return C.wrap_igSliderScalar(labelArg, C.ImGuiDataType(data_type), C.uintptr_t(p_data), C.uintptr_t(p_min), C.uintptr_t(p_max)) == C.bool(true) } -func SliderScalarN(label string, data_type DataType, p_data unsafe.Pointer, components int32, p_min unsafe.Pointer, p_max unsafe.Pointer) bool { +func SliderScalarN(label string, data_type DataType, p_data uintptr, components int32, p_min uintptr, p_max uintptr) bool { labelArg, labelFin := WrapString(label) - p_dataArg, p_dataFin := WrapVoidPtr(p_data) defer func() { labelFin() - p_dataFin() }() - return C.wrap_igSliderScalarN(labelArg, C.ImGuiDataType(data_type), p_dataArg, C.int(components), (p_min), (p_max)) == C.bool(true) + return C.wrap_igSliderScalarN(labelArg, C.ImGuiDataType(data_type), C.uintptr_t(p_data), C.int(components), C.uintptr_t(p_min), C.uintptr_t(p_max)) == C.bool(true) } func InternalSplitterBehavior(bb Rect, id ID, axis Axis, size1 *float32, size2 *float32, min_size1 float32, min_size2 float32) bool { + idArg, idFin := id.c() size1Arg, size1Fin := WrapNumberPtr[C.float, float32](size1) size2Arg, size2Fin := WrapNumberPtr[C.float, float32](size2) defer func() { + idFin() size1Fin() size2Fin() }() - return C.wrap_igSplitterBehavior(bb.toC(), C.ImGuiID(id), C.ImGuiAxis(axis), size1Arg, size2Arg, C.float(min_size1), C.float(min_size2)) == C.bool(true) + return C.wrap_igSplitterBehavior(bb.toC(), idArg, C.ImGuiAxis(axis), size1Arg, size2Arg, C.float(min_size1), C.float(min_size2)) == C.bool(true) } func StyleColorsClassic() { @@ -12340,7 +12775,10 @@ func InternalTableGetColumnResizeID(table *Table, column_n int32) ID { defer func() { tableFin() }() - return ID(C.wrap_igTableGetColumnResizeID(tableArg, C.int(column_n))) + return *newIDFromC(func() *C.ImGuiID { + result := C.wrap_igTableGetColumnResizeID(tableArg, C.int(column_n)) + return &result + }()) } func TableNextRow() { @@ -12362,17 +12800,17 @@ func TableSetupColumn(label string) { labelFin() } -func InternalTempInputScalar(bb Rect, id ID, label string, data_type DataType, p_data unsafe.Pointer, format string) bool { +func InternalTempInputScalar(bb Rect, id ID, label string, data_type DataType, p_data uintptr, format string) bool { + idArg, idFin := id.c() labelArg, labelFin := WrapString(label) - p_dataArg, p_dataFin := WrapVoidPtr(p_data) formatArg, formatFin := WrapString(format) defer func() { + idFin() labelFin() - p_dataFin() formatFin() }() - return C.wrap_igTempInputScalar(bb.toC(), C.ImGuiID(id), labelArg, C.ImGuiDataType(data_type), p_dataArg, formatArg) == C.bool(true) + return C.wrap_igTempInputScalar(bb.toC(), idArg, labelArg, C.ImGuiDataType(data_type), C.uintptr_t(p_data), formatArg) == C.bool(true) } func InternalTextEx(text string) { @@ -12390,12 +12828,14 @@ func TextUnformatted(text string) { } func InternalTreeNodeBehavior(id ID, flags TreeNodeFlags, label string) bool { + idArg, idFin := id.c() labelArg, labelFin := WrapString(label) defer func() { + idFin() labelFin() }() - return C.wrap_igTreeNodeBehavior(C.ImGuiID(id), C.ImGuiTreeNodeFlags(flags), labelArg) == C.bool(true) + return C.wrap_igTreeNodeBehavior(idArg, C.ImGuiTreeNodeFlags(flags), labelArg) == C.bool(true) } func TreeNodeExStr(label string) bool { @@ -12433,15 +12873,13 @@ func VSliderInt(label string, size Vec2, v *int32, v_min int32, v_max int32) boo return C.wrap_igVSliderInt(labelArg, size.toC(), vArg, C.int(v_min), C.int(v_max)) == C.bool(true) } -func VSliderScalar(label string, size Vec2, data_type DataType, p_data unsafe.Pointer, p_min unsafe.Pointer, p_max unsafe.Pointer) bool { +func VSliderScalar(label string, size Vec2, data_type DataType, p_data uintptr, p_min uintptr, p_max uintptr) bool { labelArg, labelFin := WrapString(label) - p_dataArg, p_dataFin := WrapVoidPtr(p_data) defer func() { labelFin() - p_dataFin() }() - return C.wrap_igVSliderScalar(labelArg, size.toC(), C.ImGuiDataType(data_type), p_dataArg, (p_min), (p_max)) == C.bool(true) + return C.wrap_igVSliderScalar(labelArg, size.toC(), C.ImGuiDataType(data_type), C.uintptr_t(p_data), C.uintptr_t(p_min), C.uintptr_t(p_max)) == C.bool(true) } func ValueFloat(prefix string, v float32) { @@ -12506,48 +12944,27 @@ func (self *DrawChannel) CmdBuffer() Vector[*DrawCmd] { return newVectorFromC(C.wrap_ImDrawChannel_Get_CmdBuffer(selfArg).Size, C.wrap_ImDrawChannel_Get_CmdBuffer(selfArg).Capacity, newDrawCmdFromC(C.wrap_ImDrawChannel_Get_CmdBuffer(selfArg).Data)) } -func (self DrawChannel) SetIdxBuffer(v Vector[*DrawIdx]) { - vData := v.Data - vDataArg, _ := WrapNumberPtr[C.ImDrawIdx, DrawIdx](vData) - vVecArg := new(C.ImVector_ImDrawIdx) - vVecArg.Size = C.int(v.Size) - vVecArg.Capacity = C.int(v.Capacity) - vVecArg.Data = vDataArg - v.pinner.Pin(vVecArg.Data) - +func (self DrawCmd) SetClipRect(v Vec4) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImDrawChannel_Set_IdxBuffer(selfArg, *vVecArg) + C.wrap_ImDrawCmd_SetClipRect(selfArg, v.toC()) } -func (self *DrawChannel) IdxBuffer() Vector[*DrawIdx] { +func (self *DrawCmd) ClipRect() Vec4 { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return newVectorFromC(C.wrap_ImDrawChannel_Get_IdxBuffer(selfArg).Size, C.wrap_ImDrawChannel_Get_IdxBuffer(selfArg).Capacity, (*DrawIdx)(C.wrap_ImDrawChannel_Get_IdxBuffer(selfArg).Data)) + return *(&Vec4{}).fromC(C.wrap_ImDrawCmd_GetClipRect(selfArg)) } -func (self DrawCmd) SetClipRect(v Vec4) { +func (self DrawCmd) SetTextureId(v TextureID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImDrawCmd_SetClipRect(selfArg, v.toC()) -} - -func (self *DrawCmd) ClipRect() Vec4 { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return *(&Vec4{}).fromC(C.wrap_ImDrawCmd_GetClipRect(selfArg)) -} - -func (self DrawCmd) SetTextureId(v TextureID) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImDrawCmd_SetTextureId(selfArg, C.ImTextureID(v)) + C.wrap_ImDrawCmd_SetTextureId(selfArg, vArg) } func (self *DrawCmd) TextureId() TextureID { @@ -12556,7 +12973,9 @@ func (self *DrawCmd) TextureId() TextureID { defer func() { selfFin() }() - return TextureID(C.wrap_ImDrawCmd_GetTextureId(selfArg)) + + result := C.wrap_ImDrawCmd_GetTextureId(selfArg) + return *newTextureIDFromC(func() *C.ImTextureID { result := result; return &result }()) } func (self DrawCmd) SetVtxOffset(v uint32) { @@ -12604,23 +13023,6 @@ func (self *DrawCmd) ElemCount() uint32 { return uint32(C.wrap_ImDrawCmd_GetElemCount(selfArg)) } -func (self DrawCmd) SetUserCallbackData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImDrawCmd_SetUserCallbackData(selfArg, vArg) -} - -func (self *DrawCmd) UserCallbackData() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_ImDrawCmd_GetUserCallbackData(selfArg)) -} - func (self DrawCmdHeader) SetClipRect(v Vec4) { selfArg, selfFin := self.handle() defer selfFin() @@ -12637,9 +13039,11 @@ func (self *DrawCmdHeader) ClipRect() Vec4 { } func (self DrawCmdHeader) SetTextureId(v TextureID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImDrawCmdHeader_SetTextureId(selfArg, C.ImTextureID(v)) + C.wrap_ImDrawCmdHeader_SetTextureId(selfArg, vArg) } func (self *DrawCmdHeader) TextureId() TextureID { @@ -12648,7 +13052,9 @@ func (self *DrawCmdHeader) TextureId() TextureID { defer func() { selfFin() }() - return TextureID(C.wrap_ImDrawCmdHeader_GetTextureId(selfArg)) + + result := C.wrap_ImDrawCmdHeader_GetTextureId(selfArg) + return *newTextureIDFromC(func() *C.ImTextureID { result := result; return &result }()) } func (self DrawCmdHeader) SetVtxOffset(v uint32) { @@ -12811,29 +13217,6 @@ func (self *DrawList) CmdBuffer() Vector[*DrawCmd] { return newVectorFromC(C.wrap_ImDrawList_GetCmdBuffer(selfArg).Size, C.wrap_ImDrawList_GetCmdBuffer(selfArg).Capacity, newDrawCmdFromC(C.wrap_ImDrawList_GetCmdBuffer(selfArg).Data)) } -func (self DrawList) SetIdxBuffer(v Vector[*DrawIdx]) { - vData := v.Data - vDataArg, _ := WrapNumberPtr[C.ImDrawIdx, DrawIdx](vData) - vVecArg := new(C.ImVector_ImDrawIdx) - vVecArg.Size = C.int(v.Size) - vVecArg.Capacity = C.int(v.Capacity) - vVecArg.Data = vDataArg - v.pinner.Pin(vVecArg.Data) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImDrawList_SetIdxBuffer(selfArg, *vVecArg) -} - -func (self *DrawList) IdxBuffer() Vector[*DrawIdx] { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return newVectorFromC(C.wrap_ImDrawList_GetIdxBuffer(selfArg).Size, C.wrap_ImDrawList_GetIdxBuffer(selfArg).Capacity, (*DrawIdx)(C.wrap_ImDrawList_GetIdxBuffer(selfArg).Data)) -} - func (self DrawList) SetVtxBuffer(v Vector[*DrawVert]) { vData := v.Data vDataArg, _ := vData.handle() @@ -12938,27 +13321,24 @@ func (self *DrawList) VtxWritePtr() *DrawVert { return newDrawVertFromC(C.wrap_ImDrawList_Get_VtxWritePtr(selfArg)) } -func (self DrawList) SetIdxWritePtr(v *DrawIdx) { - vArg, _ := WrapNumberPtr[C.ImDrawIdx, DrawIdx](v) +func (self DrawList) SetClipRectStack(v Vector[*Vec4]) { + vData := v.Data + vDataArg, _ := wrap[C.ImVec4, *Vec4](vData) + vVecArg := new(C.ImVector_ImVec4) + vVecArg.Size = C.int(v.Size) + vVecArg.Capacity = C.int(v.Capacity) + vVecArg.Data = vDataArg + v.pinner.Pin(vVecArg.Data) selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImDrawList_Set_IdxWritePtr(selfArg, vArg) -} - -func (self *DrawList) IdxWritePtr() *DrawIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return (*DrawIdx)(C.wrap_ImDrawList_Get_IdxWritePtr(selfArg)) + C.wrap_ImDrawList_Set_ClipRectStack(selfArg, *vVecArg) } -func (self DrawList) SetClipRectStack(v Vector[*Vec4]) { +func (self DrawList) SetTextureIdStack(v Vector[*TextureID]) { vData := v.Data - vDataArg, _ := wrap[C.ImVec4, *Vec4](vData) - vVecArg := new(C.ImVector_ImVec4) + vDataArg, _ := vData.handle() + vVecArg := new(C.ImVector_ImTextureID) vVecArg.Size = C.int(v.Size) vVecArg.Capacity = C.int(v.Capacity) vVecArg.Data = vDataArg @@ -12966,7 +13346,16 @@ func (self DrawList) SetClipRectStack(v Vector[*Vec4]) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImDrawList_Set_ClipRectStack(selfArg, *vVecArg) + C.wrap_ImDrawList_Set_TextureIdStack(selfArg, *vVecArg) +} + +func (self *DrawList) TextureIdStack() Vector[*TextureID] { + selfArg, selfFin := self.handle() + + defer func() { + selfFin() + }() + return newVectorFromC(C.wrap_ImDrawList_Get_TextureIdStack(selfArg).Size, C.wrap_ImDrawList_Get_TextureIdStack(selfArg).Capacity, newTextureIDFromC(C.wrap_ImDrawList_Get_TextureIdStack(selfArg).Data)) } func (self DrawList) SetPath(v Vector[*Vec2]) { @@ -13662,23 +14051,6 @@ func (self *FontAtlas) Locked() bool { return C.wrap_ImFontAtlas_GetLocked(selfArg) == C.bool(true) } -func (self FontAtlas) SetUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImFontAtlas_SetUserData(selfArg, vArg) -} - -func (self *FontAtlas) UserData() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_ImFontAtlas_GetUserData(selfArg)) -} - func (self FontAtlas) SetTexReady(v bool) { selfArg, selfFin := self.handle() defer selfFin() @@ -14033,23 +14405,6 @@ func (self *FontAtlasCustomRect) Font() *Font { return newFontFromC(C.wrap_ImFontAtlasCustomRect_GetFont(selfArg)) } -func (self FontConfig) SetFontData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImFontConfig_SetFontData(selfArg, vArg) -} - -func (self *FontConfig) FontData() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_ImFontConfig_GetFontData(selfArg)) -} - func (self FontConfig) SetFontDataSize(v int32) { selfArg, selfFin := self.handle() defer selfFin() @@ -14963,23 +15318,6 @@ func (self *Context) TestEngineHookItems() bool { return C.wrap_ImGuiContext_GetTestEngineHookItems(selfArg) == C.bool(true) } -func (self Context) SetTestEngine(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiContext_SetTestEngine(selfArg, vArg) -} - -func (self *Context) TestEngine() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_ImGuiContext_GetTestEngine(selfArg)) -} - func (self Context) SetInputEventsQueue(v Vector[*InputEvent]) { vData := v.Data vDataArg, _ := vData.handle() @@ -15289,9 +15627,11 @@ func (self *Context) WheelingAxisAvg() Vec2 { } func (self Context) SetDebugHookIdInfo(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetDebugHookIdInfo(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetDebugHookIdInfo(selfArg, vArg) } func (self *Context) DebugHookIdInfo() ID { @@ -15300,13 +15640,17 @@ func (self *Context) DebugHookIdInfo() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetDebugHookIdInfo(selfArg)) + + result := C.wrap_ImGuiContext_GetDebugHookIdInfo(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetHoveredId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetHoveredId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetHoveredId(selfArg, vArg) } func (self *Context) HoveredId() ID { @@ -15315,13 +15659,17 @@ func (self *Context) HoveredId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetHoveredId(selfArg)) + + result := C.wrap_ImGuiContext_GetHoveredId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetHoveredIdPreviousFrame(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetHoveredIdPreviousFrame(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetHoveredIdPreviousFrame(selfArg, vArg) } func (self *Context) HoveredIdPreviousFrame() ID { @@ -15330,7 +15678,9 @@ func (self *Context) HoveredIdPreviousFrame() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetHoveredIdPreviousFrame(selfArg)) + + result := C.wrap_ImGuiContext_GetHoveredIdPreviousFrame(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetHoveredIdAllowOverlap(v bool) { @@ -15394,9 +15744,11 @@ func (self *Context) HoveredIdNotActiveTimer() float32 { } func (self Context) SetActiveId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetActiveId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetActiveId(selfArg, vArg) } func (self *Context) ActiveId() ID { @@ -15405,13 +15757,17 @@ func (self *Context) ActiveId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetActiveId(selfArg)) + + result := C.wrap_ImGuiContext_GetActiveId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetActiveIdIsAlive(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetActiveIdIsAlive(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetActiveIdIsAlive(selfArg, vArg) } func (self *Context) ActiveIdIsAlive() ID { @@ -15420,7 +15776,9 @@ func (self *Context) ActiveIdIsAlive() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetActiveIdIsAlive(selfArg)) + + result := C.wrap_ImGuiContext_GetActiveIdIsAlive(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetActiveIdTimer(v float32) { @@ -15591,9 +15949,11 @@ func (self *Context) ActiveIdMouseButton() int32 { } func (self Context) SetActiveIdPreviousFrame(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetActiveIdPreviousFrame(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetActiveIdPreviousFrame(selfArg, vArg) } func (self *Context) ActiveIdPreviousFrame() ID { @@ -15602,7 +15962,9 @@ func (self *Context) ActiveIdPreviousFrame() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetActiveIdPreviousFrame(selfArg)) + + result := C.wrap_ImGuiContext_GetActiveIdPreviousFrame(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetActiveIdPreviousFrameIsAlive(v bool) { @@ -15653,9 +16015,11 @@ func (self *Context) ActiveIdPreviousFrameWindow() *Window { } func (self Context) SetLastActiveId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetLastActiveId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetLastActiveId(selfArg, vArg) } func (self *Context) LastActiveId() ID { @@ -15664,7 +16028,9 @@ func (self *Context) LastActiveId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetLastActiveId(selfArg)) + + result := C.wrap_ImGuiContext_GetLastActiveId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetLastActiveIdTimer(v float32) { @@ -15747,9 +16113,11 @@ func (self *Context) ActiveIdUsingNavInputMask() uint32 { } func (self Context) SetCurrentFocusScopeId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetCurrentFocusScopeId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetCurrentFocusScopeId(selfArg, vArg) } func (self *Context) CurrentFocusScopeId() ID { @@ -15758,7 +16126,9 @@ func (self *Context) CurrentFocusScopeId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetCurrentFocusScopeId(selfArg)) + + result := C.wrap_ImGuiContext_GetCurrentFocusScopeId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetCurrentItemFlags(v ItemFlags) { @@ -15777,9 +16147,11 @@ func (self *Context) CurrentItemFlags() ItemFlags { } func (self Context) SetDebugLocateId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetDebugLocateId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetDebugLocateId(selfArg, vArg) } func (self *Context) DebugLocateId() ID { @@ -15788,7 +16160,9 @@ func (self *Context) DebugLocateId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetDebugLocateId(selfArg)) + + result := C.wrap_ImGuiContext_GetDebugLocateId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetNextItemData(v NextItemData) { @@ -15896,7 +16270,7 @@ func (self *Context) StyleVarStack() Vector[*StyleMod] { func (self Context) SetFocusScopeStack(v Vector[*ID]) { vData := v.Data - vDataArg, _ := WrapNumberPtr[C.ImGuiID, ID](vData) + vDataArg, _ := vData.handle() vVecArg := new(C.ImVector_ImGuiID) vVecArg.Size = C.int(v.Size) vVecArg.Capacity = C.int(v.Capacity) @@ -15908,6 +16282,15 @@ func (self Context) SetFocusScopeStack(v Vector[*ID]) { C.wrap_ImGuiContext_SetFocusScopeStack(selfArg, *vVecArg) } +func (self *Context) FocusScopeStack() Vector[*ID] { + selfArg, selfFin := self.handle() + + defer func() { + selfFin() + }() + return newVectorFromC(C.wrap_ImGuiContext_GetFocusScopeStack(selfArg).Size, C.wrap_ImGuiContext_GetFocusScopeStack(selfArg).Capacity, newIDFromC(C.wrap_ImGuiContext_GetFocusScopeStack(selfArg).Data)) +} + func (self *Context) ItemFlagsStack() Vector[*ItemFlags] { selfArg, selfFin := self.handle() @@ -16091,9 +16474,11 @@ func (self *Context) MouseLastHoveredViewport() *ViewportP { } func (self Context) SetPlatformLastFocusedViewportId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetPlatformLastFocusedViewportId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetPlatformLastFocusedViewportId(selfArg, vArg) } func (self *Context) PlatformLastFocusedViewportId() ID { @@ -16102,7 +16487,9 @@ func (self *Context) PlatformLastFocusedViewportId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetPlatformLastFocusedViewportId(selfArg)) + + result := C.wrap_ImGuiContext_GetPlatformLastFocusedViewportId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetFallbackMonitor(v PlatformMonitor) { @@ -16187,9 +16574,11 @@ func (self *Context) NavWindow() *Window { } func (self Context) SetNavId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetNavId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetNavId(selfArg, vArg) } func (self *Context) NavId() ID { @@ -16198,13 +16587,17 @@ func (self *Context) NavId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetNavId(selfArg)) + + result := C.wrap_ImGuiContext_GetNavId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetNavFocusScopeId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetNavFocusScopeId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetNavFocusScopeId(selfArg, vArg) } func (self *Context) NavFocusScopeId() ID { @@ -16213,13 +16606,17 @@ func (self *Context) NavFocusScopeId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetNavFocusScopeId(selfArg)) + + result := C.wrap_ImGuiContext_GetNavFocusScopeId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetNavActivateId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetNavActivateId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetNavActivateId(selfArg, vArg) } func (self *Context) NavActivateId() ID { @@ -16228,13 +16625,17 @@ func (self *Context) NavActivateId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetNavActivateId(selfArg)) + + result := C.wrap_ImGuiContext_GetNavActivateId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetNavActivateDownId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetNavActivateDownId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetNavActivateDownId(selfArg, vArg) } func (self *Context) NavActivateDownId() ID { @@ -16243,13 +16644,17 @@ func (self *Context) NavActivateDownId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetNavActivateDownId(selfArg)) + + result := C.wrap_ImGuiContext_GetNavActivateDownId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetNavActivatePressedId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetNavActivatePressedId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetNavActivatePressedId(selfArg, vArg) } func (self *Context) NavActivatePressedId() ID { @@ -16258,7 +16663,9 @@ func (self *Context) NavActivatePressedId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetNavActivatePressedId(selfArg)) + + result := C.wrap_ImGuiContext_GetNavActivatePressedId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetNavActivateFlags(v ActivateFlags) { @@ -16277,9 +16684,11 @@ func (self *Context) NavActivateFlags() ActivateFlags { } func (self Context) SetNavJustMovedToId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetNavJustMovedToId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetNavJustMovedToId(selfArg, vArg) } func (self *Context) NavJustMovedToId() ID { @@ -16288,13 +16697,17 @@ func (self *Context) NavJustMovedToId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetNavJustMovedToId(selfArg)) + + result := C.wrap_ImGuiContext_GetNavJustMovedToId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetNavJustMovedToFocusScopeId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetNavJustMovedToFocusScopeId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetNavJustMovedToFocusScopeId(selfArg, vArg) } func (self *Context) NavJustMovedToFocusScopeId() ID { @@ -16303,19 +16716,36 @@ func (self *Context) NavJustMovedToFocusScopeId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetNavJustMovedToFocusScopeId(selfArg)) + + result := C.wrap_ImGuiContext_GetNavJustMovedToFocusScopeId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetNavJustMovedToKeyMods(v KeyChord) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetNavJustMovedToKeyMods(selfArg, C.ImGuiKeyChord(v)) + C.wrap_ImGuiContext_SetNavJustMovedToKeyMods(selfArg, vArg) +} + +func (self *Context) NavJustMovedToKeyMods() KeyChord { + selfArg, selfFin := self.handle() + + defer func() { + selfFin() + }() + + result := C.wrap_ImGuiContext_GetNavJustMovedToKeyMods(selfArg) + return *newKeyChordFromC(func() *C.ImGuiKeyChord { result := result; return &result }()) } func (self Context) SetNavNextActivateId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetNavNextActivateId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetNavNextActivateId(selfArg, vArg) } func (self *Context) NavNextActivateId() ID { @@ -16324,7 +16754,9 @@ func (self *Context) NavNextActivateId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetNavNextActivateId(selfArg)) + + result := C.wrap_ImGuiContext_GetNavNextActivateId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetNavNextActivateFlags(v ActivateFlags) { @@ -16572,9 +17004,22 @@ func (self *Context) NavMoveScrollFlags() ScrollFlags { } func (self Context) SetNavMoveKeyMods(v KeyChord) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetNavMoveKeyMods(selfArg, C.ImGuiKeyChord(v)) + C.wrap_ImGuiContext_SetNavMoveKeyMods(selfArg, vArg) +} + +func (self *Context) NavMoveKeyMods() KeyChord { + selfArg, selfFin := self.handle() + + defer func() { + selfFin() + }() + + result := C.wrap_ImGuiContext_GetNavMoveKeyMods(selfArg) + return *newKeyChordFromC(func() *C.ImGuiKeyChord { result := result; return &result }()) } func (self Context) SetNavMoveDir(v Dir) { @@ -16774,15 +17219,41 @@ func (self *Context) NavTabbingResultFirst() NavItemData { } func (self Context) SetConfigNavWindowingKeyNext(v KeyChord) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetConfigNavWindowingKeyNext(selfArg, C.ImGuiKeyChord(v)) + C.wrap_ImGuiContext_SetConfigNavWindowingKeyNext(selfArg, vArg) +} + +func (self *Context) ConfigNavWindowingKeyNext() KeyChord { + selfArg, selfFin := self.handle() + + defer func() { + selfFin() + }() + + result := C.wrap_ImGuiContext_GetConfigNavWindowingKeyNext(selfArg) + return *newKeyChordFromC(func() *C.ImGuiKeyChord { result := result; return &result }()) } func (self Context) SetConfigNavWindowingKeyPrev(v KeyChord) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetConfigNavWindowingKeyPrev(selfArg, C.ImGuiKeyChord(v)) + C.wrap_ImGuiContext_SetConfigNavWindowingKeyPrev(selfArg, vArg) +} + +func (self *Context) ConfigNavWindowingKeyPrev() KeyChord { + selfArg, selfFin := self.handle() + + defer func() { + selfFin() + }() + + result := C.wrap_ImGuiContext_GetConfigNavWindowingKeyPrev(selfArg) + return *newKeyChordFromC(func() *C.ImGuiKeyChord { result := result; return &result }()) } func (self Context) SetNavWindowingTarget(v *Window) { @@ -17051,9 +17522,11 @@ func (self *Context) DragDropTargetRect() Rect { } func (self Context) SetDragDropTargetId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetDragDropTargetId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetDragDropTargetId(selfArg, vArg) } func (self *Context) DragDropTargetId() ID { @@ -17062,7 +17535,9 @@ func (self *Context) DragDropTargetId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetDragDropTargetId(selfArg)) + + result := C.wrap_ImGuiContext_GetDragDropTargetId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetDragDropAcceptFlags(v DragDropFlags) { @@ -17096,9 +17571,11 @@ func (self *Context) DragDropAcceptIdCurrRectSurface() float32 { } func (self Context) SetDragDropAcceptIdCurr(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetDragDropAcceptIdCurr(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetDragDropAcceptIdCurr(selfArg, vArg) } func (self *Context) DragDropAcceptIdCurr() ID { @@ -17107,13 +17584,17 @@ func (self *Context) DragDropAcceptIdCurr() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetDragDropAcceptIdCurr(selfArg)) + + result := C.wrap_ImGuiContext_GetDragDropAcceptIdCurr(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetDragDropAcceptIdPrev(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetDragDropAcceptIdPrev(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetDragDropAcceptIdPrev(selfArg, vArg) } func (self *Context) DragDropAcceptIdPrev() ID { @@ -17122,7 +17603,9 @@ func (self *Context) DragDropAcceptIdPrev() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetDragDropAcceptIdPrev(selfArg)) + + result := C.wrap_ImGuiContext_GetDragDropAcceptIdPrev(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetDragDropAcceptFrameCount(v int32) { @@ -17141,9 +17624,11 @@ func (self *Context) DragDropAcceptFrameCount() int32 { } func (self Context) SetDragDropHoldJustPressedId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetDragDropHoldJustPressedId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetDragDropHoldJustPressedId(selfArg, vArg) } func (self *Context) DragDropHoldJustPressedId() ID { @@ -17152,7 +17637,9 @@ func (self *Context) DragDropHoldJustPressedId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetDragDropHoldJustPressedId(selfArg)) + + result := C.wrap_ImGuiContext_GetDragDropHoldJustPressedId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetClipperTempDataStacked(v int32) { @@ -17358,9 +17845,11 @@ func (self *Context) ShrinkWidthBuffer() Vector[*ShrinkWidthItem] { } func (self Context) SetHoverItemDelayId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetHoverItemDelayId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetHoverItemDelayId(selfArg, vArg) } func (self *Context) HoverItemDelayId() ID { @@ -17369,13 +17858,17 @@ func (self *Context) HoverItemDelayId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetHoverItemDelayId(selfArg)) + + result := C.wrap_ImGuiContext_GetHoverItemDelayId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetHoverItemDelayIdPreviousFrame(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetHoverItemDelayIdPreviousFrame(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetHoverItemDelayIdPreviousFrame(selfArg, vArg) } func (self *Context) HoverItemDelayIdPreviousFrame() ID { @@ -17384,7 +17877,9 @@ func (self *Context) HoverItemDelayIdPreviousFrame() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetHoverItemDelayIdPreviousFrame(selfArg)) + + result := C.wrap_ImGuiContext_GetHoverItemDelayIdPreviousFrame(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetHoverItemDelayTimer(v float32) { @@ -17418,9 +17913,11 @@ func (self *Context) HoverItemDelayClearTimer() float32 { } func (self Context) SetHoverItemUnlockedStationaryId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetHoverItemUnlockedStationaryId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetHoverItemUnlockedStationaryId(selfArg, vArg) } func (self *Context) HoverItemUnlockedStationaryId() ID { @@ -17429,13 +17926,17 @@ func (self *Context) HoverItemUnlockedStationaryId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetHoverItemUnlockedStationaryId(selfArg)) + + result := C.wrap_ImGuiContext_GetHoverItemUnlockedStationaryId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetHoverWindowUnlockedStationaryId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetHoverWindowUnlockedStationaryId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetHoverWindowUnlockedStationaryId(selfArg, vArg) } func (self *Context) HoverWindowUnlockedStationaryId() ID { @@ -17444,7 +17945,9 @@ func (self *Context) HoverWindowUnlockedStationaryId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetHoverWindowUnlockedStationaryId(selfArg)) + + result := C.wrap_ImGuiContext_GetHoverWindowUnlockedStationaryId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetMouseCursor(v MouseCursor) { @@ -17550,9 +18053,11 @@ func (self *Context) InputTextPasswordFont() Font { } func (self Context) SetTempInputId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetTempInputId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetTempInputId(selfArg, vArg) } func (self *Context) TempInputId() ID { @@ -17561,7 +18066,9 @@ func (self *Context) TempInputId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetTempInputId(selfArg)) + + result := C.wrap_ImGuiContext_GetTempInputId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetColorEditOptions(v ColorEditFlags) { @@ -17580,9 +18087,11 @@ func (self *Context) ColorEditOptions() ColorEditFlags { } func (self Context) SetColorEditCurrentID(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetColorEditCurrentID(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetColorEditCurrentID(selfArg, vArg) } func (self *Context) ColorEditCurrentID() ID { @@ -17591,13 +18100,17 @@ func (self *Context) ColorEditCurrentID() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetColorEditCurrentID(selfArg)) + + result := C.wrap_ImGuiContext_GetColorEditCurrentID(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetColorEditSavedID(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetColorEditSavedID(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetColorEditSavedID(selfArg, vArg) } func (self *Context) ColorEditSavedID() ID { @@ -17606,7 +18119,9 @@ func (self *Context) ColorEditSavedID() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetColorEditSavedID(selfArg)) + + result := C.wrap_ImGuiContext_GetColorEditSavedID(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetColorEditSavedHue(v float32) { @@ -17878,7 +18393,7 @@ func (self *Context) ClipboardHandlerData() Vector[string] { func (self Context) SetMenusIdSubmittedThisFrame(v Vector[*ID]) { vData := v.Data - vDataArg, _ := WrapNumberPtr[C.ImGuiID, ID](vData) + vDataArg, _ := vData.handle() vVecArg := new(C.ImVector_ImGuiID) vVecArg.Size = C.int(v.Size) vVecArg.Capacity = C.int(v.Capacity) @@ -17890,6 +18405,15 @@ func (self Context) SetMenusIdSubmittedThisFrame(v Vector[*ID]) { C.wrap_ImGuiContext_SetMenusIdSubmittedThisFrame(selfArg, *vVecArg) } +func (self *Context) MenusIdSubmittedThisFrame() Vector[*ID] { + selfArg, selfFin := self.handle() + + defer func() { + selfFin() + }() + return newVectorFromC(C.wrap_ImGuiContext_GetMenusIdSubmittedThisFrame(selfArg).Size, C.wrap_ImGuiContext_GetMenusIdSubmittedThisFrame(selfArg).Capacity, newIDFromC(C.wrap_ImGuiContext_GetMenusIdSubmittedThisFrame(selfArg).Data)) +} + func (self Context) SetTypingSelectState(v TypingSelectState) { vArg, _ := v.c() @@ -17948,9 +18472,11 @@ func (self *Context) PlatformImeDataPrev() PlatformImeData { } func (self Context) SetPlatformImeViewport(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetPlatformImeViewport(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetPlatformImeViewport(selfArg, vArg) } func (self *Context) PlatformImeViewport() ID { @@ -17959,7 +18485,9 @@ func (self *Context) PlatformImeViewport() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetPlatformImeViewport(selfArg)) + + result := C.wrap_ImGuiContext_GetPlatformImeViewport(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetDockContext(v DockContext) { @@ -18077,9 +18605,11 @@ func (self *Context) Hooks() Vector[*ContextHook] { } func (self Context) SetHookIdNext(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetHookIdNext(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetHookIdNext(selfArg, vArg) } func (self *Context) HookIdNext() ID { @@ -18088,7 +18618,9 @@ func (self *Context) HookIdNext() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetHookIdNext(selfArg)) + + result := C.wrap_ImGuiContext_GetHookIdNext(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetLogEnabled(v bool) { @@ -18378,9 +18910,11 @@ func (self *Context) DebugItemPickerMouseButton() byte { } func (self Context) SetDebugItemPickerBreakId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetDebugItemPickerBreakId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContext_SetDebugItemPickerBreakId(selfArg, vArg) } func (self *Context) DebugItemPickerBreakId() ID { @@ -18389,7 +18923,9 @@ func (self *Context) DebugItemPickerBreakId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContext_GetDebugItemPickerBreakId(selfArg)) + + result := C.wrap_ImGuiContext_GetDebugItemPickerBreakId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Context) SetDebugMetricsConfig(v MetricsConfig) { @@ -18561,9 +19097,11 @@ func (self *Context) TempBuffer() Vector[string] { } func (self ContextHook) SetHookId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContextHook_SetHookId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContextHook_SetHookId(selfArg, vArg) } func (self *ContextHook) HookId() ID { @@ -18572,7 +19110,9 @@ func (self *ContextHook) HookId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContextHook_GetHookId(selfArg)) + + result := C.wrap_ImGuiContextHook_GetHookId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self ContextHook) SetType(v ContextHookType) { @@ -18591,9 +19131,11 @@ func (self *ContextHook) Type() ContextHookType { } func (self ContextHook) SetOwner(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContextHook_SetOwner(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiContextHook_SetOwner(selfArg, vArg) } func (self *ContextHook) Owner() ID { @@ -18602,24 +19144,9 @@ func (self *ContextHook) Owner() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContextHook_GetOwner(selfArg)) -} - -func (self ContextHook) SetUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiContextHook_SetUserData(selfArg, vArg) -} - -func (self *ContextHook) UserData() unsafe.Pointer { - selfArg, selfFin := self.handle() - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_ImGuiContextHook_GetUserData(selfArg)) + result := C.wrap_ImGuiContextHook_GetOwner(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self DataTypeInfo) SetSize(v uint64) { @@ -18752,6 +19279,52 @@ func (self *DockContext) Nodes() Storage { return *newStorageFromC(func() *C.ImGuiStorage { result := result; return &result }()) } +func (self DockContext) SetRequests(v Vector[*DockRequest]) { + vData := v.Data + vDataArg, _ := vData.handle() + vVecArg := new(C.ImVector_ImGuiDockRequest) + vVecArg.Size = C.int(v.Size) + vVecArg.Capacity = C.int(v.Capacity) + vVecArg.Data = vDataArg + v.pinner.Pin(vVecArg.Data) + + selfArg, selfFin := self.handle() + defer selfFin() + C.wrap_ImGuiDockContext_SetRequests(selfArg, *vVecArg) +} + +func (self *DockContext) Requests() Vector[*DockRequest] { + selfArg, selfFin := self.handle() + + defer func() { + selfFin() + }() + return newVectorFromC(C.wrap_ImGuiDockContext_GetRequests(selfArg).Size, C.wrap_ImGuiDockContext_GetRequests(selfArg).Capacity, newDockRequestFromC(C.wrap_ImGuiDockContext_GetRequests(selfArg).Data)) +} + +func (self DockContext) SetNodesSettings(v Vector[*DockNodeSettings]) { + vData := v.Data + vDataArg, _ := vData.handle() + vVecArg := new(C.ImVector_ImGuiDockNodeSettings) + vVecArg.Size = C.int(v.Size) + vVecArg.Capacity = C.int(v.Capacity) + vVecArg.Data = vDataArg + v.pinner.Pin(vVecArg.Data) + + selfArg, selfFin := self.handle() + defer selfFin() + C.wrap_ImGuiDockContext_SetNodesSettings(selfArg, *vVecArg) +} + +func (self *DockContext) NodesSettings() Vector[*DockNodeSettings] { + selfArg, selfFin := self.handle() + + defer func() { + selfFin() + }() + return newVectorFromC(C.wrap_ImGuiDockContext_GetNodesSettings(selfArg).Size, C.wrap_ImGuiDockContext_GetNodesSettings(selfArg).Capacity, newDockNodeSettingsFromC(C.wrap_ImGuiDockContext_GetNodesSettings(selfArg).Data)) +} + func (self DockContext) SetWantFullRebuild(v bool) { selfArg, selfFin := self.handle() defer selfFin() @@ -18768,9 +19341,11 @@ func (self *DockContext) WantFullRebuild() bool { } func (self DockNode) SetID(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiDockNode_SetID(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiDockNode_SetID(selfArg, vArg) } func (self *DockNode) ID() ID { @@ -18779,7 +19354,9 @@ func (self *DockNode) ID() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiDockNode_GetID(selfArg)) + + result := C.wrap_ImGuiDockNode_GetID(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self DockNode) SetSharedFlags(v DockNodeFlags) { @@ -19099,9 +19676,11 @@ func (self *DockNode) LastFrameFocused() int32 { } func (self DockNode) SetLastFocusedNodeId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiDockNode_SetLastFocusedNodeId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiDockNode_SetLastFocusedNodeId(selfArg, vArg) } func (self *DockNode) LastFocusedNodeId() ID { @@ -19110,13 +19689,17 @@ func (self *DockNode) LastFocusedNodeId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiDockNode_GetLastFocusedNodeId(selfArg)) + + result := C.wrap_ImGuiDockNode_GetLastFocusedNodeId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self DockNode) SetSelectedTabId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiDockNode_SetSelectedTabId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiDockNode_SetSelectedTabId(selfArg, vArg) } func (self *DockNode) SelectedTabId() ID { @@ -19125,13 +19708,17 @@ func (self *DockNode) SelectedTabId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiDockNode_GetSelectedTabId(selfArg)) + + result := C.wrap_ImGuiDockNode_GetSelectedTabId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self DockNode) SetWantCloseTabId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiDockNode_SetWantCloseTabId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiDockNode_SetWantCloseTabId(selfArg, vArg) } func (self *DockNode) WantCloseTabId() ID { @@ -19140,13 +19727,17 @@ func (self *DockNode) WantCloseTabId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiDockNode_GetWantCloseTabId(selfArg)) + + result := C.wrap_ImGuiDockNode_GetWantCloseTabId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self DockNode) SetRefViewportId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiDockNode_SetRefViewportId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiDockNode_SetRefViewportId(selfArg, vArg) } func (self *DockNode) RefViewportId() ID { @@ -19155,7 +19746,9 @@ func (self *DockNode) RefViewportId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiDockNode_GetRefViewportId(selfArg)) + + result := C.wrap_ImGuiDockNode_GetRefViewportId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self DockNode) SetAuthorityForPos(v DataAuthority) { @@ -19369,9 +19962,11 @@ func (self *DockNode) WantHiddenTabBarToggle() bool { } func (self GroupData) SetWindowID(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiGroupData_SetWindowID(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiGroupData_SetWindowID(selfArg, vArg) } func (self *GroupData) WindowID() ID { @@ -19380,7 +19975,9 @@ func (self *GroupData) WindowID() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiGroupData_GetWindowID(selfArg)) + + result := C.wrap_ImGuiGroupData_GetWindowID(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self GroupData) SetBackupCursorPos(v Vec2) { @@ -19482,9 +20079,11 @@ func (self *GroupData) BackupCurrLineTextBaseOffset() float32 { } func (self GroupData) SetBackupActiveIdIsAlive(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiGroupData_SetBackupActiveIdIsAlive(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiGroupData_SetBackupActiveIdIsAlive(selfArg, vArg) } func (self *GroupData) BackupActiveIdIsAlive() ID { @@ -19493,7 +20092,9 @@ func (self *GroupData) BackupActiveIdIsAlive() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiGroupData_GetBackupActiveIdIsAlive(selfArg)) + + result := C.wrap_ImGuiGroupData_GetBackupActiveIdIsAlive(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self GroupData) SetBackupActiveIdPreviousFrameIsAlive(v bool) { @@ -19650,23 +20251,6 @@ func (self *IO) LogFilename() string { return C.GoString(C.wrap_ImGuiIO_GetLogFilename(selfArg)) } -func (self IO) SetUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiIO_SetUserData(selfArg, vArg) -} - -func (self *IO) UserData() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_ImGuiIO_GetUserData(selfArg)) -} - func (self IO) SetFonts(v *FontAtlas) { vArg, _ := v.handle() @@ -20170,91 +20754,6 @@ func (self *IO) BackendRendererName() string { return C.GoString(C.wrap_ImGuiIO_GetBackendRendererName(selfArg)) } -func (self IO) SetBackendPlatformUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiIO_SetBackendPlatformUserData(selfArg, vArg) -} - -func (self *IO) BackendPlatformUserData() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_ImGuiIO_GetBackendPlatformUserData(selfArg)) -} - -func (self IO) SetBackendRendererUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiIO_SetBackendRendererUserData(selfArg, vArg) -} - -func (self *IO) BackendRendererUserData() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_ImGuiIO_GetBackendRendererUserData(selfArg)) -} - -func (self IO) SetBackendLanguageUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiIO_SetBackendLanguageUserData(selfArg, vArg) -} - -func (self *IO) BackendLanguageUserData() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_ImGuiIO_GetBackendLanguageUserData(selfArg)) -} - -func (self IO) SetClipboardUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiIO_SetClipboardUserData(selfArg, vArg) -} - -func (self *IO) ClipboardUserData() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_ImGuiIO_GetClipboardUserData(selfArg)) -} - -func (self IO) SetUnusedPadding(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiIO_Set_UnusedPadding(selfArg, vArg) -} - -func (self *IO) UnusedPadding() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_ImGuiIO_Get_UnusedPadding(selfArg)) -} - func (self IO) SetPlatformLocaleDecimalPoint(v Wchar) { selfArg, selfFin := self.handle() defer selfFin() @@ -20558,9 +21057,11 @@ func (self *IO) MouseSource() MouseSource { } func (self IO) SetMouseHoveredViewport(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiIO_SetMouseHoveredViewport(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiIO_SetMouseHoveredViewport(selfArg, vArg) } func (self *IO) MouseHoveredViewport() ID { @@ -20569,7 +21070,9 @@ func (self *IO) MouseHoveredViewport() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiIO_GetMouseHoveredViewport(selfArg)) + + result := C.wrap_ImGuiIO_GetMouseHoveredViewport(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self IO) SetKeyCtrl(v bool) { @@ -20633,9 +21136,22 @@ func (self *IO) KeySuper() bool { } func (self IO) SetKeyMods(v KeyChord) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiIO_SetKeyMods(selfArg, C.ImGuiKeyChord(v)) + C.wrap_ImGuiIO_SetKeyMods(selfArg, vArg) +} + +func (self *IO) KeyMods() KeyChord { + selfArg, selfFin := self.handle() + + defer func() { + selfFin() + }() + + result := C.wrap_ImGuiIO_GetKeyMods(selfArg) + return *newKeyChordFromC(func() *C.ImGuiKeyChord { result := result; return &result }()) } func (self IO) SetWantCaptureMouseUnlessPopupClose(v bool) { @@ -20992,9 +21508,11 @@ func (self *InputEventMousePos) MouseSource() MouseSource { } func (self InputEventMouseViewport) SetHoveredViewportID(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiInputEventMouseViewport_SetHoveredViewportID(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiInputEventMouseViewport_SetHoveredViewportID(selfArg, vArg) } func (self *InputEventMouseViewport) HoveredViewportID() ID { @@ -21003,7 +21521,9 @@ func (self *InputEventMouseViewport) HoveredViewportID() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiInputEventMouseViewport_GetHoveredViewportID(selfArg)) + + result := C.wrap_ImGuiInputEventMouseViewport_GetHoveredViewportID(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self InputEventMouseWheel) SetWheelX(v float32) { @@ -21113,23 +21633,6 @@ func (self *InputTextCallbackData) Flags() InputTextFlags { return InputTextFlags(C.wrap_ImGuiInputTextCallbackData_GetFlags(selfArg)) } -func (self InputTextCallbackData) SetUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiInputTextCallbackData_SetUserData(selfArg, vArg) -} - -func (self *InputTextCallbackData) UserData() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_ImGuiInputTextCallbackData_GetUserData(selfArg)) -} - func (self InputTextCallbackData) SetEventChar(v Wchar) { selfArg, selfFin := self.handle() defer selfFin() @@ -21268,9 +21771,11 @@ func (self *InputTextCallbackData) SelectionEnd() int32 { } func (self InputTextDeactivatedState) SetID(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiInputTextDeactivatedState_SetID(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiInputTextDeactivatedState_SetID(selfArg, vArg) } func (self *InputTextDeactivatedState) ID() ID { @@ -21279,7 +21784,9 @@ func (self *InputTextDeactivatedState) ID() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiInputTextDeactivatedState_GetID(selfArg)) + + result := C.wrap_ImGuiInputTextDeactivatedState_GetID(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self InputTextDeactivatedState) SetTextA(v Vector[string]) { @@ -21323,9 +21830,11 @@ func (self *InputTextState) Ctx() *Context { } func (self InputTextState) SetID(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiInputTextState_SetID(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiInputTextState_SetID(selfArg, vArg) } func (self *InputTextState) ID() ID { @@ -21334,7 +21843,9 @@ func (self *InputTextState) ID() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiInputTextState_GetID(selfArg)) + + result := C.wrap_ImGuiInputTextState_GetID(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self InputTextState) SetCurLenW(v int32) { @@ -21636,9 +22147,11 @@ func (self *KeyData) AnalogValue() float32 { } func (self KeyOwnerData) SetOwnerCurr(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiKeyOwnerData_SetOwnerCurr(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiKeyOwnerData_SetOwnerCurr(selfArg, vArg) } func (self *KeyOwnerData) OwnerCurr() ID { @@ -21647,13 +22160,17 @@ func (self *KeyOwnerData) OwnerCurr() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiKeyOwnerData_GetOwnerCurr(selfArg)) + + result := C.wrap_ImGuiKeyOwnerData_GetOwnerCurr(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self KeyOwnerData) SetOwnerNext(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiKeyOwnerData_SetOwnerNext(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiKeyOwnerData_SetOwnerNext(selfArg, vArg) } func (self *KeyOwnerData) OwnerNext() ID { @@ -21662,7 +22179,9 @@ func (self *KeyOwnerData) OwnerNext() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiKeyOwnerData_GetOwnerNext(selfArg)) + + result := C.wrap_ImGuiKeyOwnerData_GetOwnerNext(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self KeyOwnerData) SetLockThisFrame(v bool) { @@ -21726,9 +22245,11 @@ func (self *KeyRoutingData) RoutingNextScore() byte { } func (self KeyRoutingData) SetRoutingCurr(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiKeyRoutingData_SetRoutingCurr(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiKeyRoutingData_SetRoutingCurr(selfArg, vArg) } func (self *KeyRoutingData) RoutingCurr() ID { @@ -21737,13 +22258,17 @@ func (self *KeyRoutingData) RoutingCurr() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiKeyRoutingData_GetRoutingCurr(selfArg)) + + result := C.wrap_ImGuiKeyRoutingData_GetRoutingCurr(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self KeyRoutingData) SetRoutingNext(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiKeyRoutingData_SetRoutingNext(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiKeyRoutingData_SetRoutingNext(selfArg, vArg) } func (self *KeyRoutingData) RoutingNext() ID { @@ -21752,7 +22277,9 @@ func (self *KeyRoutingData) RoutingNext() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiKeyRoutingData_GetRoutingNext(selfArg)) + + result := C.wrap_ImGuiKeyRoutingData_GetRoutingNext(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self KeyRoutingTable) SetEntries(v Vector[*KeyRoutingData]) { @@ -21802,9 +22329,11 @@ func (self *KeyRoutingTable) EntriesNext() Vector[*KeyRoutingData] { } func (self LastItemData) SetID(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiLastItemData_SetID(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiLastItemData_SetID(selfArg, vArg) } func (self *LastItemData) ID() ID { @@ -21813,7 +22342,9 @@ func (self *LastItemData) ID() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiLastItemData_GetID(selfArg)) + + result := C.wrap_ImGuiLastItemData_GetID(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self LastItemData) SetInFlags(v ItemFlags) { @@ -21983,23 +22514,6 @@ func (self *ListClipper) StartPosY() float32 { return float32(C.wrap_ImGuiListClipper_GetStartPosY(selfArg)) } -func (self ListClipper) SetTempData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiListClipper_SetTempData(selfArg, vArg) -} - -func (self *ListClipper) TempData() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_ImGuiListClipper_GetTempData(selfArg)) -} - func (self ListClipperData) SetListClipper(v *ListClipper) { vArg, _ := v.handle() @@ -22480,9 +22994,11 @@ func (self *NavItemData) Window() *Window { } func (self NavItemData) SetID(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiNavItemData_SetID(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiNavItemData_SetID(selfArg, vArg) } func (self *NavItemData) ID() ID { @@ -22491,13 +23007,17 @@ func (self *NavItemData) ID() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiNavItemData_GetID(selfArg)) + + result := C.wrap_ImGuiNavItemData_GetID(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self NavItemData) SetFocusScopeId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiNavItemData_SetFocusScopeId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiNavItemData_SetFocusScopeId(selfArg, vArg) } func (self *NavItemData) FocusScopeId() ID { @@ -22506,7 +23026,9 @@ func (self *NavItemData) FocusScopeId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiNavItemData_GetFocusScopeId(selfArg)) + + result := C.wrap_ImGuiNavItemData_GetFocusScopeId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self NavItemData) SetRectRel(v Rect) { @@ -22585,9 +23107,11 @@ func (self *NavItemData) DistAxial() float32 { } func (self NavTreeNodeData) SetID(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiNavTreeNodeData_SetID(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiNavTreeNodeData_SetID(selfArg, vArg) } func (self *NavTreeNodeData) ID() ID { @@ -22596,7 +23120,9 @@ func (self *NavTreeNodeData) ID() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiNavTreeNodeData_GetID(selfArg)) + + result := C.wrap_ImGuiNavTreeNodeData_GetID(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self NavTreeNodeData) SetInFlags(v ItemFlags) { @@ -22899,23 +23425,6 @@ func (self *NextWindowData) SizeConstraintRect() Rect { return *(&Rect{}).fromC(C.wrap_ImGuiNextWindowData_GetSizeConstraintRect(selfArg)) } -func (self NextWindowData) SetSizeCallbackUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiNextWindowData_SetSizeCallbackUserData(selfArg, vArg) -} - -func (self *NextWindowData) SizeCallbackUserData() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_ImGuiNextWindowData_GetSizeCallbackUserData(selfArg)) -} - func (self NextWindowData) SetBgAlphaVal(v float32) { selfArg, selfFin := self.handle() defer selfFin() @@ -22932,9 +23441,11 @@ func (self *NextWindowData) BgAlphaVal() float32 { } func (self NextWindowData) SetViewportId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiNextWindowData_SetViewportId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiNextWindowData_SetViewportId(selfArg, vArg) } func (self *NextWindowData) ViewportId() ID { @@ -22943,13 +23454,17 @@ func (self *NextWindowData) ViewportId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiNextWindowData_GetViewportId(selfArg)) + + result := C.wrap_ImGuiNextWindowData_GetViewportId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self NextWindowData) SetDockId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiNextWindowData_SetDockId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiNextWindowData_SetDockId(selfArg, vArg) } func (self *NextWindowData) DockId() ID { @@ -22958,7 +23473,9 @@ func (self *NextWindowData) DockId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiNextWindowData_GetDockId(selfArg)) + + result := C.wrap_ImGuiNextWindowData_GetDockId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self NextWindowData) SetWindowClass(v WindowClass) { @@ -23056,9 +23573,11 @@ func (self *OldColumnData) ClipRect() Rect { } func (self OldColumns) SetID(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiOldColumns_SetID(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiOldColumns_SetID(selfArg, vArg) } func (self *OldColumns) ID() ID { @@ -23067,7 +23586,9 @@ func (self *OldColumns) ID() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiOldColumns_GetID(selfArg)) + + result := C.wrap_ImGuiOldColumns_GetID(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self OldColumns) SetFlags(v OldColumnFlags) { @@ -23337,23 +23858,6 @@ func (self *OnceUponAFrame) RefFrame() int32 { return int32(C.wrap_ImGuiOnceUponAFrame_GetRefFrame(selfArg)) } -func (self Payload) SetData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiPayload_SetData(selfArg, vArg) -} - -func (self *Payload) Data() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_ImGuiPayload_GetData(selfArg)) -} - func (self Payload) SetDataSize(v int32) { selfArg, selfFin := self.handle() defer selfFin() @@ -23370,9 +23874,11 @@ func (self *Payload) DataSize() int32 { } func (self Payload) SetSourceId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiPayload_SetSourceId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiPayload_SetSourceId(selfArg, vArg) } func (self *Payload) SourceId() ID { @@ -23381,13 +23887,17 @@ func (self *Payload) SourceId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiPayload_GetSourceId(selfArg)) + + result := C.wrap_ImGuiPayload_GetSourceId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Payload) SetSourceParentId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiPayload_SetSourceParentId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiPayload_SetSourceParentId(selfArg, vArg) } func (self *Payload) SourceParentId() ID { @@ -23396,7 +23906,9 @@ func (self *Payload) SourceParentId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiPayload_GetSourceParentId(selfArg)) + + result := C.wrap_ImGuiPayload_GetSourceParentId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Payload) SetDataFrameCount(v int32) { @@ -23587,27 +24099,12 @@ func (self *PlatformMonitor) DpiScale() float32 { return float32(C.wrap_ImGuiPlatformMonitor_GetDpiScale(selfArg)) } -func (self PlatformMonitor) SetPlatformHandle(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiPlatformMonitor_SetPlatformHandle(selfArg, vArg) -} - -func (self *PlatformMonitor) PlatformHandle() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_ImGuiPlatformMonitor_GetPlatformHandle(selfArg)) -} - func (self PopupData) SetPopupId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiPopupData_SetPopupId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiPopupData_SetPopupId(selfArg, vArg) } func (self *PopupData) PopupId() ID { @@ -23616,7 +24113,9 @@ func (self *PopupData) PopupId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiPopupData_GetPopupId(selfArg)) + + result := C.wrap_ImGuiPopupData_GetPopupId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self PopupData) SetWindow(v *Window) { @@ -23684,9 +24183,11 @@ func (self *PopupData) OpenFrameCount() int32 { } func (self PopupData) SetOpenParentId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiPopupData_SetOpenParentId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiPopupData_SetOpenParentId(selfArg, vArg) } func (self *PopupData) OpenParentId() ID { @@ -23695,7 +24196,9 @@ func (self *PopupData) OpenParentId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiPopupData_GetOpenParentId(selfArg)) + + result := C.wrap_ImGuiPopupData_GetOpenParentId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self PopupData) SetOpenPopupPos(v Vec2) { @@ -23728,23 +24231,6 @@ func (self *PopupData) OpenMousePos() Vec2 { return *(&Vec2{}).fromC(C.wrap_ImGuiPopupData_GetOpenMousePos(selfArg)) } -func (self PtrOrIndex) SetPtr(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiPtrOrIndex_SetPtr(selfArg, vArg) -} - -func (self *PtrOrIndex) Ptr() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_ImGuiPtrOrIndex_GetPtr(selfArg)) -} - func (self PtrOrIndex) SetIndex(v int32) { selfArg, selfFin := self.handle() defer selfFin() @@ -23778,9 +24264,11 @@ func (self *SettingsHandler) TypeName() string { } func (self SettingsHandler) SetTypeHash(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiSettingsHandler_SetTypeHash(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiSettingsHandler_SetTypeHash(selfArg, vArg) } func (self *SettingsHandler) TypeHash() ID { @@ -23789,24 +24277,9 @@ func (self *SettingsHandler) TypeHash() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiSettingsHandler_GetTypeHash(selfArg)) -} - -func (self SettingsHandler) SetUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiSettingsHandler_SetUserData(selfArg, vArg) -} -func (self *SettingsHandler) UserData() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_ImGuiSettingsHandler_GetUserData(selfArg)) + result := C.wrap_ImGuiSettingsHandler_GetTypeHash(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self ShrinkWidthItem) SetIndex(v int32) { @@ -23854,23 +24327,6 @@ func (self *ShrinkWidthItem) InitialWidth() float32 { return float32(C.wrap_ImGuiShrinkWidthItem_GetInitialWidth(selfArg)) } -func (self SizeCallbackData) SetUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiSizeCallbackData_SetUserData(selfArg, vArg) -} - -func (self *SizeCallbackData) UserData() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_ImGuiSizeCallbackData_GetUserData(selfArg)) -} - func (self SizeCallbackData) SetPos(v Vec2) { selfArg, selfFin := self.handle() defer selfFin() @@ -23917,9 +24373,11 @@ func (self *SizeCallbackData) DesiredSize() Vec2 { } func (self StackLevelInfo) SetID(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiStackLevelInfo_SetID(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiStackLevelInfo_SetID(selfArg, vArg) } func (self *StackLevelInfo) ID() ID { @@ -23928,7 +24386,9 @@ func (self *StackLevelInfo) ID() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiStackLevelInfo_GetID(selfArg)) + + result := C.wrap_ImGuiStackLevelInfo_GetID(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self StackLevelInfo) SetQueryFrameCount(v int) { @@ -24142,9 +24602,11 @@ func (self *StackTool) StackLevel() int32 { } func (self StackTool) SetQueryId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiStackTool_SetQueryId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiStackTool_SetQueryId(selfArg, vArg) } func (self *StackTool) QueryId() ID { @@ -24153,7 +24615,9 @@ func (self *StackTool) QueryId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiStackTool_GetQueryId(selfArg)) + + result := C.wrap_ImGuiStackTool_GetQueryId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self StackTool) SetResults(v Vector[*StackLevelInfo]) { @@ -24233,9 +24697,11 @@ func (self *Storage) Data() Vector[*StoragePair] { } func (self StoragePair) SetKey(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiStoragePair_SetKey(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiStoragePair_SetKey(selfArg, vArg) } func (self *StoragePair) Key() ID { @@ -24244,7 +24710,9 @@ func (self *StoragePair) Key() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiStoragePair_GetKey(selfArg)) + + result := C.wrap_ImGuiStoragePair_GetKey(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Style) SetAlpha(v float32) { @@ -25051,9 +25519,11 @@ func (self *TabBar) Flags() TabBarFlags { } func (self TabBar) SetID(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTabBar_SetID(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiTabBar_SetID(selfArg, vArg) } func (self *TabBar) ID() ID { @@ -25062,13 +25532,17 @@ func (self *TabBar) ID() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiTabBar_GetID(selfArg)) + + result := C.wrap_ImGuiTabBar_GetID(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self TabBar) SetSelectedTabId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTabBar_SetSelectedTabId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiTabBar_SetSelectedTabId(selfArg, vArg) } func (self *TabBar) SelectedTabId() ID { @@ -25077,13 +25551,17 @@ func (self *TabBar) SelectedTabId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiTabBar_GetSelectedTabId(selfArg)) + + result := C.wrap_ImGuiTabBar_GetSelectedTabId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self TabBar) SetNextSelectedTabId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTabBar_SetNextSelectedTabId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiTabBar_SetNextSelectedTabId(selfArg, vArg) } func (self *TabBar) NextSelectedTabId() ID { @@ -25092,13 +25570,17 @@ func (self *TabBar) NextSelectedTabId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiTabBar_GetNextSelectedTabId(selfArg)) + + result := C.wrap_ImGuiTabBar_GetNextSelectedTabId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self TabBar) SetVisibleTabId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTabBar_SetVisibleTabId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiTabBar_SetVisibleTabId(selfArg, vArg) } func (self *TabBar) VisibleTabId() ID { @@ -25107,7 +25589,9 @@ func (self *TabBar) VisibleTabId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiTabBar_GetVisibleTabId(selfArg)) + + result := C.wrap_ImGuiTabBar_GetVisibleTabId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self TabBar) SetCurrFrameVisible(v int32) { @@ -25336,9 +25820,11 @@ func (self *TabBar) SeparatorMaxX() float32 { } func (self TabBar) SetReorderRequestTabId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTabBar_SetReorderRequestTabId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiTabBar_SetReorderRequestTabId(selfArg, vArg) } func (self *TabBar) ReorderRequestTabId() ID { @@ -25347,7 +25833,9 @@ func (self *TabBar) ReorderRequestTabId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiTabBar_GetReorderRequestTabId(selfArg)) + + result := C.wrap_ImGuiTabBar_GetReorderRequestTabId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self TabBar) SetReorderRequestOffset(v int) { @@ -25520,9 +26008,11 @@ func (self *TabBar) TabsNames() TextBuffer { } func (self TabItem) SetID(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTabItem_SetID(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiTabItem_SetID(selfArg, vArg) } func (self *TabItem) ID() ID { @@ -25531,7 +26021,9 @@ func (self *TabItem) ID() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiTabItem_GetID(selfArg)) + + result := C.wrap_ImGuiTabItem_GetID(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self TabItem) SetFlags(v TabItemFlags) { @@ -25717,9 +26209,11 @@ func (self *TabItem) WantClose() bool { } func (self Table) SetID(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetID(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiTable_SetID(selfArg, vArg) } func (self *Table) ID() ID { @@ -25728,7 +26222,9 @@ func (self *Table) ID() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiTable_GetID(selfArg)) + + result := C.wrap_ImGuiTable_GetID(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Table) SetFlags(v TableFlags) { @@ -25746,38 +26242,78 @@ func (self *Table) Flags() TableFlags { return TableFlags(C.wrap_ImGuiTable_GetFlags(selfArg)) } -func (self Table) SetRawData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) +func (self Table) SetTempData(v *TableTempData) { + vArg, _ := v.handle() selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetRawData(selfArg, vArg) + C.wrap_ImGuiTable_SetTempData(selfArg, vArg) } -func (self *Table) RawData() unsafe.Pointer { +func (self *Table) TempData() *TableTempData { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImGuiTable_GetRawData(selfArg)) + return newTableTempDataFromC(C.wrap_ImGuiTable_GetTempData(selfArg)) } -func (self Table) SetTempData(v *TableTempData) { - vArg, _ := v.handle() +func (self Table) SetEnabledMaskByDisplayOrder(v BitArrayPtr) { + vArg, _ := v.c() selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetTempData(selfArg, vArg) + C.wrap_ImGuiTable_SetEnabledMaskByDisplayOrder(selfArg, vArg) } -func (self *Table) TempData() *TableTempData { +func (self *Table) EnabledMaskByDisplayOrder() BitArrayPtr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return newTableTempDataFromC(C.wrap_ImGuiTable_GetTempData(selfArg)) + + result := C.wrap_ImGuiTable_GetEnabledMaskByDisplayOrder(selfArg) + return *newBitArrayPtrFromC(func() *C.ImBitArrayPtr { result := result; return &result }()) +} + +func (self Table) SetEnabledMaskByIndex(v BitArrayPtr) { + vArg, _ := v.c() + + selfArg, selfFin := self.handle() + defer selfFin() + C.wrap_ImGuiTable_SetEnabledMaskByIndex(selfArg, vArg) +} + +func (self *Table) EnabledMaskByIndex() BitArrayPtr { + selfArg, selfFin := self.handle() + + defer func() { + selfFin() + }() + + result := C.wrap_ImGuiTable_GetEnabledMaskByIndex(selfArg) + return *newBitArrayPtrFromC(func() *C.ImBitArrayPtr { result := result; return &result }()) +} + +func (self Table) SetVisibleMaskByIndex(v BitArrayPtr) { + vArg, _ := v.c() + + selfArg, selfFin := self.handle() + defer selfFin() + C.wrap_ImGuiTable_SetVisibleMaskByIndex(selfArg, vArg) +} + +func (self *Table) VisibleMaskByIndex() BitArrayPtr { + selfArg, selfFin := self.handle() + + defer func() { + selfFin() + }() + + result := C.wrap_ImGuiTable_GetVisibleMaskByIndex(selfArg) + return *newBitArrayPtrFromC(func() *C.ImBitArrayPtr { result := result; return &result }()) } func (self Table) SetSettingsLoadedFlags(v TableFlags) { @@ -26598,340 +27134,12 @@ func (self *Table) SortSpecs() TableSortSpecs { return *newTableSortSpecsFromC(func() *C.ImGuiTableSortSpecs { result := result; return &result }()) } -func (self Table) SetSortSpecsCount(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetSortSpecsCount(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *Table) SortSpecsCount() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTable_GetSortSpecsCount(selfArg)) -} - -func (self Table) SetColumnsEnabledCount(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetColumnsEnabledCount(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *Table) ColumnsEnabledCount() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTable_GetColumnsEnabledCount(selfArg)) -} - -func (self Table) SetColumnsEnabledFixedCount(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetColumnsEnabledFixedCount(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *Table) ColumnsEnabledFixedCount() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTable_GetColumnsEnabledFixedCount(selfArg)) -} - -func (self Table) SetDeclColumnsCount(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetDeclColumnsCount(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *Table) DeclColumnsCount() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTable_GetDeclColumnsCount(selfArg)) -} - -func (self Table) SetHoveredColumnBody(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetHoveredColumnBody(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *Table) HoveredColumnBody() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTable_GetHoveredColumnBody(selfArg)) -} - -func (self Table) SetHoveredColumnBorder(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetHoveredColumnBorder(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *Table) HoveredColumnBorder() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTable_GetHoveredColumnBorder(selfArg)) -} - -func (self Table) SetAutoFitSingleColumn(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetAutoFitSingleColumn(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *Table) AutoFitSingleColumn() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTable_GetAutoFitSingleColumn(selfArg)) -} - -func (self Table) SetResizedColumn(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetResizedColumn(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *Table) ResizedColumn() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTable_GetResizedColumn(selfArg)) -} - -func (self Table) SetLastResizedColumn(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetLastResizedColumn(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *Table) LastResizedColumn() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTable_GetLastResizedColumn(selfArg)) -} - -func (self Table) SetHeldHeaderColumn(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetHeldHeaderColumn(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *Table) HeldHeaderColumn() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTable_GetHeldHeaderColumn(selfArg)) -} - -func (self Table) SetReorderColumn(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetReorderColumn(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *Table) ReorderColumn() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTable_GetReorderColumn(selfArg)) -} - -func (self Table) SetReorderColumnDir(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetReorderColumnDir(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *Table) ReorderColumnDir() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTable_GetReorderColumnDir(selfArg)) -} - -func (self Table) SetLeftMostEnabledColumn(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetLeftMostEnabledColumn(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *Table) LeftMostEnabledColumn() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTable_GetLeftMostEnabledColumn(selfArg)) -} - -func (self Table) SetRightMostEnabledColumn(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetRightMostEnabledColumn(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *Table) RightMostEnabledColumn() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTable_GetRightMostEnabledColumn(selfArg)) -} - -func (self Table) SetLeftMostStretchedColumn(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetLeftMostStretchedColumn(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *Table) LeftMostStretchedColumn() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTable_GetLeftMostStretchedColumn(selfArg)) -} - -func (self Table) SetRightMostStretchedColumn(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetRightMostStretchedColumn(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *Table) RightMostStretchedColumn() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTable_GetRightMostStretchedColumn(selfArg)) -} - -func (self Table) SetContextPopupColumn(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetContextPopupColumn(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *Table) ContextPopupColumn() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTable_GetContextPopupColumn(selfArg)) -} - -func (self Table) SetFreezeRowsRequest(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetFreezeRowsRequest(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *Table) FreezeRowsRequest() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTable_GetFreezeRowsRequest(selfArg)) -} - -func (self Table) SetFreezeRowsCount(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetFreezeRowsCount(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *Table) FreezeRowsCount() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTable_GetFreezeRowsCount(selfArg)) -} - -func (self Table) SetFreezeColumnsRequest(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetFreezeColumnsRequest(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *Table) FreezeColumnsRequest() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTable_GetFreezeColumnsRequest(selfArg)) -} - -func (self Table) SetFreezeColumnsCount(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetFreezeColumnsCount(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *Table) FreezeColumnsCount() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTable_GetFreezeColumnsCount(selfArg)) -} - -func (self Table) SetRowCellDataCurrent(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetRowCellDataCurrent(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *Table) RowCellDataCurrent() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTable_GetRowCellDataCurrent(selfArg)) -} - func (self Table) SetDummyDrawChannel(v TableDrawChannelIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetDummyDrawChannel(selfArg, C.ImGuiTableDrawChannelIdx(v)) + C.wrap_ImGuiTable_SetDummyDrawChannel(selfArg, vArg) } func (self *Table) DummyDrawChannel() TableDrawChannelIdx { @@ -26940,13 +27148,17 @@ func (self *Table) DummyDrawChannel() TableDrawChannelIdx { defer func() { selfFin() }() - return TableDrawChannelIdx(C.wrap_ImGuiTable_GetDummyDrawChannel(selfArg)) + + result := C.wrap_ImGuiTable_GetDummyDrawChannel(selfArg) + return *newTableDrawChannelIdxFromC(func() *C.ImGuiTableDrawChannelIdx { result := result; return &result }()) } func (self Table) SetBg2DrawChannelCurrent(v TableDrawChannelIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetBg2DrawChannelCurrent(selfArg, C.ImGuiTableDrawChannelIdx(v)) + C.wrap_ImGuiTable_SetBg2DrawChannelCurrent(selfArg, vArg) } func (self *Table) Bg2DrawChannelCurrent() TableDrawChannelIdx { @@ -26955,13 +27167,17 @@ func (self *Table) Bg2DrawChannelCurrent() TableDrawChannelIdx { defer func() { selfFin() }() - return TableDrawChannelIdx(C.wrap_ImGuiTable_GetBg2DrawChannelCurrent(selfArg)) + + result := C.wrap_ImGuiTable_GetBg2DrawChannelCurrent(selfArg) + return *newTableDrawChannelIdxFromC(func() *C.ImGuiTableDrawChannelIdx { result := result; return &result }()) } func (self Table) SetBg2DrawChannelUnfrozen(v TableDrawChannelIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetBg2DrawChannelUnfrozen(selfArg, C.ImGuiTableDrawChannelIdx(v)) + C.wrap_ImGuiTable_SetBg2DrawChannelUnfrozen(selfArg, vArg) } func (self *Table) Bg2DrawChannelUnfrozen() TableDrawChannelIdx { @@ -26970,7 +27186,9 @@ func (self *Table) Bg2DrawChannelUnfrozen() TableDrawChannelIdx { defer func() { selfFin() }() - return TableDrawChannelIdx(C.wrap_ImGuiTable_GetBg2DrawChannelUnfrozen(selfArg)) + + result := C.wrap_ImGuiTable_GetBg2DrawChannelUnfrozen(selfArg) + return *newTableDrawChannelIdxFromC(func() *C.ImGuiTableDrawChannelIdx { result := result; return &result }()) } func (self Table) SetIsLayoutLocked(v bool) { @@ -27243,21 +27461,6 @@ func (self *TableCellData) BgColor() uint32 { return uint32(C.wrap_ImGuiTableCellData_GetBgColor(selfArg)) } -func (self TableCellData) SetColumn(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTableCellData_SetColumn(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *TableCellData) Column() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTableCellData_GetColumn(selfArg)) -} - func (self TableColumn) SetFlags(v TableColumnFlags) { selfArg, selfFin := self.handle() defer selfFin() @@ -27394,9 +27597,11 @@ func (self *TableColumn) ClipRect() Rect { } func (self TableColumn) SetUserID(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTableColumn_SetUserID(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiTableColumn_SetUserID(selfArg, vArg) } func (self *TableColumn) UserID() ID { @@ -27405,7 +27610,9 @@ func (self *TableColumn) UserID() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiTableColumn_GetUserID(selfArg)) + + result := C.wrap_ImGuiTableColumn_GetUserID(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self TableColumn) SetWorkMinX(v float32) { @@ -27528,85 +27735,12 @@ func (self *TableColumn) NameOffset() int { return int(C.wrap_ImGuiTableColumn_GetNameOffset(selfArg)) } -func (self TableColumn) SetDisplayOrder(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTableColumn_SetDisplayOrder(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *TableColumn) DisplayOrder() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTableColumn_GetDisplayOrder(selfArg)) -} - -func (self TableColumn) SetIndexWithinEnabledSet(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTableColumn_SetIndexWithinEnabledSet(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *TableColumn) IndexWithinEnabledSet() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTableColumn_GetIndexWithinEnabledSet(selfArg)) -} - -func (self TableColumn) SetPrevEnabledColumn(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTableColumn_SetPrevEnabledColumn(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *TableColumn) PrevEnabledColumn() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTableColumn_GetPrevEnabledColumn(selfArg)) -} - -func (self TableColumn) SetNextEnabledColumn(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTableColumn_SetNextEnabledColumn(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *TableColumn) NextEnabledColumn() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTableColumn_GetNextEnabledColumn(selfArg)) -} - -func (self TableColumn) SetSortOrder(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTableColumn_SetSortOrder(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *TableColumn) SortOrder() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTableColumn_GetSortOrder(selfArg)) -} - func (self TableColumn) SetDrawChannelCurrent(v TableDrawChannelIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTableColumn_SetDrawChannelCurrent(selfArg, C.ImGuiTableDrawChannelIdx(v)) + C.wrap_ImGuiTableColumn_SetDrawChannelCurrent(selfArg, vArg) } func (self *TableColumn) DrawChannelCurrent() TableDrawChannelIdx { @@ -27615,13 +27749,17 @@ func (self *TableColumn) DrawChannelCurrent() TableDrawChannelIdx { defer func() { selfFin() }() - return TableDrawChannelIdx(C.wrap_ImGuiTableColumn_GetDrawChannelCurrent(selfArg)) + + result := C.wrap_ImGuiTableColumn_GetDrawChannelCurrent(selfArg) + return *newTableDrawChannelIdxFromC(func() *C.ImGuiTableDrawChannelIdx { result := result; return &result }()) } func (self TableColumn) SetDrawChannelFrozen(v TableDrawChannelIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTableColumn_SetDrawChannelFrozen(selfArg, C.ImGuiTableDrawChannelIdx(v)) + C.wrap_ImGuiTableColumn_SetDrawChannelFrozen(selfArg, vArg) } func (self *TableColumn) DrawChannelFrozen() TableDrawChannelIdx { @@ -27630,13 +27768,17 @@ func (self *TableColumn) DrawChannelFrozen() TableDrawChannelIdx { defer func() { selfFin() }() - return TableDrawChannelIdx(C.wrap_ImGuiTableColumn_GetDrawChannelFrozen(selfArg)) + + result := C.wrap_ImGuiTableColumn_GetDrawChannelFrozen(selfArg) + return *newTableDrawChannelIdxFromC(func() *C.ImGuiTableDrawChannelIdx { result := result; return &result }()) } func (self TableColumn) SetDrawChannelUnfrozen(v TableDrawChannelIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTableColumn_SetDrawChannelUnfrozen(selfArg, C.ImGuiTableDrawChannelIdx(v)) + C.wrap_ImGuiTableColumn_SetDrawChannelUnfrozen(selfArg, vArg) } func (self *TableColumn) DrawChannelUnfrozen() TableDrawChannelIdx { @@ -27645,7 +27787,9 @@ func (self *TableColumn) DrawChannelUnfrozen() TableDrawChannelIdx { defer func() { selfFin() }() - return TableDrawChannelIdx(C.wrap_ImGuiTableColumn_GetDrawChannelUnfrozen(selfArg)) + + result := C.wrap_ImGuiTableColumn_GetDrawChannelUnfrozen(selfArg) + return *newTableDrawChannelIdxFromC(func() *C.ImGuiTableDrawChannelIdx { result := result; return &result }()) } func (self TableColumn) SetIsEnabled(v bool) { @@ -27889,63 +28033,22 @@ func (self *TableColumnSettings) WidthOrWeight() float32 { } func (self TableColumnSettings) SetUserID(v ID) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTableColumnSettings_SetUserID(selfArg, C.ImGuiID(v)) -} - -func (self *TableColumnSettings) UserID() ID { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return ID(C.wrap_ImGuiTableColumnSettings_GetUserID(selfArg)) -} - -func (self TableColumnSettings) SetIndex(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTableColumnSettings_SetIndex(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *TableColumnSettings) Index() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTableColumnSettings_GetIndex(selfArg)) -} + vArg, _ := v.c() -func (self TableColumnSettings) SetDisplayOrder(v TableColumnIdx) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTableColumnSettings_SetDisplayOrder(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTableColumnSettings_SetUserID(selfArg, vArg) } -func (self *TableColumnSettings) DisplayOrder() TableColumnIdx { +func (self *TableColumnSettings) UserID() ID { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTableColumnSettings_GetDisplayOrder(selfArg)) -} - -func (self TableColumnSettings) SetSortOrder(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTableColumnSettings_SetSortOrder(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *TableColumnSettings) SortOrder() TableColumnIdx { - selfArg, selfFin := self.handle() - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTableColumnSettings_GetSortOrder(selfArg)) + result := C.wrap_ImGuiTableColumnSettings_GetUserID(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self TableColumnSettings) SetSortDirection(v byte) { @@ -27994,9 +28097,11 @@ func (self *TableColumnSettings) IsStretch() byte { } func (self TableColumnSortSpecs) SetColumnUserID(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTableColumnSortSpecs_SetColumnUserID(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiTableColumnSortSpecs_SetColumnUserID(selfArg, vArg) } func (self *TableColumnSortSpecs) ColumnUserID() ID { @@ -28005,7 +28110,9 @@ func (self *TableColumnSortSpecs) ColumnUserID() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiTableColumnSortSpecs_GetColumnUserID(selfArg)) + + result := C.wrap_ImGuiTableColumnSortSpecs_GetColumnUserID(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self TableColumnSortSpecs) SetColumnIndex(v int) { @@ -28054,9 +28161,11 @@ func (self *TableColumnSortSpecs) SortDirection() SortDirection { } func (self TableInstanceData) SetTableInstanceID(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTableInstanceData_SetTableInstanceID(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiTableInstanceData_SetTableInstanceID(selfArg, vArg) } func (self *TableInstanceData) TableInstanceID() ID { @@ -28065,7 +28174,9 @@ func (self *TableInstanceData) TableInstanceID() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiTableInstanceData_GetTableInstanceID(selfArg)) + + result := C.wrap_ImGuiTableInstanceData_GetTableInstanceID(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self TableInstanceData) SetLastOuterHeight(v float32) { @@ -28144,9 +28255,11 @@ func (self *TableInstanceData) HoveredRowNext() int32 { } func (self TableSettings) SetID(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTableSettings_SetID(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiTableSettings_SetID(selfArg, vArg) } func (self *TableSettings) ID() ID { @@ -28155,7 +28268,9 @@ func (self *TableSettings) ID() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiTableSettings_GetID(selfArg)) + + result := C.wrap_ImGuiTableSettings_GetID(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self TableSettings) SetSaveFlags(v TableFlags) { @@ -28188,36 +28303,6 @@ func (self *TableSettings) RefScale() float32 { return float32(C.wrap_ImGuiTableSettings_GetRefScale(selfArg)) } -func (self TableSettings) SetColumnsCount(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTableSettings_SetColumnsCount(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *TableSettings) ColumnsCount() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTableSettings_GetColumnsCount(selfArg)) -} - -func (self TableSettings) SetColumnsCountMax(v TableColumnIdx) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTableSettings_SetColumnsCountMax(selfArg, C.ImGuiTableColumnIdx(v)) -} - -func (self *TableSettings) ColumnsCountMax() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TableColumnIdx(C.wrap_ImGuiTableSettings_GetColumnsCountMax(selfArg)) -} - func (self TableSettings) SetWantApply(v bool) { selfArg, selfFin := self.handle() defer selfFin() @@ -28713,9 +28798,11 @@ func (self *TypingSelectState) Request() TypingSelectRequest { } func (self TypingSelectState) SetFocusScope(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTypingSelectState_SetFocusScope(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiTypingSelectState_SetFocusScope(selfArg, vArg) } func (self *TypingSelectState) FocusScope() ID { @@ -28724,7 +28811,9 @@ func (self *TypingSelectState) FocusScope() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiTypingSelectState_GetFocusScope(selfArg)) + + result := C.wrap_ImGuiTypingSelectState_GetFocusScope(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self TypingSelectState) SetLastRequestFrame(v int32) { @@ -28773,9 +28862,11 @@ func (self *TypingSelectState) SingleCharModeLock() bool { } func (self Viewport) SetID(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiViewport_SetID(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiViewport_SetID(selfArg, vArg) } func (self *Viewport) ID() ID { @@ -28784,7 +28875,9 @@ func (self *Viewport) ID() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiViewport_GetID(selfArg)) + + result := C.wrap_ImGuiViewport_GetID(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Viewport) SetFlags(v ViewportFlags) { @@ -28878,9 +28971,11 @@ func (self *Viewport) DpiScale() float32 { } func (self Viewport) SetParentViewportId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiViewport_SetParentViewportId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiViewport_SetParentViewportId(selfArg, vArg) } func (self *Viewport) ParentViewportId() ID { @@ -28889,7 +28984,9 @@ func (self *Viewport) ParentViewportId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiViewport_GetParentViewportId(selfArg)) + + result := C.wrap_ImGuiViewport_GetParentViewportId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Viewport) SetDrawData(v *DrawData) { @@ -28909,74 +29006,6 @@ func (self *Viewport) DrawData() *DrawData { return newDrawDataFromC(C.wrap_ImGuiViewport_GetDrawData(selfArg)) } -func (self Viewport) SetRendererUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiViewport_SetRendererUserData(selfArg, vArg) -} - -func (self *Viewport) RendererUserData() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_ImGuiViewport_GetRendererUserData(selfArg)) -} - -func (self Viewport) SetPlatformUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiViewport_SetPlatformUserData(selfArg, vArg) -} - -func (self *Viewport) PlatformUserData() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_ImGuiViewport_GetPlatformUserData(selfArg)) -} - -func (self Viewport) SetPlatformHandle(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiViewport_SetPlatformHandle(selfArg, vArg) -} - -func (self *Viewport) PlatformHandle() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_ImGuiViewport_GetPlatformHandle(selfArg)) -} - -func (self Viewport) SetPlatformHandleRaw(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiViewport_SetPlatformHandleRaw(selfArg, vArg) -} - -func (self *Viewport) PlatformHandleRaw() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_ImGuiViewport_GetPlatformHandleRaw(selfArg)) -} - func (self Viewport) SetPlatformWindowCreated(v bool) { selfArg, selfFin := self.handle() defer selfFin() @@ -29119,9 +29148,11 @@ func (self *ViewportP) LastFocusedStampCount() int32 { } func (self ViewportP) SetLastNameHash(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiViewportP_SetLastNameHash(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiViewportP_SetLastNameHash(selfArg, vArg) } func (self *ViewportP) LastNameHash() ID { @@ -29130,7 +29161,9 @@ func (self *ViewportP) LastNameHash() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiViewportP_GetLastNameHash(selfArg)) + + result := C.wrap_ImGuiViewportP_GetLastNameHash(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self ViewportP) SetLastPos(v Vec2) { @@ -29397,9 +29430,11 @@ func (self *Window) Name() string { } func (self Window) SetID(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiWindow_SetID(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiWindow_SetID(selfArg, vArg) } func (self *Window) ID() ID { @@ -29408,7 +29443,9 @@ func (self *Window) ID() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiWindow_GetID(selfArg)) + + result := C.wrap_ImGuiWindow_GetID(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Window) SetFlags(v WindowFlags) { @@ -29478,9 +29515,11 @@ func (self *Window) Viewport() *ViewportP { } func (self Window) SetViewportId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiWindow_SetViewportId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiWindow_SetViewportId(selfArg, vArg) } func (self *Window) ViewportId() ID { @@ -29489,7 +29528,9 @@ func (self *Window) ViewportId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiWindow_GetViewportId(selfArg)) + + result := C.wrap_ImGuiWindow_GetViewportId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Window) SetViewportPos(v Vec2) { @@ -29763,9 +29804,11 @@ func (self *Window) NameBufLen() int32 { } func (self Window) SetMoveId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiWindow_SetMoveId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiWindow_SetMoveId(selfArg, vArg) } func (self *Window) MoveId() ID { @@ -29774,13 +29817,17 @@ func (self *Window) MoveId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiWindow_GetMoveId(selfArg)) + + result := C.wrap_ImGuiWindow_GetMoveId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Window) SetTabId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiWindow_SetTabId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiWindow_SetTabId(selfArg, vArg) } func (self *Window) TabId() ID { @@ -29789,13 +29836,17 @@ func (self *Window) TabId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiWindow_GetTabId(selfArg)) + + result := C.wrap_ImGuiWindow_GetTabId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Window) SetChildId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiWindow_SetChildId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiWindow_SetChildId(selfArg, vArg) } func (self *Window) ChildId() ID { @@ -29804,7 +29855,9 @@ func (self *Window) ChildId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiWindow_GetChildId(selfArg)) + + result := C.wrap_ImGuiWindow_GetChildId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Window) SetScroll(v Vec2) { @@ -30183,9 +30236,11 @@ func (self *Window) FocusOrder() int16 { } func (self Window) SetPopupId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiWindow_SetPopupId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiWindow_SetPopupId(selfArg, vArg) } func (self *Window) PopupId() ID { @@ -30194,7 +30249,9 @@ func (self *Window) PopupId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiWindow_GetPopupId(selfArg)) + + result := C.wrap_ImGuiWindow_GetPopupId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Window) SetAutoFitFramesX(v int) { @@ -30424,7 +30481,7 @@ func (self *Window) SetWindowPosPivot() Vec2 { func (self Window) SetIDStack(v Vector[*ID]) { vData := v.Data - vDataArg, _ := WrapNumberPtr[C.ImGuiID, ID](vData) + vDataArg, _ := vData.handle() vVecArg := new(C.ImVector_ImGuiID) vVecArg.Size = C.int(v.Size) vVecArg.Capacity = C.int(v.Capacity) @@ -30436,6 +30493,15 @@ func (self Window) SetIDStack(v Vector[*ID]) { C.wrap_ImGuiWindow_SetIDStack(selfArg, *vVecArg) } +func (self *Window) IDStack() Vector[*ID] { + selfArg, selfFin := self.handle() + + defer func() { + selfFin() + }() + return newVectorFromC(C.wrap_ImGuiWindow_GetIDStack(selfArg).Size, C.wrap_ImGuiWindow_GetIDStack(selfArg).Capacity, newIDFromC(C.wrap_ImGuiWindow_GetIDStack(selfArg).Data)) +} + func (self Window) SetDC(v WindowTempData) { vArg, _ := v.c() @@ -30894,9 +30960,11 @@ func (self Window) SetNavPreferredScoringPosRel(v [2]*Vec2) { } func (self Window) SetNavRootFocusScopeId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiWindow_SetNavRootFocusScopeId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiWindow_SetNavRootFocusScopeId(selfArg, vArg) } func (self *Window) NavRootFocusScopeId() ID { @@ -30905,7 +30973,9 @@ func (self *Window) NavRootFocusScopeId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiWindow_GetNavRootFocusScopeId(selfArg)) + + result := C.wrap_ImGuiWindow_GetNavRootFocusScopeId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Window) SetMemoryDrawListIdxCapacity(v int32) { @@ -31082,9 +31152,11 @@ func (self *Window) DockNodeAsHost() *DockNode { } func (self Window) SetDockId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiWindow_SetDockId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiWindow_SetDockId(selfArg, vArg) } func (self *Window) DockId() ID { @@ -31093,7 +31165,9 @@ func (self *Window) DockId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiWindow_GetDockId(selfArg)) + + result := C.wrap_ImGuiWindow_GetDockId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self Window) SetDockTabItemStatusFlags(v ItemStatusFlags) { @@ -31127,9 +31201,11 @@ func (self *Window) DockTabItemRect() Rect { } func (self WindowClass) SetClassId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiWindowClass_SetClassId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiWindowClass_SetClassId(selfArg, vArg) } func (self *WindowClass) ClassId() ID { @@ -31138,13 +31214,17 @@ func (self *WindowClass) ClassId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiWindowClass_GetClassId(selfArg)) + + result := C.wrap_ImGuiWindowClass_GetClassId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self WindowClass) SetParentViewportId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiWindowClass_SetParentViewportId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiWindowClass_SetParentViewportId(selfArg, vArg) } func (self *WindowClass) ParentViewportId() ID { @@ -31153,7 +31233,9 @@ func (self *WindowClass) ParentViewportId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiWindowClass_GetParentViewportId(selfArg)) + + result := C.wrap_ImGuiWindowClass_GetParentViewportId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self WindowClass) SetViewportFlagsOverrideSet(v ViewportFlags) { @@ -31247,9 +31329,11 @@ func (self *WindowClass) DockingAllowUnclassed() bool { } func (self WindowSettings) SetID(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiWindowSettings_SetID(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiWindowSettings_SetID(selfArg, vArg) } func (self *WindowSettings) ID() ID { @@ -31258,13 +31342,17 @@ func (self *WindowSettings) ID() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiWindowSettings_GetID(selfArg)) + + result := C.wrap_ImGuiWindowSettings_GetID(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self WindowSettings) SetViewportId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiWindowSettings_SetViewportId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiWindowSettings_SetViewportId(selfArg, vArg) } func (self *WindowSettings) ViewportId() ID { @@ -31273,13 +31361,17 @@ func (self *WindowSettings) ViewportId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiWindowSettings_GetViewportId(selfArg)) + + result := C.wrap_ImGuiWindowSettings_GetViewportId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self WindowSettings) SetDockId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiWindowSettings_SetDockId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiWindowSettings_SetDockId(selfArg, vArg) } func (self *WindowSettings) DockId() ID { @@ -31288,13 +31380,17 @@ func (self *WindowSettings) DockId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiWindowSettings_GetDockId(selfArg)) + + result := C.wrap_ImGuiWindowSettings_GetDockId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self WindowSettings) SetClassId(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiWindowSettings_SetClassId(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiWindowSettings_SetClassId(selfArg, vArg) } func (self *WindowSettings) ClassId() ID { @@ -31303,7 +31399,9 @@ func (self *WindowSettings) ClassId() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiWindowSettings_GetClassId(selfArg)) + + result := C.wrap_ImGuiWindowSettings_GetClassId(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self WindowSettings) SetDockOrder(v int16) { diff --git a/cimgui_structs.go b/cimgui_structs.go deleted file mode 100644 index 95a60dba6..000000000 --- a/cimgui_structs.go +++ /dev/null @@ -1,4234 +0,0 @@ -// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. -// DO NOT EDIT. - -package imgui - -// #include -// #include -// #include "extra_types.h" -// #include "cimgui_wrapper.h" -import "C" -import "unsafe" - -// Helper: ImBitVector -// Store 1-bit per value. -type BitVector struct { - FieldStorage Vector[*uint32] -} - -func (self BitVector) handle() (result *C.ImBitVector, releaseFn func()) { - result = new(C.ImBitVector) - FieldStorage := self.FieldStorage - FieldStorageData := FieldStorage.Data - FieldStorageDataArg, FieldStorageDataFin := WrapNumberPtr[C.ImU32, uint32](FieldStorageData) - FieldStorageVecArg := new(C.ImVector_ImU32) - FieldStorageVecArg.Size = C.int(FieldStorage.Size) - FieldStorageVecArg.Capacity = C.int(FieldStorage.Capacity) - FieldStorageVecArg.Data = FieldStorageDataArg - FieldStorage.pinner.Pin(FieldStorageVecArg.Data) - - result.Storage = *FieldStorageVecArg - releaseFn = func() { - FieldStorageDataFin() - FieldStorage.pinner.Unpin() - } - return result, releaseFn -} - -func (self BitVector) c() (result C.ImBitVector, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newBitVectorFromC(cvalue *C.ImBitVector) *BitVector { - result := new(BitVector) - result.FieldStorage = newVectorFromC(cvalue.Storage.Size, cvalue.Storage.Capacity, (*uint32)(cvalue.Storage.Data)) - return result -} - -// [Internal] For use by ImDrawListSplitter -type DrawChannel struct { - FieldCmdBuffer Vector[*DrawCmd] - FieldIdxBuffer Vector[*DrawIdx] -} - -func (self DrawChannel) handle() (result *C.ImDrawChannel, releaseFn func()) { - result = new(C.ImDrawChannel) - FieldCmdBuffer := self.FieldCmdBuffer - FieldCmdBufferData := FieldCmdBuffer.Data - FieldCmdBufferDataArg, FieldCmdBufferDataFin := FieldCmdBufferData.handle() - FieldCmdBufferVecArg := new(C.ImVector_ImDrawCmd) - FieldCmdBufferVecArg.Size = C.int(FieldCmdBuffer.Size) - FieldCmdBufferVecArg.Capacity = C.int(FieldCmdBuffer.Capacity) - FieldCmdBufferVecArg.Data = FieldCmdBufferDataArg - FieldCmdBuffer.pinner.Pin(FieldCmdBufferVecArg.Data) - - result._CmdBuffer = *FieldCmdBufferVecArg - FieldIdxBuffer := self.FieldIdxBuffer - FieldIdxBufferData := FieldIdxBuffer.Data - FieldIdxBufferDataArg, FieldIdxBufferDataFin := WrapNumberPtr[C.ImDrawIdx, DrawIdx](FieldIdxBufferData) - FieldIdxBufferVecArg := new(C.ImVector_ImDrawIdx) - FieldIdxBufferVecArg.Size = C.int(FieldIdxBuffer.Size) - FieldIdxBufferVecArg.Capacity = C.int(FieldIdxBuffer.Capacity) - FieldIdxBufferVecArg.Data = FieldIdxBufferDataArg - FieldIdxBuffer.pinner.Pin(FieldIdxBufferVecArg.Data) - - result._IdxBuffer = *FieldIdxBufferVecArg - releaseFn = func() { - FieldCmdBufferDataFin() - FieldCmdBuffer.pinner.Unpin() - FieldIdxBufferDataFin() - FieldIdxBuffer.pinner.Unpin() - } - return result, releaseFn -} - -func (self DrawChannel) c() (result C.ImDrawChannel, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newDrawChannelFromC(cvalue *C.ImDrawChannel) *DrawChannel { - result := new(DrawChannel) - result.FieldCmdBuffer = newVectorFromC(cvalue._CmdBuffer.Size, cvalue._CmdBuffer.Capacity, newDrawCmdFromC(cvalue._CmdBuffer.Data)) - result.FieldIdxBuffer = newVectorFromC(cvalue._IdxBuffer.Size, cvalue._IdxBuffer.Capacity, (*DrawIdx)(cvalue._IdxBuffer.Data)) - return result -} - -// Typically, 1 command = 1 GPU draw call (unless command is a callback) -// - VtxOffset: When 'io.BackendFlags & ImGuiBackendFlags_RendererHasVtxOffset' is enabled, -// this fields allow us to render meshes larger than 64K vertices while keeping 16-bit indices. -// Backends made for <1.71. will typically ignore the VtxOffset fields. -// - The ClipRect/TextureId/VtxOffset fields must be contiguous as we memcmp() them together (this is asserted for). -type DrawCmd struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self DrawCmd) handle() (result *C.ImDrawCmd, releaseFn func()) { - result = (*C.ImDrawCmd)(self.data) - return result, func() {} -} - -func (self DrawCmd) c() (result C.ImDrawCmd, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newDrawCmdFromC(cvalue *C.ImDrawCmd) *DrawCmd { - result := new(DrawCmd) - result.data = unsafe.Pointer(cvalue) - return result -} - -// [Internal] For use by ImDrawList -type DrawCmdHeader struct { - FieldClipRect Vec4 - FieldTextureId TextureID - FieldVtxOffset uint32 -} - -func (self DrawCmdHeader) handle() (result *C.ImDrawCmdHeader, releaseFn func()) { - result = new(C.ImDrawCmdHeader) - FieldClipRect := self.FieldClipRect - - result.ClipRect = FieldClipRect.toC() - FieldTextureId := self.FieldTextureId - - result.TextureId = C.ImTextureID(FieldTextureId) - FieldVtxOffset := self.FieldVtxOffset - - result.VtxOffset = C.uint(FieldVtxOffset) - releaseFn = func() { - } - return result, releaseFn -} - -func (self DrawCmdHeader) c() (result C.ImDrawCmdHeader, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newDrawCmdHeaderFromC(cvalue *C.ImDrawCmdHeader) *DrawCmdHeader { - result := new(DrawCmdHeader) - result.FieldClipRect = *(&Vec4{}).fromC(cvalue.ClipRect) - result.FieldTextureId = TextureID(cvalue.TextureId) - result.FieldVtxOffset = uint32(cvalue.VtxOffset) - return result -} - -// All draw data to render a Dear ImGui frame -// (NB: the style and the naming convention here is a little inconsistent, we currently preserve them for backward compatibility purpose, -// as this is one of the oldest structure exposed by the library! Basically, ImDrawList == CmdList) -type DrawData struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self DrawData) handle() (result *C.ImDrawData, releaseFn func()) { - result = (*C.ImDrawData)(self.data) - return result, func() {} -} - -func (self DrawData) c() (result C.ImDrawData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newDrawDataFromC(cvalue *C.ImDrawData) *DrawData { - result := new(DrawData) - result.data = unsafe.Pointer(cvalue) - return result -} - -type DrawDataBuilder struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self DrawDataBuilder) handle() (result *C.ImDrawDataBuilder, releaseFn func()) { - result = (*C.ImDrawDataBuilder)(self.data) - return result, func() {} -} - -func (self DrawDataBuilder) c() (result C.ImDrawDataBuilder, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newDrawDataBuilderFromC(cvalue *C.ImDrawDataBuilder) *DrawDataBuilder { - result := new(DrawDataBuilder) - result.data = unsafe.Pointer(cvalue) - return result -} - -// Draw command list -// This is the low-level list of polygons that ImGui:: functions are filling. At the end of the frame, -// all command lists are passed to your ImGuiIO::RenderDrawListFn function for rendering. -// Each dear imgui window contains its own ImDrawList. You can use ImGui::GetWindowDrawList() to -// access the current window draw list and draw custom primitives. -// You can interleave normal ImGui:: calls and adding primitives to the current draw list. -// In single viewport mode, top-left is == GetMainViewport()->Pos (generally 0,0), bottom-right is == GetMainViewport()->Pos+Size (generally io.DisplaySize). -// You are totally free to apply whatever transformation matrix to want to the data (depending on the use of the transformation you may want to apply it to ClipRect as well!) -// Important: Primitives are always added to the list and not culled (culling is done at higher-level by ImGui:: functions), if you use this API a lot consider coarse culling your drawn objects. -type DrawList struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self DrawList) handle() (result *C.ImDrawList, releaseFn func()) { - result = (*C.ImDrawList)(self.data) - return result, func() {} -} - -func (self DrawList) c() (result C.ImDrawList, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newDrawListFromC(cvalue *C.ImDrawList) *DrawList { - result := new(DrawList) - result.data = unsafe.Pointer(cvalue) - return result -} - -// Data shared between all ImDrawList instances -// You may want to create your own instance of this if you want to use ImDrawList completely without ImGui. In that case, watch out for future changes to this structure. -type DrawListSharedData struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self DrawListSharedData) handle() (result *C.ImDrawListSharedData, releaseFn func()) { - result = (*C.ImDrawListSharedData)(self.data) - return result, func() {} -} - -func (self DrawListSharedData) c() (result C.ImDrawListSharedData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newDrawListSharedDataFromC(cvalue *C.ImDrawListSharedData) *DrawListSharedData { - result := new(DrawListSharedData) - result.data = unsafe.Pointer(cvalue) - return result -} - -// Split/Merge functions are used to split the draw list into different layers which can be drawn into out of order. -// This is used by the Columns/Tables API, so items of each column can be batched together in a same draw call. -type DrawListSplitter struct { - FieldCurrent int32 // Current channel number (0) - FieldCount int32 // Number of active channels (1+) - FieldChannels Vector[*DrawChannel] // Draw channels (not resized down so _Count might be < Channels.Size) -} - -func (self DrawListSplitter) handle() (result *C.ImDrawListSplitter, releaseFn func()) { - result = new(C.ImDrawListSplitter) - FieldCurrent := self.FieldCurrent - - result._Current = C.int(FieldCurrent) - FieldCount := self.FieldCount - - result._Count = C.int(FieldCount) - FieldChannels := self.FieldChannels - FieldChannelsData := FieldChannels.Data - FieldChannelsDataArg, FieldChannelsDataFin := FieldChannelsData.handle() - FieldChannelsVecArg := new(C.ImVector_ImDrawChannel) - FieldChannelsVecArg.Size = C.int(FieldChannels.Size) - FieldChannelsVecArg.Capacity = C.int(FieldChannels.Capacity) - FieldChannelsVecArg.Data = FieldChannelsDataArg - FieldChannels.pinner.Pin(FieldChannelsVecArg.Data) - - result._Channels = *FieldChannelsVecArg - releaseFn = func() { - FieldChannelsDataFin() - FieldChannels.pinner.Unpin() - } - return result, releaseFn -} - -func (self DrawListSplitter) c() (result C.ImDrawListSplitter, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newDrawListSplitterFromC(cvalue *C.ImDrawListSplitter) *DrawListSplitter { - result := new(DrawListSplitter) - result.FieldCurrent = int32(cvalue._Current) - result.FieldCount = int32(cvalue._Count) - result.FieldChannels = newVectorFromC(cvalue._Channels.Size, cvalue._Channels.Capacity, newDrawChannelFromC(cvalue._Channels.Data)) - return result -} - -type DrawVert struct { - FieldPos Vec2 - FieldUv Vec2 - FieldCol uint32 -} - -func (self DrawVert) handle() (result *C.ImDrawVert, releaseFn func()) { - result = new(C.ImDrawVert) - FieldPos := self.FieldPos - - result.pos = FieldPos.toC() - FieldUv := self.FieldUv - - result.uv = FieldUv.toC() - FieldCol := self.FieldCol - - result.col = C.ImU32(FieldCol) - releaseFn = func() { - } - return result, releaseFn -} - -func (self DrawVert) c() (result C.ImDrawVert, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newDrawVertFromC(cvalue *C.ImDrawVert) *DrawVert { - result := new(DrawVert) - result.FieldPos = *(&Vec2{}).fromC(cvalue.pos) - result.FieldUv = *(&Vec2{}).fromC(cvalue.uv) - result.FieldCol = uint32(cvalue.col) - return result -} - -// Font runtime data and rendering -// ImFontAtlas automatically loads a default embedded font for you when you call GetTexDataAsAlpha8() or GetTexDataAsRGBA32(). -type Font struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self Font) handle() (result *C.ImFont, releaseFn func()) { - result = (*C.ImFont)(self.data) - return result, func() {} -} - -func (self Font) c() (result C.ImFont, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newFontFromC(cvalue *C.ImFont) *Font { - result := new(Font) - result.data = unsafe.Pointer(cvalue) - return result -} - -// Load and rasterize multiple TTF/OTF fonts into a same texture. The font atlas will build a single texture holding: -// - One or more fonts. -// - Custom graphics data needed to render the shapes needed by Dear ImGui. -// - Mouse cursor shapes for software cursor rendering (unless setting 'Flags |= ImFontAtlasFlags_NoMouseCursors' in the font atlas). -// -// It is the user-code responsibility to setup/build the atlas, then upload the pixel data into a texture accessible by your graphics api. -// - Optionally, call any of the AddFont*** functions. If you don't call any, the default font embedded in the code will be loaded for you. -// - Call GetTexDataAsAlpha8() or GetTexDataAsRGBA32() to build and retrieve pixels data. -// - Upload the pixels data into a texture within your graphics system (see imgui_impl_xxxx.cpp examples) -// - Call SetTexID(my_tex_id); and pass the pointer/identifier to your texture in a format natural to your graphics API. -// This value will be passed back to you during rendering to identify the texture. Read FAQ entry about ImTextureID for more details. -// -// Common pitfalls: -// - If you pass a 'glyph_ranges' array to AddFont*** functions, you need to make sure that your array persist up until the -// atlas is build (when calling GetTexData*** or Build()). We only copy the pointer, not the data. -// - Important: By default, AddFontFromMemoryTTF() takes ownership of the data. Even though we are not writing to it, we will free the pointer on destruction. -// You can set font_cfg->FontDataOwnedByAtlas=false to keep ownership of your data and it won't be freed, -// - Even though many functions are suffixed with "TTF", OTF data is supported just as well. -// - This is an old API and it is currently awkward for those and various other reasons! We will address them in the future! -type FontAtlas struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self FontAtlas) handle() (result *C.ImFontAtlas, releaseFn func()) { - result = (*C.ImFontAtlas)(self.data) - return result, func() {} -} - -func (self FontAtlas) c() (result C.ImFontAtlas, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newFontAtlasFromC(cvalue *C.ImFontAtlas) *FontAtlas { - result := new(FontAtlas) - result.data = unsafe.Pointer(cvalue) - return result -} - -// See ImFontAtlas::AddCustomRectXXX functions. -type FontAtlasCustomRect struct { - FieldWidth uint16 // Input // Desired rectangle dimension - FieldHeight uint16 // Input // Desired rectangle dimension - FieldX uint16 // Output // Packed position in Atlas - FieldY uint16 // Output // Packed position in Atlas - FieldGlyphID uint32 // Input // For custom font glyphs only (ID < 0x110000) - FieldGlyphAdvanceX float32 // Input // For custom font glyphs only: glyph xadvance - FieldGlyphOffset Vec2 // Input // For custom font glyphs only: glyph display offset - FieldFont *Font // Input // For custom font glyphs only: target font -} - -func (self FontAtlasCustomRect) handle() (result *C.ImFontAtlasCustomRect, releaseFn func()) { - result = new(C.ImFontAtlasCustomRect) - FieldWidth := self.FieldWidth - - result.Width = C.ushort(FieldWidth) - FieldHeight := self.FieldHeight - - result.Height = C.ushort(FieldHeight) - FieldX := self.FieldX - - result.X = C.ushort(FieldX) - FieldY := self.FieldY - - result.Y = C.ushort(FieldY) - FieldGlyphID := self.FieldGlyphID - - result.GlyphID = C.uint(FieldGlyphID) - FieldGlyphAdvanceX := self.FieldGlyphAdvanceX - - result.GlyphAdvanceX = C.float(FieldGlyphAdvanceX) - FieldGlyphOffset := self.FieldGlyphOffset - - result.GlyphOffset = FieldGlyphOffset.toC() - FieldFont := self.FieldFont - FieldFontArg, FieldFontFin := FieldFont.handle() - result.Font = FieldFontArg - releaseFn = func() { - FieldFontFin() - } - return result, releaseFn -} - -func (self FontAtlasCustomRect) c() (result C.ImFontAtlasCustomRect, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newFontAtlasCustomRectFromC(cvalue *C.ImFontAtlasCustomRect) *FontAtlasCustomRect { - result := new(FontAtlasCustomRect) - result.FieldWidth = uint16(cvalue.Width) - result.FieldHeight = uint16(cvalue.Height) - result.FieldX = uint16(cvalue.X) - result.FieldY = uint16(cvalue.Y) - result.FieldGlyphID = uint32(cvalue.GlyphID) - result.FieldGlyphAdvanceX = float32(cvalue.GlyphAdvanceX) - result.FieldGlyphOffset = *(&Vec2{}).fromC(cvalue.GlyphOffset) - result.FieldFont = newFontFromC(cvalue.Font) - return result -} - -// This structure is likely to evolve as we add support for incremental atlas updates -type FontBuilderIO struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self FontBuilderIO) handle() (result *C.ImFontBuilderIO, releaseFn func()) { - result = (*C.ImFontBuilderIO)(self.data) - return result, func() {} -} - -func (self FontBuilderIO) c() (result C.ImFontBuilderIO, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newFontBuilderIOFromC(cvalue *C.ImFontBuilderIO) *FontBuilderIO { - result := new(FontBuilderIO) - result.data = unsafe.Pointer(cvalue) - return result -} - -type FontConfig struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self FontConfig) handle() (result *C.ImFontConfig, releaseFn func()) { - result = (*C.ImFontConfig)(self.data) - return result, func() {} -} - -func (self FontConfig) c() (result C.ImFontConfig, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newFontConfigFromC(cvalue *C.ImFontConfig) *FontConfig { - result := new(FontConfig) - result.data = unsafe.Pointer(cvalue) - return result -} - -// Hold rendering data for one glyph. -// (Note: some language parsers may fail to convert the 31+1 bitfield members, in this case maybe drop store a single u32 or we can rework this) -type FontGlyph struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self FontGlyph) handle() (result *C.ImFontGlyph, releaseFn func()) { - result = (*C.ImFontGlyph)(self.data) - return result, func() {} -} - -func (self FontGlyph) c() (result C.ImFontGlyph, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newFontGlyphFromC(cvalue *C.ImFontGlyph) *FontGlyph { - result := new(FontGlyph) - result.data = unsafe.Pointer(cvalue) - return result -} - -// Helper to build glyph ranges from text/string data. Feed your application strings/characters to it then call BuildRanges(). -// This is essentially a tightly packed of vector of 64k booleans = 8KB storage. -type FontGlyphRangesBuilder struct { - FieldUsedChars Vector[*uint32] // Store 1-bit per Unicode code point (0=unused, 1=used) -} - -func (self FontGlyphRangesBuilder) handle() (result *C.ImFontGlyphRangesBuilder, releaseFn func()) { - result = new(C.ImFontGlyphRangesBuilder) - FieldUsedChars := self.FieldUsedChars - FieldUsedCharsData := FieldUsedChars.Data - FieldUsedCharsDataArg, FieldUsedCharsDataFin := WrapNumberPtr[C.ImU32, uint32](FieldUsedCharsData) - FieldUsedCharsVecArg := new(C.ImVector_ImU32) - FieldUsedCharsVecArg.Size = C.int(FieldUsedChars.Size) - FieldUsedCharsVecArg.Capacity = C.int(FieldUsedChars.Capacity) - FieldUsedCharsVecArg.Data = FieldUsedCharsDataArg - FieldUsedChars.pinner.Pin(FieldUsedCharsVecArg.Data) - - result.UsedChars = *FieldUsedCharsVecArg - releaseFn = func() { - FieldUsedCharsDataFin() - FieldUsedChars.pinner.Unpin() - } - return result, releaseFn -} - -func (self FontGlyphRangesBuilder) c() (result C.ImFontGlyphRangesBuilder, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newFontGlyphRangesBuilderFromC(cvalue *C.ImFontGlyphRangesBuilder) *FontGlyphRangesBuilder { - result := new(FontGlyphRangesBuilder) - result.FieldUsedChars = newVectorFromC(cvalue.UsedChars.Size, cvalue.UsedChars.Capacity, (*uint32)(cvalue.UsedChars.Data)) - return result -} - -// Stacked color modifier, backup of modified data so we can restore it -type ColorMod struct { - FieldCol Col - FieldBackupValue Vec4 -} - -func (self ColorMod) handle() (result *C.ImGuiColorMod, releaseFn func()) { - result = new(C.ImGuiColorMod) - FieldCol := self.FieldCol - - result.Col = C.ImGuiCol(FieldCol) - FieldBackupValue := self.FieldBackupValue - - result.BackupValue = FieldBackupValue.toC() - releaseFn = func() { - } - return result, releaseFn -} - -func (self ColorMod) c() (result C.ImGuiColorMod, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newColorModFromC(cvalue *C.ImGuiColorMod) *ColorMod { - result := new(ColorMod) - result.FieldCol = Col(cvalue.Col) - result.FieldBackupValue = *(&Vec4{}).fromC(cvalue.BackupValue) - return result -} - -// Storage data for BeginComboPreview()/EndComboPreview() -type ComboPreviewData struct { - FieldPreviewRect Rect - FieldBackupCursorPos Vec2 - FieldBackupCursorMaxPos Vec2 - FieldBackupCursorPosPrevLine Vec2 - FieldBackupPrevLineTextBaseOffset float32 - FieldBackupLayout LayoutType -} - -func (self ComboPreviewData) handle() (result *C.ImGuiComboPreviewData, releaseFn func()) { - result = new(C.ImGuiComboPreviewData) - FieldPreviewRect := self.FieldPreviewRect - - result.PreviewRect = FieldPreviewRect.toC() - FieldBackupCursorPos := self.FieldBackupCursorPos - - result.BackupCursorPos = FieldBackupCursorPos.toC() - FieldBackupCursorMaxPos := self.FieldBackupCursorMaxPos - - result.BackupCursorMaxPos = FieldBackupCursorMaxPos.toC() - FieldBackupCursorPosPrevLine := self.FieldBackupCursorPosPrevLine - - result.BackupCursorPosPrevLine = FieldBackupCursorPosPrevLine.toC() - FieldBackupPrevLineTextBaseOffset := self.FieldBackupPrevLineTextBaseOffset - - result.BackupPrevLineTextBaseOffset = C.float(FieldBackupPrevLineTextBaseOffset) - FieldBackupLayout := self.FieldBackupLayout - - result.BackupLayout = C.ImGuiLayoutType(FieldBackupLayout) - releaseFn = func() { - } - return result, releaseFn -} - -func (self ComboPreviewData) c() (result C.ImGuiComboPreviewData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newComboPreviewDataFromC(cvalue *C.ImGuiComboPreviewData) *ComboPreviewData { - result := new(ComboPreviewData) - result.FieldPreviewRect = *(&Rect{}).fromC(cvalue.PreviewRect) - result.FieldBackupCursorPos = *(&Vec2{}).fromC(cvalue.BackupCursorPos) - result.FieldBackupCursorMaxPos = *(&Vec2{}).fromC(cvalue.BackupCursorMaxPos) - result.FieldBackupCursorPosPrevLine = *(&Vec2{}).fromC(cvalue.BackupCursorPosPrevLine) - result.FieldBackupPrevLineTextBaseOffset = float32(cvalue.BackupPrevLineTextBaseOffset) - result.FieldBackupLayout = LayoutType(cvalue.BackupLayout) - return result -} - -type Context struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self Context) handle() (result *C.ImGuiContext, releaseFn func()) { - result = (*C.ImGuiContext)(self.data) - return result, func() {} -} - -func (self Context) c() (result C.ImGuiContext, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newContextFromC(cvalue *C.ImGuiContext) *Context { - result := new(Context) - result.data = unsafe.Pointer(cvalue) - return result -} - -type ContextHook struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self ContextHook) handle() (result *C.ImGuiContextHook, releaseFn func()) { - result = (*C.ImGuiContextHook)(self.data) - return result, func() {} -} - -func (self ContextHook) c() (result C.ImGuiContextHook, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newContextHookFromC(cvalue *C.ImGuiContextHook) *ContextHook { - result := new(ContextHook) - result.data = unsafe.Pointer(cvalue) - return result -} - -// Type information associated to one ImGuiDataType. Retrieve with DataTypeGetInfo(). -type DataTypeInfo struct { - FieldSize uint64 // Size in bytes - FieldName string // Short descriptive name for the type, for debugging - FieldPrintFmt string // Default printf format for the type - FieldScanFmt string // Default scanf format for the type -} - -func (self DataTypeInfo) handle() (result *C.ImGuiDataTypeInfo, releaseFn func()) { - result = new(C.ImGuiDataTypeInfo) - FieldSize := self.FieldSize - - result.Size = C.xulong(FieldSize) - FieldName := self.FieldName - FieldNameArg, FieldNameFin := WrapString(FieldName) - result.Name = FieldNameArg - FieldPrintFmt := self.FieldPrintFmt - FieldPrintFmtArg, FieldPrintFmtFin := WrapString(FieldPrintFmt) - result.PrintFmt = FieldPrintFmtArg - FieldScanFmt := self.FieldScanFmt - FieldScanFmtArg, FieldScanFmtFin := WrapString(FieldScanFmt) - result.ScanFmt = FieldScanFmtArg - releaseFn = func() { - FieldNameFin() - FieldPrintFmtFin() - FieldScanFmtFin() - } - return result, releaseFn -} - -func (self DataTypeInfo) c() (result C.ImGuiDataTypeInfo, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newDataTypeInfoFromC(cvalue *C.ImGuiDataTypeInfo) *DataTypeInfo { - result := new(DataTypeInfo) - result.FieldSize = uint64(cvalue.Size) - result.FieldName = C.GoString(cvalue.Name) - result.FieldPrintFmt = C.GoString(cvalue.PrintFmt) - result.FieldScanFmt = C.GoString(cvalue.ScanFmt) - return result -} - -type DataTypeTempStorage struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self DataTypeTempStorage) handle() (result *C.ImGuiDataTypeTempStorage, releaseFn func()) { - result = (*C.ImGuiDataTypeTempStorage)(self.data) - return result, func() {} -} - -func (self DataTypeTempStorage) c() (result C.ImGuiDataTypeTempStorage, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newDataTypeTempStorageFromC(cvalue *C.ImGuiDataTypeTempStorage) *DataTypeTempStorage { - result := new(DataTypeTempStorage) - result.data = unsafe.Pointer(cvalue) - return result -} - -type DataVarInfo struct { - FieldType DataType - FieldCount uint32 // 1+ - FieldOffset uint32 // Offset in parent structure -} - -func (self DataVarInfo) handle() (result *C.ImGuiDataVarInfo, releaseFn func()) { - result = new(C.ImGuiDataVarInfo) - FieldType := self.FieldType - - result.Type = C.ImGuiDataType(FieldType) - FieldCount := self.FieldCount - - result.Count = C.ImU32(FieldCount) - FieldOffset := self.FieldOffset - - result.Offset = C.ImU32(FieldOffset) - releaseFn = func() { - } - return result, releaseFn -} - -func (self DataVarInfo) c() (result C.ImGuiDataVarInfo, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newDataVarInfoFromC(cvalue *C.ImGuiDataVarInfo) *DataVarInfo { - result := new(DataVarInfo) - result.FieldType = DataType(cvalue.Type) - result.FieldCount = uint32(cvalue.Count) - result.FieldOffset = uint32(cvalue.Offset) - return result -} - -type DockContext struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self DockContext) handle() (result *C.ImGuiDockContext, releaseFn func()) { - result = (*C.ImGuiDockContext)(self.data) - return result, func() {} -} - -func (self DockContext) c() (result C.ImGuiDockContext, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newDockContextFromC(cvalue *C.ImGuiDockContext) *DockContext { - result := new(DockContext) - result.data = unsafe.Pointer(cvalue) - return result -} - -// sizeof() 156~192 -type DockNode struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self DockNode) handle() (result *C.ImGuiDockNode, releaseFn func()) { - result = (*C.ImGuiDockNode)(self.data) - return result, func() {} -} - -func (self DockNode) c() (result C.ImGuiDockNode, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newDockNodeFromC(cvalue *C.ImGuiDockNode) *DockNode { - result := new(DockNode) - result.data = unsafe.Pointer(cvalue) - return result -} - -// Stacked storage data for BeginGroup()/EndGroup() -type GroupData struct { - FieldWindowID ID - FieldBackupCursorPos Vec2 - FieldBackupCursorMaxPos Vec2 - FieldBackupIndent Vec1 - FieldBackupGroupOffset Vec1 - FieldBackupCurrLineSize Vec2 - FieldBackupCurrLineTextBaseOffset float32 - FieldBackupActiveIdIsAlive ID - FieldBackupActiveIdPreviousFrameIsAlive bool - FieldBackupHoveredIdIsAlive bool - FieldEmitItem bool -} - -func (self GroupData) handle() (result *C.ImGuiGroupData, releaseFn func()) { - result = new(C.ImGuiGroupData) - FieldWindowID := self.FieldWindowID - - result.WindowID = C.ImGuiID(FieldWindowID) - FieldBackupCursorPos := self.FieldBackupCursorPos - - result.BackupCursorPos = FieldBackupCursorPos.toC() - FieldBackupCursorMaxPos := self.FieldBackupCursorMaxPos - - result.BackupCursorMaxPos = FieldBackupCursorMaxPos.toC() - FieldBackupIndent := self.FieldBackupIndent - FieldBackupIndentArg, FieldBackupIndentFin := FieldBackupIndent.c() - result.BackupIndent = FieldBackupIndentArg - FieldBackupGroupOffset := self.FieldBackupGroupOffset - FieldBackupGroupOffsetArg, FieldBackupGroupOffsetFin := FieldBackupGroupOffset.c() - result.BackupGroupOffset = FieldBackupGroupOffsetArg - FieldBackupCurrLineSize := self.FieldBackupCurrLineSize - - result.BackupCurrLineSize = FieldBackupCurrLineSize.toC() - FieldBackupCurrLineTextBaseOffset := self.FieldBackupCurrLineTextBaseOffset - - result.BackupCurrLineTextBaseOffset = C.float(FieldBackupCurrLineTextBaseOffset) - FieldBackupActiveIdIsAlive := self.FieldBackupActiveIdIsAlive - - result.BackupActiveIdIsAlive = C.ImGuiID(FieldBackupActiveIdIsAlive) - FieldBackupActiveIdPreviousFrameIsAlive := self.FieldBackupActiveIdPreviousFrameIsAlive - - result.BackupActiveIdPreviousFrameIsAlive = C.bool(FieldBackupActiveIdPreviousFrameIsAlive) - FieldBackupHoveredIdIsAlive := self.FieldBackupHoveredIdIsAlive - - result.BackupHoveredIdIsAlive = C.bool(FieldBackupHoveredIdIsAlive) - FieldEmitItem := self.FieldEmitItem - - result.EmitItem = C.bool(FieldEmitItem) - releaseFn = func() { - FieldBackupIndentFin() - FieldBackupGroupOffsetFin() - } - return result, releaseFn -} - -func (self GroupData) c() (result C.ImGuiGroupData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newGroupDataFromC(cvalue *C.ImGuiGroupData) *GroupData { - result := new(GroupData) - result.FieldWindowID = ID(cvalue.WindowID) - result.FieldBackupCursorPos = *(&Vec2{}).fromC(cvalue.BackupCursorPos) - result.FieldBackupCursorMaxPos = *(&Vec2{}).fromC(cvalue.BackupCursorMaxPos) - result.FieldBackupIndent = *newVec1FromC(func() *C.ImVec1 { result := cvalue.BackupIndent; return &result }()) - - result.FieldBackupGroupOffset = *newVec1FromC(func() *C.ImVec1 { result := cvalue.BackupGroupOffset; return &result }()) - - result.FieldBackupCurrLineSize = *(&Vec2{}).fromC(cvalue.BackupCurrLineSize) - result.FieldBackupCurrLineTextBaseOffset = float32(cvalue.BackupCurrLineTextBaseOffset) - result.FieldBackupActiveIdIsAlive = ID(cvalue.BackupActiveIdIsAlive) - result.FieldBackupActiveIdPreviousFrameIsAlive = cvalue.BackupActiveIdPreviousFrameIsAlive == C.bool(true) - result.FieldBackupHoveredIdIsAlive = cvalue.BackupHoveredIdIsAlive == C.bool(true) - result.FieldEmitItem = cvalue.EmitItem == C.bool(true) - return result -} - -type IO struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self IO) handle() (result *C.ImGuiIO, releaseFn func()) { - result = (*C.ImGuiIO)(self.data) - return result, func() {} -} - -func (self IO) c() (result C.ImGuiIO, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newIOFromC(cvalue *C.ImGuiIO) *IO { - result := new(IO) - result.data = unsafe.Pointer(cvalue) - return result -} - -type InputEvent struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self InputEvent) handle() (result *C.ImGuiInputEvent, releaseFn func()) { - result = (*C.ImGuiInputEvent)(self.data) - return result, func() {} -} - -func (self InputEvent) c() (result C.ImGuiInputEvent, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newInputEventFromC(cvalue *C.ImGuiInputEvent) *InputEvent { - result := new(InputEvent) - result.data = unsafe.Pointer(cvalue) - return result -} - -type InputEventAppFocused struct { - FieldFocused bool -} - -func (self InputEventAppFocused) handle() (result *C.ImGuiInputEventAppFocused, releaseFn func()) { - result = new(C.ImGuiInputEventAppFocused) - FieldFocused := self.FieldFocused - - result.Focused = C.bool(FieldFocused) - releaseFn = func() { - } - return result, releaseFn -} - -func (self InputEventAppFocused) c() (result C.ImGuiInputEventAppFocused, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newInputEventAppFocusedFromC(cvalue *C.ImGuiInputEventAppFocused) *InputEventAppFocused { - result := new(InputEventAppFocused) - result.FieldFocused = cvalue.Focused == C.bool(true) - return result -} - -type InputEventKey struct { - FieldKey Key - FieldDown bool - FieldAnalogValue float32 -} - -func (self InputEventKey) handle() (result *C.ImGuiInputEventKey, releaseFn func()) { - result = new(C.ImGuiInputEventKey) - FieldKey := self.FieldKey - - result.Key = C.ImGuiKey(FieldKey) - FieldDown := self.FieldDown - - result.Down = C.bool(FieldDown) - FieldAnalogValue := self.FieldAnalogValue - - result.AnalogValue = C.float(FieldAnalogValue) - releaseFn = func() { - } - return result, releaseFn -} - -func (self InputEventKey) c() (result C.ImGuiInputEventKey, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newInputEventKeyFromC(cvalue *C.ImGuiInputEventKey) *InputEventKey { - result := new(InputEventKey) - result.FieldKey = Key(cvalue.Key) - result.FieldDown = cvalue.Down == C.bool(true) - result.FieldAnalogValue = float32(cvalue.AnalogValue) - return result -} - -type InputEventMouseButton struct { - FieldButton int32 - FieldDown bool - FieldMouseSource MouseSource -} - -func (self InputEventMouseButton) handle() (result *C.ImGuiInputEventMouseButton, releaseFn func()) { - result = new(C.ImGuiInputEventMouseButton) - FieldButton := self.FieldButton - - result.Button = C.int(FieldButton) - FieldDown := self.FieldDown - - result.Down = C.bool(FieldDown) - FieldMouseSource := self.FieldMouseSource - - result.MouseSource = C.ImGuiMouseSource(FieldMouseSource) - releaseFn = func() { - } - return result, releaseFn -} - -func (self InputEventMouseButton) c() (result C.ImGuiInputEventMouseButton, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newInputEventMouseButtonFromC(cvalue *C.ImGuiInputEventMouseButton) *InputEventMouseButton { - result := new(InputEventMouseButton) - result.FieldButton = int32(cvalue.Button) - result.FieldDown = cvalue.Down == C.bool(true) - result.FieldMouseSource = MouseSource(cvalue.MouseSource) - return result -} - -// FIXME: Structures in the union below need to be declared as anonymous unions appears to be an extension? -// Using ImVec2() would fail on Clang 'union member 'MousePos' has a non-trivial default constructor' -type InputEventMousePos struct { - FieldPosX float32 - FieldPosY float32 - FieldMouseSource MouseSource -} - -func (self InputEventMousePos) handle() (result *C.ImGuiInputEventMousePos, releaseFn func()) { - result = new(C.ImGuiInputEventMousePos) - FieldPosX := self.FieldPosX - - result.PosX = C.float(FieldPosX) - FieldPosY := self.FieldPosY - - result.PosY = C.float(FieldPosY) - FieldMouseSource := self.FieldMouseSource - - result.MouseSource = C.ImGuiMouseSource(FieldMouseSource) - releaseFn = func() { - } - return result, releaseFn -} - -func (self InputEventMousePos) c() (result C.ImGuiInputEventMousePos, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newInputEventMousePosFromC(cvalue *C.ImGuiInputEventMousePos) *InputEventMousePos { - result := new(InputEventMousePos) - result.FieldPosX = float32(cvalue.PosX) - result.FieldPosY = float32(cvalue.PosY) - result.FieldMouseSource = MouseSource(cvalue.MouseSource) - return result -} - -type InputEventMouseViewport struct { - FieldHoveredViewportID ID -} - -func (self InputEventMouseViewport) handle() (result *C.ImGuiInputEventMouseViewport, releaseFn func()) { - result = new(C.ImGuiInputEventMouseViewport) - FieldHoveredViewportID := self.FieldHoveredViewportID - - result.HoveredViewportID = C.ImGuiID(FieldHoveredViewportID) - releaseFn = func() { - } - return result, releaseFn -} - -func (self InputEventMouseViewport) c() (result C.ImGuiInputEventMouseViewport, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newInputEventMouseViewportFromC(cvalue *C.ImGuiInputEventMouseViewport) *InputEventMouseViewport { - result := new(InputEventMouseViewport) - result.FieldHoveredViewportID = ID(cvalue.HoveredViewportID) - return result -} - -type InputEventMouseWheel struct { - FieldWheelX float32 - FieldWheelY float32 - FieldMouseSource MouseSource -} - -func (self InputEventMouseWheel) handle() (result *C.ImGuiInputEventMouseWheel, releaseFn func()) { - result = new(C.ImGuiInputEventMouseWheel) - FieldWheelX := self.FieldWheelX - - result.WheelX = C.float(FieldWheelX) - FieldWheelY := self.FieldWheelY - - result.WheelY = C.float(FieldWheelY) - FieldMouseSource := self.FieldMouseSource - - result.MouseSource = C.ImGuiMouseSource(FieldMouseSource) - releaseFn = func() { - } - return result, releaseFn -} - -func (self InputEventMouseWheel) c() (result C.ImGuiInputEventMouseWheel, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newInputEventMouseWheelFromC(cvalue *C.ImGuiInputEventMouseWheel) *InputEventMouseWheel { - result := new(InputEventMouseWheel) - result.FieldWheelX = float32(cvalue.WheelX) - result.FieldWheelY = float32(cvalue.WheelY) - result.FieldMouseSource = MouseSource(cvalue.MouseSource) - return result -} - -type InputEventText struct { - FieldChar uint32 -} - -func (self InputEventText) handle() (result *C.ImGuiInputEventText, releaseFn func()) { - result = new(C.ImGuiInputEventText) - FieldChar := self.FieldChar - - result.Char = C.uint(FieldChar) - releaseFn = func() { - } - return result, releaseFn -} - -func (self InputEventText) c() (result C.ImGuiInputEventText, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newInputEventTextFromC(cvalue *C.ImGuiInputEventText) *InputEventText { - result := new(InputEventText) - result.FieldChar = uint32(cvalue.Char) - return result -} - -// Shared state of InputText(), passed as an argument to your callback when a ImGuiInputTextFlags_Callback* flag is used. -// The callback function should return 0 by default. -// Callbacks (follow a flag name and see comments in ImGuiInputTextFlags_ declarations for more details) -// - ImGuiInputTextFlags_CallbackEdit: Callback on buffer edit (note that InputText() already returns true on edit, the callback is useful mainly to manipulate the underlying buffer while focus is active) -// - ImGuiInputTextFlags_CallbackAlways: Callback on each iteration -// - ImGuiInputTextFlags_CallbackCompletion: Callback on pressing TAB -// - ImGuiInputTextFlags_CallbackHistory: Callback on pressing Up/Down arrows -// - ImGuiInputTextFlags_CallbackCharFilter: Callback on character inputs to replace or discard them. Modify 'EventChar' to replace or discard, or return 1 in callback to discard. -// - ImGuiInputTextFlags_CallbackResize: Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. -type InputTextCallbackData struct { - FieldCtx *Context // Parent UI context - FieldEventFlag InputTextFlags // One ImGuiInputTextFlags_Callback* // Read-only - FieldFlags InputTextFlags // What user passed to InputText() // Read-only - FieldUserData unsafe.Pointer // What user passed to InputText() // Read-only - // Arguments for the different callback events - // - To modify the text buffer in a callback, prefer using the InsertChars() / DeleteChars() function. InsertChars() will take care of calling the resize callback if necessary. - // - If you know your edits are not going to resize the underlying buffer allocation, you may modify the contents of 'Buf[]' directly. You need to update 'BufTextLen' accordingly (0 <= BufTextLen < BufSize) and set 'BufDirty'' to true so InputText can update its internal state. - FieldEventChar Wchar // Character input // Read-write // [CharFilter] Replace character with another one, or set to zero to drop. return 1 is equivalent to setting EventChar=0; - FieldEventKey Key // Key pressed (Up/Down/TAB) // Read-only // [Completion,History] - FieldBuf string // Text buffer // Read-write // [Resize] Can replace pointer / [Completion,History,Always] Only write to pointed data, don't replace the actual pointer! - FieldBufTextLen int32 // 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() - FieldBufSize int32 // Buffer size (in bytes) = capacity+1 // Read-only // [Resize,Completion,History,Always] Include zero-terminator storage. In C land == ARRAYSIZE(my_char_array), in C++ land: string.capacity()+1 - FieldBufDirty bool // Set if you modify Buf/BufTextLen! // Write // [Completion,History,Always] - FieldCursorPos int32 // // Read-write // [Completion,History,Always] - FieldSelectionStart int32 // // Read-write // [Completion,History,Always] == to SelectionEnd when no selection) - FieldSelectionEnd int32 // // Read-write // [Completion,History,Always] -} - -func (self InputTextCallbackData) handle() (result *C.ImGuiInputTextCallbackData, releaseFn func()) { - result = new(C.ImGuiInputTextCallbackData) - FieldCtx := self.FieldCtx - FieldCtxArg, FieldCtxFin := FieldCtx.handle() - result.Ctx = FieldCtxArg - FieldEventFlag := self.FieldEventFlag - - result.EventFlag = C.ImGuiInputTextFlags(FieldEventFlag) - FieldFlags := self.FieldFlags - - result.Flags = C.ImGuiInputTextFlags(FieldFlags) - FieldUserData := self.FieldUserData - FieldUserDataArg, FieldUserDataFin := WrapVoidPtr(FieldUserData) - result.UserData = FieldUserDataArg - FieldEventChar := self.FieldEventChar - - result.EventChar = C.ImWchar(FieldEventChar) - FieldEventKey := self.FieldEventKey - - result.EventKey = C.ImGuiKey(FieldEventKey) - FieldBuf := self.FieldBuf - FieldBufArg, FieldBufFin := WrapString(FieldBuf) - result.Buf = FieldBufArg - FieldBufTextLen := self.FieldBufTextLen - - result.BufTextLen = C.int(FieldBufTextLen) - FieldBufSize := self.FieldBufSize - - result.BufSize = C.int(FieldBufSize) - FieldBufDirty := self.FieldBufDirty - - result.BufDirty = C.bool(FieldBufDirty) - FieldCursorPos := self.FieldCursorPos - - result.CursorPos = C.int(FieldCursorPos) - FieldSelectionStart := self.FieldSelectionStart - - result.SelectionStart = C.int(FieldSelectionStart) - FieldSelectionEnd := self.FieldSelectionEnd - - result.SelectionEnd = C.int(FieldSelectionEnd) - releaseFn = func() { - FieldCtxFin() - - FieldUserDataFin() - - FieldBufFin() - } - return result, releaseFn -} - -func (self InputTextCallbackData) c() (result C.ImGuiInputTextCallbackData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newInputTextCallbackDataFromC(cvalue *C.ImGuiInputTextCallbackData) *InputTextCallbackData { - result := new(InputTextCallbackData) - result.FieldCtx = newContextFromC(cvalue.Ctx) - result.FieldEventFlag = InputTextFlags(cvalue.EventFlag) - result.FieldFlags = InputTextFlags(cvalue.Flags) - result.FieldUserData = unsafe.Pointer(cvalue.UserData) - result.FieldEventChar = Wchar(cvalue.EventChar) - result.FieldEventKey = Key(cvalue.EventKey) - result.FieldBuf = C.GoString(cvalue.Buf) - result.FieldBufTextLen = int32(cvalue.BufTextLen) - result.FieldBufSize = int32(cvalue.BufSize) - result.FieldBufDirty = cvalue.BufDirty == C.bool(true) - result.FieldCursorPos = int32(cvalue.CursorPos) - result.FieldSelectionStart = int32(cvalue.SelectionStart) - result.FieldSelectionEnd = int32(cvalue.SelectionEnd) - return result -} - -// Internal temporary state for deactivating InputText() instances. -type InputTextDeactivatedState struct { - FieldID ID // widget id owning the text state (which just got deactivated) - FieldTextA Vector[string] // text buffer -} - -func (self InputTextDeactivatedState) handle() (result *C.ImGuiInputTextDeactivatedState, releaseFn func()) { - result = new(C.ImGuiInputTextDeactivatedState) - FieldID := self.FieldID - - result.ID = C.ImGuiID(FieldID) - FieldTextA := self.FieldTextA - FieldTextAData := FieldTextA.Data - FieldTextADataArg, FieldTextADataFin := WrapString(FieldTextAData) - FieldTextAVecArg := new(C.ImVector_char) - FieldTextAVecArg.Size = C.int(FieldTextA.Size) - FieldTextAVecArg.Capacity = C.int(FieldTextA.Capacity) - FieldTextAVecArg.Data = FieldTextADataArg - FieldTextA.pinner.Pin(FieldTextAVecArg.Data) - - result.TextA = *FieldTextAVecArg - releaseFn = func() { - FieldTextADataFin() - FieldTextA.pinner.Unpin() - } - return result, releaseFn -} - -func (self InputTextDeactivatedState) c() (result C.ImGuiInputTextDeactivatedState, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newInputTextDeactivatedStateFromC(cvalue *C.ImGuiInputTextDeactivatedState) *InputTextDeactivatedState { - result := new(InputTextDeactivatedState) - result.FieldID = ID(cvalue.ID) - result.FieldTextA = newVectorFromC(cvalue.TextA.Size, cvalue.TextA.Capacity, C.GoString(cvalue.TextA.Data)) - return result -} - -// Internal state of the currently focused/edited text input box -// For a given item ID, access with ImGui::GetInputTextState() -type InputTextState struct { - FieldCtx *Context // parent UI context (needs to be set explicitly by parent). - FieldID ID // widget id owning the text state - FieldCurLenW int32 // we need to maintain our buffer length in both UTF-8 and wchar format. UTF-8 length is valid even if TextA is not. - FieldCurLenA int32 // we need to maintain our buffer length in both UTF-8 and wchar format. UTF-8 length is valid even if TextA is not. - FieldTextW Vector[(*Wchar)] // edit buffer, we need to persist but can't guarantee the persistence of the user-provided buffer. so we copy into own buffer. - FieldTextA Vector[string] // temporary UTF8 buffer for callbacks and other operations. this is not updated in every code-path! size=capacity. - FieldInitialTextA Vector[string] // backup of end-user buffer at the time of focus (in UTF-8, unaltered) - FieldTextAIsValid bool // temporary UTF8 buffer is not initially valid before we make the widget active (until then we pull the data from user argument) - FieldBufCapacityA int32 // end-user buffer capacity - FieldScrollX float32 // horizontal scrolling/offset - FieldStb STBTexteditState // state for stb_textedit.h - FieldCursorAnim float32 // timer for cursor blink, reset on every user action so the cursor reappears immediately - FieldCursorFollow bool // set when we want scrolling to follow the current cursor position (not always!) - FieldSelectedAllMouseLock bool // after a double-click to select all, we ignore further mouse drags to update selection - FieldEdited bool // edited this frame - FieldFlags InputTextFlags // copy of InputText() flags. may be used to check if e.g. ImGuiInputTextFlags_Password is set. -} - -func (self InputTextState) handle() (result *C.ImGuiInputTextState, releaseFn func()) { - result = new(C.ImGuiInputTextState) - FieldCtx := self.FieldCtx - FieldCtxArg, FieldCtxFin := FieldCtx.handle() - result.Ctx = FieldCtxArg - FieldID := self.FieldID - - result.ID = C.ImGuiID(FieldID) - FieldCurLenW := self.FieldCurLenW - - result.CurLenW = C.int(FieldCurLenW) - FieldCurLenA := self.FieldCurLenA - - result.CurLenA = C.int(FieldCurLenA) - FieldTextW := self.FieldTextW - FieldTextWData := FieldTextW.Data - - FieldTextWVecArg := new(C.ImVector_ImWchar) - FieldTextWVecArg.Size = C.int(FieldTextW.Size) - FieldTextWVecArg.Capacity = C.int(FieldTextW.Capacity) - FieldTextWVecArg.Data = (*C.ImWchar)(FieldTextWData) - FieldTextW.pinner.Pin(FieldTextWVecArg.Data) - - result.TextW = *FieldTextWVecArg - FieldTextA := self.FieldTextA - FieldTextAData := FieldTextA.Data - FieldTextADataArg, FieldTextADataFin := WrapString(FieldTextAData) - FieldTextAVecArg := new(C.ImVector_char) - FieldTextAVecArg.Size = C.int(FieldTextA.Size) - FieldTextAVecArg.Capacity = C.int(FieldTextA.Capacity) - FieldTextAVecArg.Data = FieldTextADataArg - FieldTextA.pinner.Pin(FieldTextAVecArg.Data) - - result.TextA = *FieldTextAVecArg - FieldInitialTextA := self.FieldInitialTextA - FieldInitialTextAData := FieldInitialTextA.Data - FieldInitialTextADataArg, FieldInitialTextADataFin := WrapString(FieldInitialTextAData) - FieldInitialTextAVecArg := new(C.ImVector_char) - FieldInitialTextAVecArg.Size = C.int(FieldInitialTextA.Size) - FieldInitialTextAVecArg.Capacity = C.int(FieldInitialTextA.Capacity) - FieldInitialTextAVecArg.Data = FieldInitialTextADataArg - FieldInitialTextA.pinner.Pin(FieldInitialTextAVecArg.Data) - - result.InitialTextA = *FieldInitialTextAVecArg - FieldTextAIsValid := self.FieldTextAIsValid - - result.TextAIsValid = C.bool(FieldTextAIsValid) - FieldBufCapacityA := self.FieldBufCapacityA - - result.BufCapacityA = C.int(FieldBufCapacityA) - FieldScrollX := self.FieldScrollX - - result.ScrollX = C.float(FieldScrollX) - FieldStb := self.FieldStb - FieldStbArg, FieldStbFin := FieldStb.c() - result.Stb = FieldStbArg - FieldCursorAnim := self.FieldCursorAnim - - result.CursorAnim = C.float(FieldCursorAnim) - FieldCursorFollow := self.FieldCursorFollow - - result.CursorFollow = C.bool(FieldCursorFollow) - FieldSelectedAllMouseLock := self.FieldSelectedAllMouseLock - - result.SelectedAllMouseLock = C.bool(FieldSelectedAllMouseLock) - FieldEdited := self.FieldEdited - - result.Edited = C.bool(FieldEdited) - FieldFlags := self.FieldFlags - - result.Flags = C.ImGuiInputTextFlags(FieldFlags) - releaseFn = func() { - FieldCtxFin() - - FieldTextW.pinner.Unpin() - FieldTextADataFin() - FieldTextA.pinner.Unpin() - FieldInitialTextADataFin() - FieldInitialTextA.pinner.Unpin() - - FieldStbFin() - } - return result, releaseFn -} - -func (self InputTextState) c() (result C.ImGuiInputTextState, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newInputTextStateFromC(cvalue *C.ImGuiInputTextState) *InputTextState { - result := new(InputTextState) - result.FieldCtx = newContextFromC(cvalue.Ctx) - result.FieldID = ID(cvalue.ID) - result.FieldCurLenW = int32(cvalue.CurLenW) - result.FieldCurLenA = int32(cvalue.CurLenA) - result.FieldTextW = newVectorFromC(cvalue.TextW.Size, cvalue.TextW.Capacity, (*Wchar)(cvalue.TextW.Data)) - result.FieldTextA = newVectorFromC(cvalue.TextA.Size, cvalue.TextA.Capacity, C.GoString(cvalue.TextA.Data)) - result.FieldInitialTextA = newVectorFromC(cvalue.InitialTextA.Size, cvalue.InitialTextA.Capacity, C.GoString(cvalue.InitialTextA.Data)) - result.FieldTextAIsValid = cvalue.TextAIsValid == C.bool(true) - result.FieldBufCapacityA = int32(cvalue.BufCapacityA) - result.FieldScrollX = float32(cvalue.ScrollX) - result.FieldStb = *newSTBTexteditStateFromC(func() *C.STB_TexteditState { result := cvalue.Stb; return &result }()) - - result.FieldCursorAnim = float32(cvalue.CursorAnim) - result.FieldCursorFollow = cvalue.CursorFollow == C.bool(true) - result.FieldSelectedAllMouseLock = cvalue.SelectedAllMouseLock == C.bool(true) - result.FieldEdited = cvalue.Edited == C.bool(true) - result.FieldFlags = InputTextFlags(cvalue.Flags) - return result -} - -// [Internal] Storage used by IsKeyDown(), IsKeyPressed() etc functions. -// If prior to 1.87 you used io.KeysDownDuration[] (which was marked as internal), you should use GetKeyData(key)->DownDuration and *NOT* io.KeysData[key]->DownDuration. -type KeyData struct { - FieldDown bool // True for if key is down - FieldDownDuration float32 // Duration the key has been down (<0.0f: not pressed, 0.0f: just pressed, >0.0f: time held) - FieldDownDurationPrev float32 // Last frame duration the key has been down - FieldAnalogValue float32 // 0.0f..1.0f for gamepad values -} - -func (self KeyData) handle() (result *C.ImGuiKeyData, releaseFn func()) { - result = new(C.ImGuiKeyData) - FieldDown := self.FieldDown - - result.Down = C.bool(FieldDown) - FieldDownDuration := self.FieldDownDuration - - result.DownDuration = C.float(FieldDownDuration) - FieldDownDurationPrev := self.FieldDownDurationPrev - - result.DownDurationPrev = C.float(FieldDownDurationPrev) - FieldAnalogValue := self.FieldAnalogValue - - result.AnalogValue = C.float(FieldAnalogValue) - releaseFn = func() { - } - return result, releaseFn -} - -func (self KeyData) c() (result C.ImGuiKeyData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newKeyDataFromC(cvalue *C.ImGuiKeyData) *KeyData { - result := new(KeyData) - result.FieldDown = cvalue.Down == C.bool(true) - result.FieldDownDuration = float32(cvalue.DownDuration) - result.FieldDownDurationPrev = float32(cvalue.DownDurationPrev) - result.FieldAnalogValue = float32(cvalue.AnalogValue) - return result -} - -// This extends ImGuiKeyData but only for named keys (legacy keys don't support the new features) -// Stored in main context (1 per named key). In the future it might be merged into ImGuiKeyData. -type KeyOwnerData struct { - FieldOwnerCurr ID - FieldOwnerNext ID - FieldLockThisFrame bool // Reading this key requires explicit owner id (until end of frame). Set by ImGuiInputFlags_LockThisFrame. - FieldLockUntilRelease bool // Reading this key requires explicit owner id (until key is released). Set by ImGuiInputFlags_LockUntilRelease. When this is true LockThisFrame is always true as well. -} - -func (self KeyOwnerData) handle() (result *C.ImGuiKeyOwnerData, releaseFn func()) { - result = new(C.ImGuiKeyOwnerData) - FieldOwnerCurr := self.FieldOwnerCurr - - result.OwnerCurr = C.ImGuiID(FieldOwnerCurr) - FieldOwnerNext := self.FieldOwnerNext - - result.OwnerNext = C.ImGuiID(FieldOwnerNext) - FieldLockThisFrame := self.FieldLockThisFrame - - result.LockThisFrame = C.bool(FieldLockThisFrame) - FieldLockUntilRelease := self.FieldLockUntilRelease - - result.LockUntilRelease = C.bool(FieldLockUntilRelease) - releaseFn = func() { - } - return result, releaseFn -} - -func (self KeyOwnerData) c() (result C.ImGuiKeyOwnerData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newKeyOwnerDataFromC(cvalue *C.ImGuiKeyOwnerData) *KeyOwnerData { - result := new(KeyOwnerData) - result.FieldOwnerCurr = ID(cvalue.OwnerCurr) - result.FieldOwnerNext = ID(cvalue.OwnerNext) - result.FieldLockThisFrame = cvalue.LockThisFrame == C.bool(true) - result.FieldLockUntilRelease = cvalue.LockUntilRelease == C.bool(true) - return result -} - -// Routing table entry (sizeof() == 16 bytes) -type KeyRoutingData struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self KeyRoutingData) handle() (result *C.ImGuiKeyRoutingData, releaseFn func()) { - result = (*C.ImGuiKeyRoutingData)(self.data) - return result, func() {} -} - -func (self KeyRoutingData) c() (result C.ImGuiKeyRoutingData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newKeyRoutingDataFromC(cvalue *C.ImGuiKeyRoutingData) *KeyRoutingData { - result := new(KeyRoutingData) - result.data = unsafe.Pointer(cvalue) - return result -} - -// Routing table: maintain a desired owner for each possible key-chord (key + mods), and setup owner in NewFrame() when mods are matching. -// Stored in main context (1 instance) -type KeyRoutingTable struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self KeyRoutingTable) handle() (result *C.ImGuiKeyRoutingTable, releaseFn func()) { - result = (*C.ImGuiKeyRoutingTable)(self.data) - return result, func() {} -} - -func (self KeyRoutingTable) c() (result C.ImGuiKeyRoutingTable, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newKeyRoutingTableFromC(cvalue *C.ImGuiKeyRoutingTable) *KeyRoutingTable { - result := new(KeyRoutingTable) - result.data = unsafe.Pointer(cvalue) - return result -} - -// Status storage for the last submitted item -type LastItemData struct { - FieldID ID - FieldInFlags ItemFlags // See ImGuiItemFlags_ - FieldStatusFlags ItemStatusFlags // See ImGuiItemStatusFlags_ - FieldRect Rect // Full rectangle - FieldNavRect Rect // Navigation scoring rectangle (not displayed) - FieldDisplayRect Rect // Display rectangle (only if ImGuiItemStatusFlags_HasDisplayRect is set) -} - -func (self LastItemData) handle() (result *C.ImGuiLastItemData, releaseFn func()) { - result = new(C.ImGuiLastItemData) - FieldID := self.FieldID - - result.ID = C.ImGuiID(FieldID) - FieldInFlags := self.FieldInFlags - - result.InFlags = C.ImGuiItemFlags(FieldInFlags) - FieldStatusFlags := self.FieldStatusFlags - - result.StatusFlags = C.ImGuiItemStatusFlags(FieldStatusFlags) - FieldRect := self.FieldRect - - result.Rect = FieldRect.toC() - FieldNavRect := self.FieldNavRect - - result.NavRect = FieldNavRect.toC() - FieldDisplayRect := self.FieldDisplayRect - - result.DisplayRect = FieldDisplayRect.toC() - releaseFn = func() { - } - return result, releaseFn -} - -func (self LastItemData) c() (result C.ImGuiLastItemData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newLastItemDataFromC(cvalue *C.ImGuiLastItemData) *LastItemData { - result := new(LastItemData) - result.FieldID = ID(cvalue.ID) - result.FieldInFlags = ItemFlags(cvalue.InFlags) - result.FieldStatusFlags = ItemStatusFlags(cvalue.StatusFlags) - result.FieldRect = *(&Rect{}).fromC(cvalue.Rect) - result.FieldNavRect = *(&Rect{}).fromC(cvalue.NavRect) - result.FieldDisplayRect = *(&Rect{}).fromC(cvalue.DisplayRect) - return result -} - -// Helper: Manually clip large list of items. -// If you have lots evenly spaced items and you have random access to the list, you can perform coarse -// clipping based on visibility to only submit items that are in view. -// The clipper calculates the range of visible items and advance the cursor to compensate for the non-visible items we have skipped. -// (Dear ImGui already clip items based on their bounds but: it needs to first layout the item to do so, and generally -// -// fetching/submitting your own data incurs additional cost. Coarse clipping using ImGuiListClipper allows you to easily -// scale using lists with tens of thousands of items without a problem) -// -// Usage: -// -// ImGuiListClipper clipper; -// clipper.Begin(1000); // We have 1000 elements, evenly spaced. -// while (clipper.Step()) -// for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) -// ImGui::Text("line number %d", i); -// -// Generally what happens is: -// - Clipper lets you process the first element (DisplayStart = 0, DisplayEnd = 1) regardless of it being visible or not. -// - User code submit that one element. -// - Clipper can measure the height of the first element -// - Clipper calculate the actual range of elements to display based on the current clipping rectangle, position the cursor before the first visible element. -// - User code submit visible elements. -// - The clipper also handles various subtleties related to keyboard/gamepad navigation, wrapping etc. -type ListClipper struct { - FieldCtx *Context // Parent UI context - FieldDisplayStart int32 // First item to display, updated by each call to Step() - FieldDisplayEnd int32 // End of items to display (exclusive) - FieldItemsCount int32 // [Internal] Number of items - FieldItemsHeight float32 // [Internal] Height of item after a first step and item submission can calculate it - FieldStartPosY float32 // [Internal] Cursor position at the time of Begin() or after table frozen rows are all processed - FieldTempData unsafe.Pointer // [Internal] Internal data -} - -func (self ListClipper) handle() (result *C.ImGuiListClipper, releaseFn func()) { - result = new(C.ImGuiListClipper) - FieldCtx := self.FieldCtx - FieldCtxArg, FieldCtxFin := FieldCtx.handle() - result.Ctx = FieldCtxArg - FieldDisplayStart := self.FieldDisplayStart - - result.DisplayStart = C.int(FieldDisplayStart) - FieldDisplayEnd := self.FieldDisplayEnd - - result.DisplayEnd = C.int(FieldDisplayEnd) - FieldItemsCount := self.FieldItemsCount - - result.ItemsCount = C.int(FieldItemsCount) - FieldItemsHeight := self.FieldItemsHeight - - result.ItemsHeight = C.float(FieldItemsHeight) - FieldStartPosY := self.FieldStartPosY - - result.StartPosY = C.float(FieldStartPosY) - FieldTempData := self.FieldTempData - FieldTempDataArg, FieldTempDataFin := WrapVoidPtr(FieldTempData) - result.TempData = FieldTempDataArg - releaseFn = func() { - FieldCtxFin() - - FieldTempDataFin() - } - return result, releaseFn -} - -func (self ListClipper) c() (result C.ImGuiListClipper, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newListClipperFromC(cvalue *C.ImGuiListClipper) *ListClipper { - result := new(ListClipper) - result.FieldCtx = newContextFromC(cvalue.Ctx) - result.FieldDisplayStart = int32(cvalue.DisplayStart) - result.FieldDisplayEnd = int32(cvalue.DisplayEnd) - result.FieldItemsCount = int32(cvalue.ItemsCount) - result.FieldItemsHeight = float32(cvalue.ItemsHeight) - result.FieldStartPosY = float32(cvalue.StartPosY) - result.FieldTempData = unsafe.Pointer(cvalue.TempData) - return result -} - -// Temporary clipper data, buffers shared/reused between instances -type ListClipperData struct { - FieldListClipper *ListClipper - FieldLossynessOffset float32 - FieldStepNo int32 - FieldItemsFrozen int32 - FieldRanges Vector[*ListClipperRange] -} - -func (self ListClipperData) handle() (result *C.ImGuiListClipperData, releaseFn func()) { - result = new(C.ImGuiListClipperData) - FieldListClipper := self.FieldListClipper - FieldListClipperArg, FieldListClipperFin := FieldListClipper.handle() - result.ListClipper = FieldListClipperArg - FieldLossynessOffset := self.FieldLossynessOffset - - result.LossynessOffset = C.float(FieldLossynessOffset) - FieldStepNo := self.FieldStepNo - - result.StepNo = C.int(FieldStepNo) - FieldItemsFrozen := self.FieldItemsFrozen - - result.ItemsFrozen = C.int(FieldItemsFrozen) - FieldRanges := self.FieldRanges - FieldRangesData := FieldRanges.Data - FieldRangesDataArg, FieldRangesDataFin := FieldRangesData.handle() - FieldRangesVecArg := new(C.ImVector_ImGuiListClipperRange) - FieldRangesVecArg.Size = C.int(FieldRanges.Size) - FieldRangesVecArg.Capacity = C.int(FieldRanges.Capacity) - FieldRangesVecArg.Data = FieldRangesDataArg - FieldRanges.pinner.Pin(FieldRangesVecArg.Data) - - result.Ranges = *FieldRangesVecArg - releaseFn = func() { - FieldListClipperFin() - - FieldRangesDataFin() - FieldRanges.pinner.Unpin() - } - return result, releaseFn -} - -func (self ListClipperData) c() (result C.ImGuiListClipperData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newListClipperDataFromC(cvalue *C.ImGuiListClipperData) *ListClipperData { - result := new(ListClipperData) - result.FieldListClipper = newListClipperFromC(cvalue.ListClipper) - result.FieldLossynessOffset = float32(cvalue.LossynessOffset) - result.FieldStepNo = int32(cvalue.StepNo) - result.FieldItemsFrozen = int32(cvalue.ItemsFrozen) - result.FieldRanges = newVectorFromC(cvalue.Ranges.Size, cvalue.Ranges.Capacity, newListClipperRangeFromC(cvalue.Ranges.Data)) - return result -} - -// Note that Max is exclusive, so perhaps should be using a Begin/End convention. -type ListClipperRange struct { - FieldMin int32 - FieldMax int32 - FieldPosToIndexConvert bool // Begin/End are absolute position (will be converted to indices later) - FieldPosToIndexOffsetMin int // Add to Min after converting to indices - FieldPosToIndexOffsetMax int // Add to Min after converting to indices -} - -func (self ListClipperRange) handle() (result *C.ImGuiListClipperRange, releaseFn func()) { - result = new(C.ImGuiListClipperRange) - FieldMin := self.FieldMin - - result.Min = C.int(FieldMin) - FieldMax := self.FieldMax - - result.Max = C.int(FieldMax) - FieldPosToIndexConvert := self.FieldPosToIndexConvert - - result.PosToIndexConvert = C.bool(FieldPosToIndexConvert) - FieldPosToIndexOffsetMin := self.FieldPosToIndexOffsetMin - - result.PosToIndexOffsetMin = C.ImS8(FieldPosToIndexOffsetMin) - FieldPosToIndexOffsetMax := self.FieldPosToIndexOffsetMax - - result.PosToIndexOffsetMax = C.ImS8(FieldPosToIndexOffsetMax) - releaseFn = func() { - } - return result, releaseFn -} - -func (self ListClipperRange) c() (result C.ImGuiListClipperRange, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newListClipperRangeFromC(cvalue *C.ImGuiListClipperRange) *ListClipperRange { - result := new(ListClipperRange) - result.FieldMin = int32(cvalue.Min) - result.FieldMax = int32(cvalue.Max) - result.FieldPosToIndexConvert = cvalue.PosToIndexConvert == C.bool(true) - result.FieldPosToIndexOffsetMin = int(cvalue.PosToIndexOffsetMin) - result.FieldPosToIndexOffsetMax = int(cvalue.PosToIndexOffsetMax) - return result -} - -type LocEntry struct { - FieldKey LocKey - FieldText string -} - -func (self LocEntry) handle() (result *C.ImGuiLocEntry, releaseFn func()) { - result = new(C.ImGuiLocEntry) - FieldKey := self.FieldKey - - result.Key = C.ImGuiLocKey(FieldKey) - FieldText := self.FieldText - FieldTextArg, FieldTextFin := WrapString(FieldText) - result.Text = FieldTextArg - releaseFn = func() { - FieldTextFin() - } - return result, releaseFn -} - -func (self LocEntry) c() (result C.ImGuiLocEntry, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newLocEntryFromC(cvalue *C.ImGuiLocEntry) *LocEntry { - result := new(LocEntry) - result.FieldKey = LocKey(cvalue.Key) - result.FieldText = C.GoString(cvalue.Text) - return result -} - -// Simple column measurement, currently used for MenuItem() only.. This is very short-sighted/throw-away code and NOT a generic helper. -type MenuColumns struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self MenuColumns) handle() (result *C.ImGuiMenuColumns, releaseFn func()) { - result = (*C.ImGuiMenuColumns)(self.data) - return result, func() {} -} - -func (self MenuColumns) c() (result C.ImGuiMenuColumns, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newMenuColumnsFromC(cvalue *C.ImGuiMenuColumns) *MenuColumns { - result := new(MenuColumns) - result.data = unsafe.Pointer(cvalue) - return result -} - -type MetricsConfig struct { - FieldShowDebugLog bool - FieldShowStackTool bool - FieldShowWindowsRects bool - FieldShowWindowsBeginOrder bool - FieldShowTablesRects bool - FieldShowDrawCmdMesh bool - FieldShowDrawCmdBoundingBoxes bool - FieldShowAtlasTintedWithTextColor bool - FieldShowDockingNodes bool - FieldShowWindowsRectsType int32 - FieldShowTablesRectsType int32 -} - -func (self MetricsConfig) handle() (result *C.ImGuiMetricsConfig, releaseFn func()) { - result = new(C.ImGuiMetricsConfig) - FieldShowDebugLog := self.FieldShowDebugLog - - result.ShowDebugLog = C.bool(FieldShowDebugLog) - FieldShowStackTool := self.FieldShowStackTool - - result.ShowStackTool = C.bool(FieldShowStackTool) - FieldShowWindowsRects := self.FieldShowWindowsRects - - result.ShowWindowsRects = C.bool(FieldShowWindowsRects) - FieldShowWindowsBeginOrder := self.FieldShowWindowsBeginOrder - - result.ShowWindowsBeginOrder = C.bool(FieldShowWindowsBeginOrder) - FieldShowTablesRects := self.FieldShowTablesRects - - result.ShowTablesRects = C.bool(FieldShowTablesRects) - FieldShowDrawCmdMesh := self.FieldShowDrawCmdMesh - - result.ShowDrawCmdMesh = C.bool(FieldShowDrawCmdMesh) - FieldShowDrawCmdBoundingBoxes := self.FieldShowDrawCmdBoundingBoxes - - result.ShowDrawCmdBoundingBoxes = C.bool(FieldShowDrawCmdBoundingBoxes) - FieldShowAtlasTintedWithTextColor := self.FieldShowAtlasTintedWithTextColor - - result.ShowAtlasTintedWithTextColor = C.bool(FieldShowAtlasTintedWithTextColor) - FieldShowDockingNodes := self.FieldShowDockingNodes - - result.ShowDockingNodes = C.bool(FieldShowDockingNodes) - FieldShowWindowsRectsType := self.FieldShowWindowsRectsType - - result.ShowWindowsRectsType = C.int(FieldShowWindowsRectsType) - FieldShowTablesRectsType := self.FieldShowTablesRectsType - - result.ShowTablesRectsType = C.int(FieldShowTablesRectsType) - releaseFn = func() { - } - return result, releaseFn -} - -func (self MetricsConfig) c() (result C.ImGuiMetricsConfig, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newMetricsConfigFromC(cvalue *C.ImGuiMetricsConfig) *MetricsConfig { - result := new(MetricsConfig) - result.FieldShowDebugLog = cvalue.ShowDebugLog == C.bool(true) - result.FieldShowStackTool = cvalue.ShowStackTool == C.bool(true) - result.FieldShowWindowsRects = cvalue.ShowWindowsRects == C.bool(true) - result.FieldShowWindowsBeginOrder = cvalue.ShowWindowsBeginOrder == C.bool(true) - result.FieldShowTablesRects = cvalue.ShowTablesRects == C.bool(true) - result.FieldShowDrawCmdMesh = cvalue.ShowDrawCmdMesh == C.bool(true) - result.FieldShowDrawCmdBoundingBoxes = cvalue.ShowDrawCmdBoundingBoxes == C.bool(true) - result.FieldShowAtlasTintedWithTextColor = cvalue.ShowAtlasTintedWithTextColor == C.bool(true) - result.FieldShowDockingNodes = cvalue.ShowDockingNodes == C.bool(true) - result.FieldShowWindowsRectsType = int32(cvalue.ShowWindowsRectsType) - result.FieldShowTablesRectsType = int32(cvalue.ShowTablesRectsType) - return result -} - -type NavItemData struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self NavItemData) handle() (result *C.ImGuiNavItemData, releaseFn func()) { - result = (*C.ImGuiNavItemData)(self.data) - return result, func() {} -} - -func (self NavItemData) c() (result C.ImGuiNavItemData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newNavItemDataFromC(cvalue *C.ImGuiNavItemData) *NavItemData { - result := new(NavItemData) - result.data = unsafe.Pointer(cvalue) - return result -} - -// Store data emitted by TreeNode() for usage by TreePop() to implement ImGuiTreeNodeFlags_NavLeftJumpsBackHere. -// This is the minimum amount of data that we need to perform the equivalent of NavApplyItemToResult() and which we can't infer in TreePop() -// Only stored when the node is a potential candidate for landing on a Left arrow jump. -type NavTreeNodeData struct { - FieldID ID - FieldInFlags ItemFlags - FieldNavRect Rect -} - -func (self NavTreeNodeData) handle() (result *C.ImGuiNavTreeNodeData, releaseFn func()) { - result = new(C.ImGuiNavTreeNodeData) - FieldID := self.FieldID - - result.ID = C.ImGuiID(FieldID) - FieldInFlags := self.FieldInFlags - - result.InFlags = C.ImGuiItemFlags(FieldInFlags) - FieldNavRect := self.FieldNavRect - - result.NavRect = FieldNavRect.toC() - releaseFn = func() { - } - return result, releaseFn -} - -func (self NavTreeNodeData) c() (result C.ImGuiNavTreeNodeData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newNavTreeNodeDataFromC(cvalue *C.ImGuiNavTreeNodeData) *NavTreeNodeData { - result := new(NavTreeNodeData) - result.FieldID = ID(cvalue.ID) - result.FieldInFlags = ItemFlags(cvalue.InFlags) - result.FieldNavRect = *(&Rect{}).fromC(cvalue.NavRect) - return result -} - -type NextItemData struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self NextItemData) handle() (result *C.ImGuiNextItemData, releaseFn func()) { - result = (*C.ImGuiNextItemData)(self.data) - return result, func() {} -} - -func (self NextItemData) c() (result C.ImGuiNextItemData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newNextItemDataFromC(cvalue *C.ImGuiNextItemData) *NextItemData { - result := new(NextItemData) - result.data = unsafe.Pointer(cvalue) - return result -} - -// Storage for SetNexWindow** functions -type NextWindowData struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self NextWindowData) handle() (result *C.ImGuiNextWindowData, releaseFn func()) { - result = (*C.ImGuiNextWindowData)(self.data) - return result, func() {} -} - -func (self NextWindowData) c() (result C.ImGuiNextWindowData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newNextWindowDataFromC(cvalue *C.ImGuiNextWindowData) *NextWindowData { - result := new(NextWindowData) - result.data = unsafe.Pointer(cvalue) - return result -} - -type OldColumnData struct { - FieldOffsetNorm float32 // Column start offset, normalized 0.0 (far left) -> 1.0 (far right) - FieldOffsetNormBeforeResize float32 - FieldFlags OldColumnFlags // Not exposed - FieldClipRect Rect -} - -func (self OldColumnData) handle() (result *C.ImGuiOldColumnData, releaseFn func()) { - result = new(C.ImGuiOldColumnData) - FieldOffsetNorm := self.FieldOffsetNorm - - result.OffsetNorm = C.float(FieldOffsetNorm) - FieldOffsetNormBeforeResize := self.FieldOffsetNormBeforeResize - - result.OffsetNormBeforeResize = C.float(FieldOffsetNormBeforeResize) - FieldFlags := self.FieldFlags - - result.Flags = C.ImGuiOldColumnFlags(FieldFlags) - FieldClipRect := self.FieldClipRect - - result.ClipRect = FieldClipRect.toC() - releaseFn = func() { - } - return result, releaseFn -} - -func (self OldColumnData) c() (result C.ImGuiOldColumnData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newOldColumnDataFromC(cvalue *C.ImGuiOldColumnData) *OldColumnData { - result := new(OldColumnData) - result.FieldOffsetNorm = float32(cvalue.OffsetNorm) - result.FieldOffsetNormBeforeResize = float32(cvalue.OffsetNormBeforeResize) - result.FieldFlags = OldColumnFlags(cvalue.Flags) - result.FieldClipRect = *(&Rect{}).fromC(cvalue.ClipRect) - return result -} - -type OldColumns struct { - FieldID ID - FieldFlags OldColumnFlags - FieldIsFirstFrame bool - FieldIsBeingResized bool - FieldCurrent int32 - FieldCount int32 - FieldOffMinX float32 // Offsets from HostWorkRect.Min.x - FieldOffMaxX float32 // Offsets from HostWorkRect.Min.x - FieldLineMinY float32 - FieldLineMaxY float32 - FieldHostCursorPosY float32 // Backup of CursorPos at the time of BeginColumns() - FieldHostCursorMaxPosX float32 // Backup of CursorMaxPos at the time of BeginColumns() - FieldHostInitialClipRect Rect // Backup of ClipRect at the time of BeginColumns() - FieldHostBackupClipRect Rect // Backup of ClipRect during PushColumnsBackground()/PopColumnsBackground() - FieldHostBackupParentWorkRect Rect // Backup of WorkRect at the time of BeginColumns() - FieldColumns Vector[*OldColumnData] - FieldSplitter DrawListSplitter -} - -func (self OldColumns) handle() (result *C.ImGuiOldColumns, releaseFn func()) { - result = new(C.ImGuiOldColumns) - FieldID := self.FieldID - - result.ID = C.ImGuiID(FieldID) - FieldFlags := self.FieldFlags - - result.Flags = C.ImGuiOldColumnFlags(FieldFlags) - FieldIsFirstFrame := self.FieldIsFirstFrame - - result.IsFirstFrame = C.bool(FieldIsFirstFrame) - FieldIsBeingResized := self.FieldIsBeingResized - - result.IsBeingResized = C.bool(FieldIsBeingResized) - FieldCurrent := self.FieldCurrent - - result.Current = C.int(FieldCurrent) - FieldCount := self.FieldCount - - result.Count = C.int(FieldCount) - FieldOffMinX := self.FieldOffMinX - - result.OffMinX = C.float(FieldOffMinX) - FieldOffMaxX := self.FieldOffMaxX - - result.OffMaxX = C.float(FieldOffMaxX) - FieldLineMinY := self.FieldLineMinY - - result.LineMinY = C.float(FieldLineMinY) - FieldLineMaxY := self.FieldLineMaxY - - result.LineMaxY = C.float(FieldLineMaxY) - FieldHostCursorPosY := self.FieldHostCursorPosY - - result.HostCursorPosY = C.float(FieldHostCursorPosY) - FieldHostCursorMaxPosX := self.FieldHostCursorMaxPosX - - result.HostCursorMaxPosX = C.float(FieldHostCursorMaxPosX) - FieldHostInitialClipRect := self.FieldHostInitialClipRect - - result.HostInitialClipRect = FieldHostInitialClipRect.toC() - FieldHostBackupClipRect := self.FieldHostBackupClipRect - - result.HostBackupClipRect = FieldHostBackupClipRect.toC() - FieldHostBackupParentWorkRect := self.FieldHostBackupParentWorkRect - - result.HostBackupParentWorkRect = FieldHostBackupParentWorkRect.toC() - FieldColumns := self.FieldColumns - FieldColumnsData := FieldColumns.Data - FieldColumnsDataArg, FieldColumnsDataFin := FieldColumnsData.handle() - FieldColumnsVecArg := new(C.ImVector_ImGuiOldColumnData) - FieldColumnsVecArg.Size = C.int(FieldColumns.Size) - FieldColumnsVecArg.Capacity = C.int(FieldColumns.Capacity) - FieldColumnsVecArg.Data = FieldColumnsDataArg - FieldColumns.pinner.Pin(FieldColumnsVecArg.Data) - - result.Columns = *FieldColumnsVecArg - FieldSplitter := self.FieldSplitter - FieldSplitterArg, FieldSplitterFin := FieldSplitter.c() - result.Splitter = FieldSplitterArg - releaseFn = func() { - FieldColumnsDataFin() - FieldColumns.pinner.Unpin() - FieldSplitterFin() - } - return result, releaseFn -} - -func (self OldColumns) c() (result C.ImGuiOldColumns, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newOldColumnsFromC(cvalue *C.ImGuiOldColumns) *OldColumns { - result := new(OldColumns) - result.FieldID = ID(cvalue.ID) - result.FieldFlags = OldColumnFlags(cvalue.Flags) - result.FieldIsFirstFrame = cvalue.IsFirstFrame == C.bool(true) - result.FieldIsBeingResized = cvalue.IsBeingResized == C.bool(true) - result.FieldCurrent = int32(cvalue.Current) - result.FieldCount = int32(cvalue.Count) - result.FieldOffMinX = float32(cvalue.OffMinX) - result.FieldOffMaxX = float32(cvalue.OffMaxX) - result.FieldLineMinY = float32(cvalue.LineMinY) - result.FieldLineMaxY = float32(cvalue.LineMaxY) - result.FieldHostCursorPosY = float32(cvalue.HostCursorPosY) - result.FieldHostCursorMaxPosX = float32(cvalue.HostCursorMaxPosX) - result.FieldHostInitialClipRect = *(&Rect{}).fromC(cvalue.HostInitialClipRect) - result.FieldHostBackupClipRect = *(&Rect{}).fromC(cvalue.HostBackupClipRect) - result.FieldHostBackupParentWorkRect = *(&Rect{}).fromC(cvalue.HostBackupParentWorkRect) - result.FieldColumns = newVectorFromC(cvalue.Columns.Size, cvalue.Columns.Capacity, newOldColumnDataFromC(cvalue.Columns.Data)) - result.FieldSplitter = *newDrawListSplitterFromC(func() *C.ImDrawListSplitter { result := cvalue.Splitter; return &result }()) - - return result -} - -// Helper: Execute a block of code at maximum once a frame. Convenient if you want to quickly create a UI within deep-nested code that runs multiple times every frame. -// Usage: static ImGuiOnceUponAFrame oaf; if (oaf) ImGui::Text("This will be called only once per frame"); -type OnceUponAFrame struct { - FieldRefFrame int32 -} - -func (self OnceUponAFrame) handle() (result *C.ImGuiOnceUponAFrame, releaseFn func()) { - result = new(C.ImGuiOnceUponAFrame) - FieldRefFrame := self.FieldRefFrame - - result.RefFrame = C.int(FieldRefFrame) - releaseFn = func() { - } - return result, releaseFn -} - -func (self OnceUponAFrame) c() (result C.ImGuiOnceUponAFrame, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newOnceUponAFrameFromC(cvalue *C.ImGuiOnceUponAFrame) *OnceUponAFrame { - result := new(OnceUponAFrame) - result.FieldRefFrame = int32(cvalue.RefFrame) - return result -} - -// Data payload for Drag and Drop operations: AcceptDragDropPayload(), GetDragDropPayload() -type Payload struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self Payload) handle() (result *C.ImGuiPayload, releaseFn func()) { - result = (*C.ImGuiPayload)(self.data) - return result, func() {} -} - -func (self Payload) c() (result C.ImGuiPayload, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPayloadFromC(cvalue *C.ImGuiPayload) *Payload { - result := new(Payload) - result.data = unsafe.Pointer(cvalue) - return result -} - -// (Optional) Access via ImGui::GetPlatformIO() -type PlatformIO struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self PlatformIO) handle() (result *C.ImGuiPlatformIO, releaseFn func()) { - result = (*C.ImGuiPlatformIO)(self.data) - return result, func() {} -} - -func (self PlatformIO) c() (result C.ImGuiPlatformIO, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPlatformIOFromC(cvalue *C.ImGuiPlatformIO) *PlatformIO { - result := new(PlatformIO) - result.data = unsafe.Pointer(cvalue) - return result -} - -// (Optional) Support for IME (Input Method Editor) via the io.SetPlatformImeDataFn() function. -type PlatformImeData struct { - FieldWantVisible bool // A widget wants the IME to be visible - FieldInputPos Vec2 // Position of the input cursor - FieldInputLineHeight float32 // Line height -} - -func (self PlatformImeData) handle() (result *C.ImGuiPlatformImeData, releaseFn func()) { - result = new(C.ImGuiPlatformImeData) - FieldWantVisible := self.FieldWantVisible - - result.WantVisible = C.bool(FieldWantVisible) - FieldInputPos := self.FieldInputPos - - result.InputPos = FieldInputPos.toC() - FieldInputLineHeight := self.FieldInputLineHeight - - result.InputLineHeight = C.float(FieldInputLineHeight) - releaseFn = func() { - } - return result, releaseFn -} - -func (self PlatformImeData) c() (result C.ImGuiPlatformImeData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPlatformImeDataFromC(cvalue *C.ImGuiPlatformImeData) *PlatformImeData { - result := new(PlatformImeData) - result.FieldWantVisible = cvalue.WantVisible == C.bool(true) - result.FieldInputPos = *(&Vec2{}).fromC(cvalue.InputPos) - result.FieldInputLineHeight = float32(cvalue.InputLineHeight) - return result -} - -// (Optional) This is required when enabling multi-viewport. Represent the bounds of each connected monitor/display and their DPI. -// We use this information for multiple DPI support + clamping the position of popups and tooltips so they don't straddle multiple monitors. -type PlatformMonitor struct { - FieldMainPos Vec2 // Coordinates of the area displayed on this monitor (Min = upper left, Max = bottom right) - FieldMainSize Vec2 // Coordinates of the area displayed on this monitor (Min = upper left, Max = bottom right) - FieldWorkPos Vec2 // Coordinates without task bars / side bars / menu bars. Used to avoid positioning popups/tooltips inside this region. If you don't have this info, please copy the value for MainPos/MainSize. - FieldWorkSize Vec2 // Coordinates without task bars / side bars / menu bars. Used to avoid positioning popups/tooltips inside this region. If you don't have this info, please copy the value for MainPos/MainSize. - FieldDpiScale float32 // 1.0f = 96 DPI - FieldPlatformHandle unsafe.Pointer // Backend dependant data (e.g. HMONITOR, GLFWmonitor*, SDL Display Index, NSScreen*) -} - -func (self PlatformMonitor) handle() (result *C.ImGuiPlatformMonitor, releaseFn func()) { - result = new(C.ImGuiPlatformMonitor) - FieldMainPos := self.FieldMainPos - - result.MainPos = FieldMainPos.toC() - FieldMainSize := self.FieldMainSize - - result.MainSize = FieldMainSize.toC() - FieldWorkPos := self.FieldWorkPos - - result.WorkPos = FieldWorkPos.toC() - FieldWorkSize := self.FieldWorkSize - - result.WorkSize = FieldWorkSize.toC() - FieldDpiScale := self.FieldDpiScale - - result.DpiScale = C.float(FieldDpiScale) - FieldPlatformHandle := self.FieldPlatformHandle - FieldPlatformHandleArg, FieldPlatformHandleFin := WrapVoidPtr(FieldPlatformHandle) - result.PlatformHandle = FieldPlatformHandleArg - releaseFn = func() { - FieldPlatformHandleFin() - } - return result, releaseFn -} - -func (self PlatformMonitor) c() (result C.ImGuiPlatformMonitor, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPlatformMonitorFromC(cvalue *C.ImGuiPlatformMonitor) *PlatformMonitor { - result := new(PlatformMonitor) - result.FieldMainPos = *(&Vec2{}).fromC(cvalue.MainPos) - result.FieldMainSize = *(&Vec2{}).fromC(cvalue.MainSize) - result.FieldWorkPos = *(&Vec2{}).fromC(cvalue.WorkPos) - result.FieldWorkSize = *(&Vec2{}).fromC(cvalue.WorkSize) - result.FieldDpiScale = float32(cvalue.DpiScale) - result.FieldPlatformHandle = unsafe.Pointer(cvalue.PlatformHandle) - return result -} - -// Storage for current popup stack -type PopupData struct { - FieldPopupId ID // Set on OpenPopup() - FieldWindow *Window // Resolved on BeginPopup() - may stay unresolved if user never calls OpenPopup() - FieldBackupNavWindow *Window // Set on OpenPopup(), a NavWindow that will be restored on popup close - FieldParentNavLayer int32 // Resolved on BeginPopup(). Actually a ImGuiNavLayer type (declared down below), initialized to -1 which is not part of an enum, but serves well-enough as "not any of layers" value - FieldOpenFrameCount int32 // Set on OpenPopup() - FieldOpenParentId ID // Set on OpenPopup(), we need this to differentiate multiple menu sets from each others (e.g. inside menu bar vs loose menu items) - FieldOpenPopupPos Vec2 // Set on OpenPopup(), preferred popup position (typically == OpenMousePos when using mouse) - FieldOpenMousePos Vec2 // Set on OpenPopup(), copy of mouse position at the time of opening popup -} - -func (self PopupData) handle() (result *C.ImGuiPopupData, releaseFn func()) { - result = new(C.ImGuiPopupData) - FieldPopupId := self.FieldPopupId - - result.PopupId = C.ImGuiID(FieldPopupId) - FieldWindow := self.FieldWindow - FieldWindowArg, FieldWindowFin := FieldWindow.handle() - result.Window = FieldWindowArg - FieldBackupNavWindow := self.FieldBackupNavWindow - FieldBackupNavWindowArg, FieldBackupNavWindowFin := FieldBackupNavWindow.handle() - result.BackupNavWindow = FieldBackupNavWindowArg - FieldParentNavLayer := self.FieldParentNavLayer - - result.ParentNavLayer = C.int(FieldParentNavLayer) - FieldOpenFrameCount := self.FieldOpenFrameCount - - result.OpenFrameCount = C.int(FieldOpenFrameCount) - FieldOpenParentId := self.FieldOpenParentId - - result.OpenParentId = C.ImGuiID(FieldOpenParentId) - FieldOpenPopupPos := self.FieldOpenPopupPos - - result.OpenPopupPos = FieldOpenPopupPos.toC() - FieldOpenMousePos := self.FieldOpenMousePos - - result.OpenMousePos = FieldOpenMousePos.toC() - releaseFn = func() { - FieldWindowFin() - FieldBackupNavWindowFin() - } - return result, releaseFn -} - -func (self PopupData) c() (result C.ImGuiPopupData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPopupDataFromC(cvalue *C.ImGuiPopupData) *PopupData { - result := new(PopupData) - result.FieldPopupId = ID(cvalue.PopupId) - result.FieldWindow = newWindowFromC(cvalue.Window) - result.FieldBackupNavWindow = newWindowFromC(cvalue.BackupNavWindow) - result.FieldParentNavLayer = int32(cvalue.ParentNavLayer) - result.FieldOpenFrameCount = int32(cvalue.OpenFrameCount) - result.FieldOpenParentId = ID(cvalue.OpenParentId) - result.FieldOpenPopupPos = *(&Vec2{}).fromC(cvalue.OpenPopupPos) - result.FieldOpenMousePos = *(&Vec2{}).fromC(cvalue.OpenMousePos) - return result -} - -type PtrOrIndex struct { - FieldPtr unsafe.Pointer // Either field can be set, not both. e.g. Dock node tab bars are loose while BeginTabBar() ones are in a pool. - FieldIndex int32 // Usually index in a main pool. -} - -func (self PtrOrIndex) handle() (result *C.ImGuiPtrOrIndex, releaseFn func()) { - result = new(C.ImGuiPtrOrIndex) - FieldPtr := self.FieldPtr - FieldPtrArg, FieldPtrFin := WrapVoidPtr(FieldPtr) - result.Ptr = FieldPtrArg - FieldIndex := self.FieldIndex - - result.Index = C.int(FieldIndex) - releaseFn = func() { - FieldPtrFin() - } - return result, releaseFn -} - -func (self PtrOrIndex) c() (result C.ImGuiPtrOrIndex, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPtrOrIndexFromC(cvalue *C.ImGuiPtrOrIndex) *PtrOrIndex { - result := new(PtrOrIndex) - result.FieldPtr = unsafe.Pointer(cvalue.Ptr) - result.FieldIndex = int32(cvalue.Index) - return result -} - -type SettingsHandler struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self SettingsHandler) handle() (result *C.ImGuiSettingsHandler, releaseFn func()) { - result = (*C.ImGuiSettingsHandler)(self.data) - return result, func() {} -} - -func (self SettingsHandler) c() (result C.ImGuiSettingsHandler, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newSettingsHandlerFromC(cvalue *C.ImGuiSettingsHandler) *SettingsHandler { - result := new(SettingsHandler) - result.data = unsafe.Pointer(cvalue) - return result -} - -type ShrinkWidthItem struct { - FieldIndex int32 - FieldWidth float32 - FieldInitialWidth float32 -} - -func (self ShrinkWidthItem) handle() (result *C.ImGuiShrinkWidthItem, releaseFn func()) { - result = new(C.ImGuiShrinkWidthItem) - FieldIndex := self.FieldIndex - - result.Index = C.int(FieldIndex) - FieldWidth := self.FieldWidth - - result.Width = C.float(FieldWidth) - FieldInitialWidth := self.FieldInitialWidth - - result.InitialWidth = C.float(FieldInitialWidth) - releaseFn = func() { - } - return result, releaseFn -} - -func (self ShrinkWidthItem) c() (result C.ImGuiShrinkWidthItem, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newShrinkWidthItemFromC(cvalue *C.ImGuiShrinkWidthItem) *ShrinkWidthItem { - result := new(ShrinkWidthItem) - result.FieldIndex = int32(cvalue.Index) - result.FieldWidth = float32(cvalue.Width) - result.FieldInitialWidth = float32(cvalue.InitialWidth) - return result -} - -// Resizing callback data to apply custom constraint. As enabled by SetNextWindowSizeConstraints(). Callback is called during the next Begin(). -// NB: For basic min/max size constraint on each axis you don't need to use the callback! The SetNextWindowSizeConstraints() parameters are enough. -type SizeCallbackData struct { - FieldUserData unsafe.Pointer // Read-only. What user passed to SetNextWindowSizeConstraints(). Generally store an integer or float in here (need reinterpret_cast<>). - FieldPos Vec2 // Read-only. Window position, for reference. - FieldCurrentSize Vec2 // Read-only. Current window size. - FieldDesiredSize Vec2 // Read-write. Desired size, based on user's mouse position. Write to this field to restrain resizing. -} - -func (self SizeCallbackData) handle() (result *C.ImGuiSizeCallbackData, releaseFn func()) { - result = new(C.ImGuiSizeCallbackData) - FieldUserData := self.FieldUserData - FieldUserDataArg, FieldUserDataFin := WrapVoidPtr(FieldUserData) - result.UserData = FieldUserDataArg - FieldPos := self.FieldPos - - result.Pos = FieldPos.toC() - FieldCurrentSize := self.FieldCurrentSize - - result.CurrentSize = FieldCurrentSize.toC() - FieldDesiredSize := self.FieldDesiredSize - - result.DesiredSize = FieldDesiredSize.toC() - releaseFn = func() { - FieldUserDataFin() - } - return result, releaseFn -} - -func (self SizeCallbackData) c() (result C.ImGuiSizeCallbackData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newSizeCallbackDataFromC(cvalue *C.ImGuiSizeCallbackData) *SizeCallbackData { - result := new(SizeCallbackData) - result.FieldUserData = unsafe.Pointer(cvalue.UserData) - result.FieldPos = *(&Vec2{}).fromC(cvalue.Pos) - result.FieldCurrentSize = *(&Vec2{}).fromC(cvalue.CurrentSize) - result.FieldDesiredSize = *(&Vec2{}).fromC(cvalue.DesiredSize) - return result -} - -type StackLevelInfo struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self StackLevelInfo) handle() (result *C.ImGuiStackLevelInfo, releaseFn func()) { - result = (*C.ImGuiStackLevelInfo)(self.data) - return result, func() {} -} - -func (self StackLevelInfo) c() (result C.ImGuiStackLevelInfo, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newStackLevelInfoFromC(cvalue *C.ImGuiStackLevelInfo) *StackLevelInfo { - result := new(StackLevelInfo) - result.data = unsafe.Pointer(cvalue) - return result -} - -type StackSizes struct { - FieldSizeOfIDStack int16 - FieldSizeOfColorStack int16 - FieldSizeOfStyleVarStack int16 - FieldSizeOfFontStack int16 - FieldSizeOfFocusScopeStack int16 - FieldSizeOfGroupStack int16 - FieldSizeOfItemFlagsStack int16 - FieldSizeOfBeginPopupStack int16 - FieldSizeOfDisabledStack int16 -} - -func (self StackSizes) handle() (result *C.ImGuiStackSizes, releaseFn func()) { - result = new(C.ImGuiStackSizes) - FieldSizeOfIDStack := self.FieldSizeOfIDStack - - result.SizeOfIDStack = C.short(FieldSizeOfIDStack) - FieldSizeOfColorStack := self.FieldSizeOfColorStack - - result.SizeOfColorStack = C.short(FieldSizeOfColorStack) - FieldSizeOfStyleVarStack := self.FieldSizeOfStyleVarStack - - result.SizeOfStyleVarStack = C.short(FieldSizeOfStyleVarStack) - FieldSizeOfFontStack := self.FieldSizeOfFontStack - - result.SizeOfFontStack = C.short(FieldSizeOfFontStack) - FieldSizeOfFocusScopeStack := self.FieldSizeOfFocusScopeStack - - result.SizeOfFocusScopeStack = C.short(FieldSizeOfFocusScopeStack) - FieldSizeOfGroupStack := self.FieldSizeOfGroupStack - - result.SizeOfGroupStack = C.short(FieldSizeOfGroupStack) - FieldSizeOfItemFlagsStack := self.FieldSizeOfItemFlagsStack - - result.SizeOfItemFlagsStack = C.short(FieldSizeOfItemFlagsStack) - FieldSizeOfBeginPopupStack := self.FieldSizeOfBeginPopupStack - - result.SizeOfBeginPopupStack = C.short(FieldSizeOfBeginPopupStack) - FieldSizeOfDisabledStack := self.FieldSizeOfDisabledStack - - result.SizeOfDisabledStack = C.short(FieldSizeOfDisabledStack) - releaseFn = func() { - } - return result, releaseFn -} - -func (self StackSizes) c() (result C.ImGuiStackSizes, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newStackSizesFromC(cvalue *C.ImGuiStackSizes) *StackSizes { - result := new(StackSizes) - result.FieldSizeOfIDStack = int16(cvalue.SizeOfIDStack) - result.FieldSizeOfColorStack = int16(cvalue.SizeOfColorStack) - result.FieldSizeOfStyleVarStack = int16(cvalue.SizeOfStyleVarStack) - result.FieldSizeOfFontStack = int16(cvalue.SizeOfFontStack) - result.FieldSizeOfFocusScopeStack = int16(cvalue.SizeOfFocusScopeStack) - result.FieldSizeOfGroupStack = int16(cvalue.SizeOfGroupStack) - result.FieldSizeOfItemFlagsStack = int16(cvalue.SizeOfItemFlagsStack) - result.FieldSizeOfBeginPopupStack = int16(cvalue.SizeOfBeginPopupStack) - result.FieldSizeOfDisabledStack = int16(cvalue.SizeOfDisabledStack) - return result -} - -// State for Stack tool queries -type StackTool struct { - FieldLastActiveFrame int32 - FieldStackLevel int32 // -1: query stack and resize Results, >= 0: individual stack level - FieldQueryId ID // ID to query details for - FieldResults Vector[*StackLevelInfo] - FieldCopyToClipboardOnCtrlC bool - FieldCopyToClipboardLastTime float32 -} - -func (self StackTool) handle() (result *C.ImGuiStackTool, releaseFn func()) { - result = new(C.ImGuiStackTool) - FieldLastActiveFrame := self.FieldLastActiveFrame - - result.LastActiveFrame = C.int(FieldLastActiveFrame) - FieldStackLevel := self.FieldStackLevel - - result.StackLevel = C.int(FieldStackLevel) - FieldQueryId := self.FieldQueryId - - result.QueryId = C.ImGuiID(FieldQueryId) - FieldResults := self.FieldResults - FieldResultsData := FieldResults.Data - FieldResultsDataArg, FieldResultsDataFin := FieldResultsData.handle() - FieldResultsVecArg := new(C.ImVector_ImGuiStackLevelInfo) - FieldResultsVecArg.Size = C.int(FieldResults.Size) - FieldResultsVecArg.Capacity = C.int(FieldResults.Capacity) - FieldResultsVecArg.Data = FieldResultsDataArg - FieldResults.pinner.Pin(FieldResultsVecArg.Data) - - result.Results = *FieldResultsVecArg - FieldCopyToClipboardOnCtrlC := self.FieldCopyToClipboardOnCtrlC - - result.CopyToClipboardOnCtrlC = C.bool(FieldCopyToClipboardOnCtrlC) - FieldCopyToClipboardLastTime := self.FieldCopyToClipboardLastTime - - result.CopyToClipboardLastTime = C.float(FieldCopyToClipboardLastTime) - releaseFn = func() { - FieldResultsDataFin() - FieldResults.pinner.Unpin() - } - return result, releaseFn -} - -func (self StackTool) c() (result C.ImGuiStackTool, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newStackToolFromC(cvalue *C.ImGuiStackTool) *StackTool { - result := new(StackTool) - result.FieldLastActiveFrame = int32(cvalue.LastActiveFrame) - result.FieldStackLevel = int32(cvalue.StackLevel) - result.FieldQueryId = ID(cvalue.QueryId) - result.FieldResults = newVectorFromC(cvalue.Results.Size, cvalue.Results.Capacity, newStackLevelInfoFromC(cvalue.Results.Data)) - result.FieldCopyToClipboardOnCtrlC = cvalue.CopyToClipboardOnCtrlC == C.bool(true) - result.FieldCopyToClipboardLastTime = float32(cvalue.CopyToClipboardLastTime) - return result -} - -// Helper: Key->Value storage -// Typically you don't have to worry about this since a storage is held within each Window. -// We use it to e.g. store collapse state for a tree (Int 0/1) -// This is optimized for efficient lookup (dichotomy into a contiguous buffer) and rare insertion (typically tied to user interactions aka max once a frame) -// You can use it as custom user storage for temporary values. Declare your own storage if, for example: -// - You want to manipulate the open/close state of a particular sub-tree in your interface (tree node uses Int 0/1 to store their state). -// - You want to store custom debug data easily without adding or editing structures in your code (probably not efficient, but convenient) -// Types are NOT stored, so it is up to you to make sure your Key don't collide with different types. -type Storage struct { - FieldData Vector[*StoragePair] -} - -func (self Storage) handle() (result *C.ImGuiStorage, releaseFn func()) { - result = new(C.ImGuiStorage) - FieldData := self.FieldData - FieldDataData := FieldData.Data - FieldDataDataArg, FieldDataDataFin := FieldDataData.handle() - FieldDataVecArg := new(C.ImVector_ImGuiStoragePair) - FieldDataVecArg.Size = C.int(FieldData.Size) - FieldDataVecArg.Capacity = C.int(FieldData.Capacity) - FieldDataVecArg.Data = FieldDataDataArg - FieldData.pinner.Pin(FieldDataVecArg.Data) - - result.Data = *FieldDataVecArg - releaseFn = func() { - FieldDataDataFin() - FieldData.pinner.Unpin() - } - return result, releaseFn -} - -func (self Storage) c() (result C.ImGuiStorage, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newStorageFromC(cvalue *C.ImGuiStorage) *Storage { - result := new(Storage) - result.FieldData = newVectorFromC(cvalue.Data.Size, cvalue.Data.Capacity, newStoragePairFromC(cvalue.Data.Data)) - return result -} - -// [Internal] -type StoragePair struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self StoragePair) handle() (result *C.ImGuiStoragePair, releaseFn func()) { - result = (*C.ImGuiStoragePair)(self.data) - return result, func() {} -} - -func (self StoragePair) c() (result C.ImGuiStoragePair, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newStoragePairFromC(cvalue *C.ImGuiStoragePair) *StoragePair { - result := new(StoragePair) - result.data = unsafe.Pointer(cvalue) - return result -} - -type Style struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self Style) handle() (result *C.ImGuiStyle, releaseFn func()) { - result = (*C.ImGuiStyle)(self.data) - return result, func() {} -} - -func (self Style) c() (result C.ImGuiStyle, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newStyleFromC(cvalue *C.ImGuiStyle) *Style { - result := new(Style) - result.data = unsafe.Pointer(cvalue) - return result -} - -// Stacked style modifier, backup of modified data so we can restore it. Data type inferred from the variable. -type StyleMod struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self StyleMod) handle() (result *C.ImGuiStyleMod, releaseFn func()) { - result = (*C.ImGuiStyleMod)(self.data) - return result, func() {} -} - -func (self StyleMod) c() (result C.ImGuiStyleMod, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newStyleModFromC(cvalue *C.ImGuiStyleMod) *StyleMod { - result := new(StyleMod) - result.data = unsafe.Pointer(cvalue) - return result -} - -// Storage for a tab bar (sizeof() 152 bytes) -type TabBar struct { - FieldTabs Vector[*TabItem] - FieldFlags TabBarFlags - FieldID ID // Zero for tab-bars used by docking - FieldSelectedTabId ID // Selected tab/window - FieldNextSelectedTabId ID // Next selected tab/window. Will also trigger a scrolling animation - FieldVisibleTabId ID // Can occasionally be != SelectedTabId (e.g. when previewing contents for CTRL+TAB preview) - FieldCurrFrameVisible int32 - FieldPrevFrameVisible int32 - FieldBarRect Rect - FieldCurrTabsContentsHeight float32 - FieldPrevTabsContentsHeight float32 // Record the height of contents submitted below the tab bar - FieldWidthAllTabs float32 // Actual width of all tabs (locked during layout) - FieldWidthAllTabsIdeal float32 // Ideal width if all tabs were visible and not clipped - FieldScrollingAnim float32 - FieldScrollingTarget float32 - FieldScrollingTargetDistToVisibility float32 - FieldScrollingSpeed float32 - FieldScrollingRectMinX float32 - FieldScrollingRectMaxX float32 - FieldSeparatorMinX float32 - FieldSeparatorMaxX float32 - FieldReorderRequestTabId ID - FieldReorderRequestOffset int - FieldBeginCount int - FieldWantLayout bool - FieldVisibleTabWasSubmitted bool - FieldTabsAddedNew bool // Set to true when a new tab item or button has been added to the tab bar during last frame - FieldTabsActiveCount int // Number of tabs submitted this frame. - FieldLastTabItemIdx int // Index of last BeginTabItem() tab for use by EndTabItem() - FieldItemSpacingY float32 - FieldFramePadding Vec2 // style.FramePadding locked at the time of BeginTabBar() - FieldBackupCursorPos Vec2 - FieldTabsNames TextBuffer // For non-docking tab bar we re-append names in a contiguous buffer. -} - -func (self TabBar) handle() (result *C.ImGuiTabBar, releaseFn func()) { - result = new(C.ImGuiTabBar) - FieldTabs := self.FieldTabs - FieldTabsData := FieldTabs.Data - FieldTabsDataArg, FieldTabsDataFin := FieldTabsData.handle() - FieldTabsVecArg := new(C.ImVector_ImGuiTabItem) - FieldTabsVecArg.Size = C.int(FieldTabs.Size) - FieldTabsVecArg.Capacity = C.int(FieldTabs.Capacity) - FieldTabsVecArg.Data = FieldTabsDataArg - FieldTabs.pinner.Pin(FieldTabsVecArg.Data) - - result.Tabs = *FieldTabsVecArg - FieldFlags := self.FieldFlags - - result.Flags = C.ImGuiTabBarFlags(FieldFlags) - FieldID := self.FieldID - - result.ID = C.ImGuiID(FieldID) - FieldSelectedTabId := self.FieldSelectedTabId - - result.SelectedTabId = C.ImGuiID(FieldSelectedTabId) - FieldNextSelectedTabId := self.FieldNextSelectedTabId - - result.NextSelectedTabId = C.ImGuiID(FieldNextSelectedTabId) - FieldVisibleTabId := self.FieldVisibleTabId - - result.VisibleTabId = C.ImGuiID(FieldVisibleTabId) - FieldCurrFrameVisible := self.FieldCurrFrameVisible - - result.CurrFrameVisible = C.int(FieldCurrFrameVisible) - FieldPrevFrameVisible := self.FieldPrevFrameVisible - - result.PrevFrameVisible = C.int(FieldPrevFrameVisible) - FieldBarRect := self.FieldBarRect - - result.BarRect = FieldBarRect.toC() - FieldCurrTabsContentsHeight := self.FieldCurrTabsContentsHeight - - result.CurrTabsContentsHeight = C.float(FieldCurrTabsContentsHeight) - FieldPrevTabsContentsHeight := self.FieldPrevTabsContentsHeight - - result.PrevTabsContentsHeight = C.float(FieldPrevTabsContentsHeight) - FieldWidthAllTabs := self.FieldWidthAllTabs - - result.WidthAllTabs = C.float(FieldWidthAllTabs) - FieldWidthAllTabsIdeal := self.FieldWidthAllTabsIdeal - - result.WidthAllTabsIdeal = C.float(FieldWidthAllTabsIdeal) - FieldScrollingAnim := self.FieldScrollingAnim - - result.ScrollingAnim = C.float(FieldScrollingAnim) - FieldScrollingTarget := self.FieldScrollingTarget - - result.ScrollingTarget = C.float(FieldScrollingTarget) - FieldScrollingTargetDistToVisibility := self.FieldScrollingTargetDistToVisibility - - result.ScrollingTargetDistToVisibility = C.float(FieldScrollingTargetDistToVisibility) - FieldScrollingSpeed := self.FieldScrollingSpeed - - result.ScrollingSpeed = C.float(FieldScrollingSpeed) - FieldScrollingRectMinX := self.FieldScrollingRectMinX - - result.ScrollingRectMinX = C.float(FieldScrollingRectMinX) - FieldScrollingRectMaxX := self.FieldScrollingRectMaxX - - result.ScrollingRectMaxX = C.float(FieldScrollingRectMaxX) - FieldSeparatorMinX := self.FieldSeparatorMinX - - result.SeparatorMinX = C.float(FieldSeparatorMinX) - FieldSeparatorMaxX := self.FieldSeparatorMaxX - - result.SeparatorMaxX = C.float(FieldSeparatorMaxX) - FieldReorderRequestTabId := self.FieldReorderRequestTabId - - result.ReorderRequestTabId = C.ImGuiID(FieldReorderRequestTabId) - FieldReorderRequestOffset := self.FieldReorderRequestOffset - - result.ReorderRequestOffset = C.ImS16(FieldReorderRequestOffset) - FieldBeginCount := self.FieldBeginCount - - result.BeginCount = C.ImS8(FieldBeginCount) - FieldWantLayout := self.FieldWantLayout - - result.WantLayout = C.bool(FieldWantLayout) - FieldVisibleTabWasSubmitted := self.FieldVisibleTabWasSubmitted - - result.VisibleTabWasSubmitted = C.bool(FieldVisibleTabWasSubmitted) - FieldTabsAddedNew := self.FieldTabsAddedNew - - result.TabsAddedNew = C.bool(FieldTabsAddedNew) - FieldTabsActiveCount := self.FieldTabsActiveCount - - result.TabsActiveCount = C.ImS16(FieldTabsActiveCount) - FieldLastTabItemIdx := self.FieldLastTabItemIdx - - result.LastTabItemIdx = C.ImS16(FieldLastTabItemIdx) - FieldItemSpacingY := self.FieldItemSpacingY - - result.ItemSpacingY = C.float(FieldItemSpacingY) - FieldFramePadding := self.FieldFramePadding - - result.FramePadding = FieldFramePadding.toC() - FieldBackupCursorPos := self.FieldBackupCursorPos - - result.BackupCursorPos = FieldBackupCursorPos.toC() - FieldTabsNames := self.FieldTabsNames - FieldTabsNamesArg, FieldTabsNamesFin := FieldTabsNames.c() - result.TabsNames = FieldTabsNamesArg - releaseFn = func() { - FieldTabsDataFin() - FieldTabs.pinner.Unpin() - - FieldTabsNamesFin() - } - return result, releaseFn -} - -func (self TabBar) c() (result C.ImGuiTabBar, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newTabBarFromC(cvalue *C.ImGuiTabBar) *TabBar { - result := new(TabBar) - result.FieldTabs = newVectorFromC(cvalue.Tabs.Size, cvalue.Tabs.Capacity, newTabItemFromC(cvalue.Tabs.Data)) - result.FieldFlags = TabBarFlags(cvalue.Flags) - result.FieldID = ID(cvalue.ID) - result.FieldSelectedTabId = ID(cvalue.SelectedTabId) - result.FieldNextSelectedTabId = ID(cvalue.NextSelectedTabId) - result.FieldVisibleTabId = ID(cvalue.VisibleTabId) - result.FieldCurrFrameVisible = int32(cvalue.CurrFrameVisible) - result.FieldPrevFrameVisible = int32(cvalue.PrevFrameVisible) - result.FieldBarRect = *(&Rect{}).fromC(cvalue.BarRect) - result.FieldCurrTabsContentsHeight = float32(cvalue.CurrTabsContentsHeight) - result.FieldPrevTabsContentsHeight = float32(cvalue.PrevTabsContentsHeight) - result.FieldWidthAllTabs = float32(cvalue.WidthAllTabs) - result.FieldWidthAllTabsIdeal = float32(cvalue.WidthAllTabsIdeal) - result.FieldScrollingAnim = float32(cvalue.ScrollingAnim) - result.FieldScrollingTarget = float32(cvalue.ScrollingTarget) - result.FieldScrollingTargetDistToVisibility = float32(cvalue.ScrollingTargetDistToVisibility) - result.FieldScrollingSpeed = float32(cvalue.ScrollingSpeed) - result.FieldScrollingRectMinX = float32(cvalue.ScrollingRectMinX) - result.FieldScrollingRectMaxX = float32(cvalue.ScrollingRectMaxX) - result.FieldSeparatorMinX = float32(cvalue.SeparatorMinX) - result.FieldSeparatorMaxX = float32(cvalue.SeparatorMaxX) - result.FieldReorderRequestTabId = ID(cvalue.ReorderRequestTabId) - result.FieldReorderRequestOffset = int(cvalue.ReorderRequestOffset) - result.FieldBeginCount = int(cvalue.BeginCount) - result.FieldWantLayout = cvalue.WantLayout == C.bool(true) - result.FieldVisibleTabWasSubmitted = cvalue.VisibleTabWasSubmitted == C.bool(true) - result.FieldTabsAddedNew = cvalue.TabsAddedNew == C.bool(true) - result.FieldTabsActiveCount = int(cvalue.TabsActiveCount) - result.FieldLastTabItemIdx = int(cvalue.LastTabItemIdx) - result.FieldItemSpacingY = float32(cvalue.ItemSpacingY) - result.FieldFramePadding = *(&Vec2{}).fromC(cvalue.FramePadding) - result.FieldBackupCursorPos = *(&Vec2{}).fromC(cvalue.BackupCursorPos) - result.FieldTabsNames = *newTextBufferFromC(func() *C.ImGuiTextBuffer { result := cvalue.TabsNames; return &result }()) - - return result -} - -// Storage for one active tab item (sizeof() 48 bytes) -type TabItem struct { - FieldID ID - FieldFlags TabItemFlags - FieldWindow *Window // When TabItem is part of a DockNode's TabBar, we hold on to a window. - FieldLastFrameVisible int32 - FieldLastFrameSelected int32 // This allows us to infer an ordered list of the last activated tabs with little maintenance - FieldOffset float32 // Position relative to beginning of tab - FieldWidth float32 // Width currently displayed - FieldContentWidth float32 // Width of label, stored during BeginTabItem() call - FieldRequestedWidth float32 // Width optionally requested by caller, -1.0f is unused - FieldNameOffset int // When Window==NULL, offset to name within parent ImGuiTabBar::TabsNames - FieldBeginOrder int // BeginTabItem() order, used to re-order tabs after toggling ImGuiTabBarFlags_Reorderable - FieldIndexDuringLayout int // Index only used during TabBarLayout(). Tabs gets reordered so 'Tabs[n].IndexDuringLayout == n' but may mismatch during additions. - FieldWantClose bool // Marked as closed by SetTabItemClosed() -} - -func (self TabItem) handle() (result *C.ImGuiTabItem, releaseFn func()) { - result = new(C.ImGuiTabItem) - FieldID := self.FieldID - - result.ID = C.ImGuiID(FieldID) - FieldFlags := self.FieldFlags - - result.Flags = C.ImGuiTabItemFlags(FieldFlags) - FieldWindow := self.FieldWindow - FieldWindowArg, FieldWindowFin := FieldWindow.handle() - result.Window = FieldWindowArg - FieldLastFrameVisible := self.FieldLastFrameVisible - - result.LastFrameVisible = C.int(FieldLastFrameVisible) - FieldLastFrameSelected := self.FieldLastFrameSelected - - result.LastFrameSelected = C.int(FieldLastFrameSelected) - FieldOffset := self.FieldOffset - - result.Offset = C.float(FieldOffset) - FieldWidth := self.FieldWidth - - result.Width = C.float(FieldWidth) - FieldContentWidth := self.FieldContentWidth - - result.ContentWidth = C.float(FieldContentWidth) - FieldRequestedWidth := self.FieldRequestedWidth - - result.RequestedWidth = C.float(FieldRequestedWidth) - FieldNameOffset := self.FieldNameOffset - - result.NameOffset = C.ImS32(FieldNameOffset) - FieldBeginOrder := self.FieldBeginOrder - - result.BeginOrder = C.ImS16(FieldBeginOrder) - FieldIndexDuringLayout := self.FieldIndexDuringLayout - - result.IndexDuringLayout = C.ImS16(FieldIndexDuringLayout) - FieldWantClose := self.FieldWantClose - - result.WantClose = C.bool(FieldWantClose) - releaseFn = func() { - FieldWindowFin() - } - return result, releaseFn -} - -func (self TabItem) c() (result C.ImGuiTabItem, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newTabItemFromC(cvalue *C.ImGuiTabItem) *TabItem { - result := new(TabItem) - result.FieldID = ID(cvalue.ID) - result.FieldFlags = TabItemFlags(cvalue.Flags) - result.FieldWindow = newWindowFromC(cvalue.Window) - result.FieldLastFrameVisible = int32(cvalue.LastFrameVisible) - result.FieldLastFrameSelected = int32(cvalue.LastFrameSelected) - result.FieldOffset = float32(cvalue.Offset) - result.FieldWidth = float32(cvalue.Width) - result.FieldContentWidth = float32(cvalue.ContentWidth) - result.FieldRequestedWidth = float32(cvalue.RequestedWidth) - result.FieldNameOffset = int(cvalue.NameOffset) - result.FieldBeginOrder = int(cvalue.BeginOrder) - result.FieldIndexDuringLayout = int(cvalue.IndexDuringLayout) - result.FieldWantClose = cvalue.WantClose == C.bool(true) - return result -} - -// FIXME-TABLE: more transient data could be stored in a stacked ImGuiTableTempData: e.g. SortSpecs, incoming RowData -// sizeof() ~ 580 bytes + heap allocs described in TableBeginInitMemory() -type Table struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self Table) handle() (result *C.ImGuiTable, releaseFn func()) { - result = (*C.ImGuiTable)(self.data) - return result, func() {} -} - -func (self Table) c() (result C.ImGuiTable, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newTableFromC(cvalue *C.ImGuiTable) *Table { - result := new(Table) - result.data = unsafe.Pointer(cvalue) - return result -} - -// Transient cell data stored per row. -// sizeof() ~ 6 -type TableCellData struct { - FieldBgColor uint32 // Actual color - FieldColumn TableColumnIdx // Column number -} - -func (self TableCellData) handle() (result *C.ImGuiTableCellData, releaseFn func()) { - result = new(C.ImGuiTableCellData) - FieldBgColor := self.FieldBgColor - - result.BgColor = C.ImU32(FieldBgColor) - FieldColumn := self.FieldColumn - - result.Column = C.ImGuiTableColumnIdx(FieldColumn) - releaseFn = func() { - } - return result, releaseFn -} - -func (self TableCellData) c() (result C.ImGuiTableCellData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newTableCellDataFromC(cvalue *C.ImGuiTableCellData) *TableCellData { - result := new(TableCellData) - result.FieldBgColor = uint32(cvalue.BgColor) - result.FieldColumn = TableColumnIdx(cvalue.Column) - return result -} - -// [Internal] sizeof() ~ 112 -// We use the terminology "Enabled" to refer to a column that is not Hidden by user/api. -// We use the terminology "Clipped" to refer to a column that is out of sight because of scrolling/clipping. -// This is in contrast with some user-facing api such as IsItemVisible() / IsRectVisible() which use "Visible" to mean "not clipped". -type TableColumn struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self TableColumn) handle() (result *C.ImGuiTableColumn, releaseFn func()) { - result = (*C.ImGuiTableColumn)(self.data) - return result, func() {} -} - -func (self TableColumn) c() (result C.ImGuiTableColumn, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newTableColumnFromC(cvalue *C.ImGuiTableColumn) *TableColumn { - result := new(TableColumn) - result.data = unsafe.Pointer(cvalue) - return result -} - -// sizeof() ~ 12 -type TableColumnSettings struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self TableColumnSettings) handle() (result *C.ImGuiTableColumnSettings, releaseFn func()) { - result = (*C.ImGuiTableColumnSettings)(self.data) - return result, func() {} -} - -func (self TableColumnSettings) c() (result C.ImGuiTableColumnSettings, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newTableColumnSettingsFromC(cvalue *C.ImGuiTableColumnSettings) *TableColumnSettings { - result := new(TableColumnSettings) - result.data = unsafe.Pointer(cvalue) - return result -} - -// Sorting specification for one column of a table (sizeof == 12 bytes) -type TableColumnSortSpecs struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self TableColumnSortSpecs) handle() (result *C.ImGuiTableColumnSortSpecs, releaseFn func()) { - result = (*C.ImGuiTableColumnSortSpecs)(self.data) - return result, func() {} -} - -func (self TableColumnSortSpecs) c() (result C.ImGuiTableColumnSortSpecs, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newTableColumnSortSpecsFromC(cvalue *C.ImGuiTableColumnSortSpecs) *TableColumnSortSpecs { - result := new(TableColumnSortSpecs) - result.data = unsafe.Pointer(cvalue) - return result -} - -// Per-instance data that needs preserving across frames (seemingly most others do not need to be preserved aside from debug needs. Does that means they could be moved to ImGuiTableTempData?) -type TableInstanceData struct { - FieldTableInstanceID ID - FieldLastOuterHeight float32 // Outer height from last frame - FieldLastFirstRowHeight float32 // Height of first row from last frame (FIXME: this is used as "header height" and may be reworked) - FieldLastFrozenHeight float32 // Height of frozen section from last frame - FieldHoveredRowLast int32 // Index of row which was hovered last frame. - FieldHoveredRowNext int32 // Index of row hovered this frame, set after encountering it. -} - -func (self TableInstanceData) handle() (result *C.ImGuiTableInstanceData, releaseFn func()) { - result = new(C.ImGuiTableInstanceData) - FieldTableInstanceID := self.FieldTableInstanceID - - result.TableInstanceID = C.ImGuiID(FieldTableInstanceID) - FieldLastOuterHeight := self.FieldLastOuterHeight - - result.LastOuterHeight = C.float(FieldLastOuterHeight) - FieldLastFirstRowHeight := self.FieldLastFirstRowHeight - - result.LastFirstRowHeight = C.float(FieldLastFirstRowHeight) - FieldLastFrozenHeight := self.FieldLastFrozenHeight - - result.LastFrozenHeight = C.float(FieldLastFrozenHeight) - FieldHoveredRowLast := self.FieldHoveredRowLast - - result.HoveredRowLast = C.int(FieldHoveredRowLast) - FieldHoveredRowNext := self.FieldHoveredRowNext - - result.HoveredRowNext = C.int(FieldHoveredRowNext) - releaseFn = func() { - } - return result, releaseFn -} - -func (self TableInstanceData) c() (result C.ImGuiTableInstanceData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newTableInstanceDataFromC(cvalue *C.ImGuiTableInstanceData) *TableInstanceData { - result := new(TableInstanceData) - result.FieldTableInstanceID = ID(cvalue.TableInstanceID) - result.FieldLastOuterHeight = float32(cvalue.LastOuterHeight) - result.FieldLastFirstRowHeight = float32(cvalue.LastFirstRowHeight) - result.FieldLastFrozenHeight = float32(cvalue.LastFrozenHeight) - result.FieldHoveredRowLast = int32(cvalue.HoveredRowLast) - result.FieldHoveredRowNext = int32(cvalue.HoveredRowNext) - return result -} - -// This is designed to be stored in a single ImChunkStream (1 header followed by N ImGuiTableColumnSettings, etc.) -type TableSettings struct { - FieldID ID // Set to 0 to invalidate/delete the setting - FieldSaveFlags TableFlags // Indicate data we want to save using the Resizable/Reorderable/Sortable/Hideable flags (could be using its own flags..) - FieldRefScale float32 // Reference scale to be able to rescale columns on font/dpi changes. - FieldColumnsCount TableColumnIdx - FieldColumnsCountMax TableColumnIdx // Maximum number of columns this settings instance can store, we can recycle a settings instance with lower number of columns but not higher - FieldWantApply bool // Set when loaded from .ini data (to enable merging/loading .ini data into an already running context) -} - -func (self TableSettings) handle() (result *C.ImGuiTableSettings, releaseFn func()) { - result = new(C.ImGuiTableSettings) - FieldID := self.FieldID - - result.ID = C.ImGuiID(FieldID) - FieldSaveFlags := self.FieldSaveFlags - - result.SaveFlags = C.ImGuiTableFlags(FieldSaveFlags) - FieldRefScale := self.FieldRefScale - - result.RefScale = C.float(FieldRefScale) - FieldColumnsCount := self.FieldColumnsCount - - result.ColumnsCount = C.ImGuiTableColumnIdx(FieldColumnsCount) - FieldColumnsCountMax := self.FieldColumnsCountMax - - result.ColumnsCountMax = C.ImGuiTableColumnIdx(FieldColumnsCountMax) - FieldWantApply := self.FieldWantApply - - result.WantApply = C.bool(FieldWantApply) - releaseFn = func() { - } - return result, releaseFn -} - -func (self TableSettings) c() (result C.ImGuiTableSettings, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newTableSettingsFromC(cvalue *C.ImGuiTableSettings) *TableSettings { - result := new(TableSettings) - result.FieldID = ID(cvalue.ID) - result.FieldSaveFlags = TableFlags(cvalue.SaveFlags) - result.FieldRefScale = float32(cvalue.RefScale) - result.FieldColumnsCount = TableColumnIdx(cvalue.ColumnsCount) - result.FieldColumnsCountMax = TableColumnIdx(cvalue.ColumnsCountMax) - result.FieldWantApply = cvalue.WantApply == C.bool(true) - return result -} - -// Sorting specifications for a table (often handling sort specs for a single column, occasionally more) -// Obtained by calling TableGetSortSpecs(). -// When 'SpecsDirty == true' you can sort your data. It will be true with sorting specs have changed since last call, or the first time. -// Make sure to set 'SpecsDirty = false' after sorting, else you may wastefully sort your data every frame! -type TableSortSpecs struct { - FieldSpecs *TableColumnSortSpecs // Pointer to sort spec array. - FieldSpecsCount int32 // Sort spec count. Most often 1. May be > 1 when ImGuiTableFlags_SortMulti is enabled. May be == 0 when ImGuiTableFlags_SortTristate is enabled. - FieldSpecsDirty bool // Set to true when specs have changed since last time! Use this to sort again, then clear the flag. -} - -func (self TableSortSpecs) handle() (result *C.ImGuiTableSortSpecs, releaseFn func()) { - result = new(C.ImGuiTableSortSpecs) - FieldSpecs := self.FieldSpecs - FieldSpecsArg, FieldSpecsFin := FieldSpecs.handle() - result.Specs = FieldSpecsArg - FieldSpecsCount := self.FieldSpecsCount - - result.SpecsCount = C.int(FieldSpecsCount) - FieldSpecsDirty := self.FieldSpecsDirty - - result.SpecsDirty = C.bool(FieldSpecsDirty) - releaseFn = func() { - FieldSpecsFin() - } - return result, releaseFn -} - -func (self TableSortSpecs) c() (result C.ImGuiTableSortSpecs, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newTableSortSpecsFromC(cvalue *C.ImGuiTableSortSpecs) *TableSortSpecs { - result := new(TableSortSpecs) - result.FieldSpecs = newTableColumnSortSpecsFromC(cvalue.Specs) - result.FieldSpecsCount = int32(cvalue.SpecsCount) - result.FieldSpecsDirty = cvalue.SpecsDirty == C.bool(true) - return result -} - -// Transient data that are only needed between BeginTable() and EndTable(), those buffers are shared (1 per level of stacked table). -// - Accessing those requires chasing an extra pointer so for very frequently used data we leave them in the main table structure. -// - We also leave out of this structure data that tend to be particularly useful for debugging/metrics. -// sizeof() ~ 112 bytes. -type TableTempData struct { - FieldTableIndex int32 // Index in g.Tables.Buf[] pool - FieldLastTimeActive float32 // Last timestamp this structure was used - FieldUserOuterSize Vec2 // outer_size.x passed to BeginTable() - FieldDrawSplitter DrawListSplitter - FieldHostBackupWorkRect Rect // Backup of InnerWindow->WorkRect at the end of BeginTable() - FieldHostBackupParentWorkRect Rect // Backup of InnerWindow->ParentWorkRect at the end of BeginTable() - FieldHostBackupPrevLineSize Vec2 // Backup of InnerWindow->DC.PrevLineSize at the end of BeginTable() - FieldHostBackupCurrLineSize Vec2 // Backup of InnerWindow->DC.CurrLineSize at the end of BeginTable() - FieldHostBackupCursorMaxPos Vec2 // Backup of InnerWindow->DC.CursorMaxPos at the end of BeginTable() - FieldHostBackupColumnsOffset Vec1 // Backup of OuterWindow->DC.ColumnsOffset at the end of BeginTable() - FieldHostBackupItemWidth float32 // Backup of OuterWindow->DC.ItemWidth at the end of BeginTable() - FieldHostBackupItemWidthStackSize int32 // Backup of OuterWindow->DC.ItemWidthStack.Size at the end of BeginTable() - -} - -func (self TableTempData) handle() (result *C.ImGuiTableTempData, releaseFn func()) { - result = new(C.ImGuiTableTempData) - FieldTableIndex := self.FieldTableIndex - - result.TableIndex = C.int(FieldTableIndex) - FieldLastTimeActive := self.FieldLastTimeActive - - result.LastTimeActive = C.float(FieldLastTimeActive) - FieldUserOuterSize := self.FieldUserOuterSize - - result.UserOuterSize = FieldUserOuterSize.toC() - FieldDrawSplitter := self.FieldDrawSplitter - FieldDrawSplitterArg, FieldDrawSplitterFin := FieldDrawSplitter.c() - result.DrawSplitter = FieldDrawSplitterArg - FieldHostBackupWorkRect := self.FieldHostBackupWorkRect - - result.HostBackupWorkRect = FieldHostBackupWorkRect.toC() - FieldHostBackupParentWorkRect := self.FieldHostBackupParentWorkRect - - result.HostBackupParentWorkRect = FieldHostBackupParentWorkRect.toC() - FieldHostBackupPrevLineSize := self.FieldHostBackupPrevLineSize - - result.HostBackupPrevLineSize = FieldHostBackupPrevLineSize.toC() - FieldHostBackupCurrLineSize := self.FieldHostBackupCurrLineSize - - result.HostBackupCurrLineSize = FieldHostBackupCurrLineSize.toC() - FieldHostBackupCursorMaxPos := self.FieldHostBackupCursorMaxPos - - result.HostBackupCursorMaxPos = FieldHostBackupCursorMaxPos.toC() - FieldHostBackupColumnsOffset := self.FieldHostBackupColumnsOffset - FieldHostBackupColumnsOffsetArg, FieldHostBackupColumnsOffsetFin := FieldHostBackupColumnsOffset.c() - result.HostBackupColumnsOffset = FieldHostBackupColumnsOffsetArg - FieldHostBackupItemWidth := self.FieldHostBackupItemWidth - - result.HostBackupItemWidth = C.float(FieldHostBackupItemWidth) - FieldHostBackupItemWidthStackSize := self.FieldHostBackupItemWidthStackSize - - result.HostBackupItemWidthStackSize = C.int(FieldHostBackupItemWidthStackSize) - releaseFn = func() { - FieldDrawSplitterFin() - - FieldHostBackupColumnsOffsetFin() - } - return result, releaseFn -} - -func (self TableTempData) c() (result C.ImGuiTableTempData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newTableTempDataFromC(cvalue *C.ImGuiTableTempData) *TableTempData { - result := new(TableTempData) - result.FieldTableIndex = int32(cvalue.TableIndex) - result.FieldLastTimeActive = float32(cvalue.LastTimeActive) - result.FieldUserOuterSize = *(&Vec2{}).fromC(cvalue.UserOuterSize) - result.FieldDrawSplitter = *newDrawListSplitterFromC(func() *C.ImDrawListSplitter { result := cvalue.DrawSplitter; return &result }()) - - result.FieldHostBackupWorkRect = *(&Rect{}).fromC(cvalue.HostBackupWorkRect) - result.FieldHostBackupParentWorkRect = *(&Rect{}).fromC(cvalue.HostBackupParentWorkRect) - result.FieldHostBackupPrevLineSize = *(&Vec2{}).fromC(cvalue.HostBackupPrevLineSize) - result.FieldHostBackupCurrLineSize = *(&Vec2{}).fromC(cvalue.HostBackupCurrLineSize) - result.FieldHostBackupCursorMaxPos = *(&Vec2{}).fromC(cvalue.HostBackupCursorMaxPos) - result.FieldHostBackupColumnsOffset = *newVec1FromC(func() *C.ImVec1 { result := cvalue.HostBackupColumnsOffset; return &result }()) - - result.FieldHostBackupItemWidth = float32(cvalue.HostBackupItemWidth) - result.FieldHostBackupItemWidthStackSize = int32(cvalue.HostBackupItemWidthStackSize) - return result -} - -// Helper: Growable text buffer for logging/accumulating text -// (this could be called 'ImGuiTextBuilder' / 'ImGuiStringBuilder') -type TextBuffer struct { - FieldBuf Vector[string] -} - -func (self TextBuffer) handle() (result *C.ImGuiTextBuffer, releaseFn func()) { - result = new(C.ImGuiTextBuffer) - FieldBuf := self.FieldBuf - FieldBufData := FieldBuf.Data - FieldBufDataArg, FieldBufDataFin := WrapString(FieldBufData) - FieldBufVecArg := new(C.ImVector_char) - FieldBufVecArg.Size = C.int(FieldBuf.Size) - FieldBufVecArg.Capacity = C.int(FieldBuf.Capacity) - FieldBufVecArg.Data = FieldBufDataArg - FieldBuf.pinner.Pin(FieldBufVecArg.Data) - - result.Buf = *FieldBufVecArg - releaseFn = func() { - FieldBufDataFin() - FieldBuf.pinner.Unpin() - } - return result, releaseFn -} - -func (self TextBuffer) c() (result C.ImGuiTextBuffer, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newTextBufferFromC(cvalue *C.ImGuiTextBuffer) *TextBuffer { - result := new(TextBuffer) - result.FieldBuf = newVectorFromC(cvalue.Buf.Size, cvalue.Buf.Capacity, C.GoString(cvalue.Buf.Data)) - return result -} - -// Helper: Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]" -type TextFilter struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self TextFilter) handle() (result *C.ImGuiTextFilter, releaseFn func()) { - result = (*C.ImGuiTextFilter)(self.data) - return result, func() {} -} - -func (self TextFilter) c() (result C.ImGuiTextFilter, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newTextFilterFromC(cvalue *C.ImGuiTextFilter) *TextFilter { - result := new(TextFilter) - result.data = unsafe.Pointer(cvalue) - return result -} - -// Helper: ImGuiTextIndex<> -// Maintain a line index for a text buffer. This is a strong candidate to be moved into the public API. -type TextIndex struct { - FieldLineOffsets Vector[*int32] - FieldEndOffset int32 // Because we don't own text buffer we need to maintain EndOffset (may bake in LineOffsets?) -} - -func (self TextIndex) handle() (result *C.ImGuiTextIndex, releaseFn func()) { - result = new(C.ImGuiTextIndex) - FieldLineOffsets := self.FieldLineOffsets - FieldLineOffsetsData := FieldLineOffsets.Data - FieldLineOffsetsDataArg, FieldLineOffsetsDataFin := WrapNumberPtr[C.int, int32](FieldLineOffsetsData) - FieldLineOffsetsVecArg := new(C.ImVector_int) - FieldLineOffsetsVecArg.Size = C.int(FieldLineOffsets.Size) - FieldLineOffsetsVecArg.Capacity = C.int(FieldLineOffsets.Capacity) - FieldLineOffsetsVecArg.Data = FieldLineOffsetsDataArg - FieldLineOffsets.pinner.Pin(FieldLineOffsetsVecArg.Data) - - result.LineOffsets = *FieldLineOffsetsVecArg - FieldEndOffset := self.FieldEndOffset - - result.EndOffset = C.int(FieldEndOffset) - releaseFn = func() { - FieldLineOffsetsDataFin() - FieldLineOffsets.pinner.Unpin() - } - return result, releaseFn -} - -func (self TextIndex) c() (result C.ImGuiTextIndex, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newTextIndexFromC(cvalue *C.ImGuiTextIndex) *TextIndex { - result := new(TextIndex) - result.FieldLineOffsets = newVectorFromC(cvalue.LineOffsets.Size, cvalue.LineOffsets.Capacity, (*int32)(cvalue.LineOffsets.Data)) - result.FieldEndOffset = int32(cvalue.EndOffset) - return result -} - -// [Internal] -type TextRange struct { - FieldB string - FieldE string -} - -func (self TextRange) handle() (result *C.ImGuiTextRange, releaseFn func()) { - result = new(C.ImGuiTextRange) - FieldB := self.FieldB - FieldBArg, FieldBFin := WrapString(FieldB) - result.b = FieldBArg - FieldE := self.FieldE - FieldEArg, FieldEFin := WrapString(FieldE) - result.e = FieldEArg - releaseFn = func() { - FieldBFin() - FieldEFin() - } - return result, releaseFn -} - -func (self TextRange) c() (result C.ImGuiTextRange, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newTextRangeFromC(cvalue *C.ImGuiTextRange) *TextRange { - result := new(TextRange) - result.FieldB = C.GoString(cvalue.b) - result.FieldE = C.GoString(cvalue.e) - return result -} - -// Returned by GetTypingSelectRequest(), designed to eventually be public. -type TypingSelectRequest struct { - FieldFlags TypingSelectFlags // Flags passed to GetTypingSelectRequest() - FieldSearchBufferLen int32 - FieldSearchBuffer string // Search buffer contents (use full string. unless SingleCharMode is set, in which case use SingleCharSize). - FieldSelectRequest bool // Set when buffer was modified this frame, requesting a selection. - FieldSingleCharMode bool // Notify when buffer contains same character repeated, to implement special mode. In this situation it preferred to not display any on-screen search indication. - FieldSingleCharSize int // Length in bytes of first letter codepoint (1 for ascii, 2-4 for UTF-8). If (SearchBufferLen==RepeatCharSize) only 1 letter has been input. -} - -func (self TypingSelectRequest) handle() (result *C.ImGuiTypingSelectRequest, releaseFn func()) { - result = new(C.ImGuiTypingSelectRequest) - FieldFlags := self.FieldFlags - - result.Flags = C.ImGuiTypingSelectFlags(FieldFlags) - FieldSearchBufferLen := self.FieldSearchBufferLen - - result.SearchBufferLen = C.int(FieldSearchBufferLen) - FieldSearchBuffer := self.FieldSearchBuffer - FieldSearchBufferArg, FieldSearchBufferFin := WrapString(FieldSearchBuffer) - result.SearchBuffer = FieldSearchBufferArg - FieldSelectRequest := self.FieldSelectRequest - - result.SelectRequest = C.bool(FieldSelectRequest) - FieldSingleCharMode := self.FieldSingleCharMode - - result.SingleCharMode = C.bool(FieldSingleCharMode) - FieldSingleCharSize := self.FieldSingleCharSize - - result.SingleCharSize = C.ImS8(FieldSingleCharSize) - releaseFn = func() { - FieldSearchBufferFin() - } - return result, releaseFn -} - -func (self TypingSelectRequest) c() (result C.ImGuiTypingSelectRequest, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newTypingSelectRequestFromC(cvalue *C.ImGuiTypingSelectRequest) *TypingSelectRequest { - result := new(TypingSelectRequest) - result.FieldFlags = TypingSelectFlags(cvalue.Flags) - result.FieldSearchBufferLen = int32(cvalue.SearchBufferLen) - result.FieldSearchBuffer = C.GoString(cvalue.SearchBuffer) - result.FieldSelectRequest = cvalue.SelectRequest == C.bool(true) - result.FieldSingleCharMode = cvalue.SingleCharMode == C.bool(true) - result.FieldSingleCharSize = int(cvalue.SingleCharSize) - return result -} - -// Storage for GetTypingSelectRequest() -type TypingSelectState struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self TypingSelectState) handle() (result *C.ImGuiTypingSelectState, releaseFn func()) { - result = (*C.ImGuiTypingSelectState)(self.data) - return result, func() {} -} - -func (self TypingSelectState) c() (result C.ImGuiTypingSelectState, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newTypingSelectStateFromC(cvalue *C.ImGuiTypingSelectState) *TypingSelectState { - result := new(TypingSelectState) - result.data = unsafe.Pointer(cvalue) - return result -} - -// - Currently represents the Platform Window created by the application which is hosting our Dear ImGui windows. -// - With multi-viewport enabled, we extend this concept to have multiple active viewports. -// - In the future we will extend this concept further to also represent Platform Monitor and support a "no main platform window" operation mode. -// - About Main Area vs Work Area: -// - Main Area = entire viewport. -// - Work Area = entire viewport minus sections used by main menu bars (for platform windows), or by task bar (for platform monitor). -// - Windows are generally trying to stay within the Work Area of their host viewport. -type Viewport struct { - FieldID ID // Unique identifier for the viewport - FieldFlags ViewportFlags // See ImGuiViewportFlags_ - FieldPos Vec2 // Main Area: Position of the viewport (Dear ImGui coordinates are the same as OS desktop/native coordinates) - FieldSize Vec2 // Main Area: Size of the viewport. - FieldWorkPos Vec2 // Work Area: Position of the viewport minus task bars, menus bars, status bars (>= Pos) - FieldWorkSize Vec2 // Work Area: Size of the viewport minus task bars, menu bars, status bars (<= Size) - FieldDpiScale float32 // 1.0f = 96 DPI = No extra scale. - FieldParentViewportId ID // (Advanced) 0: no parent. Instruct the platform backend to setup a parent/child relationship between platform windows. - FieldDrawData *DrawData // The ImDrawData corresponding to this viewport. Valid after Render() and until the next call to NewFrame(). - // Platform/Backend Dependent Data - // Our design separate the Renderer and Platform backends to facilitate combining default backends with each others. - // When our create your own backend for a custom engine, it is possible that both Renderer and Platform will be handled - // by the same system and you may not need to use all the UserData/Handle fields. - // The library never uses those fields, they are merely storage to facilitate backend implementation. - FieldRendererUserData unsafe.Pointer // void* to hold custom data structure for the renderer (e.g. swap chain, framebuffers etc.). generally set by your Renderer_CreateWindow function. - FieldPlatformUserData unsafe.Pointer // void* to hold custom data structure for the OS / platform (e.g. windowing info, render context). generally set by your Platform_CreateWindow function. - FieldPlatformHandle unsafe.Pointer // void* for FindViewportByPlatformHandle(). (e.g. suggested to use natural platform handle such as HWND, GLFWWindow*, SDL_Window*) - FieldPlatformHandleRaw unsafe.Pointer // void* to hold lower-level, platform-native window handle (under Win32 this is expected to be a HWND, unused for other platforms), when using an abstraction layer like GLFW or SDL (where PlatformHandle would be a SDL_Window*) - FieldPlatformWindowCreated bool // Platform window has been created (Platform_CreateWindow() has been called). This is false during the first frame where a viewport is being created. - FieldPlatformRequestMove bool // Platform window requested move (e.g. window was moved by the OS / host window manager, authoritative position will be OS window position) - FieldPlatformRequestResize bool // Platform window requested resize (e.g. window was resized by the OS / host window manager, authoritative size will be OS window size) - FieldPlatformRequestClose bool // Platform window requested closure (e.g. window was moved by the OS / host window manager, e.g. pressing ALT-F4) -} - -func (self Viewport) handle() (result *C.ImGuiViewport, releaseFn func()) { - result = new(C.ImGuiViewport) - FieldID := self.FieldID - - result.ID = C.ImGuiID(FieldID) - FieldFlags := self.FieldFlags - - result.Flags = C.ImGuiViewportFlags(FieldFlags) - FieldPos := self.FieldPos - - result.Pos = FieldPos.toC() - FieldSize := self.FieldSize - - result.Size = FieldSize.toC() - FieldWorkPos := self.FieldWorkPos - - result.WorkPos = FieldWorkPos.toC() - FieldWorkSize := self.FieldWorkSize - - result.WorkSize = FieldWorkSize.toC() - FieldDpiScale := self.FieldDpiScale - - result.DpiScale = C.float(FieldDpiScale) - FieldParentViewportId := self.FieldParentViewportId - - result.ParentViewportId = C.ImGuiID(FieldParentViewportId) - FieldDrawData := self.FieldDrawData - FieldDrawDataArg, FieldDrawDataFin := FieldDrawData.handle() - result.DrawData = FieldDrawDataArg - FieldRendererUserData := self.FieldRendererUserData - FieldRendererUserDataArg, FieldRendererUserDataFin := WrapVoidPtr(FieldRendererUserData) - result.RendererUserData = FieldRendererUserDataArg - FieldPlatformUserData := self.FieldPlatformUserData - FieldPlatformUserDataArg, FieldPlatformUserDataFin := WrapVoidPtr(FieldPlatformUserData) - result.PlatformUserData = FieldPlatformUserDataArg - FieldPlatformHandle := self.FieldPlatformHandle - FieldPlatformHandleArg, FieldPlatformHandleFin := WrapVoidPtr(FieldPlatformHandle) - result.PlatformHandle = FieldPlatformHandleArg - FieldPlatformHandleRaw := self.FieldPlatformHandleRaw - FieldPlatformHandleRawArg, FieldPlatformHandleRawFin := WrapVoidPtr(FieldPlatformHandleRaw) - result.PlatformHandleRaw = FieldPlatformHandleRawArg - FieldPlatformWindowCreated := self.FieldPlatformWindowCreated - - result.PlatformWindowCreated = C.bool(FieldPlatformWindowCreated) - FieldPlatformRequestMove := self.FieldPlatformRequestMove - - result.PlatformRequestMove = C.bool(FieldPlatformRequestMove) - FieldPlatformRequestResize := self.FieldPlatformRequestResize - - result.PlatformRequestResize = C.bool(FieldPlatformRequestResize) - FieldPlatformRequestClose := self.FieldPlatformRequestClose - - result.PlatformRequestClose = C.bool(FieldPlatformRequestClose) - releaseFn = func() { - FieldDrawDataFin() - FieldRendererUserDataFin() - FieldPlatformUserDataFin() - FieldPlatformHandleFin() - FieldPlatformHandleRawFin() - } - return result, releaseFn -} - -func (self Viewport) c() (result C.ImGuiViewport, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newViewportFromC(cvalue *C.ImGuiViewport) *Viewport { - result := new(Viewport) - result.FieldID = ID(cvalue.ID) - result.FieldFlags = ViewportFlags(cvalue.Flags) - result.FieldPos = *(&Vec2{}).fromC(cvalue.Pos) - result.FieldSize = *(&Vec2{}).fromC(cvalue.Size) - result.FieldWorkPos = *(&Vec2{}).fromC(cvalue.WorkPos) - result.FieldWorkSize = *(&Vec2{}).fromC(cvalue.WorkSize) - result.FieldDpiScale = float32(cvalue.DpiScale) - result.FieldParentViewportId = ID(cvalue.ParentViewportId) - result.FieldDrawData = newDrawDataFromC(cvalue.DrawData) - result.FieldRendererUserData = unsafe.Pointer(cvalue.RendererUserData) - result.FieldPlatformUserData = unsafe.Pointer(cvalue.PlatformUserData) - result.FieldPlatformHandle = unsafe.Pointer(cvalue.PlatformHandle) - result.FieldPlatformHandleRaw = unsafe.Pointer(cvalue.PlatformHandleRaw) - result.FieldPlatformWindowCreated = cvalue.PlatformWindowCreated == C.bool(true) - result.FieldPlatformRequestMove = cvalue.PlatformRequestMove == C.bool(true) - result.FieldPlatformRequestResize = cvalue.PlatformRequestResize == C.bool(true) - result.FieldPlatformRequestClose = cvalue.PlatformRequestClose == C.bool(true) - return result -} - -// ImGuiViewport Private/Internals fields (cardinal sin: we are using inheritance!) -// Every instance of ImGuiViewport is in fact a ImGuiViewportP. -type ViewportP struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self ViewportP) handle() (result *C.ImGuiViewportP, releaseFn func()) { - result = (*C.ImGuiViewportP)(self.data) - return result, func() {} -} - -func (self ViewportP) c() (result C.ImGuiViewportP, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newViewportPFromC(cvalue *C.ImGuiViewportP) *ViewportP { - result := new(ViewportP) - result.data = unsafe.Pointer(cvalue) - return result -} - -// Storage for one window -type Window struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self Window) handle() (result *C.ImGuiWindow, releaseFn func()) { - result = (*C.ImGuiWindow)(self.data) - return result, func() {} -} - -func (self Window) c() (result C.ImGuiWindow, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newWindowFromC(cvalue *C.ImGuiWindow) *Window { - result := new(Window) - result.data = unsafe.Pointer(cvalue) - return result -} - -// [ALPHA] Rarely used / very advanced uses only. Use with SetNextWindowClass() and DockSpace() functions. -// Important: the content of this class is still highly WIP and likely to change and be refactored -// before we stabilize Docking features. Please be mindful if using this. -// Provide hints: -// - To the platform backend via altered viewport flags (enable/disable OS decoration, OS task bar icons, etc.) -// - To the platform backend for OS level parent/child relationships of viewport. -// - To the docking system for various options and filtering. -type WindowClass struct { - FieldClassId ID // User data. 0 = Default class (unclassed). Windows of different classes cannot be docked with each others. - FieldParentViewportId ID // Hint for the platform backend. -1: use default. 0: request platform backend to not parent the platform. != 0: request platform backend to create a parent<>child relationship between the platform windows. Not conforming backends are free to e.g. parent every viewport to the main viewport or not. - FieldViewportFlagsOverrideSet ViewportFlags // Viewport flags to set when a window of this class owns a viewport. This allows you to enforce OS decoration or task bar icon, override the defaults on a per-window basis. - FieldViewportFlagsOverrideClear ViewportFlags // Viewport flags to clear when a window of this class owns a viewport. This allows you to enforce OS decoration or task bar icon, override the defaults on a per-window basis. - FieldTabItemFlagsOverrideSet TabItemFlags // [EXPERIMENTAL] TabItem flags to set when a window of this class gets submitted into a dock node tab bar. May use with ImGuiTabItemFlags_Leading or ImGuiTabItemFlags_Trailing. - FieldDockNodeFlagsOverrideSet DockNodeFlags // [EXPERIMENTAL] Dock node flags to set when a window of this class is hosted by a dock node (it doesn't have to be selected!) - FieldDockingAlwaysTabBar bool // Set to true to enforce single floating windows of this class always having their own docking node (equivalent of setting the global io.ConfigDockingAlwaysTabBar) - FieldDockingAllowUnclassed bool // Set to true to allow windows of this class to be docked/merged with an unclassed window. // FIXME-DOCK: Move to DockNodeFlags override? -} - -func (self WindowClass) handle() (result *C.ImGuiWindowClass, releaseFn func()) { - result = new(C.ImGuiWindowClass) - FieldClassId := self.FieldClassId - - result.ClassId = C.ImGuiID(FieldClassId) - FieldParentViewportId := self.FieldParentViewportId - - result.ParentViewportId = C.ImGuiID(FieldParentViewportId) - FieldViewportFlagsOverrideSet := self.FieldViewportFlagsOverrideSet - - result.ViewportFlagsOverrideSet = C.ImGuiViewportFlags(FieldViewportFlagsOverrideSet) - FieldViewportFlagsOverrideClear := self.FieldViewportFlagsOverrideClear - - result.ViewportFlagsOverrideClear = C.ImGuiViewportFlags(FieldViewportFlagsOverrideClear) - FieldTabItemFlagsOverrideSet := self.FieldTabItemFlagsOverrideSet - - result.TabItemFlagsOverrideSet = C.ImGuiTabItemFlags(FieldTabItemFlagsOverrideSet) - FieldDockNodeFlagsOverrideSet := self.FieldDockNodeFlagsOverrideSet - - result.DockNodeFlagsOverrideSet = C.ImGuiDockNodeFlags(FieldDockNodeFlagsOverrideSet) - FieldDockingAlwaysTabBar := self.FieldDockingAlwaysTabBar - - result.DockingAlwaysTabBar = C.bool(FieldDockingAlwaysTabBar) - FieldDockingAllowUnclassed := self.FieldDockingAllowUnclassed - - result.DockingAllowUnclassed = C.bool(FieldDockingAllowUnclassed) - releaseFn = func() { - } - return result, releaseFn -} - -func (self WindowClass) c() (result C.ImGuiWindowClass, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newWindowClassFromC(cvalue *C.ImGuiWindowClass) *WindowClass { - result := new(WindowClass) - result.FieldClassId = ID(cvalue.ClassId) - result.FieldParentViewportId = ID(cvalue.ParentViewportId) - result.FieldViewportFlagsOverrideSet = ViewportFlags(cvalue.ViewportFlagsOverrideSet) - result.FieldViewportFlagsOverrideClear = ViewportFlags(cvalue.ViewportFlagsOverrideClear) - result.FieldTabItemFlagsOverrideSet = TabItemFlags(cvalue.TabItemFlagsOverrideSet) - result.FieldDockNodeFlagsOverrideSet = DockNodeFlags(cvalue.DockNodeFlagsOverrideSet) - result.FieldDockingAlwaysTabBar = cvalue.DockingAlwaysTabBar == C.bool(true) - result.FieldDockingAllowUnclassed = cvalue.DockingAllowUnclassed == C.bool(true) - return result -} - -type WindowDockStyle struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self WindowDockStyle) handle() (result *C.ImGuiWindowDockStyle, releaseFn func()) { - result = (*C.ImGuiWindowDockStyle)(self.data) - return result, func() {} -} - -func (self WindowDockStyle) c() (result C.ImGuiWindowDockStyle, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newWindowDockStyleFromC(cvalue *C.ImGuiWindowDockStyle) *WindowDockStyle { - result := new(WindowDockStyle) - result.data = unsafe.Pointer(cvalue) - return result -} - -// Windows data saved in imgui.ini file -// Because we never destroy or rename ImGuiWindowSettings, we can store the names in a separate buffer easily. -// (this is designed to be stored in a ImChunkStream buffer, with the variable-length Name following our structure) -type WindowSettings struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self WindowSettings) handle() (result *C.ImGuiWindowSettings, releaseFn func()) { - result = (*C.ImGuiWindowSettings)(self.data) - return result, func() {} -} - -func (self WindowSettings) c() (result C.ImGuiWindowSettings, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newWindowSettingsFromC(cvalue *C.ImGuiWindowSettings) *WindowSettings { - result := new(WindowSettings) - result.data = unsafe.Pointer(cvalue) - return result -} - -// Data saved for each window pushed into the stack -type WindowStackData struct { - FieldWindow *Window - FieldParentLastItemDataBackup LastItemData - FieldStackSizesOnBegin StackSizes // Store size of various stacks for asserting -} - -func (self WindowStackData) handle() (result *C.ImGuiWindowStackData, releaseFn func()) { - result = new(C.ImGuiWindowStackData) - FieldWindow := self.FieldWindow - FieldWindowArg, FieldWindowFin := FieldWindow.handle() - result.Window = FieldWindowArg - FieldParentLastItemDataBackup := self.FieldParentLastItemDataBackup - FieldParentLastItemDataBackupArg, FieldParentLastItemDataBackupFin := FieldParentLastItemDataBackup.c() - result.ParentLastItemDataBackup = FieldParentLastItemDataBackupArg - FieldStackSizesOnBegin := self.FieldStackSizesOnBegin - FieldStackSizesOnBeginArg, FieldStackSizesOnBeginFin := FieldStackSizesOnBegin.c() - result.StackSizesOnBegin = FieldStackSizesOnBeginArg - releaseFn = func() { - FieldWindowFin() - FieldParentLastItemDataBackupFin() - FieldStackSizesOnBeginFin() - } - return result, releaseFn -} - -func (self WindowStackData) c() (result C.ImGuiWindowStackData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newWindowStackDataFromC(cvalue *C.ImGuiWindowStackData) *WindowStackData { - result := new(WindowStackData) - result.FieldWindow = newWindowFromC(cvalue.Window) - result.FieldParentLastItemDataBackup = *newLastItemDataFromC(func() *C.ImGuiLastItemData { result := cvalue.ParentLastItemDataBackup; return &result }()) - - result.FieldStackSizesOnBegin = *newStackSizesFromC(func() *C.ImGuiStackSizes { result := cvalue.StackSizesOnBegin; return &result }()) - - return result -} - -// Transient per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the DC variable name in ImGuiWindow. -// (That's theory, in practice the delimitation between ImGuiWindow and ImGuiWindowTempData is quite tenuous and could be reconsidered..) -// (This doesn't need a constructor because we zero-clear it as part of ImGuiWindow and all frame-temporary data are setup on Begin) -type WindowTempData struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self WindowTempData) handle() (result *C.ImGuiWindowTempData, releaseFn func()) { - result = (*C.ImGuiWindowTempData)(self.data) - return result, func() {} -} - -func (self WindowTempData) c() (result C.ImGuiWindowTempData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newWindowTempDataFromC(cvalue *C.ImGuiWindowTempData) *WindowTempData { - result := new(WindowTempData) - result.data = unsafe.Pointer(cvalue) - return result -} - -type Vec1 struct { - FieldX float32 -} - -func (self Vec1) handle() (result *C.ImVec1, releaseFn func()) { - result = new(C.ImVec1) - FieldX := self.FieldX - - result.x = C.float(FieldX) - releaseFn = func() { - } - return result, releaseFn -} - -func (self Vec1) c() (result C.ImVec1, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newVec1FromC(cvalue *C.ImVec1) *Vec1 { - result := new(Vec1) - result.FieldX = float32(cvalue.x) - return result -} - -type STBTexteditState struct { - FieldCursor int32 - FieldSelect_start int32 // selection start point - FieldSelect_end int32 - FieldInsert_mode uint - FieldRow_count_per_page int32 - ///////////////////// - // - // private data - // - FieldCursor_at_end_of_line uint // not implemented yet - FieldInitialized uint - FieldHas_preferred_x uint - FieldSingle_line uint - FieldPadding1 uint - FieldPadding2 uint - FieldPadding3 uint - FieldPreferred_x float32 // this determines where the cursor up/down tries to seek to along x - FieldUndostate StbUndoState -} - -func (self STBTexteditState) handle() (result *C.STB_TexteditState, releaseFn func()) { - result = new(C.STB_TexteditState) - FieldCursor := self.FieldCursor - - result.cursor = C.int(FieldCursor) - FieldSelect_start := self.FieldSelect_start - - result.select_start = C.int(FieldSelect_start) - FieldSelect_end := self.FieldSelect_end - - result.select_end = C.int(FieldSelect_end) - FieldInsert_mode := self.FieldInsert_mode - - result.insert_mode = C.uchar(FieldInsert_mode) - FieldRow_count_per_page := self.FieldRow_count_per_page - - result.row_count_per_page = C.int(FieldRow_count_per_page) - FieldCursor_at_end_of_line := self.FieldCursor_at_end_of_line - - result.cursor_at_end_of_line = C.uchar(FieldCursor_at_end_of_line) - FieldInitialized := self.FieldInitialized - - result.initialized = C.uchar(FieldInitialized) - FieldHas_preferred_x := self.FieldHas_preferred_x - - result.has_preferred_x = C.uchar(FieldHas_preferred_x) - FieldSingle_line := self.FieldSingle_line - - result.single_line = C.uchar(FieldSingle_line) - FieldPadding1 := self.FieldPadding1 - - result.padding1 = C.uchar(FieldPadding1) - FieldPadding2 := self.FieldPadding2 - - result.padding2 = C.uchar(FieldPadding2) - FieldPadding3 := self.FieldPadding3 - - result.padding3 = C.uchar(FieldPadding3) - FieldPreferred_x := self.FieldPreferred_x - - result.preferred_x = C.float(FieldPreferred_x) - FieldUndostate := self.FieldUndostate - FieldUndostateArg, FieldUndostateFin := FieldUndostate.c() - result.undostate = FieldUndostateArg - releaseFn = func() { - FieldUndostateFin() - } - return result, releaseFn -} - -func (self STBTexteditState) c() (result C.STB_TexteditState, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newSTBTexteditStateFromC(cvalue *C.STB_TexteditState) *STBTexteditState { - result := new(STBTexteditState) - result.FieldCursor = int32(cvalue.cursor) - result.FieldSelect_start = int32(cvalue.select_start) - result.FieldSelect_end = int32(cvalue.select_end) - result.FieldInsert_mode = uint(cvalue.insert_mode) - result.FieldRow_count_per_page = int32(cvalue.row_count_per_page) - result.FieldCursor_at_end_of_line = uint(cvalue.cursor_at_end_of_line) - result.FieldInitialized = uint(cvalue.initialized) - result.FieldHas_preferred_x = uint(cvalue.has_preferred_x) - result.FieldSingle_line = uint(cvalue.single_line) - result.FieldPadding1 = uint(cvalue.padding1) - result.FieldPadding2 = uint(cvalue.padding2) - result.FieldPadding3 = uint(cvalue.padding3) - result.FieldPreferred_x = float32(cvalue.preferred_x) - result.FieldUndostate = *newStbUndoStateFromC(func() *C.StbUndoState { result := cvalue.undostate; return &result }()) - - return result -} - -// result of layout query -type StbTexteditRow struct { - FieldX0 float32 // starting x location, end x location (allows for align=right, etc) - FieldX1 float32 // starting x location, end x location (allows for align=right, etc) - FieldBaseline_y_delta float32 // position of baseline relative to previous row's baseline - FieldYmin float32 // height of row above and below baseline - FieldYmax float32 // height of row above and below baseline - FieldNum_chars int32 -} - -func (self StbTexteditRow) handle() (result *C.StbTexteditRow, releaseFn func()) { - result = new(C.StbTexteditRow) - FieldX0 := self.FieldX0 - - result.x0 = C.float(FieldX0) - FieldX1 := self.FieldX1 - - result.x1 = C.float(FieldX1) - FieldBaseline_y_delta := self.FieldBaseline_y_delta - - result.baseline_y_delta = C.float(FieldBaseline_y_delta) - FieldYmin := self.FieldYmin - - result.ymin = C.float(FieldYmin) - FieldYmax := self.FieldYmax - - result.ymax = C.float(FieldYmax) - FieldNum_chars := self.FieldNum_chars - - result.num_chars = C.int(FieldNum_chars) - releaseFn = func() { - } - return result, releaseFn -} - -func (self StbTexteditRow) c() (result C.StbTexteditRow, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newStbTexteditRowFromC(cvalue *C.StbTexteditRow) *StbTexteditRow { - result := new(StbTexteditRow) - result.FieldX0 = float32(cvalue.x0) - result.FieldX1 = float32(cvalue.x1) - result.FieldBaseline_y_delta = float32(cvalue.baseline_y_delta) - result.FieldYmin = float32(cvalue.ymin) - result.FieldYmax = float32(cvalue.ymax) - result.FieldNum_chars = int32(cvalue.num_chars) - return result -} - -// ////////////////////////////////////////////////////////////////////// -// -// STB_TexteditState -// -// Definition of STB_TexteditState which you should store -// per-textfield; it includes cursor position, selection state, -// and undo state. -type StbUndoRecord struct { - // private data - FieldWhere int32 - FieldInsert_length int32 - FieldDelete_length int32 - FieldChar_storage int32 -} - -func (self StbUndoRecord) handle() (result *C.StbUndoRecord, releaseFn func()) { - result = new(C.StbUndoRecord) - FieldWhere := self.FieldWhere - - result.where = C.int(FieldWhere) - FieldInsert_length := self.FieldInsert_length - - result.insert_length = C.int(FieldInsert_length) - FieldDelete_length := self.FieldDelete_length - - result.delete_length = C.int(FieldDelete_length) - FieldChar_storage := self.FieldChar_storage - - result.char_storage = C.int(FieldChar_storage) - releaseFn = func() { - } - return result, releaseFn -} - -func (self StbUndoRecord) c() (result C.StbUndoRecord, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newStbUndoRecordFromC(cvalue *C.StbUndoRecord) *StbUndoRecord { - result := new(StbUndoRecord) - result.FieldWhere = int32(cvalue.where) - result.FieldInsert_length = int32(cvalue.insert_length) - result.FieldDelete_length = int32(cvalue.delete_length) - result.FieldChar_storage = int32(cvalue.char_storage) - return result -} - -type StbUndoState struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self StbUndoState) handle() (result *C.StbUndoState, releaseFn func()) { - result = (*C.StbUndoState)(self.data) - return result, func() {} -} - -func (self StbUndoState) c() (result C.StbUndoState, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newStbUndoStateFromC(cvalue *C.StbUndoState) *StbUndoState { - result := new(StbUndoState) - result.data = unsafe.Pointer(cvalue) - return result -} diff --git a/cimgui_test.go b/cimgui_test.go index 403432d70..e11d57ef3 100644 --- a/cimgui_test.go +++ b/cimgui_test.go @@ -9,7 +9,7 @@ func TestSetIOConfigFlags(t *testing.T) { defer DestroyContext() io := CurrentIO() - if io.data == nil { + if io.CData == nil { t.Error("get io failed") } diff --git a/cimgui_typedefs.cpp b/cimgui_typedefs.cpp new file mode 100644 index 000000000..c8aeb3ad5 --- /dev/null +++ b/cimgui_typedefs.cpp @@ -0,0 +1,14 @@ +// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. +// DO NOT EDIT. + + +#include "cimgui_typedefs.h" +#include "cimgui/cimgui.h" + +uintptr_t ImTextureID_toUintptr(ImTextureID ptr) { + return (uintptr_t)ptr; +} + +ImTextureID ImTextureID_fromUintptr(uintptr_t ptr) { + return (ImTextureID)ptr; +} diff --git a/cimgui_typedefs.go b/cimgui_typedefs.go new file mode 100644 index 000000000..9b12bb672 --- /dev/null +++ b/cimgui_typedefs.go @@ -0,0 +1,1927 @@ +// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. +// DO NOT EDIT. + +package imgui + +// #include +// #include +// #include "extra_types.h" +// #include "cimgui_wrapper.h" +// #include "cimgui_typedefs.h" +import "C" + +type BitArrayPtr struct { + Data *uint32 +} + +func (self *BitArrayPtr) handle() (*C.ImBitArrayPtr, func()) { + result, fn := self.c() + return &result, fn +} + +func (selfStruct *BitArrayPtr) c() (result C.ImBitArrayPtr, fin func()) { + self := selfStruct.Data + selfArg, selfFin := WrapNumberPtr[C.ImU32, uint32](self) + return (C.ImBitArrayPtr)(selfArg), func() { selfFin() } +} + +func newBitArrayPtrFromC(cvalue *C.ImBitArrayPtr) *BitArrayPtr { + v := (*C.ImU32)(*cvalue) + return &BitArrayPtr{Data: (*uint32)(v)} +} + +type BitVector struct { + CData *C.ImBitVector +} + +func (self *BitVector) handle() (result *C.ImBitVector, fin func()) { + return self.CData, func() {} +} + +func (self BitVector) c() (C.ImBitVector, func()) { + result, fn := self.handle() + return *result, fn +} + +func newBitVectorFromC(cvalue *C.ImBitVector) *BitVector { + return &BitVector{CData: cvalue} +} + +type DrawChannel struct { + CData *C.ImDrawChannel +} + +func (self *DrawChannel) handle() (result *C.ImDrawChannel, fin func()) { + return self.CData, func() {} +} + +func (self DrawChannel) c() (C.ImDrawChannel, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDrawChannelFromC(cvalue *C.ImDrawChannel) *DrawChannel { + return &DrawChannel{CData: cvalue} +} + +type DrawCmd struct { + CData *C.ImDrawCmd +} + +func (self *DrawCmd) handle() (result *C.ImDrawCmd, fin func()) { + return self.CData, func() {} +} + +func (self DrawCmd) c() (C.ImDrawCmd, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDrawCmdFromC(cvalue *C.ImDrawCmd) *DrawCmd { + return &DrawCmd{CData: cvalue} +} + +type DrawCmdHeader struct { + CData *C.ImDrawCmdHeader +} + +func (self *DrawCmdHeader) handle() (result *C.ImDrawCmdHeader, fin func()) { + return self.CData, func() {} +} + +func (self DrawCmdHeader) c() (C.ImDrawCmdHeader, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDrawCmdHeaderFromC(cvalue *C.ImDrawCmdHeader) *DrawCmdHeader { + return &DrawCmdHeader{CData: cvalue} +} + +type DrawData struct { + CData *C.ImDrawData +} + +func (self *DrawData) handle() (result *C.ImDrawData, fin func()) { + return self.CData, func() {} +} + +func (self DrawData) c() (C.ImDrawData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDrawDataFromC(cvalue *C.ImDrawData) *DrawData { + return &DrawData{CData: cvalue} +} + +type DrawDataBuilder struct { + CData *C.ImDrawDataBuilder +} + +func (self *DrawDataBuilder) handle() (result *C.ImDrawDataBuilder, fin func()) { + return self.CData, func() {} +} + +func (self DrawDataBuilder) c() (C.ImDrawDataBuilder, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDrawDataBuilderFromC(cvalue *C.ImDrawDataBuilder) *DrawDataBuilder { + return &DrawDataBuilder{CData: cvalue} +} + +type DrawList struct { + CData *C.ImDrawList +} + +func (self *DrawList) handle() (result *C.ImDrawList, fin func()) { + return self.CData, func() {} +} + +func (self DrawList) c() (C.ImDrawList, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDrawListFromC(cvalue *C.ImDrawList) *DrawList { + return &DrawList{CData: cvalue} +} + +type DrawListSharedData struct { + CData *C.ImDrawListSharedData +} + +func (self *DrawListSharedData) handle() (result *C.ImDrawListSharedData, fin func()) { + return self.CData, func() {} +} + +func (self DrawListSharedData) c() (C.ImDrawListSharedData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDrawListSharedDataFromC(cvalue *C.ImDrawListSharedData) *DrawListSharedData { + return &DrawListSharedData{CData: cvalue} +} + +type DrawListSplitter struct { + CData *C.ImDrawListSplitter +} + +func (self *DrawListSplitter) handle() (result *C.ImDrawListSplitter, fin func()) { + return self.CData, func() {} +} + +func (self DrawListSplitter) c() (C.ImDrawListSplitter, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDrawListSplitterFromC(cvalue *C.ImDrawListSplitter) *DrawListSplitter { + return &DrawListSplitter{CData: cvalue} +} + +type DrawVert struct { + CData *C.ImDrawVert +} + +func (self *DrawVert) handle() (result *C.ImDrawVert, fin func()) { + return self.CData, func() {} +} + +func (self DrawVert) c() (C.ImDrawVert, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDrawVertFromC(cvalue *C.ImDrawVert) *DrawVert { + return &DrawVert{CData: cvalue} +} + +type Font struct { + CData *C.ImFont +} + +func (self *Font) handle() (result *C.ImFont, fin func()) { + return self.CData, func() {} +} + +func (self Font) c() (C.ImFont, func()) { + result, fn := self.handle() + return *result, fn +} + +func newFontFromC(cvalue *C.ImFont) *Font { + return &Font{CData: cvalue} +} + +type FontAtlas struct { + CData *C.ImFontAtlas +} + +func (self *FontAtlas) handle() (result *C.ImFontAtlas, fin func()) { + return self.CData, func() {} +} + +func (self FontAtlas) c() (C.ImFontAtlas, func()) { + result, fn := self.handle() + return *result, fn +} + +func newFontAtlasFromC(cvalue *C.ImFontAtlas) *FontAtlas { + return &FontAtlas{CData: cvalue} +} + +type FontAtlasCustomRect struct { + CData *C.ImFontAtlasCustomRect +} + +func (self *FontAtlasCustomRect) handle() (result *C.ImFontAtlasCustomRect, fin func()) { + return self.CData, func() {} +} + +func (self FontAtlasCustomRect) c() (C.ImFontAtlasCustomRect, func()) { + result, fn := self.handle() + return *result, fn +} + +func newFontAtlasCustomRectFromC(cvalue *C.ImFontAtlasCustomRect) *FontAtlasCustomRect { + return &FontAtlasCustomRect{CData: cvalue} +} + +type FontBuilderIO struct { + CData *C.ImFontBuilderIO +} + +func (self *FontBuilderIO) handle() (result *C.ImFontBuilderIO, fin func()) { + return self.CData, func() {} +} + +func (self FontBuilderIO) c() (C.ImFontBuilderIO, func()) { + result, fn := self.handle() + return *result, fn +} + +func newFontBuilderIOFromC(cvalue *C.ImFontBuilderIO) *FontBuilderIO { + return &FontBuilderIO{CData: cvalue} +} + +type FontConfig struct { + CData *C.ImFontConfig +} + +func (self *FontConfig) handle() (result *C.ImFontConfig, fin func()) { + return self.CData, func() {} +} + +func (self FontConfig) c() (C.ImFontConfig, func()) { + result, fn := self.handle() + return *result, fn +} + +func newFontConfigFromC(cvalue *C.ImFontConfig) *FontConfig { + return &FontConfig{CData: cvalue} +} + +type FontGlyph struct { + CData *C.ImFontGlyph +} + +func (self *FontGlyph) handle() (result *C.ImFontGlyph, fin func()) { + return self.CData, func() {} +} + +func (self FontGlyph) c() (C.ImFontGlyph, func()) { + result, fn := self.handle() + return *result, fn +} + +func newFontGlyphFromC(cvalue *C.ImFontGlyph) *FontGlyph { + return &FontGlyph{CData: cvalue} +} + +type FontGlyphRangesBuilder struct { + CData *C.ImFontGlyphRangesBuilder +} + +func (self *FontGlyphRangesBuilder) handle() (result *C.ImFontGlyphRangesBuilder, fin func()) { + return self.CData, func() {} +} + +func (self FontGlyphRangesBuilder) c() (C.ImFontGlyphRangesBuilder, func()) { + result, fn := self.handle() + return *result, fn +} + +func newFontGlyphRangesBuilderFromC(cvalue *C.ImFontGlyphRangesBuilder) *FontGlyphRangesBuilder { + return &FontGlyphRangesBuilder{CData: cvalue} +} + +type ColorMod struct { + CData *C.ImGuiColorMod +} + +func (self *ColorMod) handle() (result *C.ImGuiColorMod, fin func()) { + return self.CData, func() {} +} + +func (self ColorMod) c() (C.ImGuiColorMod, func()) { + result, fn := self.handle() + return *result, fn +} + +func newColorModFromC(cvalue *C.ImGuiColorMod) *ColorMod { + return &ColorMod{CData: cvalue} +} + +type ComboPreviewData struct { + CData *C.ImGuiComboPreviewData +} + +func (self *ComboPreviewData) handle() (result *C.ImGuiComboPreviewData, fin func()) { + return self.CData, func() {} +} + +func (self ComboPreviewData) c() (C.ImGuiComboPreviewData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newComboPreviewDataFromC(cvalue *C.ImGuiComboPreviewData) *ComboPreviewData { + return &ComboPreviewData{CData: cvalue} +} + +type Context struct { + CData *C.ImGuiContext +} + +func (self *Context) handle() (result *C.ImGuiContext, fin func()) { + return self.CData, func() {} +} + +func (self Context) c() (C.ImGuiContext, func()) { + result, fn := self.handle() + return *result, fn +} + +func newContextFromC(cvalue *C.ImGuiContext) *Context { + return &Context{CData: cvalue} +} + +type ContextHook struct { + CData *C.ImGuiContextHook +} + +func (self *ContextHook) handle() (result *C.ImGuiContextHook, fin func()) { + return self.CData, func() {} +} + +func (self ContextHook) c() (C.ImGuiContextHook, func()) { + result, fn := self.handle() + return *result, fn +} + +func newContextHookFromC(cvalue *C.ImGuiContextHook) *ContextHook { + return &ContextHook{CData: cvalue} +} + +type DataTypeInfo struct { + CData *C.ImGuiDataTypeInfo +} + +func (self *DataTypeInfo) handle() (result *C.ImGuiDataTypeInfo, fin func()) { + return self.CData, func() {} +} + +func (self DataTypeInfo) c() (C.ImGuiDataTypeInfo, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDataTypeInfoFromC(cvalue *C.ImGuiDataTypeInfo) *DataTypeInfo { + return &DataTypeInfo{CData: cvalue} +} + +type DataTypeTempStorage struct { + CData *C.ImGuiDataTypeTempStorage +} + +func (self *DataTypeTempStorage) handle() (result *C.ImGuiDataTypeTempStorage, fin func()) { + return self.CData, func() {} +} + +func (self DataTypeTempStorage) c() (C.ImGuiDataTypeTempStorage, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDataTypeTempStorageFromC(cvalue *C.ImGuiDataTypeTempStorage) *DataTypeTempStorage { + return &DataTypeTempStorage{CData: cvalue} +} + +type DataVarInfo struct { + CData *C.ImGuiDataVarInfo +} + +func (self *DataVarInfo) handle() (result *C.ImGuiDataVarInfo, fin func()) { + return self.CData, func() {} +} + +func (self DataVarInfo) c() (C.ImGuiDataVarInfo, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDataVarInfoFromC(cvalue *C.ImGuiDataVarInfo) *DataVarInfo { + return &DataVarInfo{CData: cvalue} +} + +type DockContext struct { + CData *C.ImGuiDockContext +} + +func (self *DockContext) handle() (result *C.ImGuiDockContext, fin func()) { + return self.CData, func() {} +} + +func (self DockContext) c() (C.ImGuiDockContext, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDockContextFromC(cvalue *C.ImGuiDockContext) *DockContext { + return &DockContext{CData: cvalue} +} + +type DockNode struct { + CData *C.ImGuiDockNode +} + +func (self *DockNode) handle() (result *C.ImGuiDockNode, fin func()) { + return self.CData, func() {} +} + +func (self DockNode) c() (C.ImGuiDockNode, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDockNodeFromC(cvalue *C.ImGuiDockNode) *DockNode { + return &DockNode{CData: cvalue} +} + +type DockNodeSettings struct { + CData *C.ImGuiDockNodeSettings +} + +func (self *DockNodeSettings) handle() (result *C.ImGuiDockNodeSettings, fin func()) { + return self.CData, func() {} +} + +func newDockNodeSettingsFromC(cvalue *C.ImGuiDockNodeSettings) *DockNodeSettings { + return &DockNodeSettings{CData: cvalue} +} + +type DockRequest struct { + CData *C.ImGuiDockRequest +} + +func (self *DockRequest) handle() (result *C.ImGuiDockRequest, fin func()) { + return self.CData, func() {} +} + +func newDockRequestFromC(cvalue *C.ImGuiDockRequest) *DockRequest { + return &DockRequest{CData: cvalue} +} + +type GroupData struct { + CData *C.ImGuiGroupData +} + +func (self *GroupData) handle() (result *C.ImGuiGroupData, fin func()) { + return self.CData, func() {} +} + +func (self GroupData) c() (C.ImGuiGroupData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newGroupDataFromC(cvalue *C.ImGuiGroupData) *GroupData { + return &GroupData{CData: cvalue} +} + +type ID uint32 + +func (selfSrc *ID) handle() (result *C.ImGuiID, fin func()) { + self := (*uint32)(selfSrc) + selfArg, selfFin := WrapNumberPtr[C.uint, uint32](self) + return (*C.ImGuiID)(selfArg), func() { selfFin() } +} + +func (self ID) c() (C.ImGuiID, func()) { + return (C.ImGuiID)(C.uint(self)), func() {} +} + +func newIDFromC(cvalue *C.ImGuiID) *ID { + return (*ID)((*uint32)(cvalue)) +} + +type IO struct { + CData *C.ImGuiIO +} + +func (self *IO) handle() (result *C.ImGuiIO, fin func()) { + return self.CData, func() {} +} + +func (self IO) c() (C.ImGuiIO, func()) { + result, fn := self.handle() + return *result, fn +} + +func newIOFromC(cvalue *C.ImGuiIO) *IO { + return &IO{CData: cvalue} +} + +type InputEvent struct { + CData *C.ImGuiInputEvent +} + +func (self *InputEvent) handle() (result *C.ImGuiInputEvent, fin func()) { + return self.CData, func() {} +} + +func (self InputEvent) c() (C.ImGuiInputEvent, func()) { + result, fn := self.handle() + return *result, fn +} + +func newInputEventFromC(cvalue *C.ImGuiInputEvent) *InputEvent { + return &InputEvent{CData: cvalue} +} + +type InputEventAppFocused struct { + CData *C.ImGuiInputEventAppFocused +} + +func (self *InputEventAppFocused) handle() (result *C.ImGuiInputEventAppFocused, fin func()) { + return self.CData, func() {} +} + +func (self InputEventAppFocused) c() (C.ImGuiInputEventAppFocused, func()) { + result, fn := self.handle() + return *result, fn +} + +func newInputEventAppFocusedFromC(cvalue *C.ImGuiInputEventAppFocused) *InputEventAppFocused { + return &InputEventAppFocused{CData: cvalue} +} + +type InputEventKey struct { + CData *C.ImGuiInputEventKey +} + +func (self *InputEventKey) handle() (result *C.ImGuiInputEventKey, fin func()) { + return self.CData, func() {} +} + +func (self InputEventKey) c() (C.ImGuiInputEventKey, func()) { + result, fn := self.handle() + return *result, fn +} + +func newInputEventKeyFromC(cvalue *C.ImGuiInputEventKey) *InputEventKey { + return &InputEventKey{CData: cvalue} +} + +type InputEventMouseButton struct { + CData *C.ImGuiInputEventMouseButton +} + +func (self *InputEventMouseButton) handle() (result *C.ImGuiInputEventMouseButton, fin func()) { + return self.CData, func() {} +} + +func (self InputEventMouseButton) c() (C.ImGuiInputEventMouseButton, func()) { + result, fn := self.handle() + return *result, fn +} + +func newInputEventMouseButtonFromC(cvalue *C.ImGuiInputEventMouseButton) *InputEventMouseButton { + return &InputEventMouseButton{CData: cvalue} +} + +type InputEventMousePos struct { + CData *C.ImGuiInputEventMousePos +} + +func (self *InputEventMousePos) handle() (result *C.ImGuiInputEventMousePos, fin func()) { + return self.CData, func() {} +} + +func (self InputEventMousePos) c() (C.ImGuiInputEventMousePos, func()) { + result, fn := self.handle() + return *result, fn +} + +func newInputEventMousePosFromC(cvalue *C.ImGuiInputEventMousePos) *InputEventMousePos { + return &InputEventMousePos{CData: cvalue} +} + +type InputEventMouseViewport struct { + CData *C.ImGuiInputEventMouseViewport +} + +func (self *InputEventMouseViewport) handle() (result *C.ImGuiInputEventMouseViewport, fin func()) { + return self.CData, func() {} +} + +func (self InputEventMouseViewport) c() (C.ImGuiInputEventMouseViewport, func()) { + result, fn := self.handle() + return *result, fn +} + +func newInputEventMouseViewportFromC(cvalue *C.ImGuiInputEventMouseViewport) *InputEventMouseViewport { + return &InputEventMouseViewport{CData: cvalue} +} + +type InputEventMouseWheel struct { + CData *C.ImGuiInputEventMouseWheel +} + +func (self *InputEventMouseWheel) handle() (result *C.ImGuiInputEventMouseWheel, fin func()) { + return self.CData, func() {} +} + +func (self InputEventMouseWheel) c() (C.ImGuiInputEventMouseWheel, func()) { + result, fn := self.handle() + return *result, fn +} + +func newInputEventMouseWheelFromC(cvalue *C.ImGuiInputEventMouseWheel) *InputEventMouseWheel { + return &InputEventMouseWheel{CData: cvalue} +} + +type InputEventText struct { + CData *C.ImGuiInputEventText +} + +func (self *InputEventText) handle() (result *C.ImGuiInputEventText, fin func()) { + return self.CData, func() {} +} + +func (self InputEventText) c() (C.ImGuiInputEventText, func()) { + result, fn := self.handle() + return *result, fn +} + +func newInputEventTextFromC(cvalue *C.ImGuiInputEventText) *InputEventText { + return &InputEventText{CData: cvalue} +} + +type InputTextCallbackData struct { + CData *C.ImGuiInputTextCallbackData +} + +func (self *InputTextCallbackData) handle() (result *C.ImGuiInputTextCallbackData, fin func()) { + return self.CData, func() {} +} + +func (self InputTextCallbackData) c() (C.ImGuiInputTextCallbackData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newInputTextCallbackDataFromC(cvalue *C.ImGuiInputTextCallbackData) *InputTextCallbackData { + return &InputTextCallbackData{CData: cvalue} +} + +type InputTextDeactivateData struct { + CData *C.ImGuiInputTextDeactivateData +} + +func (self *InputTextDeactivateData) handle() (result *C.ImGuiInputTextDeactivateData, fin func()) { + return self.CData, func() {} +} + +func newInputTextDeactivateDataFromC(cvalue *C.ImGuiInputTextDeactivateData) *InputTextDeactivateData { + return &InputTextDeactivateData{CData: cvalue} +} + +type InputTextDeactivatedState struct { + CData *C.ImGuiInputTextDeactivatedState +} + +func (self *InputTextDeactivatedState) handle() (result *C.ImGuiInputTextDeactivatedState, fin func()) { + return self.CData, func() {} +} + +func (self InputTextDeactivatedState) c() (C.ImGuiInputTextDeactivatedState, func()) { + result, fn := self.handle() + return *result, fn +} + +func newInputTextDeactivatedStateFromC(cvalue *C.ImGuiInputTextDeactivatedState) *InputTextDeactivatedState { + return &InputTextDeactivatedState{CData: cvalue} +} + +type InputTextState struct { + CData *C.ImGuiInputTextState +} + +func (self *InputTextState) handle() (result *C.ImGuiInputTextState, fin func()) { + return self.CData, func() {} +} + +func (self InputTextState) c() (C.ImGuiInputTextState, func()) { + result, fn := self.handle() + return *result, fn +} + +func newInputTextStateFromC(cvalue *C.ImGuiInputTextState) *InputTextState { + return &InputTextState{CData: cvalue} +} + +type KeyChord int32 + +func (selfSrc *KeyChord) handle() (result *C.ImGuiKeyChord, fin func()) { + self := (*int32)(selfSrc) + selfArg, selfFin := WrapNumberPtr[C.int, int32](self) + return (*C.ImGuiKeyChord)(selfArg), func() { selfFin() } +} + +func (self KeyChord) c() (C.ImGuiKeyChord, func()) { + return (C.ImGuiKeyChord)(C.int(self)), func() {} +} + +func newKeyChordFromC(cvalue *C.ImGuiKeyChord) *KeyChord { + return (*KeyChord)((*int32)(cvalue)) +} + +type KeyData struct { + CData *C.ImGuiKeyData +} + +func (self *KeyData) handle() (result *C.ImGuiKeyData, fin func()) { + return self.CData, func() {} +} + +func (self KeyData) c() (C.ImGuiKeyData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newKeyDataFromC(cvalue *C.ImGuiKeyData) *KeyData { + return &KeyData{CData: cvalue} +} + +type KeyOwnerData struct { + CData *C.ImGuiKeyOwnerData +} + +func (self *KeyOwnerData) handle() (result *C.ImGuiKeyOwnerData, fin func()) { + return self.CData, func() {} +} + +func (self KeyOwnerData) c() (C.ImGuiKeyOwnerData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newKeyOwnerDataFromC(cvalue *C.ImGuiKeyOwnerData) *KeyOwnerData { + return &KeyOwnerData{CData: cvalue} +} + +type KeyRoutingData struct { + CData *C.ImGuiKeyRoutingData +} + +func (self *KeyRoutingData) handle() (result *C.ImGuiKeyRoutingData, fin func()) { + return self.CData, func() {} +} + +func (self KeyRoutingData) c() (C.ImGuiKeyRoutingData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newKeyRoutingDataFromC(cvalue *C.ImGuiKeyRoutingData) *KeyRoutingData { + return &KeyRoutingData{CData: cvalue} +} + +type KeyRoutingTable struct { + CData *C.ImGuiKeyRoutingTable +} + +func (self *KeyRoutingTable) handle() (result *C.ImGuiKeyRoutingTable, fin func()) { + return self.CData, func() {} +} + +func (self KeyRoutingTable) c() (C.ImGuiKeyRoutingTable, func()) { + result, fn := self.handle() + return *result, fn +} + +func newKeyRoutingTableFromC(cvalue *C.ImGuiKeyRoutingTable) *KeyRoutingTable { + return &KeyRoutingTable{CData: cvalue} +} + +type LastItemData struct { + CData *C.ImGuiLastItemData +} + +func (self *LastItemData) handle() (result *C.ImGuiLastItemData, fin func()) { + return self.CData, func() {} +} + +func (self LastItemData) c() (C.ImGuiLastItemData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newLastItemDataFromC(cvalue *C.ImGuiLastItemData) *LastItemData { + return &LastItemData{CData: cvalue} +} + +type ListClipper struct { + CData *C.ImGuiListClipper +} + +func (self *ListClipper) handle() (result *C.ImGuiListClipper, fin func()) { + return self.CData, func() {} +} + +func (self ListClipper) c() (C.ImGuiListClipper, func()) { + result, fn := self.handle() + return *result, fn +} + +func newListClipperFromC(cvalue *C.ImGuiListClipper) *ListClipper { + return &ListClipper{CData: cvalue} +} + +type ListClipperData struct { + CData *C.ImGuiListClipperData +} + +func (self *ListClipperData) handle() (result *C.ImGuiListClipperData, fin func()) { + return self.CData, func() {} +} + +func (self ListClipperData) c() (C.ImGuiListClipperData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newListClipperDataFromC(cvalue *C.ImGuiListClipperData) *ListClipperData { + return &ListClipperData{CData: cvalue} +} + +type ListClipperRange struct { + CData *C.ImGuiListClipperRange +} + +func (self *ListClipperRange) handle() (result *C.ImGuiListClipperRange, fin func()) { + return self.CData, func() {} +} + +func (self ListClipperRange) c() (C.ImGuiListClipperRange, func()) { + result, fn := self.handle() + return *result, fn +} + +func newListClipperRangeFromC(cvalue *C.ImGuiListClipperRange) *ListClipperRange { + return &ListClipperRange{CData: cvalue} +} + +type LocEntry struct { + CData *C.ImGuiLocEntry +} + +func (self *LocEntry) handle() (result *C.ImGuiLocEntry, fin func()) { + return self.CData, func() {} +} + +func (self LocEntry) c() (C.ImGuiLocEntry, func()) { + result, fn := self.handle() + return *result, fn +} + +func newLocEntryFromC(cvalue *C.ImGuiLocEntry) *LocEntry { + return &LocEntry{CData: cvalue} +} + +type MenuColumns struct { + CData *C.ImGuiMenuColumns +} + +func (self *MenuColumns) handle() (result *C.ImGuiMenuColumns, fin func()) { + return self.CData, func() {} +} + +func (self MenuColumns) c() (C.ImGuiMenuColumns, func()) { + result, fn := self.handle() + return *result, fn +} + +func newMenuColumnsFromC(cvalue *C.ImGuiMenuColumns) *MenuColumns { + return &MenuColumns{CData: cvalue} +} + +type MetricsConfig struct { + CData *C.ImGuiMetricsConfig +} + +func (self *MetricsConfig) handle() (result *C.ImGuiMetricsConfig, fin func()) { + return self.CData, func() {} +} + +func (self MetricsConfig) c() (C.ImGuiMetricsConfig, func()) { + result, fn := self.handle() + return *result, fn +} + +func newMetricsConfigFromC(cvalue *C.ImGuiMetricsConfig) *MetricsConfig { + return &MetricsConfig{CData: cvalue} +} + +type NavItemData struct { + CData *C.ImGuiNavItemData +} + +func (self *NavItemData) handle() (result *C.ImGuiNavItemData, fin func()) { + return self.CData, func() {} +} + +func (self NavItemData) c() (C.ImGuiNavItemData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newNavItemDataFromC(cvalue *C.ImGuiNavItemData) *NavItemData { + return &NavItemData{CData: cvalue} +} + +type NavTreeNodeData struct { + CData *C.ImGuiNavTreeNodeData +} + +func (self *NavTreeNodeData) handle() (result *C.ImGuiNavTreeNodeData, fin func()) { + return self.CData, func() {} +} + +func (self NavTreeNodeData) c() (C.ImGuiNavTreeNodeData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newNavTreeNodeDataFromC(cvalue *C.ImGuiNavTreeNodeData) *NavTreeNodeData { + return &NavTreeNodeData{CData: cvalue} +} + +type NextItemData struct { + CData *C.ImGuiNextItemData +} + +func (self *NextItemData) handle() (result *C.ImGuiNextItemData, fin func()) { + return self.CData, func() {} +} + +func (self NextItemData) c() (C.ImGuiNextItemData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newNextItemDataFromC(cvalue *C.ImGuiNextItemData) *NextItemData { + return &NextItemData{CData: cvalue} +} + +type NextWindowData struct { + CData *C.ImGuiNextWindowData +} + +func (self *NextWindowData) handle() (result *C.ImGuiNextWindowData, fin func()) { + return self.CData, func() {} +} + +func (self NextWindowData) c() (C.ImGuiNextWindowData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newNextWindowDataFromC(cvalue *C.ImGuiNextWindowData) *NextWindowData { + return &NextWindowData{CData: cvalue} +} + +type OldColumnData struct { + CData *C.ImGuiOldColumnData +} + +func (self *OldColumnData) handle() (result *C.ImGuiOldColumnData, fin func()) { + return self.CData, func() {} +} + +func (self OldColumnData) c() (C.ImGuiOldColumnData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newOldColumnDataFromC(cvalue *C.ImGuiOldColumnData) *OldColumnData { + return &OldColumnData{CData: cvalue} +} + +type OldColumns struct { + CData *C.ImGuiOldColumns +} + +func (self *OldColumns) handle() (result *C.ImGuiOldColumns, fin func()) { + return self.CData, func() {} +} + +func (self OldColumns) c() (C.ImGuiOldColumns, func()) { + result, fn := self.handle() + return *result, fn +} + +func newOldColumnsFromC(cvalue *C.ImGuiOldColumns) *OldColumns { + return &OldColumns{CData: cvalue} +} + +type OnceUponAFrame struct { + CData *C.ImGuiOnceUponAFrame +} + +func (self *OnceUponAFrame) handle() (result *C.ImGuiOnceUponAFrame, fin func()) { + return self.CData, func() {} +} + +func (self OnceUponAFrame) c() (C.ImGuiOnceUponAFrame, func()) { + result, fn := self.handle() + return *result, fn +} + +func newOnceUponAFrameFromC(cvalue *C.ImGuiOnceUponAFrame) *OnceUponAFrame { + return &OnceUponAFrame{CData: cvalue} +} + +type Payload struct { + CData *C.ImGuiPayload +} + +func (self *Payload) handle() (result *C.ImGuiPayload, fin func()) { + return self.CData, func() {} +} + +func (self Payload) c() (C.ImGuiPayload, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPayloadFromC(cvalue *C.ImGuiPayload) *Payload { + return &Payload{CData: cvalue} +} + +type PlatformIO struct { + CData *C.ImGuiPlatformIO +} + +func (self *PlatformIO) handle() (result *C.ImGuiPlatformIO, fin func()) { + return self.CData, func() {} +} + +func (self PlatformIO) c() (C.ImGuiPlatformIO, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlatformIOFromC(cvalue *C.ImGuiPlatformIO) *PlatformIO { + return &PlatformIO{CData: cvalue} +} + +type PlatformImeData struct { + CData *C.ImGuiPlatformImeData +} + +func (self *PlatformImeData) handle() (result *C.ImGuiPlatformImeData, fin func()) { + return self.CData, func() {} +} + +func (self PlatformImeData) c() (C.ImGuiPlatformImeData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlatformImeDataFromC(cvalue *C.ImGuiPlatformImeData) *PlatformImeData { + return &PlatformImeData{CData: cvalue} +} + +type PlatformMonitor struct { + CData *C.ImGuiPlatformMonitor +} + +func (self *PlatformMonitor) handle() (result *C.ImGuiPlatformMonitor, fin func()) { + return self.CData, func() {} +} + +func (self PlatformMonitor) c() (C.ImGuiPlatformMonitor, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlatformMonitorFromC(cvalue *C.ImGuiPlatformMonitor) *PlatformMonitor { + return &PlatformMonitor{CData: cvalue} +} + +type PopupData struct { + CData *C.ImGuiPopupData +} + +func (self *PopupData) handle() (result *C.ImGuiPopupData, fin func()) { + return self.CData, func() {} +} + +func (self PopupData) c() (C.ImGuiPopupData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPopupDataFromC(cvalue *C.ImGuiPopupData) *PopupData { + return &PopupData{CData: cvalue} +} + +type PtrOrIndex struct { + CData *C.ImGuiPtrOrIndex +} + +func (self *PtrOrIndex) handle() (result *C.ImGuiPtrOrIndex, fin func()) { + return self.CData, func() {} +} + +func (self PtrOrIndex) c() (C.ImGuiPtrOrIndex, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPtrOrIndexFromC(cvalue *C.ImGuiPtrOrIndex) *PtrOrIndex { + return &PtrOrIndex{CData: cvalue} +} + +type SettingsHandler struct { + CData *C.ImGuiSettingsHandler +} + +func (self *SettingsHandler) handle() (result *C.ImGuiSettingsHandler, fin func()) { + return self.CData, func() {} +} + +func (self SettingsHandler) c() (C.ImGuiSettingsHandler, func()) { + result, fn := self.handle() + return *result, fn +} + +func newSettingsHandlerFromC(cvalue *C.ImGuiSettingsHandler) *SettingsHandler { + return &SettingsHandler{CData: cvalue} +} + +type ShrinkWidthItem struct { + CData *C.ImGuiShrinkWidthItem +} + +func (self *ShrinkWidthItem) handle() (result *C.ImGuiShrinkWidthItem, fin func()) { + return self.CData, func() {} +} + +func (self ShrinkWidthItem) c() (C.ImGuiShrinkWidthItem, func()) { + result, fn := self.handle() + return *result, fn +} + +func newShrinkWidthItemFromC(cvalue *C.ImGuiShrinkWidthItem) *ShrinkWidthItem { + return &ShrinkWidthItem{CData: cvalue} +} + +type SizeCallbackData struct { + CData *C.ImGuiSizeCallbackData +} + +func (self *SizeCallbackData) handle() (result *C.ImGuiSizeCallbackData, fin func()) { + return self.CData, func() {} +} + +func (self SizeCallbackData) c() (C.ImGuiSizeCallbackData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newSizeCallbackDataFromC(cvalue *C.ImGuiSizeCallbackData) *SizeCallbackData { + return &SizeCallbackData{CData: cvalue} +} + +type StackLevelInfo struct { + CData *C.ImGuiStackLevelInfo +} + +func (self *StackLevelInfo) handle() (result *C.ImGuiStackLevelInfo, fin func()) { + return self.CData, func() {} +} + +func (self StackLevelInfo) c() (C.ImGuiStackLevelInfo, func()) { + result, fn := self.handle() + return *result, fn +} + +func newStackLevelInfoFromC(cvalue *C.ImGuiStackLevelInfo) *StackLevelInfo { + return &StackLevelInfo{CData: cvalue} +} + +type StackSizes struct { + CData *C.ImGuiStackSizes +} + +func (self *StackSizes) handle() (result *C.ImGuiStackSizes, fin func()) { + return self.CData, func() {} +} + +func (self StackSizes) c() (C.ImGuiStackSizes, func()) { + result, fn := self.handle() + return *result, fn +} + +func newStackSizesFromC(cvalue *C.ImGuiStackSizes) *StackSizes { + return &StackSizes{CData: cvalue} +} + +type StackTool struct { + CData *C.ImGuiStackTool +} + +func (self *StackTool) handle() (result *C.ImGuiStackTool, fin func()) { + return self.CData, func() {} +} + +func (self StackTool) c() (C.ImGuiStackTool, func()) { + result, fn := self.handle() + return *result, fn +} + +func newStackToolFromC(cvalue *C.ImGuiStackTool) *StackTool { + return &StackTool{CData: cvalue} +} + +type Storage struct { + CData *C.ImGuiStorage +} + +func (self *Storage) handle() (result *C.ImGuiStorage, fin func()) { + return self.CData, func() {} +} + +func (self Storage) c() (C.ImGuiStorage, func()) { + result, fn := self.handle() + return *result, fn +} + +func newStorageFromC(cvalue *C.ImGuiStorage) *Storage { + return &Storage{CData: cvalue} +} + +type StoragePair struct { + CData *C.ImGuiStoragePair +} + +func (self *StoragePair) handle() (result *C.ImGuiStoragePair, fin func()) { + return self.CData, func() {} +} + +func (self StoragePair) c() (C.ImGuiStoragePair, func()) { + result, fn := self.handle() + return *result, fn +} + +func newStoragePairFromC(cvalue *C.ImGuiStoragePair) *StoragePair { + return &StoragePair{CData: cvalue} +} + +type Style struct { + CData *C.ImGuiStyle +} + +func (self *Style) handle() (result *C.ImGuiStyle, fin func()) { + return self.CData, func() {} +} + +func (self Style) c() (C.ImGuiStyle, func()) { + result, fn := self.handle() + return *result, fn +} + +func newStyleFromC(cvalue *C.ImGuiStyle) *Style { + return &Style{CData: cvalue} +} + +type StyleMod struct { + CData *C.ImGuiStyleMod +} + +func (self *StyleMod) handle() (result *C.ImGuiStyleMod, fin func()) { + return self.CData, func() {} +} + +func (self StyleMod) c() (C.ImGuiStyleMod, func()) { + result, fn := self.handle() + return *result, fn +} + +func newStyleModFromC(cvalue *C.ImGuiStyleMod) *StyleMod { + return &StyleMod{CData: cvalue} +} + +type TabBar struct { + CData *C.ImGuiTabBar +} + +func (self *TabBar) handle() (result *C.ImGuiTabBar, fin func()) { + return self.CData, func() {} +} + +func (self TabBar) c() (C.ImGuiTabBar, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTabBarFromC(cvalue *C.ImGuiTabBar) *TabBar { + return &TabBar{CData: cvalue} +} + +type TabItem struct { + CData *C.ImGuiTabItem +} + +func (self *TabItem) handle() (result *C.ImGuiTabItem, fin func()) { + return self.CData, func() {} +} + +func (self TabItem) c() (C.ImGuiTabItem, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTabItemFromC(cvalue *C.ImGuiTabItem) *TabItem { + return &TabItem{CData: cvalue} +} + +type Table struct { + CData *C.ImGuiTable +} + +func (self *Table) handle() (result *C.ImGuiTable, fin func()) { + return self.CData, func() {} +} + +func (self Table) c() (C.ImGuiTable, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTableFromC(cvalue *C.ImGuiTable) *Table { + return &Table{CData: cvalue} +} + +type TableCellData struct { + CData *C.ImGuiTableCellData +} + +func (self *TableCellData) handle() (result *C.ImGuiTableCellData, fin func()) { + return self.CData, func() {} +} + +func (self TableCellData) c() (C.ImGuiTableCellData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTableCellDataFromC(cvalue *C.ImGuiTableCellData) *TableCellData { + return &TableCellData{CData: cvalue} +} + +type TableColumn struct { + CData *C.ImGuiTableColumn +} + +func (self *TableColumn) handle() (result *C.ImGuiTableColumn, fin func()) { + return self.CData, func() {} +} + +func (self TableColumn) c() (C.ImGuiTableColumn, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTableColumnFromC(cvalue *C.ImGuiTableColumn) *TableColumn { + return &TableColumn{CData: cvalue} +} + +type TableColumnSettings struct { + CData *C.ImGuiTableColumnSettings +} + +func (self *TableColumnSettings) handle() (result *C.ImGuiTableColumnSettings, fin func()) { + return self.CData, func() {} +} + +func (self TableColumnSettings) c() (C.ImGuiTableColumnSettings, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTableColumnSettingsFromC(cvalue *C.ImGuiTableColumnSettings) *TableColumnSettings { + return &TableColumnSettings{CData: cvalue} +} + +type TableColumnSortSpecs struct { + CData *C.ImGuiTableColumnSortSpecs +} + +func (self *TableColumnSortSpecs) handle() (result *C.ImGuiTableColumnSortSpecs, fin func()) { + return self.CData, func() {} +} + +func (self TableColumnSortSpecs) c() (C.ImGuiTableColumnSortSpecs, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTableColumnSortSpecsFromC(cvalue *C.ImGuiTableColumnSortSpecs) *TableColumnSortSpecs { + return &TableColumnSortSpecs{CData: cvalue} +} + +type TableColumnsSettings struct { + CData *C.ImGuiTableColumnsSettings +} + +func (self *TableColumnsSettings) handle() (result *C.ImGuiTableColumnsSettings, fin func()) { + return self.CData, func() {} +} + +func newTableColumnsSettingsFromC(cvalue *C.ImGuiTableColumnsSettings) *TableColumnsSettings { + return &TableColumnsSettings{CData: cvalue} +} + +type TableDrawChannelIdx uint16 + +func (selfSrc *TableDrawChannelIdx) handle() (result *C.ImGuiTableDrawChannelIdx, fin func()) { + self := (*uint16)(selfSrc) + selfArg, selfFin := WrapNumberPtr[C.ImU16, uint16](self) + return (*C.ImGuiTableDrawChannelIdx)(selfArg), func() { selfFin() } +} + +func (self TableDrawChannelIdx) c() (C.ImGuiTableDrawChannelIdx, func()) { + return (C.ImGuiTableDrawChannelIdx)(C.ImU16(self)), func() {} +} + +func newTableDrawChannelIdxFromC(cvalue *C.ImGuiTableDrawChannelIdx) *TableDrawChannelIdx { + return (*TableDrawChannelIdx)((*uint16)(cvalue)) +} + +type TableInstanceData struct { + CData *C.ImGuiTableInstanceData +} + +func (self *TableInstanceData) handle() (result *C.ImGuiTableInstanceData, fin func()) { + return self.CData, func() {} +} + +func (self TableInstanceData) c() (C.ImGuiTableInstanceData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTableInstanceDataFromC(cvalue *C.ImGuiTableInstanceData) *TableInstanceData { + return &TableInstanceData{CData: cvalue} +} + +type TableSettings struct { + CData *C.ImGuiTableSettings +} + +func (self *TableSettings) handle() (result *C.ImGuiTableSettings, fin func()) { + return self.CData, func() {} +} + +func (self TableSettings) c() (C.ImGuiTableSettings, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTableSettingsFromC(cvalue *C.ImGuiTableSettings) *TableSettings { + return &TableSettings{CData: cvalue} +} + +type TableSortSpecs struct { + CData *C.ImGuiTableSortSpecs +} + +func (self *TableSortSpecs) handle() (result *C.ImGuiTableSortSpecs, fin func()) { + return self.CData, func() {} +} + +func (self TableSortSpecs) c() (C.ImGuiTableSortSpecs, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTableSortSpecsFromC(cvalue *C.ImGuiTableSortSpecs) *TableSortSpecs { + return &TableSortSpecs{CData: cvalue} +} + +type TableTempData struct { + CData *C.ImGuiTableTempData +} + +func (self *TableTempData) handle() (result *C.ImGuiTableTempData, fin func()) { + return self.CData, func() {} +} + +func (self TableTempData) c() (C.ImGuiTableTempData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTableTempDataFromC(cvalue *C.ImGuiTableTempData) *TableTempData { + return &TableTempData{CData: cvalue} +} + +type TextBuffer struct { + CData *C.ImGuiTextBuffer +} + +func (self *TextBuffer) handle() (result *C.ImGuiTextBuffer, fin func()) { + return self.CData, func() {} +} + +func (self TextBuffer) c() (C.ImGuiTextBuffer, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTextBufferFromC(cvalue *C.ImGuiTextBuffer) *TextBuffer { + return &TextBuffer{CData: cvalue} +} + +type TextFilter struct { + CData *C.ImGuiTextFilter +} + +func (self *TextFilter) handle() (result *C.ImGuiTextFilter, fin func()) { + return self.CData, func() {} +} + +func (self TextFilter) c() (C.ImGuiTextFilter, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTextFilterFromC(cvalue *C.ImGuiTextFilter) *TextFilter { + return &TextFilter{CData: cvalue} +} + +type TextIndex struct { + CData *C.ImGuiTextIndex +} + +func (self *TextIndex) handle() (result *C.ImGuiTextIndex, fin func()) { + return self.CData, func() {} +} + +func (self TextIndex) c() (C.ImGuiTextIndex, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTextIndexFromC(cvalue *C.ImGuiTextIndex) *TextIndex { + return &TextIndex{CData: cvalue} +} + +type TextRange struct { + CData *C.ImGuiTextRange +} + +func (self *TextRange) handle() (result *C.ImGuiTextRange, fin func()) { + return self.CData, func() {} +} + +func (self TextRange) c() (C.ImGuiTextRange, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTextRangeFromC(cvalue *C.ImGuiTextRange) *TextRange { + return &TextRange{CData: cvalue} +} + +type TypingSelectRequest struct { + CData *C.ImGuiTypingSelectRequest +} + +func (self *TypingSelectRequest) handle() (result *C.ImGuiTypingSelectRequest, fin func()) { + return self.CData, func() {} +} + +func (self TypingSelectRequest) c() (C.ImGuiTypingSelectRequest, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTypingSelectRequestFromC(cvalue *C.ImGuiTypingSelectRequest) *TypingSelectRequest { + return &TypingSelectRequest{CData: cvalue} +} + +type TypingSelectState struct { + CData *C.ImGuiTypingSelectState +} + +func (self *TypingSelectState) handle() (result *C.ImGuiTypingSelectState, fin func()) { + return self.CData, func() {} +} + +func (self TypingSelectState) c() (C.ImGuiTypingSelectState, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTypingSelectStateFromC(cvalue *C.ImGuiTypingSelectState) *TypingSelectState { + return &TypingSelectState{CData: cvalue} +} + +type Viewport struct { + CData *C.ImGuiViewport +} + +func (self *Viewport) handle() (result *C.ImGuiViewport, fin func()) { + return self.CData, func() {} +} + +func (self Viewport) c() (C.ImGuiViewport, func()) { + result, fn := self.handle() + return *result, fn +} + +func newViewportFromC(cvalue *C.ImGuiViewport) *Viewport { + return &Viewport{CData: cvalue} +} + +type ViewportP struct { + CData *C.ImGuiViewportP +} + +func (self *ViewportP) handle() (result *C.ImGuiViewportP, fin func()) { + return self.CData, func() {} +} + +func (self ViewportP) c() (C.ImGuiViewportP, func()) { + result, fn := self.handle() + return *result, fn +} + +func newViewportPFromC(cvalue *C.ImGuiViewportP) *ViewportP { + return &ViewportP{CData: cvalue} +} + +type Window struct { + CData *C.ImGuiWindow +} + +func (self *Window) handle() (result *C.ImGuiWindow, fin func()) { + return self.CData, func() {} +} + +func (self Window) c() (C.ImGuiWindow, func()) { + result, fn := self.handle() + return *result, fn +} + +func newWindowFromC(cvalue *C.ImGuiWindow) *Window { + return &Window{CData: cvalue} +} + +type WindowClass struct { + CData *C.ImGuiWindowClass +} + +func (self *WindowClass) handle() (result *C.ImGuiWindowClass, fin func()) { + return self.CData, func() {} +} + +func (self WindowClass) c() (C.ImGuiWindowClass, func()) { + result, fn := self.handle() + return *result, fn +} + +func newWindowClassFromC(cvalue *C.ImGuiWindowClass) *WindowClass { + return &WindowClass{CData: cvalue} +} + +type WindowDockStyle struct { + CData *C.ImGuiWindowDockStyle +} + +func (self *WindowDockStyle) handle() (result *C.ImGuiWindowDockStyle, fin func()) { + return self.CData, func() {} +} + +func (self WindowDockStyle) c() (C.ImGuiWindowDockStyle, func()) { + result, fn := self.handle() + return *result, fn +} + +func newWindowDockStyleFromC(cvalue *C.ImGuiWindowDockStyle) *WindowDockStyle { + return &WindowDockStyle{CData: cvalue} +} + +type WindowSettings struct { + CData *C.ImGuiWindowSettings +} + +func (self *WindowSettings) handle() (result *C.ImGuiWindowSettings, fin func()) { + return self.CData, func() {} +} + +func (self WindowSettings) c() (C.ImGuiWindowSettings, func()) { + result, fn := self.handle() + return *result, fn +} + +func newWindowSettingsFromC(cvalue *C.ImGuiWindowSettings) *WindowSettings { + return &WindowSettings{CData: cvalue} +} + +type WindowStackData struct { + CData *C.ImGuiWindowStackData +} + +func (self *WindowStackData) handle() (result *C.ImGuiWindowStackData, fin func()) { + return self.CData, func() {} +} + +func (self WindowStackData) c() (C.ImGuiWindowStackData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newWindowStackDataFromC(cvalue *C.ImGuiWindowStackData) *WindowStackData { + return &WindowStackData{CData: cvalue} +} + +type WindowTempData struct { + CData *C.ImGuiWindowTempData +} + +func (self *WindowTempData) handle() (result *C.ImGuiWindowTempData, fin func()) { + return self.CData, func() {} +} + +func (self WindowTempData) c() (C.ImGuiWindowTempData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newWindowTempDataFromC(cvalue *C.ImGuiWindowTempData) *WindowTempData { + return &WindowTempData{CData: cvalue} +} + +type PoolIdx int32 + +func (selfSrc *PoolIdx) handle() (result *C.ImPoolIdx, fin func()) { + self := (*int32)(selfSrc) + selfArg, selfFin := WrapNumberPtr[C.int, int32](self) + return (*C.ImPoolIdx)(selfArg), func() { selfFin() } +} + +func (self PoolIdx) c() (C.ImPoolIdx, func()) { + return (C.ImPoolIdx)(C.int(self)), func() {} +} + +func newPoolIdxFromC(cvalue *C.ImPoolIdx) *PoolIdx { + return (*PoolIdx)((*int32)(cvalue)) +} + +type TextureID struct { + Data uintptr +} + +func (self *TextureID) handle() (result *C.ImTextureID, fin func()) { + r, f := self.c() + return &r, f +} + +func (self TextureID) c() (C.ImTextureID, func()) { + return (C.ImTextureID)(C.ImTextureID_fromUintptr(C.uintptr_t(self.Data))), func() {} +} + +func newTextureIDFromC(cvalue *C.ImTextureID) *TextureID { + return &TextureID{Data: (uintptr)(C.ImTextureID_toUintptr(*cvalue))} +} + +type Vec1 struct { + CData *C.ImVec1 +} + +func (self *Vec1) handle() (result *C.ImVec1, fin func()) { + return self.CData, func() {} +} + +func (self Vec1) c() (C.ImVec1, func()) { + result, fn := self.handle() + return *result, fn +} + +func newVec1FromC(cvalue *C.ImVec1) *Vec1 { + return &Vec1{CData: cvalue} +} + +type Wchar32 uint32 + +func (selfSrc *Wchar32) handle() (result *C.ImWchar32, fin func()) { + self := (*uint32)(selfSrc) + selfArg, selfFin := WrapNumberPtr[C.uint, uint32](self) + return (*C.ImWchar32)(selfArg), func() { selfFin() } +} + +func (self Wchar32) c() (C.ImWchar32, func()) { + return (C.ImWchar32)(C.uint(self)), func() {} +} + +func newWchar32FromC(cvalue *C.ImWchar32) *Wchar32 { + return (*Wchar32)((*uint32)(cvalue)) +} + +type STBTexteditState struct { + CData *C.STB_TexteditState +} + +func (self *STBTexteditState) handle() (result *C.STB_TexteditState, fin func()) { + return self.CData, func() {} +} + +func (self STBTexteditState) c() (C.STB_TexteditState, func()) { + result, fn := self.handle() + return *result, fn +} + +func newSTBTexteditStateFromC(cvalue *C.STB_TexteditState) *STBTexteditState { + return &STBTexteditState{CData: cvalue} +} + +type StbTexteditRow struct { + CData *C.StbTexteditRow +} + +func (self *StbTexteditRow) handle() (result *C.StbTexteditRow, fin func()) { + return self.CData, func() {} +} + +func (self StbTexteditRow) c() (C.StbTexteditRow, func()) { + result, fn := self.handle() + return *result, fn +} + +func newStbTexteditRowFromC(cvalue *C.StbTexteditRow) *StbTexteditRow { + return &StbTexteditRow{CData: cvalue} +} + +type StbUndoRecord struct { + CData *C.StbUndoRecord +} + +func (self *StbUndoRecord) handle() (result *C.StbUndoRecord, fin func()) { + return self.CData, func() {} +} + +func (self StbUndoRecord) c() (C.StbUndoRecord, func()) { + result, fn := self.handle() + return *result, fn +} + +func newStbUndoRecordFromC(cvalue *C.StbUndoRecord) *StbUndoRecord { + return &StbUndoRecord{CData: cvalue} +} + +type StbUndoState struct { + CData *C.StbUndoState +} + +func (self *StbUndoState) handle() (result *C.StbUndoState, fin func()) { + return self.CData, func() {} +} + +func (self StbUndoState) c() (C.StbUndoState, func()) { + result, fn := self.handle() + return *result, fn +} + +func newStbUndoStateFromC(cvalue *C.StbUndoState) *StbUndoState { + return &StbUndoState{CData: cvalue} +} diff --git a/cimgui_typedefs.h b/cimgui_typedefs.h new file mode 100644 index 000000000..93694afe0 --- /dev/null +++ b/cimgui_typedefs.h @@ -0,0 +1,16 @@ +// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. +// DO NOT EDIT. + + +#pragma once + +#include "cimgui/cimgui.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern uintptr_t ImTextureID_toUintptr(ImTextureID ptr); +extern ImTextureID ImTextureID_fromUintptr(uintptr_t ptr); +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/cimgui_wrapper.cpp b/cimgui_wrapper.cpp index b686edebd..cf503cf6a 100644 --- a/cimgui_wrapper.cpp +++ b/cimgui_wrapper.cpp @@ -4,41 +4,97 @@ #include "cimgui_wrapper.h" #include "cimgui/cimgui.h" +void wrap_ImDrawList_AddCallback(ImDrawList* self,ImDrawCallback callback,uintptr_t callback_data) { ImDrawList_AddCallback(self,callback,(void*)(uintptr_t)callback_data); } void wrap_ImDrawList_AddText_FontPtrV(ImDrawList* self,const ImFont* font,float font_size,const ImVec2 pos,ImU32 col,const char* text_begin,float wrap_width,const ImVec4* cpu_fine_clip_rect) { ImDrawList_AddText_FontPtr(self,font,font_size,pos,col,text_begin,0,wrap_width,cpu_fine_clip_rect); } void wrap_ImDrawList_AddText_Vec2V(ImDrawList* self,const ImVec2 pos,ImU32 col,const char* text_begin) { ImDrawList_AddText_Vec2(self,pos,col,text_begin,0); } +ImFont* wrap_ImFontAtlas_AddFontFromMemoryCompressedTTFV(ImFontAtlas* self,const uintptr_t compressed_font_data,int compressed_font_data_size,float size_pixels,const ImFontConfig* font_cfg,const ImWchar* glyph_ranges) { return ImFontAtlas_AddFontFromMemoryCompressedTTF(self,(const void*)(uintptr_t)compressed_font_data,compressed_font_data_size,size_pixels,font_cfg,glyph_ranges); } +ImFont* wrap_ImFontAtlas_AddFontFromMemoryTTFV(ImFontAtlas* self,uintptr_t font_data,int font_data_size,float size_pixels,const ImFontConfig* font_cfg,const ImWchar* glyph_ranges) { return ImFontAtlas_AddFontFromMemoryTTF(self,(void*)(uintptr_t)font_data,font_data_size,size_pixels,font_cfg,glyph_ranges); } void wrap_ImFontGlyphRangesBuilder_AddTextV(ImFontGlyphRangesBuilder* self,const char* text,const int text_len) { ImFontGlyphRangesBuilder_AddText(self,text,(text_len > 0) ? text + text_len*sizeof(char)-1 : 0); } void wrap_ImFont_CalcTextSizeAV(ImVec2 *pOut,ImFont* self,float size,float max_width,float wrap_width,const char* text_begin,const char** remaining) { ImFont_CalcTextSizeA(pOut,self,size,max_width,wrap_width,text_begin,0,remaining); } const char* wrap_ImFont_CalcWordWrapPositionA(ImFont* self,float scale,const char* text,const int text_len,float wrap_width) { return ImFont_CalcWordWrapPositionA(self,scale,text,(text_len > 0) ? text + text_len*sizeof(char)-1 : 0,wrap_width); } void wrap_ImFont_RenderTextV(ImFont* self,ImDrawList* draw_list,float size,const ImVec2 pos,ImU32 col,const ImVec4 clip_rect,const char* text_begin,float wrap_width,bool cpu_fine_clip) { ImFont_RenderText(self,draw_list,size,pos,col,clip_rect,text_begin,0,wrap_width,cpu_fine_clip); } +uintptr_t wrap_ImGuiDataVarInfo_GetVarPtr(ImGuiDataVarInfo* self,uintptr_t parent) { return (uintptr_t)ImGuiDataVarInfo_GetVarPtr(self,(void*)(uintptr_t)parent); } void wrap_ImGuiInputTextCallbackData_InsertCharsV(ImGuiInputTextCallbackData* self,int pos,const char* text,const int text_len) { ImGuiInputTextCallbackData_InsertChars(self,pos,text,(text_len > 0) ? text + text_len*sizeof(char)-1 : 0); } +ImGuiPtrOrIndex* wrap_ImGuiPtrOrIndex_ImGuiPtrOrIndex_Ptr(uintptr_t ptr) { return ImGuiPtrOrIndex_ImGuiPtrOrIndex_Ptr((void*)(uintptr_t)ptr); } +ImGuiStoragePair* wrap_ImGuiStoragePair_ImGuiStoragePair_Ptr(ImGuiID _key,uintptr_t _val_p) { return ImGuiStoragePair_ImGuiStoragePair_Ptr(_key,(void*)(uintptr_t)_val_p); } +uintptr_t wrap_ImGuiStorage_GetVoidPtr(ImGuiStorage* self,ImGuiID key) { return (uintptr_t)ImGuiStorage_GetVoidPtr(self,key); } +void** wrap_ImGuiStorage_GetVoidPtrRefV(ImGuiStorage* self,ImGuiID key,uintptr_t default_val) { return ImGuiStorage_GetVoidPtrRef(self,key,(void*)(uintptr_t)default_val); } +void wrap_ImGuiStorage_SetVoidPtr(ImGuiStorage* self,ImGuiID key,uintptr_t val) { ImGuiStorage_SetVoidPtr(self,key,(void*)(uintptr_t)val); } void wrap_ImGuiTextBuffer_Appendf(ImGuiTextBuffer* self,const char* fmt) { ImGuiTextBuffer_appendf(self,fmt); } bool wrap_ImGuiTextFilter_PassFilterV(ImGuiTextFilter* self,const char* text,const int text_len) { return ImGuiTextFilter_PassFilter(self,text,(text_len > 0) ? text + text_len*sizeof(char)-1 : 0); } +ImGuiID wrap_ImGuiWindow_GetID_Ptr(ImGuiWindow* self,const uintptr_t ptr) { return ImGuiWindow_GetID_Ptr(self,(const void*)(uintptr_t)ptr); } void wrap_igBulletText(const char* fmt) { igBulletText(fmt); } void wrap_igCalcTextSizeV(ImVec2 *pOut,const char* text,const int text_len,bool hide_text_after_double_hash,float wrap_width) { igCalcTextSize(pOut,text,(text_len > 0) ? text + text_len*sizeof(char)-1 : 0,hide_text_after_double_hash,wrap_width); } +bool wrap_igCombo_FnStrPtr(const char* label,int* current_item,const char*(*getter)(void* user_data,int idx),uintptr_t user_data,int items_count,int popup_max_height_in_items) { return igCombo_FnStrPtr(label,current_item,getter,(void*)(uintptr_t)user_data,items_count,popup_max_height_in_items); } +bool wrap_igDataTypeApplyFromText(const char* buf,ImGuiDataType data_type,uintptr_t p_data,const char* format) { return igDataTypeApplyFromText(buf,data_type,(void*)(uintptr_t)p_data,format); } +void wrap_igDataTypeApplyOp(ImGuiDataType data_type,int op,uintptr_t output,const uintptr_t arg_1,const uintptr_t arg_2) { igDataTypeApplyOp(data_type,op,(void*)(uintptr_t)output,(const void*)(uintptr_t)arg_1,(const void*)(uintptr_t)arg_2); } +bool wrap_igDataTypeClamp(ImGuiDataType data_type,uintptr_t p_data,const uintptr_t p_min,const uintptr_t p_max) { return igDataTypeClamp(data_type,(void*)(uintptr_t)p_data,(const void*)(uintptr_t)p_min,(const void*)(uintptr_t)p_max); } +int wrap_igDataTypeCompare(ImGuiDataType data_type,const uintptr_t arg_1,const uintptr_t arg_2) { return igDataTypeCompare(data_type,(const void*)(uintptr_t)arg_1,(const void*)(uintptr_t)arg_2); } +int wrap_igDataTypeFormatString(char* buf,int buf_size,ImGuiDataType data_type,const uintptr_t p_data,const char* format) { return igDataTypeFormatString(buf,buf_size,data_type,(const void*)(uintptr_t)p_data,format); } +void wrap_igDebugHookIdInfo(ImGuiID id,ImGuiDataType data_type,const uintptr_t data_id,const uintptr_t data_id_end) { igDebugHookIdInfo(id,data_type,(const void*)(uintptr_t)data_id,(const void*)(uintptr_t)data_id_end); } void wrap_igDebugLog(const char* fmt) { igDebugLog(fmt); } +bool wrap_igDragBehavior(ImGuiID id,ImGuiDataType data_type,uintptr_t p_v,float v_speed,const uintptr_t p_min,const uintptr_t p_max,const char* format,ImGuiSliderFlags flags) { return igDragBehavior(id,data_type,(void*)(uintptr_t)p_v,v_speed,(const void*)(uintptr_t)p_min,(const void*)(uintptr_t)p_max,format,flags); } +bool wrap_igDragScalarV(const char* label,ImGuiDataType data_type,uintptr_t p_data,float v_speed,const uintptr_t p_min,const uintptr_t p_max,const char* format,ImGuiSliderFlags flags) { return igDragScalar(label,data_type,(void*)(uintptr_t)p_data,v_speed,(const void*)(uintptr_t)p_min,(const void*)(uintptr_t)p_max,format,flags); } +bool wrap_igDragScalarNV(const char* label,ImGuiDataType data_type,uintptr_t p_data,int components,float v_speed,const uintptr_t p_min,const uintptr_t p_max,const char* format,ImGuiSliderFlags flags) { return igDragScalarN(label,data_type,(void*)(uintptr_t)p_data,components,v_speed,(const void*)(uintptr_t)p_min,(const void*)(uintptr_t)p_max,format,flags); } +void wrap_igErrorCheckEndFrameRecoverV(ImGuiErrorLogCallback log_callback,uintptr_t user_data) { igErrorCheckEndFrameRecover(log_callback,(void*)(uintptr_t)user_data); } +void wrap_igErrorCheckEndWindowRecoverV(ImGuiErrorLogCallback log_callback,uintptr_t user_data) { igErrorCheckEndWindowRecover(log_callback,(void*)(uintptr_t)user_data); } const char* wrap_igFindRenderedTextEndV(const char* text,const int text_len) { return igFindRenderedTextEnd(text,(text_len > 0) ? text + text_len*sizeof(char)-1 : 0); } +ImGuiViewport* wrap_igFindViewportByPlatformHandle(uintptr_t platform_handle) { return igFindViewportByPlatformHandle((void*)(uintptr_t)platform_handle); } +ImGuiID wrap_igGetID_Ptr(const uintptr_t ptr_id) { return igGetID_Ptr((const void*)(uintptr_t)ptr_id); } +uintptr_t wrap_igImFileLoadToMemoryV(const char* filename,const char* mode,size_t* out_file_size,int padding_bytes) { return (uintptr_t)igImFileLoadToMemory(filename,mode,out_file_size,padding_bytes); } +ImU64 wrap_igImFileRead(uintptr_t data,ImU64 size,ImU64 count,ImFileHandle file) { return igImFileRead((void*)(uintptr_t)data,size,count,file); } +ImU64 wrap_igImFileWrite(const uintptr_t data,ImU64 size,ImU64 count,ImFileHandle file) { return igImFileWrite((const void*)(uintptr_t)data,size,count,file); } +void wrap_igImFontAtlasBuildPackCustomRects(ImFontAtlas* atlas,uintptr_t stbrp_context_opaque) { igImFontAtlasBuildPackCustomRects(atlas,(void*)(uintptr_t)stbrp_context_opaque); } int wrap_igImFormatString(char* buf,size_t buf_size,const char* fmt) { return igImFormatString(buf,buf_size,fmt); } void wrap_igImFormatStringToTempBuffer(const char** out_buf,const char** out_buf_end,const char* fmt) { igImFormatStringToTempBuffer(out_buf,out_buf_end,fmt); } +ImGuiID wrap_igImHashDataV(const uintptr_t data,size_t data_size,ImGuiID seed) { return igImHashData((const void*)(uintptr_t)data,data_size,seed); } +void wrap_igImQsort(uintptr_t base,size_t count,size_t size_of_element,int(*compare_func)(void const*,void const*)) { igImQsort((void*)(uintptr_t)base,count,size_of_element,compare_func); } +bool wrap_igInputScalarV(const char* label,ImGuiDataType data_type,uintptr_t p_data,const uintptr_t p_step,const uintptr_t p_step_fast,const char* format,ImGuiInputTextFlags flags) { return igInputScalar(label,data_type,(void*)(uintptr_t)p_data,(const void*)(uintptr_t)p_step,(const void*)(uintptr_t)p_step_fast,format,flags); } +bool wrap_igInputScalarNV(const char* label,ImGuiDataType data_type,uintptr_t p_data,int components,const uintptr_t p_step,const uintptr_t p_step_fast,const char* format,ImGuiInputTextFlags flags) { return igInputScalarN(label,data_type,(void*)(uintptr_t)p_data,components,(const void*)(uintptr_t)p_step,(const void*)(uintptr_t)p_step_fast,format,flags); } +bool wrap_igInputTextV(const char* label,char* buf,size_t buf_size,ImGuiInputTextFlags flags,ImGuiInputTextCallback callback,uintptr_t user_data) { return igInputText(label,buf,buf_size,flags,callback,(void*)(uintptr_t)user_data); } +bool wrap_igInputTextExV(const char* label,const char* hint,char* buf,int buf_size,const ImVec2 size_arg,ImGuiInputTextFlags flags,ImGuiInputTextCallback callback,uintptr_t user_data) { return igInputTextEx(label,hint,buf,buf_size,size_arg,flags,callback,(void*)(uintptr_t)user_data); } +bool wrap_igInputTextMultilineV(const char* label,char* buf,size_t buf_size,const ImVec2 size,ImGuiInputTextFlags flags,ImGuiInputTextCallback callback,uintptr_t user_data) { return igInputTextMultiline(label,buf,buf_size,size,flags,callback,(void*)(uintptr_t)user_data); } +bool wrap_igInputTextWithHintV(const char* label,const char* hint,char* buf,size_t buf_size,ImGuiInputTextFlags flags,ImGuiInputTextCallback callback,uintptr_t user_data) { return igInputTextWithHint(label,hint,buf,buf_size,flags,callback,(void*)(uintptr_t)user_data); } void wrap_igLabelText(const char* label,const char* fmt) { igLabelText(label,fmt); } +bool wrap_igListBox_FnStrPtr(const char* label,int* current_item,const char*(*getter)(void* user_data,int idx),uintptr_t user_data,int items_count,int height_in_items) { return igListBox_FnStrPtr(label,current_item,getter,(void*)(uintptr_t)user_data,items_count,height_in_items); } void wrap_igLogRenderedTextV(const ImVec2* ref_pos,const char* text,const int text_len) { igLogRenderedText(ref_pos,text,(text_len > 0) ? text + text_len*sizeof(char)-1 : 0); } void wrap_igLogText(const char* fmt) { igLogText(fmt); } +uintptr_t wrap_igMemAlloc(size_t size) { return (uintptr_t)igMemAlloc(size); } +void wrap_igMemFree(uintptr_t ptr) { igMemFree((void*)(uintptr_t)ptr); } +int wrap_igPlotEx(ImGuiPlotType plot_type,const char* label,float(*values_getter)(void* data,int idx),uintptr_t data,int values_count,int values_offset,const char* overlay_text,float scale_min,float scale_max,const ImVec2 size_arg) { return igPlotEx(plot_type,label,values_getter,(void*)(uintptr_t)data,values_count,values_offset,overlay_text,scale_min,scale_max,size_arg); } +void wrap_igPlotHistogram_FnFloatPtr(const char* label,float(*values_getter)(void* data,int idx),uintptr_t data,int values_count,int values_offset,const char* overlay_text,float scale_min,float scale_max,ImVec2 graph_size) { igPlotHistogram_FnFloatPtr(label,values_getter,(void*)(uintptr_t)data,values_count,values_offset,overlay_text,scale_min,scale_max,graph_size); } +void wrap_igPlotLines_FnFloatPtr(const char* label,float(*values_getter)(void* data,int idx),uintptr_t data,int values_count,int values_offset,const char* overlay_text,float scale_min,float scale_max,ImVec2 graph_size) { igPlotLines_FnFloatPtr(label,values_getter,(void*)(uintptr_t)data,values_count,values_offset,overlay_text,scale_min,scale_max,graph_size); } +void wrap_igPushID_Ptr(const uintptr_t ptr_id) { igPushID_Ptr((const void*)(uintptr_t)ptr_id); } +void wrap_igRenderPlatformWindowsDefaultV(uintptr_t platform_render_arg,uintptr_t renderer_render_arg) { igRenderPlatformWindowsDefault((void*)(uintptr_t)platform_render_arg,(void*)(uintptr_t)renderer_render_arg); } void wrap_igRenderTextV(ImVec2 pos,const char* text,const int text_len,bool hide_text_after_hash) { igRenderText(pos,text,(text_len > 0) ? text + text_len*sizeof(char)-1 : 0,hide_text_after_hash); } void wrap_igRenderTextClippedV(const ImVec2 pos_min,const ImVec2 pos_max,const char* text,const int text_len,const ImVec2* text_size_if_known,const ImVec2 align,const ImRect* clip_rect) { igRenderTextClipped(pos_min,pos_max,text,(text_len > 0) ? text + text_len*sizeof(char)-1 : 0,text_size_if_known,align,clip_rect); } void wrap_igRenderTextClippedExV(ImDrawList* draw_list,const ImVec2 pos_min,const ImVec2 pos_max,const char* text,const int text_len,const ImVec2* text_size_if_known,const ImVec2 align,const ImRect* clip_rect) { igRenderTextClippedEx(draw_list,pos_min,pos_max,text,(text_len > 0) ? text + text_len*sizeof(char)-1 : 0,text_size_if_known,align,clip_rect); } void wrap_igRenderTextEllipsis(ImDrawList* draw_list,const ImVec2 pos_min,const ImVec2 pos_max,float clip_max_x,float ellipsis_max_x,const char* text,const int text_len,const ImVec2* text_size_if_known) { igRenderTextEllipsis(draw_list,pos_min,pos_max,clip_max_x,ellipsis_max_x,text,(text_len > 0) ? text + text_len*sizeof(char)-1 : 0,text_size_if_known); } void wrap_igRenderTextWrapped(ImVec2 pos,const char* text,const int text_len,float wrap_width) { igRenderTextWrapped(pos,text,(text_len > 0) ? text + text_len*sizeof(char)-1 : 0,wrap_width); } +void wrap_igSetAllocatorFunctionsV(ImGuiMemAllocFunc alloc_func,ImGuiMemFreeFunc free_func,uintptr_t user_data) { igSetAllocatorFunctions(alloc_func,free_func,(void*)(uintptr_t)user_data); } +bool wrap_igSetDragDropPayloadV(const char* type,const uintptr_t data,size_t sz,ImGuiCond cond) { return igSetDragDropPayload(type,(const void*)(uintptr_t)data,sz,cond); } void wrap_igSetItemTooltip(const char* fmt) { igSetItemTooltip(fmt); } +void wrap_igSetNextWindowSizeConstraintsV(const ImVec2 size_min,const ImVec2 size_max,ImGuiSizeCallback custom_callback,uintptr_t custom_callback_data) { igSetNextWindowSizeConstraints(size_min,size_max,custom_callback,(void*)(uintptr_t)custom_callback_data); } void wrap_igSetTooltip(const char* fmt) { igSetTooltip(fmt); } +bool wrap_igSliderBehavior(const ImRect bb,ImGuiID id,ImGuiDataType data_type,uintptr_t p_v,const uintptr_t p_min,const uintptr_t p_max,const char* format,ImGuiSliderFlags flags,ImRect* out_grab_bb) { return igSliderBehavior(bb,id,data_type,(void*)(uintptr_t)p_v,(const void*)(uintptr_t)p_min,(const void*)(uintptr_t)p_max,format,flags,out_grab_bb); } +bool wrap_igSliderScalarV(const char* label,ImGuiDataType data_type,uintptr_t p_data,const uintptr_t p_min,const uintptr_t p_max,const char* format,ImGuiSliderFlags flags) { return igSliderScalar(label,data_type,(void*)(uintptr_t)p_data,(const void*)(uintptr_t)p_min,(const void*)(uintptr_t)p_max,format,flags); } +bool wrap_igSliderScalarNV(const char* label,ImGuiDataType data_type,uintptr_t p_data,int components,const uintptr_t p_min,const uintptr_t p_max,const char* format,ImGuiSliderFlags flags) { return igSliderScalarN(label,data_type,(void*)(uintptr_t)p_data,components,(const void*)(uintptr_t)p_min,(const void*)(uintptr_t)p_max,format,flags); } +bool wrap_igTempInputScalarV(const ImRect bb,ImGuiID id,const char* label,ImGuiDataType data_type,uintptr_t p_data,const char* format,const uintptr_t p_clamp_min,const uintptr_t p_clamp_max) { return igTempInputScalar(bb,id,label,data_type,(void*)(uintptr_t)p_data,format,(const void*)(uintptr_t)p_clamp_min,(const void*)(uintptr_t)p_clamp_max); } void wrap_igText(const char* fmt) { igText(fmt); } void wrap_igTextColored(const ImVec4 col,const char* fmt) { igTextColored(col,fmt); } void wrap_igTextDisabled(const char* fmt) { igTextDisabled(fmt); } void wrap_igTextExV(const char* text,const int text_len,ImGuiTextFlags flags) { igTextEx(text,(text_len > 0) ? text + text_len*sizeof(char)-1 : 0,flags); } void wrap_igTextUnformattedV(const char* text,const int text_len) { igTextUnformatted(text,(text_len > 0) ? text + text_len*sizeof(char)-1 : 0); } void wrap_igTextWrapped(const char* fmt) { igTextWrapped(fmt); } -bool wrap_igTreeNodeEx_Ptr(const void* ptr_id,ImGuiTreeNodeFlags flags,const char* fmt) { return igTreeNodeEx_Ptr(ptr_id,flags,fmt); } +bool wrap_igTreeNodeEx_Ptr(const uintptr_t ptr_id,ImGuiTreeNodeFlags flags,const char* fmt) { return igTreeNodeEx_Ptr((const void*)(uintptr_t)ptr_id,flags,fmt); } bool wrap_igTreeNodeEx_StrStr(const char* str_id,ImGuiTreeNodeFlags flags,const char* fmt) { return igTreeNodeEx_StrStr(str_id,flags,fmt); } -bool wrap_igTreeNode_Ptr(const void* ptr_id,const char* fmt) { return igTreeNode_Ptr(ptr_id,fmt); } +bool wrap_igTreeNode_Ptr(const uintptr_t ptr_id,const char* fmt) { return igTreeNode_Ptr((const void*)(uintptr_t)ptr_id,fmt); } bool wrap_igTreeNode_StrStr(const char* str_id,const char* fmt) { return igTreeNode_StrStr(str_id,fmt); } +void wrap_igTreePush_Ptr(const uintptr_t ptr_id) { igTreePush_Ptr((const void*)(uintptr_t)ptr_id); } +int wrap_igTypingSelectFindBestLeadingMatch(ImGuiTypingSelectRequest* req,int items_count,const char*(*get_item_name_func)(void*,int),uintptr_t user_data) { return igTypingSelectFindBestLeadingMatch(req,items_count,get_item_name_func,(void*)(uintptr_t)user_data); } +int wrap_igTypingSelectFindMatch(ImGuiTypingSelectRequest* req,int items_count,const char*(*get_item_name_func)(void*,int),uintptr_t user_data,int nav_item_idx) { return igTypingSelectFindMatch(req,items_count,get_item_name_func,(void*)(uintptr_t)user_data,nav_item_idx); } +int wrap_igTypingSelectFindNextSingleCharMatch(ImGuiTypingSelectRequest* req,int items_count,const char*(*get_item_name_func)(void*,int),uintptr_t user_data,int nav_item_idx) { return igTypingSelectFindNextSingleCharMatch(req,items_count,get_item_name_func,(void*)(uintptr_t)user_data,nav_item_idx); } +bool wrap_igVSliderScalarV(const char* label,const ImVec2 size,ImGuiDataType data_type,uintptr_t p_data,const uintptr_t p_min,const uintptr_t p_max,const char* format,ImGuiSliderFlags flags) { return igVSliderScalar(label,size,data_type,(void*)(uintptr_t)p_data,(const void*)(uintptr_t)p_min,(const void*)(uintptr_t)p_max,format,flags); } void wrap_ImColor_HSV(ImColor* pOut,float h,float s,float v) { ImColor_HSV(pOut,h,s,v,1.0f); } void wrap_ImColor_SetHSV(ImColor* self,float h,float s,float v) { ImColor_SetHSV(self,h,s,v,1.0f); } void wrap_ImDrawList_AddBezierCubic(ImDrawList* self,const ImVec2 p1,const ImVec2 p2,const ImVec2 p3,const ImVec2 p4,ImU32 col,float thickness) { ImDrawList_AddBezierCubic(self,p1,p2,p3,p4,col,thickness,0); } @@ -55,7 +111,7 @@ void wrap_ImDrawList_AddNgon(ImDrawList* self,const ImVec2 center,float radius,I void wrap_ImDrawList_AddQuad(ImDrawList* self,const ImVec2 p1,const ImVec2 p2,const ImVec2 p3,const ImVec2 p4,ImU32 col) { ImDrawList_AddQuad(self,p1,p2,p3,p4,col,1.0f); } void wrap_ImDrawList_AddRect(ImDrawList* self,const ImVec2 p_min,const ImVec2 p_max,ImU32 col) { ImDrawList_AddRect(self,p_min,p_max,col,0.0f,0,1.0f); } void wrap_ImDrawList_AddRectFilled(ImDrawList* self,const ImVec2 p_min,const ImVec2 p_max,ImU32 col) { ImDrawList_AddRectFilled(self,p_min,p_max,col,0.0f,0); } -void wrap_ImDrawList_AddText_FontPtr(ImDrawList* self,const ImFont* font,float font_size,const ImVec2 pos,ImU32 col,const char* text_begin) { wrap_ImDrawList_AddText_FontPtrV(self,font,font_size,pos,col,text_begin,0.0f,NULL); } +void wrap_ImDrawList_AddText_FontPtr(ImDrawList* self,const ImFont* font,float font_size,const ImVec2 pos,ImU32 col,const char* text_begin) { wrap_ImDrawList_AddText_FontPtrV(self,font,font_size,pos,col,text_begin,0.0f,0); } void wrap_ImDrawList_AddText_Vec2(ImDrawList* self,const ImVec2 pos,ImU32 col,const char* text_begin) { wrap_ImDrawList_AddText_Vec2V(self,pos,col,text_begin); } void wrap_ImDrawList_AddTriangle(ImDrawList* self,const ImVec2 p1,const ImVec2 p2,const ImVec2 p3,ImU32 col) { ImDrawList_AddTriangle(self,p1,p2,p3,col,1.0f); } void wrap_ImDrawList_PathArcTo(ImDrawList* self,const ImVec2 center,float radius,float a_min,float a_max) { ImDrawList_PathArcTo(self,center,radius,a_min,a_max,0); } @@ -66,16 +122,16 @@ void wrap_ImDrawList_PathRect(ImDrawList* self,const ImVec2 rect_min,const ImVec void wrap_ImDrawList_PathStroke(ImDrawList* self,ImU32 col) { ImDrawList_PathStroke(self,col,0,1.0f); } void wrap_ImDrawList_PushClipRect(ImDrawList* self,const ImVec2 clip_rect_min,const ImVec2 clip_rect_max) { ImDrawList_PushClipRect(self,clip_rect_min,clip_rect_max,false); } int wrap_ImFontAtlas_AddCustomRectFontGlyph(ImFontAtlas* self,ImFont* font,ImWchar id,int width,int height,float advance_x) { return ImFontAtlas_AddCustomRectFontGlyph(self,font,id,width,height,advance_x,(ImVec2){.x=0, .y=0}); } -ImFont* wrap_ImFontAtlas_AddFontDefault(ImFontAtlas* self) { return ImFontAtlas_AddFontDefault(self,NULL); } -ImFont* wrap_ImFontAtlas_AddFontFromFileTTF(ImFontAtlas* self,const char* filename,float size_pixels) { return ImFontAtlas_AddFontFromFileTTF(self,filename,size_pixels,NULL,NULL); } -ImFont* wrap_ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(ImFontAtlas* self,const char* compressed_font_data_base85,float size_pixels) { return ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(self,compressed_font_data_base85,size_pixels,NULL,NULL); } -ImFont* wrap_ImFontAtlas_AddFontFromMemoryCompressedTTF(ImFontAtlas* self,const void* compressed_font_data,int compressed_font_data_size,float size_pixels) { return ImFontAtlas_AddFontFromMemoryCompressedTTF(self,compressed_font_data,compressed_font_data_size,size_pixels,NULL,NULL); } -ImFont* wrap_ImFontAtlas_AddFontFromMemoryTTF(ImFontAtlas* self,void* font_data,int font_data_size,float size_pixels) { return ImFontAtlas_AddFontFromMemoryTTF(self,font_data,font_data_size,size_pixels,NULL,NULL); } -void wrap_ImFontAtlas_GetTexDataAsAlpha8(ImFontAtlas* self,unsigned char** out_pixels,int* out_width,int* out_height) { ImFontAtlas_GetTexDataAsAlpha8(self,out_pixels,out_width,out_height,NULL); } -void wrap_ImFontAtlas_GetTexDataAsRGBA32(ImFontAtlas* self,unsigned char** out_pixels,int* out_width,int* out_height) { ImFontAtlas_GetTexDataAsRGBA32(self,out_pixels,out_width,out_height,NULL); } +ImFont* wrap_ImFontAtlas_AddFontDefault(ImFontAtlas* self) { return ImFontAtlas_AddFontDefault(self,0); } +ImFont* wrap_ImFontAtlas_AddFontFromFileTTF(ImFontAtlas* self,const char* filename,float size_pixels) { return ImFontAtlas_AddFontFromFileTTF(self,filename,size_pixels,0,0); } +ImFont* wrap_ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(ImFontAtlas* self,const char* compressed_font_data_base85,float size_pixels) { return ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(self,compressed_font_data_base85,size_pixels,0,0); } +ImFont* wrap_ImFontAtlas_AddFontFromMemoryCompressedTTF(ImFontAtlas* self,uintptr_t compressed_font_data,int compressed_font_data_size,float size_pixels) { return wrap_ImFontAtlas_AddFontFromMemoryCompressedTTFV(self,compressed_font_data,compressed_font_data_size,size_pixels,0,0); } +ImFont* wrap_ImFontAtlas_AddFontFromMemoryTTF(ImFontAtlas* self,uintptr_t font_data,int font_data_size,float size_pixels) { return wrap_ImFontAtlas_AddFontFromMemoryTTFV(self,font_data,font_data_size,size_pixels,0,0); } +void wrap_ImFontAtlas_GetTexDataAsAlpha8(ImFontAtlas* self,unsigned char** out_pixels,int* out_width,int* out_height) { ImFontAtlas_GetTexDataAsAlpha8(self,out_pixels,out_width,out_height,0); } +void wrap_ImFontAtlas_GetTexDataAsRGBA32(ImFontAtlas* self,unsigned char** out_pixels,int* out_width,int* out_height) { ImFontAtlas_GetTexDataAsRGBA32(self,out_pixels,out_width,out_height,0); } void wrap_ImFontGlyphRangesBuilder_AddText(ImFontGlyphRangesBuilder* self,const char* text,const int text_len) { wrap_ImFontGlyphRangesBuilder_AddTextV(self,text,text_len); } void wrap_ImFont_AddRemapChar(ImFont* self,ImWchar dst,ImWchar src) { ImFont_AddRemapChar(self,dst,src,true); } -void wrap_ImFont_CalcTextSizeA(ImVec2* pOut,ImFont* self,float size,float max_width,float wrap_width,const char* text_begin) { wrap_ImFont_CalcTextSizeAV(pOut,self,size,max_width,wrap_width,text_begin,NULL); } +void wrap_ImFont_CalcTextSizeA(ImVec2* pOut,ImFont* self,float size,float max_width,float wrap_width,const char* text_begin) { wrap_ImFont_CalcTextSizeAV(pOut,self,size,max_width,wrap_width,text_begin,0); } void wrap_ImFont_RenderText(ImFont* self,ImDrawList* draw_list,float size,const ImVec2 pos,ImU32 col,const ImVec4 clip_rect,const char* text_begin) { wrap_ImFont_RenderTextV(self,draw_list,size,pos,col,clip_rect,text_begin,0.0f,false); } void wrap_ImGuiIO_SetKeyEventNativeData(ImGuiIO* self,ImGuiKey key,int native_keycode,int native_scancode) { ImGuiIO_SetKeyEventNativeData(self,key,native_keycode,native_scancode,-1); } void wrap_ImGuiInputTextCallbackData_InsertChars(ImGuiInputTextCallbackData* self,int pos,const char* text,const int text_len) { wrap_ImGuiInputTextCallbackData_InsertCharsV(self,pos,text,text_len); } @@ -86,14 +142,14 @@ float wrap_ImGuiStorage_GetFloat(ImGuiStorage* self,ImGuiID key) { return ImGuiS float* wrap_ImGuiStorage_GetFloatRef(ImGuiStorage* self,ImGuiID key) { return ImGuiStorage_GetFloatRef(self,key,0.0f); } int wrap_ImGuiStorage_GetInt(ImGuiStorage* self,ImGuiID key) { return ImGuiStorage_GetInt(self,key,0); } int* wrap_ImGuiStorage_GetIntRef(ImGuiStorage* self,ImGuiID key) { return ImGuiStorage_GetIntRef(self,key,0); } -void** wrap_ImGuiStorage_GetVoidPtrRef(ImGuiStorage* self,ImGuiID key) { return ImGuiStorage_GetVoidPtrRef(self,key,NULL); } -void wrap_ImGuiTextBuffer_Append(ImGuiTextBuffer* self,const char* str) { ImGuiTextBuffer_append(self,str,NULL); } +void** wrap_ImGuiStorage_GetVoidPtrRef(ImGuiStorage* self,ImGuiID key) { return wrap_ImGuiStorage_GetVoidPtrRefV(self,key,0); } +void wrap_ImGuiTextBuffer_Append(ImGuiTextBuffer* self,const char* str) { ImGuiTextBuffer_append(self,str,0); } bool wrap_ImGuiTextFilter_Draw(ImGuiTextFilter* self) { return ImGuiTextFilter_Draw(self,"Filter(inc,-exc)",0.0f); } bool wrap_ImGuiTextFilter_PassFilter(ImGuiTextFilter* self,const char* text,const int text_len) { return wrap_ImGuiTextFilter_PassFilterV(self,text,text_len); } -ImGuiID wrap_ImGuiWindow_GetID_Str(ImGuiWindow* self,const char* str) { return ImGuiWindow_GetID_Str(self,str,NULL); } +ImGuiID wrap_ImGuiWindow_GetID_Str(ImGuiWindow* self,const char* str) { return ImGuiWindow_GetID_Str(self,str,0); } const ImGuiPayload* wrap_igAcceptDragDropPayload(const char* type) { return igAcceptDragDropPayload(type,0); } bool wrap_igArrowButtonEx(const char* str_id,ImGuiDir dir,ImVec2 size_arg) { return igArrowButtonEx(str_id,dir,size_arg,0); } -bool wrap_igBegin(const char* name) { return igBegin(name,NULL,0); } +bool wrap_igBegin(const char* name) { return igBegin(name,0,0); } bool wrap_igBeginChildFrame(ImGuiID id,const ImVec2 size) { return igBeginChildFrame(id,size,0); } bool wrap_igBeginChild_ID(ImGuiID id) { return igBeginChild_ID(id,(ImVec2){.x=0, .y=0},false,0); } bool wrap_igBeginChild_Str(const char* str_id) { return igBeginChild_Str(str_id,(ImVec2){.x=0, .y=0},false,0); } @@ -105,12 +161,12 @@ bool wrap_igBeginListBox(const char* label) { return igBeginListBox(label,(ImVec bool wrap_igBeginMenu(const char* label) { return igBeginMenu(label,true); } bool wrap_igBeginMenuEx(const char* label,const char* icon) { return igBeginMenuEx(label,icon,true); } bool wrap_igBeginPopup(const char* str_id) { return igBeginPopup(str_id,0); } -bool wrap_igBeginPopupContextItem() { return igBeginPopupContextItem(NULL,1); } -bool wrap_igBeginPopupContextVoid() { return igBeginPopupContextVoid(NULL,1); } -bool wrap_igBeginPopupContextWindow() { return igBeginPopupContextWindow(NULL,1); } -bool wrap_igBeginPopupModal(const char* name) { return igBeginPopupModal(name,NULL,0); } +bool wrap_igBeginPopupContextItem() { return igBeginPopupContextItem(0,1); } +bool wrap_igBeginPopupContextVoid() { return igBeginPopupContextVoid(0,1); } +bool wrap_igBeginPopupContextWindow() { return igBeginPopupContextWindow(0,1); } +bool wrap_igBeginPopupModal(const char* name) { return igBeginPopupModal(name,0,0); } bool wrap_igBeginTabBar(const char* str_id) { return igBeginTabBar(str_id,0); } -bool wrap_igBeginTabItem(const char* label) { return igBeginTabItem(label,NULL,0); } +bool wrap_igBeginTabItem(const char* label) { return igBeginTabItem(label,0,0); } bool wrap_igBeginTable(const char* str_id,int column) { return igBeginTable(str_id,column,0,(ImVec2){.x=0, .y=0},0.0f); } bool wrap_igBeginTableEx(const char* name,ImGuiID id,int columns_count) { return igBeginTableEx(name,id,columns_count,0,(ImVec2){.x=0, .y=0},0.0f); } bool wrap_igButton(const char* label) { return igButton(label,(ImVec2){.x=0, .y=0}); } @@ -123,34 +179,34 @@ bool wrap_igColorButton(const char* desc_id,const ImVec4 col) { return igColorBu bool wrap_igColorEdit3(const char* label,float col[3]) { return igColorEdit3(label,col,0); } bool wrap_igColorEdit4(const char* label,float col[4]) { return igColorEdit4(label,col,0); } bool wrap_igColorPicker3(const char* label,float col[3]) { return igColorPicker3(label,col,0); } -bool wrap_igColorPicker4(const char* label,float col[4]) { return igColorPicker4(label,col,0,NULL); } -void wrap_igColumns() { igColumns(1,NULL,true); } +bool wrap_igColorPicker4(const char* label,float col[4]) { return igColorPicker4(label,col,0,0); } +void wrap_igColumns() { igColumns(1,0,true); } bool wrap_igCombo_Str(const char* label,int* current_item,const char* items_separated_by_zeros) { return igCombo_Str(label,current_item,items_separated_by_zeros,-1); } bool wrap_igCombo_Str_arr(const char* label,int* current_item,const char* const items[],int items_count) { return igCombo_Str_arr(label,current_item,items,items_count,-1); } -ImGuiContext* wrap_igCreateContext() { return igCreateContext(NULL); } +ImGuiContext* wrap_igCreateContext() { return igCreateContext(0); } void wrap_igDebugDrawCursorPos() { igDebugDrawCursorPos(4278190335); } void wrap_igDebugDrawItemRect() { igDebugDrawItemRect(4278190335); } void wrap_igDebugDrawLineExtents() { igDebugDrawLineExtents(4278190335); } -void wrap_igDestroyContext() { igDestroyContext(NULL); } +void wrap_igDestroyContext() { igDestroyContext(0); } ImGuiID wrap_igDockBuilderAddNode() { return igDockBuilderAddNode(0,0); } void wrap_igDockBuilderRemoveNodeDockedWindows(ImGuiID node_id) { igDockBuilderRemoveNodeDockedWindows(node_id,true); } void wrap_igDockContextProcessUndockWindow(ImGuiContext* ctx,ImGuiWindow* window) { igDockContextProcessUndockWindow(ctx,window,true); } -ImGuiID wrap_igDockSpace(ImGuiID id) { return igDockSpace(id,(ImVec2){.x=0, .y=0},0,NULL); } -ImGuiID wrap_igDockSpaceOverViewport() { return igDockSpaceOverViewport(NULL,0,NULL); } +ImGuiID wrap_igDockSpace(ImGuiID id) { return igDockSpace(id,(ImVec2){.x=0, .y=0},0,0); } +ImGuiID wrap_igDockSpaceOverViewport() { return igDockSpaceOverViewport(0,0,0); } bool wrap_igDragFloat(const char* label,float* v) { return igDragFloat(label,v,1.0f,0.0f,0.0f,"%.3f",0); } bool wrap_igDragFloat2(const char* label,float v[2]) { return igDragFloat2(label,v,1.0f,0.0f,0.0f,"%.3f",0); } bool wrap_igDragFloat3(const char* label,float v[3]) { return igDragFloat3(label,v,1.0f,0.0f,0.0f,"%.3f",0); } bool wrap_igDragFloat4(const char* label,float v[4]) { return igDragFloat4(label,v,1.0f,0.0f,0.0f,"%.3f",0); } -bool wrap_igDragFloatRange2(const char* label,float* v_current_min,float* v_current_max) { return igDragFloatRange2(label,v_current_min,v_current_max,1.0f,0.0f,0.0f,"%.3f",NULL,0); } +bool wrap_igDragFloatRange2(const char* label,float* v_current_min,float* v_current_max) { return igDragFloatRange2(label,v_current_min,v_current_max,1.0f,0.0f,0.0f,"%.3f",0,0); } bool wrap_igDragInt(const char* label,int* v) { return igDragInt(label,v,1.0f,0,0,"%d",0); } bool wrap_igDragInt2(const char* label,int v[2]) { return igDragInt2(label,v,1.0f,0,0,"%d",0); } bool wrap_igDragInt3(const char* label,int v[3]) { return igDragInt3(label,v,1.0f,0,0,"%d",0); } bool wrap_igDragInt4(const char* label,int v[4]) { return igDragInt4(label,v,1.0f,0,0,"%d",0); } -bool wrap_igDragIntRange2(const char* label,int* v_current_min,int* v_current_max) { return igDragIntRange2(label,v_current_min,v_current_max,1.0f,0,0,"%d",NULL,0); } -bool wrap_igDragScalar(const char* label,ImGuiDataType data_type,void* p_data) { return igDragScalar(label,data_type,p_data,1.0f,NULL,NULL,NULL,0); } -bool wrap_igDragScalarN(const char* label,ImGuiDataType data_type,void* p_data,int components) { return igDragScalarN(label,data_type,p_data,components,1.0f,NULL,NULL,NULL,0); } -void wrap_igErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback) { igErrorCheckEndFrameRecover(log_callback,NULL); } -void wrap_igErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback) { igErrorCheckEndWindowRecover(log_callback,NULL); } +bool wrap_igDragIntRange2(const char* label,int* v_current_min,int* v_current_max) { return igDragIntRange2(label,v_current_min,v_current_max,1.0f,0,0,"%d",0,0); } +bool wrap_igDragScalar(const char* label,ImGuiDataType data_type,uintptr_t p_data) { return wrap_igDragScalarV(label,data_type,p_data,1.0f,0,0,0,0); } +bool wrap_igDragScalarN(const char* label,ImGuiDataType data_type,uintptr_t p_data,int components) { return wrap_igDragScalarNV(label,data_type,p_data,components,1.0f,0,0,0,0); } +void wrap_igErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback) { wrap_igErrorCheckEndFrameRecoverV(log_callback,0); } +void wrap_igErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback) { wrap_igErrorCheckEndWindowRecoverV(log_callback,0); } const char* wrap_igFindRenderedTextEnd(const char* text,const int text_len) { return wrap_igFindRenderedTextEndV(text,text_len); } void wrap_igFocusWindow(ImGuiWindow* window) { igFocusWindow(window,0); } ImU32 wrap_igGetColorU32_Col(ImGuiCol idx) { return igGetColorU32_Col(idx,1.0f); } @@ -158,10 +214,10 @@ float wrap_igGetColumnOffset() { return igGetColumnOffset(-1); } float wrap_igGetColumnWidth() { return igGetColumnWidth(-1); } void wrap_igGetMouseDragDelta(ImVec2* pOut) { igGetMouseDragDelta(pOut,0,-1.0f); } ImGuiTypingSelectRequest* wrap_igGetTypingSelectRequest() { return igGetTypingSelectRequest(ImGuiTypingSelectFlags_None); } -void* wrap_igImFileLoadToMemory(const char* filename,const char* mode) { return igImFileLoadToMemory(filename,mode,NULL,0); } -ImGuiID wrap_igImHashData(const void* data,size_t data_size) { return igImHashData(data,data_size,0); } +uintptr_t wrap_igImFileLoadToMemory(const char* filename,const char* mode) { return wrap_igImFileLoadToMemoryV(filename,mode,0,0); } +ImGuiID wrap_igImHashData(uintptr_t data,size_t data_size) { return wrap_igImHashDataV(data,data_size,0); } ImGuiID wrap_igImHashStr(const char* data) { return igImHashStr(data,0,0); } -int wrap_igImTextStrFromUtf8(ImWchar* out_buf,int out_buf_size,const char* in_text,const char* in_text_end) { return igImTextStrFromUtf8(out_buf,out_buf_size,in_text,in_text_end,NULL); } +int wrap_igImTextStrFromUtf8(ImWchar* out_buf,int out_buf_size,const char* in_text,const char* in_text_end) { return igImTextStrFromUtf8(out_buf,out_buf_size,in_text,in_text_end,0); } void wrap_igImage(ImTextureID user_texture_id,const ImVec2 size) { igImage(user_texture_id,size,(ImVec2){.x=0, .y=0},(ImVec2){.x=1, .y=1},(ImVec4){.x=1, .y=1, .z=1, .w=1},(ImVec4){.x=0, .y=0, .z=0, .w=0}); } bool wrap_igImageButton(const char* str_id,ImTextureID user_texture_id,const ImVec2 size) { return igImageButton(str_id,user_texture_id,size,(ImVec2){.x=0, .y=0},(ImVec2){.x=1, .y=1},(ImVec4){.x=0, .y=0, .z=0, .w=0},(ImVec4){.x=1, .y=1, .z=1, .w=1}); } bool wrap_igImageButtonEx(ImGuiID id,ImTextureID texture_id,const ImVec2 size,const ImVec2 uv0,const ImVec2 uv1,const ImVec4 bg_col,const ImVec4 tint_col) { return igImageButtonEx(id,texture_id,size,uv0,uv1,bg_col,tint_col,0); } @@ -175,12 +231,12 @@ bool wrap_igInputInt(const char* label,int* v) { return igInputInt(label,v,1,100 bool wrap_igInputInt2(const char* label,int v[2]) { return igInputInt2(label,v,0); } bool wrap_igInputInt3(const char* label,int v[3]) { return igInputInt3(label,v,0); } bool wrap_igInputInt4(const char* label,int v[4]) { return igInputInt4(label,v,0); } -bool wrap_igInputScalar(const char* label,ImGuiDataType data_type,void* p_data) { return igInputScalar(label,data_type,p_data,NULL,NULL,NULL,0); } -bool wrap_igInputScalarN(const char* label,ImGuiDataType data_type,void* p_data,int components) { return igInputScalarN(label,data_type,p_data,components,NULL,NULL,NULL,0); } -bool wrap_igInputText(const char* label,char* buf,size_t buf_size) { return igInputText(label,buf,buf_size,0,NULL,NULL); } -bool wrap_igInputTextEx(const char* label,const char* hint,char* buf,int buf_size,const ImVec2 size_arg,ImGuiInputTextFlags flags) { return igInputTextEx(label,hint,buf,buf_size,size_arg,flags,NULL,NULL); } -bool wrap_igInputTextMultiline(const char* label,char* buf,size_t buf_size) { return igInputTextMultiline(label,buf,buf_size,(ImVec2){.x=0, .y=0},0,NULL,NULL); } -bool wrap_igInputTextWithHint(const char* label,const char* hint,char* buf,size_t buf_size) { return igInputTextWithHint(label,hint,buf,buf_size,0,NULL,NULL); } +bool wrap_igInputScalar(const char* label,ImGuiDataType data_type,uintptr_t p_data) { return wrap_igInputScalarV(label,data_type,p_data,0,0,0,0); } +bool wrap_igInputScalarN(const char* label,ImGuiDataType data_type,uintptr_t p_data,int components) { return wrap_igInputScalarNV(label,data_type,p_data,components,0,0,0,0); } +bool wrap_igInputText(const char* label,char* buf,size_t buf_size) { return wrap_igInputTextV(label,buf,buf_size,0,0,0); } +bool wrap_igInputTextEx(const char* label,const char* hint,char* buf,int buf_size,const ImVec2 size_arg,ImGuiInputTextFlags flags) { return wrap_igInputTextExV(label,hint,buf,buf_size,size_arg,flags,0,0); } +bool wrap_igInputTextMultiline(const char* label,char* buf,size_t buf_size) { return wrap_igInputTextMultilineV(label,buf,buf_size,(ImVec2){.x=0, .y=0},0,0,0); } +bool wrap_igInputTextWithHint(const char* label,const char* hint,char* buf,size_t buf_size) { return wrap_igInputTextWithHintV(label,hint,buf,buf_size,0,0,0); } bool wrap_igInvisibleButton(const char* str_id,const ImVec2 size) { return igInvisibleButton(str_id,size,0); } bool wrap_igIsItemClicked() { return igIsItemClicked(0); } bool wrap_igIsItemHovered() { return igIsItemHovered(0); } @@ -192,12 +248,12 @@ bool wrap_igIsMouseClicked_ID(ImGuiMouseButton button,ImGuiID owner_id) { return bool wrap_igIsMouseDragPastThreshold(ImGuiMouseButton button) { return igIsMouseDragPastThreshold(button,-1.0f); } bool wrap_igIsMouseDragging(ImGuiMouseButton button) { return igIsMouseDragging(button,-1.0f); } bool wrap_igIsMouseHoveringRect(const ImVec2 r_min,const ImVec2 r_max) { return igIsMouseHoveringRect(r_min,r_max,true); } -bool wrap_igIsMousePosValid() { return igIsMousePosValid(NULL); } +bool wrap_igIsMousePosValid() { return igIsMousePosValid(0); } bool wrap_igIsPopupOpen_Str(const char* str_id) { return igIsPopupOpen_Str(str_id,0); } bool wrap_igIsWindowContentHoverable(ImGuiWindow* window) { return igIsWindowContentHoverable(window,0); } bool wrap_igIsWindowFocused() { return igIsWindowFocused(0); } bool wrap_igIsWindowHovered() { return igIsWindowHovered(0); } -bool wrap_igItemAdd(const ImRect bb,ImGuiID id) { return igItemAdd(bb,id,NULL,0); } +bool wrap_igItemAdd(const ImRect bb,ImGuiID id) { return igItemAdd(bb,id,0,0); } void wrap_igItemSize_Rect(const ImRect bb) { igItemSize_Rect(bb,-1.0f); } void wrap_igItemSize_Vec2(const ImVec2 size) { igItemSize_Vec2(size,-1.0f); } bool wrap_igListBox_Str_arr(const char* label,int* current_item,const char* const items[],int items_count) { return igListBox_Str_arr(label,current_item,items,items_count,-1); } @@ -205,41 +261,41 @@ void wrap_igLoadIniSettingsFromMemory(const char* ini_data) { igLoadIniSettingsF void wrap_igLogRenderedText(const ImVec2* ref_pos,const char* text,const int text_len) { wrap_igLogRenderedTextV(ref_pos,text,text_len); } void wrap_igLogToBuffer() { igLogToBuffer(-1); } void wrap_igLogToClipboard() { igLogToClipboard(-1); } -void wrap_igLogToFile() { igLogToFile(-1,NULL); } +void wrap_igLogToFile() { igLogToFile(-1,0); } void wrap_igLogToTTY() { igLogToTTY(-1); } -bool wrap_igMenuItemEx(const char* label,const char* icon) { return igMenuItemEx(label,icon,NULL,false,true); } -bool wrap_igMenuItem_Bool(const char* label) { return igMenuItem_Bool(label,NULL,false,true); } +bool wrap_igMenuItemEx(const char* label,const char* icon) { return igMenuItemEx(label,icon,0,false,true); } +bool wrap_igMenuItem_Bool(const char* label) { return igMenuItem_Bool(label,0,false,true); } bool wrap_igMenuItem_BoolPtr(const char* label,const char* shortcut,bool* p_selected) { return igMenuItem_BoolPtr(label,shortcut,p_selected,true); } void wrap_igOpenPopupEx(ImGuiID id) { igOpenPopupEx(id,ImGuiPopupFlags_None); } -void wrap_igOpenPopupOnItemClick() { igOpenPopupOnItemClick(NULL,1); } +void wrap_igOpenPopupOnItemClick() { igOpenPopupOnItemClick(0,1); } void wrap_igOpenPopup_ID(ImGuiID id) { igOpenPopup_ID(id,0); } void wrap_igOpenPopup_Str(const char* str_id) { igOpenPopup_Str(str_id,0); } -void wrap_igPlotHistogram_FloatPtr(const char* label,const float* values,int values_count) { igPlotHistogram_FloatPtr(label,values,values_count,0,NULL,igGET_FLT_MAX(),igGET_FLT_MAX(),(ImVec2){.x=0, .y=0},sizeof(float)); } -void wrap_igPlotLines_FloatPtr(const char* label,const float* values,int values_count) { igPlotLines_FloatPtr(label,values,values_count,0,NULL,igGET_FLT_MAX(),igGET_FLT_MAX(),(ImVec2){.x=0, .y=0},sizeof(float)); } +void wrap_igPlotHistogram_FloatPtr(const char* label,const float* values,int values_count) { igPlotHistogram_FloatPtr(label,values,values_count,0,0,igGET_FLT_MAX(),igGET_FLT_MAX(),(ImVec2){.x=0, .y=0},sizeof(float)); } +void wrap_igPlotLines_FloatPtr(const char* label,const float* values,int values_count) { igPlotLines_FloatPtr(label,values,values_count,0,0,igGET_FLT_MAX(),igGET_FLT_MAX(),(ImVec2){.x=0, .y=0},sizeof(float)); } void wrap_igPopStyleColor() { igPopStyleColor(1); } void wrap_igPopStyleVar() { igPopStyleVar(1); } -void wrap_igProgressBar(float fraction) { igProgressBar(fraction,(ImVec2){.x=-1*igGET_FLT_MIN(), .y=0},NULL); } +void wrap_igProgressBar(float fraction) { igProgressBar(fraction,(ImVec2){.x=-1*igGET_FLT_MIN(), .y=0},0); } void wrap_igPushTextWrapPos() { igPushTextWrapPos(0.0f); } void wrap_igRenderArrow(ImDrawList* draw_list,ImVec2 pos,ImU32 col,ImGuiDir dir) { igRenderArrow(draw_list,pos,col,dir,1.0f); } void wrap_igRenderColorRectWithAlphaCheckerboard(ImDrawList* draw_list,ImVec2 p_min,ImVec2 p_max,ImU32 fill_col,float grid_step,ImVec2 grid_off) { igRenderColorRectWithAlphaCheckerboard(draw_list,p_min,p_max,fill_col,grid_step,grid_off,0.0f,0); } void wrap_igRenderFrame(ImVec2 p_min,ImVec2 p_max,ImU32 fill_col) { igRenderFrame(p_min,p_max,fill_col,true,0.0f); } void wrap_igRenderFrameBorder(ImVec2 p_min,ImVec2 p_max) { igRenderFrameBorder(p_min,p_max,0.0f); } void wrap_igRenderNavHighlight(const ImRect bb,ImGuiID id) { igRenderNavHighlight(bb,id,ImGuiNavHighlightFlags_TypeDefault); } -void wrap_igRenderPlatformWindowsDefault() { igRenderPlatformWindowsDefault(NULL,NULL); } +void wrap_igRenderPlatformWindowsDefault() { wrap_igRenderPlatformWindowsDefaultV(0,0); } void wrap_igRenderText(ImVec2 pos,const char* text,const int text_len) { wrap_igRenderTextV(pos,text,text_len,true); } -void wrap_igRenderTextClipped(const ImVec2 pos_min,const ImVec2 pos_max,const char* text,const int text_len,const ImVec2* text_size_if_known) { wrap_igRenderTextClippedV(pos_min,pos_max,text,text_len,text_size_if_known,(ImVec2){.x=0, .y=0},NULL); } -void wrap_igRenderTextClippedEx(ImDrawList* draw_list,const ImVec2 pos_min,const ImVec2 pos_max,const char* text,const int text_len,const ImVec2* text_size_if_known) { wrap_igRenderTextClippedExV(draw_list,pos_min,pos_max,text,text_len,text_size_if_known,(ImVec2){.x=0, .y=0},NULL); } +void wrap_igRenderTextClipped(const ImVec2 pos_min,const ImVec2 pos_max,const char* text,const int text_len,const ImVec2* text_size_if_known) { wrap_igRenderTextClippedV(pos_min,pos_max,text,text_len,text_size_if_known,(ImVec2){.x=0, .y=0},0); } +void wrap_igRenderTextClippedEx(ImDrawList* draw_list,const ImVec2 pos_min,const ImVec2 pos_max,const char* text,const int text_len,const ImVec2* text_size_if_known) { wrap_igRenderTextClippedExV(draw_list,pos_min,pos_max,text,text_len,text_size_if_known,(ImVec2){.x=0, .y=0},0); } void wrap_igResetMouseDragDelta() { igResetMouseDragDelta(0); } void wrap_igSameLine() { igSameLine(0.0f,-1.0f); } -const char* wrap_igSaveIniSettingsToMemory() { return igSaveIniSettingsToMemory(NULL); } +const char* wrap_igSaveIniSettingsToMemory() { return igSaveIniSettingsToMemory(0); } void wrap_igScrollToItem() { igScrollToItem(0); } void wrap_igScrollToRect(ImGuiWindow* window,const ImRect rect) { igScrollToRect(window,rect,0); } void wrap_igScrollToRectEx(ImVec2* pOut,ImGuiWindow* window,const ImRect rect) { igScrollToRectEx(pOut,window,rect,0); } bool wrap_igSelectable_Bool(const char* label) { return igSelectable_Bool(label,false,0,(ImVec2){.x=0, .y=0}); } bool wrap_igSelectable_BoolPtr(const char* label,bool* p_selected) { return igSelectable_BoolPtr(label,p_selected,0,(ImVec2){.x=0, .y=0}); } void wrap_igSeparatorEx(ImGuiSeparatorFlags flags) { igSeparatorEx(flags,1.0f); } -void wrap_igSetAllocatorFunctions(ImGuiMemAllocFunc alloc_func,ImGuiMemFreeFunc free_func) { igSetAllocatorFunctions(alloc_func,free_func,NULL); } -bool wrap_igSetDragDropPayload(const char* type,const void* data,size_t sz) { return igSetDragDropPayload(type,data,sz,0); } +void wrap_igSetAllocatorFunctions(ImGuiMemAllocFunc alloc_func,ImGuiMemFreeFunc free_func) { wrap_igSetAllocatorFunctionsV(alloc_func,free_func,0); } +bool wrap_igSetDragDropPayload(const char* type,uintptr_t data,size_t sz) { return wrap_igSetDragDropPayloadV(type,data,sz,0); } void wrap_igSetItemKeyOwner(ImGuiKey key) { igSetItemKeyOwner(key,0); } void wrap_igSetKeyOwner(ImGuiKey key,ImGuiID owner_id) { igSetKeyOwner(key,owner_id,0); } void wrap_igSetKeyOwnersForKeyChord(ImGuiKeyChord key,ImGuiID owner_id) { igSetKeyOwnersForKeyChord(key,owner_id,0); } @@ -249,7 +305,7 @@ void wrap_igSetNextWindowCollapsed(bool collapsed) { igSetNextWindowCollapsed(co void wrap_igSetNextWindowDockID(ImGuiID dock_id) { igSetNextWindowDockID(dock_id,0); } void wrap_igSetNextWindowPos(const ImVec2 pos) { igSetNextWindowPos(pos,0,(ImVec2){.x=0, .y=0}); } void wrap_igSetNextWindowSize(const ImVec2 size) { igSetNextWindowSize(size,0); } -void wrap_igSetNextWindowSizeConstraints(const ImVec2 size_min,const ImVec2 size_max) { igSetNextWindowSizeConstraints(size_min,size_max,NULL,NULL); } +void wrap_igSetNextWindowSizeConstraints(const ImVec2 size_min,const ImVec2 size_max) { wrap_igSetNextWindowSizeConstraintsV(size_min,size_max,0,0); } void wrap_igSetScrollFromPosX_Float(float local_x) { igSetScrollFromPosX_Float(local_x,0.5f); } void wrap_igSetScrollFromPosY_Float(float local_y) { igSetScrollFromPosY_Float(local_y,0.5f); } void wrap_igSetScrollHereX() { igSetScrollHereX(0.5f); } @@ -265,12 +321,12 @@ void wrap_igSetWindowSize_Str(const char* name,const ImVec2 size) { igSetWindowS void wrap_igSetWindowSize_Vec2(const ImVec2 size) { igSetWindowSize_Vec2(size,0); } void wrap_igSetWindowSize_WindowPtr(ImGuiWindow* window,const ImVec2 size) { igSetWindowSize_WindowPtr(window,size,0); } bool wrap_igShortcut(ImGuiKeyChord key_chord) { return igShortcut(key_chord,0,0); } -void wrap_igShowAboutWindow() { igShowAboutWindow(NULL); } -void wrap_igShowDebugLogWindow() { igShowDebugLogWindow(NULL); } -void wrap_igShowDemoWindow() { igShowDemoWindow(NULL); } -void wrap_igShowMetricsWindow() { igShowMetricsWindow(NULL); } -void wrap_igShowStackToolWindow() { igShowStackToolWindow(NULL); } -void wrap_igShowStyleEditor() { igShowStyleEditor(NULL); } +void wrap_igShowAboutWindow() { igShowAboutWindow(0); } +void wrap_igShowDebugLogWindow() { igShowDebugLogWindow(0); } +void wrap_igShowDemoWindow() { igShowDemoWindow(0); } +void wrap_igShowMetricsWindow() { igShowMetricsWindow(0); } +void wrap_igShowStackToolWindow() { igShowStackToolWindow(0); } +void wrap_igShowStyleEditor() { igShowStyleEditor(0); } bool wrap_igSliderAngle(const char* label,float* v_rad) { return igSliderAngle(label,v_rad,-360.0f,+360.0f,"%.0f deg",0); } bool wrap_igSliderFloat(const char* label,float* v,float v_min,float v_max) { return igSliderFloat(label,v,v_min,v_max,"%.3f",0); } bool wrap_igSliderFloat2(const char* label,float v[2],float v_min,float v_max) { return igSliderFloat2(label,v,v_min,v_max,"%.3f",0); } @@ -280,12 +336,12 @@ bool wrap_igSliderInt(const char* label,int* v,int v_min,int v_max) { return igS bool wrap_igSliderInt2(const char* label,int v[2],int v_min,int v_max) { return igSliderInt2(label,v,v_min,v_max,"%d",0); } bool wrap_igSliderInt3(const char* label,int v[3],int v_min,int v_max) { return igSliderInt3(label,v,v_min,v_max,"%d",0); } bool wrap_igSliderInt4(const char* label,int v[4],int v_min,int v_max) { return igSliderInt4(label,v,v_min,v_max,"%d",0); } -bool wrap_igSliderScalar(const char* label,ImGuiDataType data_type,void* p_data,const void* p_min,const void* p_max) { return igSliderScalar(label,data_type,p_data,p_min,p_max,NULL,0); } -bool wrap_igSliderScalarN(const char* label,ImGuiDataType data_type,void* p_data,int components,const void* p_min,const void* p_max) { return igSliderScalarN(label,data_type,p_data,components,p_min,p_max,NULL,0); } +bool wrap_igSliderScalar(const char* label,ImGuiDataType data_type,uintptr_t p_data,uintptr_t p_min,uintptr_t p_max) { return wrap_igSliderScalarV(label,data_type,p_data,p_min,p_max,0,0); } +bool wrap_igSliderScalarN(const char* label,ImGuiDataType data_type,uintptr_t p_data,int components,uintptr_t p_min,uintptr_t p_max) { return wrap_igSliderScalarNV(label,data_type,p_data,components,p_min,p_max,0,0); } bool wrap_igSplitterBehavior(const ImRect bb,ImGuiID id,ImGuiAxis axis,float* size1,float* size2,float min_size1,float min_size2) { return igSplitterBehavior(bb,id,axis,size1,size2,min_size1,min_size2,0.0f,0.0f,0); } -void wrap_igStyleColorsClassic() { igStyleColorsClassic(NULL); } -void wrap_igStyleColorsDark() { igStyleColorsDark(NULL); } -void wrap_igStyleColorsLight() { igStyleColorsLight(NULL); } +void wrap_igStyleColorsClassic() { igStyleColorsClassic(0); } +void wrap_igStyleColorsDark() { igStyleColorsDark(0); } +void wrap_igStyleColorsLight() { igStyleColorsLight(0); } bool wrap_igTabItemButton(const char* label) { return igTabItemButton(label,0); } ImGuiTableColumnFlags wrap_igTableGetColumnFlags() { return igTableGetColumnFlags(-1); } const char* wrap_igTableGetColumnName_Int() { return igTableGetColumnName_Int(-1); } @@ -294,13 +350,13 @@ void wrap_igTableNextRow() { igTableNextRow(0,0.0f); } void wrap_igTableOpenContextMenu() { igTableOpenContextMenu(-1); } void wrap_igTableSetBgColor(ImGuiTableBgTarget target,ImU32 color) { igTableSetBgColor(target,color,-1); } void wrap_igTableSetupColumn(const char* label) { igTableSetupColumn(label,0,0.0f,0); } -bool wrap_igTempInputScalar(const ImRect bb,ImGuiID id,const char* label,ImGuiDataType data_type,void* p_data,const char* format) { return igTempInputScalar(bb,id,label,data_type,p_data,format,NULL,NULL); } +bool wrap_igTempInputScalar(const ImRect bb,ImGuiID id,const char* label,ImGuiDataType data_type,uintptr_t p_data,const char* format) { return wrap_igTempInputScalarV(bb,id,label,data_type,p_data,format,0,0); } void wrap_igTextEx(const char* text,const int text_len) { wrap_igTextExV(text,text_len,0); } void wrap_igTextUnformatted(const char* text,const int text_len) { wrap_igTextUnformattedV(text,text_len); } -bool wrap_igTreeNodeBehavior(ImGuiID id,ImGuiTreeNodeFlags flags,const char* label) { return igTreeNodeBehavior(id,flags,label,NULL); } +bool wrap_igTreeNodeBehavior(ImGuiID id,ImGuiTreeNodeFlags flags,const char* label) { return igTreeNodeBehavior(id,flags,label,0); } bool wrap_igTreeNodeEx_Str(const char* label) { return igTreeNodeEx_Str(label,0); } void wrap_igUnindent() { igUnindent(0.0f); } bool wrap_igVSliderFloat(const char* label,const ImVec2 size,float* v,float v_min,float v_max) { return igVSliderFloat(label,size,v,v_min,v_max,"%.3f",0); } bool wrap_igVSliderInt(const char* label,const ImVec2 size,int* v,int v_min,int v_max) { return igVSliderInt(label,size,v,v_min,v_max,"%d",0); } -bool wrap_igVSliderScalar(const char* label,const ImVec2 size,ImGuiDataType data_type,void* p_data,const void* p_min,const void* p_max) { return igVSliderScalar(label,size,data_type,p_data,p_min,p_max,NULL,0); } -void wrap_igValue_Float(const char* prefix,float v) { igValue_Float(prefix,v,NULL); } +bool wrap_igVSliderScalar(const char* label,const ImVec2 size,ImGuiDataType data_type,uintptr_t p_data,uintptr_t p_min,uintptr_t p_max) { return wrap_igVSliderScalarV(label,size,data_type,p_data,p_min,p_max,0,0); } +void wrap_igValue_Float(const char* prefix,float v) { igValue_Float(prefix,v,0); } diff --git a/cimgui_wrapper.h b/cimgui_wrapper.h index 9319d9222..aae8cdfa0 100644 --- a/cimgui_wrapper.h +++ b/cimgui_wrapper.h @@ -9,41 +9,97 @@ extern "C" { #endif +extern void wrap_ImDrawList_AddCallback(ImDrawList* self,ImDrawCallback callback,uintptr_t callback_data); extern void wrap_ImDrawList_AddText_FontPtrV(ImDrawList* self,const ImFont* font,float font_size,const ImVec2 pos,ImU32 col,const char* text_begin,float wrap_width,const ImVec4* cpu_fine_clip_rect); extern void wrap_ImDrawList_AddText_Vec2V(ImDrawList* self,const ImVec2 pos,ImU32 col,const char* text_begin); +extern ImFont* wrap_ImFontAtlas_AddFontFromMemoryCompressedTTFV(ImFontAtlas* self,const uintptr_t compressed_font_data,int compressed_font_data_size,float size_pixels,const ImFontConfig* font_cfg,const ImWchar* glyph_ranges); +extern ImFont* wrap_ImFontAtlas_AddFontFromMemoryTTFV(ImFontAtlas* self,uintptr_t font_data,int font_data_size,float size_pixels,const ImFontConfig* font_cfg,const ImWchar* glyph_ranges); extern void wrap_ImFontGlyphRangesBuilder_AddTextV(ImFontGlyphRangesBuilder* self,const char* text,const int text_len); extern void wrap_ImFont_CalcTextSizeAV(ImVec2 *pOut,ImFont* self,float size,float max_width,float wrap_width,const char* text_begin,const char** remaining); extern const char* wrap_ImFont_CalcWordWrapPositionA(ImFont* self,float scale,const char* text,const int text_len,float wrap_width); extern void wrap_ImFont_RenderTextV(ImFont* self,ImDrawList* draw_list,float size,const ImVec2 pos,ImU32 col,const ImVec4 clip_rect,const char* text_begin,float wrap_width,bool cpu_fine_clip); +extern uintptr_t wrap_ImGuiDataVarInfo_GetVarPtr(ImGuiDataVarInfo* self,uintptr_t parent); extern void wrap_ImGuiInputTextCallbackData_InsertCharsV(ImGuiInputTextCallbackData* self,int pos,const char* text,const int text_len); +extern ImGuiPtrOrIndex* wrap_ImGuiPtrOrIndex_ImGuiPtrOrIndex_Ptr(uintptr_t ptr); +extern ImGuiStoragePair* wrap_ImGuiStoragePair_ImGuiStoragePair_Ptr(ImGuiID _key,uintptr_t _val_p); +extern uintptr_t wrap_ImGuiStorage_GetVoidPtr(ImGuiStorage* self,ImGuiID key); +extern void** wrap_ImGuiStorage_GetVoidPtrRefV(ImGuiStorage* self,ImGuiID key,uintptr_t default_val); +extern void wrap_ImGuiStorage_SetVoidPtr(ImGuiStorage* self,ImGuiID key,uintptr_t val); extern void wrap_ImGuiTextBuffer_Appendf(ImGuiTextBuffer* self,const char* fmt); extern bool wrap_ImGuiTextFilter_PassFilterV(ImGuiTextFilter* self,const char* text,const int text_len); +extern ImGuiID wrap_ImGuiWindow_GetID_Ptr(ImGuiWindow* self,const uintptr_t ptr); extern void wrap_igBulletText(const char* fmt); extern void wrap_igCalcTextSizeV(ImVec2 *pOut,const char* text,const int text_len,bool hide_text_after_double_hash,float wrap_width); +extern bool wrap_igCombo_FnStrPtr(const char* label,int* current_item,const char*(*getter)(void* user_data,int idx),uintptr_t user_data,int items_count,int popup_max_height_in_items); +extern bool wrap_igDataTypeApplyFromText(const char* buf,ImGuiDataType data_type,uintptr_t p_data,const char* format); +extern void wrap_igDataTypeApplyOp(ImGuiDataType data_type,int op,uintptr_t output,const uintptr_t arg_1,const uintptr_t arg_2); +extern bool wrap_igDataTypeClamp(ImGuiDataType data_type,uintptr_t p_data,const uintptr_t p_min,const uintptr_t p_max); +extern int wrap_igDataTypeCompare(ImGuiDataType data_type,const uintptr_t arg_1,const uintptr_t arg_2); +extern int wrap_igDataTypeFormatString(char* buf,int buf_size,ImGuiDataType data_type,const uintptr_t p_data,const char* format); +extern void wrap_igDebugHookIdInfo(ImGuiID id,ImGuiDataType data_type,const uintptr_t data_id,const uintptr_t data_id_end); extern void wrap_igDebugLog(const char* fmt); +extern bool wrap_igDragBehavior(ImGuiID id,ImGuiDataType data_type,uintptr_t p_v,float v_speed,const uintptr_t p_min,const uintptr_t p_max,const char* format,ImGuiSliderFlags flags); +extern bool wrap_igDragScalarV(const char* label,ImGuiDataType data_type,uintptr_t p_data,float v_speed,const uintptr_t p_min,const uintptr_t p_max,const char* format,ImGuiSliderFlags flags); +extern bool wrap_igDragScalarNV(const char* label,ImGuiDataType data_type,uintptr_t p_data,int components,float v_speed,const uintptr_t p_min,const uintptr_t p_max,const char* format,ImGuiSliderFlags flags); +extern void wrap_igErrorCheckEndFrameRecoverV(ImGuiErrorLogCallback log_callback,uintptr_t user_data); +extern void wrap_igErrorCheckEndWindowRecoverV(ImGuiErrorLogCallback log_callback,uintptr_t user_data); extern const char* wrap_igFindRenderedTextEndV(const char* text,const int text_len); +extern ImGuiViewport* wrap_igFindViewportByPlatformHandle(uintptr_t platform_handle); +extern ImGuiID wrap_igGetID_Ptr(const uintptr_t ptr_id); +extern uintptr_t wrap_igImFileLoadToMemoryV(const char* filename,const char* mode,size_t* out_file_size,int padding_bytes); +extern ImU64 wrap_igImFileRead(uintptr_t data,ImU64 size,ImU64 count,ImFileHandle file); +extern ImU64 wrap_igImFileWrite(const uintptr_t data,ImU64 size,ImU64 count,ImFileHandle file); +extern void wrap_igImFontAtlasBuildPackCustomRects(ImFontAtlas* atlas,uintptr_t stbrp_context_opaque); extern int wrap_igImFormatString(char* buf,size_t buf_size,const char* fmt); extern void wrap_igImFormatStringToTempBuffer(const char** out_buf,const char** out_buf_end,const char* fmt); +extern ImGuiID wrap_igImHashDataV(const uintptr_t data,size_t data_size,ImGuiID seed); +extern void wrap_igImQsort(uintptr_t base,size_t count,size_t size_of_element,int(*compare_func)(void const*,void const*)); +extern bool wrap_igInputScalarV(const char* label,ImGuiDataType data_type,uintptr_t p_data,const uintptr_t p_step,const uintptr_t p_step_fast,const char* format,ImGuiInputTextFlags flags); +extern bool wrap_igInputScalarNV(const char* label,ImGuiDataType data_type,uintptr_t p_data,int components,const uintptr_t p_step,const uintptr_t p_step_fast,const char* format,ImGuiInputTextFlags flags); +extern bool wrap_igInputTextV(const char* label,char* buf,size_t buf_size,ImGuiInputTextFlags flags,ImGuiInputTextCallback callback,uintptr_t user_data); +extern bool wrap_igInputTextExV(const char* label,const char* hint,char* buf,int buf_size,const ImVec2 size_arg,ImGuiInputTextFlags flags,ImGuiInputTextCallback callback,uintptr_t user_data); +extern bool wrap_igInputTextMultilineV(const char* label,char* buf,size_t buf_size,const ImVec2 size,ImGuiInputTextFlags flags,ImGuiInputTextCallback callback,uintptr_t user_data); +extern bool wrap_igInputTextWithHintV(const char* label,const char* hint,char* buf,size_t buf_size,ImGuiInputTextFlags flags,ImGuiInputTextCallback callback,uintptr_t user_data); extern void wrap_igLabelText(const char* label,const char* fmt); +extern bool wrap_igListBox_FnStrPtr(const char* label,int* current_item,const char*(*getter)(void* user_data,int idx),uintptr_t user_data,int items_count,int height_in_items); extern void wrap_igLogRenderedTextV(const ImVec2* ref_pos,const char* text,const int text_len); extern void wrap_igLogText(const char* fmt); +extern uintptr_t wrap_igMemAlloc(size_t size); +extern void wrap_igMemFree(uintptr_t ptr); +extern int wrap_igPlotEx(ImGuiPlotType plot_type,const char* label,float(*values_getter)(void* data,int idx),uintptr_t data,int values_count,int values_offset,const char* overlay_text,float scale_min,float scale_max,const ImVec2 size_arg); +extern void wrap_igPlotHistogram_FnFloatPtr(const char* label,float(*values_getter)(void* data,int idx),uintptr_t data,int values_count,int values_offset,const char* overlay_text,float scale_min,float scale_max,ImVec2 graph_size); +extern void wrap_igPlotLines_FnFloatPtr(const char* label,float(*values_getter)(void* data,int idx),uintptr_t data,int values_count,int values_offset,const char* overlay_text,float scale_min,float scale_max,ImVec2 graph_size); +extern void wrap_igPushID_Ptr(const uintptr_t ptr_id); +extern void wrap_igRenderPlatformWindowsDefaultV(uintptr_t platform_render_arg,uintptr_t renderer_render_arg); extern void wrap_igRenderTextV(ImVec2 pos,const char* text,const int text_len,bool hide_text_after_hash); extern void wrap_igRenderTextClippedV(const ImVec2 pos_min,const ImVec2 pos_max,const char* text,const int text_len,const ImVec2* text_size_if_known,const ImVec2 align,const ImRect* clip_rect); extern void wrap_igRenderTextClippedExV(ImDrawList* draw_list,const ImVec2 pos_min,const ImVec2 pos_max,const char* text,const int text_len,const ImVec2* text_size_if_known,const ImVec2 align,const ImRect* clip_rect); extern void wrap_igRenderTextEllipsis(ImDrawList* draw_list,const ImVec2 pos_min,const ImVec2 pos_max,float clip_max_x,float ellipsis_max_x,const char* text,const int text_len,const ImVec2* text_size_if_known); extern void wrap_igRenderTextWrapped(ImVec2 pos,const char* text,const int text_len,float wrap_width); +extern void wrap_igSetAllocatorFunctionsV(ImGuiMemAllocFunc alloc_func,ImGuiMemFreeFunc free_func,uintptr_t user_data); +extern bool wrap_igSetDragDropPayloadV(const char* type,const uintptr_t data,size_t sz,ImGuiCond cond); extern void wrap_igSetItemTooltip(const char* fmt); +extern void wrap_igSetNextWindowSizeConstraintsV(const ImVec2 size_min,const ImVec2 size_max,ImGuiSizeCallback custom_callback,uintptr_t custom_callback_data); extern void wrap_igSetTooltip(const char* fmt); +extern bool wrap_igSliderBehavior(const ImRect bb,ImGuiID id,ImGuiDataType data_type,uintptr_t p_v,const uintptr_t p_min,const uintptr_t p_max,const char* format,ImGuiSliderFlags flags,ImRect* out_grab_bb); +extern bool wrap_igSliderScalarV(const char* label,ImGuiDataType data_type,uintptr_t p_data,const uintptr_t p_min,const uintptr_t p_max,const char* format,ImGuiSliderFlags flags); +extern bool wrap_igSliderScalarNV(const char* label,ImGuiDataType data_type,uintptr_t p_data,int components,const uintptr_t p_min,const uintptr_t p_max,const char* format,ImGuiSliderFlags flags); +extern bool wrap_igTempInputScalarV(const ImRect bb,ImGuiID id,const char* label,ImGuiDataType data_type,uintptr_t p_data,const char* format,const uintptr_t p_clamp_min,const uintptr_t p_clamp_max); extern void wrap_igText(const char* fmt); extern void wrap_igTextColored(const ImVec4 col,const char* fmt); extern void wrap_igTextDisabled(const char* fmt); extern void wrap_igTextExV(const char* text,const int text_len,ImGuiTextFlags flags); extern void wrap_igTextUnformattedV(const char* text,const int text_len); extern void wrap_igTextWrapped(const char* fmt); -extern bool wrap_igTreeNodeEx_Ptr(const void* ptr_id,ImGuiTreeNodeFlags flags,const char* fmt); +extern bool wrap_igTreeNodeEx_Ptr(const uintptr_t ptr_id,ImGuiTreeNodeFlags flags,const char* fmt); extern bool wrap_igTreeNodeEx_StrStr(const char* str_id,ImGuiTreeNodeFlags flags,const char* fmt); -extern bool wrap_igTreeNode_Ptr(const void* ptr_id,const char* fmt); +extern bool wrap_igTreeNode_Ptr(const uintptr_t ptr_id,const char* fmt); extern bool wrap_igTreeNode_StrStr(const char* str_id,const char* fmt); +extern void wrap_igTreePush_Ptr(const uintptr_t ptr_id); +extern int wrap_igTypingSelectFindBestLeadingMatch(ImGuiTypingSelectRequest* req,int items_count,const char*(*get_item_name_func)(void*,int),uintptr_t user_data); +extern int wrap_igTypingSelectFindMatch(ImGuiTypingSelectRequest* req,int items_count,const char*(*get_item_name_func)(void*,int),uintptr_t user_data,int nav_item_idx); +extern int wrap_igTypingSelectFindNextSingleCharMatch(ImGuiTypingSelectRequest* req,int items_count,const char*(*get_item_name_func)(void*,int),uintptr_t user_data,int nav_item_idx); +extern bool wrap_igVSliderScalarV(const char* label,const ImVec2 size,ImGuiDataType data_type,uintptr_t p_data,const uintptr_t p_min,const uintptr_t p_max,const char* format,ImGuiSliderFlags flags); extern void wrap_ImColor_HSV(ImColor* pOut,float h,float s,float v); extern void wrap_ImColor_SetHSV(ImColor* self,float h,float s,float v); extern void wrap_ImDrawList_AddBezierCubic(ImDrawList* self,const ImVec2 p1,const ImVec2 p2,const ImVec2 p3,const ImVec2 p4,ImU32 col,float thickness); @@ -74,8 +130,8 @@ extern int wrap_ImFontAtlas_AddCustomRectFontGlyph(ImFontAtlas* self,ImFont* fon extern ImFont* wrap_ImFontAtlas_AddFontDefault(ImFontAtlas* self); extern ImFont* wrap_ImFontAtlas_AddFontFromFileTTF(ImFontAtlas* self,const char* filename,float size_pixels); extern ImFont* wrap_ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(ImFontAtlas* self,const char* compressed_font_data_base85,float size_pixels); -extern ImFont* wrap_ImFontAtlas_AddFontFromMemoryCompressedTTF(ImFontAtlas* self,const void* compressed_font_data,int compressed_font_data_size,float size_pixels); -extern ImFont* wrap_ImFontAtlas_AddFontFromMemoryTTF(ImFontAtlas* self,void* font_data,int font_data_size,float size_pixels); +extern ImFont* wrap_ImFontAtlas_AddFontFromMemoryCompressedTTF(ImFontAtlas* self,uintptr_t compressed_font_data,int compressed_font_data_size,float size_pixels); +extern ImFont* wrap_ImFontAtlas_AddFontFromMemoryTTF(ImFontAtlas* self,uintptr_t font_data,int font_data_size,float size_pixels); extern void wrap_ImFontAtlas_GetTexDataAsAlpha8(ImFontAtlas* self,unsigned char** out_pixels,int* out_width,int* out_height); extern void wrap_ImFontAtlas_GetTexDataAsRGBA32(ImFontAtlas* self,unsigned char** out_pixels,int* out_width,int* out_height); extern void wrap_ImFontGlyphRangesBuilder_AddText(ImFontGlyphRangesBuilder* self,const char* text,const int text_len); @@ -152,8 +208,8 @@ extern bool wrap_igDragInt2(const char* label,int v[2]); extern bool wrap_igDragInt3(const char* label,int v[3]); extern bool wrap_igDragInt4(const char* label,int v[4]); extern bool wrap_igDragIntRange2(const char* label,int* v_current_min,int* v_current_max); -extern bool wrap_igDragScalar(const char* label,ImGuiDataType data_type,void* p_data); -extern bool wrap_igDragScalarN(const char* label,ImGuiDataType data_type,void* p_data,int components); +extern bool wrap_igDragScalar(const char* label,ImGuiDataType data_type,uintptr_t p_data); +extern bool wrap_igDragScalarN(const char* label,ImGuiDataType data_type,uintptr_t p_data,int components); extern void wrap_igErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback); extern void wrap_igErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback); extern const char* wrap_igFindRenderedTextEnd(const char* text,const int text_len); @@ -163,8 +219,8 @@ extern float wrap_igGetColumnOffset(); extern float wrap_igGetColumnWidth(); extern void wrap_igGetMouseDragDelta(ImVec2* pOut); extern ImGuiTypingSelectRequest* wrap_igGetTypingSelectRequest(); -extern void* wrap_igImFileLoadToMemory(const char* filename,const char* mode); -extern ImGuiID wrap_igImHashData(const void* data,size_t data_size); +extern uintptr_t wrap_igImFileLoadToMemory(const char* filename,const char* mode); +extern ImGuiID wrap_igImHashData(uintptr_t data,size_t data_size); extern ImGuiID wrap_igImHashStr(const char* data); extern int wrap_igImTextStrFromUtf8(ImWchar* out_buf,int out_buf_size,const char* in_text,const char* in_text_end); extern void wrap_igImage(ImTextureID user_texture_id,const ImVec2 size); @@ -180,8 +236,8 @@ extern bool wrap_igInputInt(const char* label,int* v); extern bool wrap_igInputInt2(const char* label,int v[2]); extern bool wrap_igInputInt3(const char* label,int v[3]); extern bool wrap_igInputInt4(const char* label,int v[4]); -extern bool wrap_igInputScalar(const char* label,ImGuiDataType data_type,void* p_data); -extern bool wrap_igInputScalarN(const char* label,ImGuiDataType data_type,void* p_data,int components); +extern bool wrap_igInputScalar(const char* label,ImGuiDataType data_type,uintptr_t p_data); +extern bool wrap_igInputScalarN(const char* label,ImGuiDataType data_type,uintptr_t p_data,int components); extern bool wrap_igInputText(const char* label,char* buf,size_t buf_size); extern bool wrap_igInputTextEx(const char* label,const char* hint,char* buf,int buf_size,const ImVec2 size_arg,ImGuiInputTextFlags flags); extern bool wrap_igInputTextMultiline(const char* label,char* buf,size_t buf_size); @@ -244,7 +300,7 @@ extern bool wrap_igSelectable_Bool(const char* label); extern bool wrap_igSelectable_BoolPtr(const char* label,bool* p_selected); extern void wrap_igSeparatorEx(ImGuiSeparatorFlags flags); extern void wrap_igSetAllocatorFunctions(ImGuiMemAllocFunc alloc_func,ImGuiMemFreeFunc free_func); -extern bool wrap_igSetDragDropPayload(const char* type,const void* data,size_t sz); +extern bool wrap_igSetDragDropPayload(const char* type,uintptr_t data,size_t sz); extern void wrap_igSetItemKeyOwner(ImGuiKey key); extern void wrap_igSetKeyOwner(ImGuiKey key,ImGuiID owner_id); extern void wrap_igSetKeyOwnersForKeyChord(ImGuiKeyChord key,ImGuiID owner_id); @@ -285,8 +341,8 @@ extern bool wrap_igSliderInt(const char* label,int* v,int v_min,int v_max); extern bool wrap_igSliderInt2(const char* label,int v[2],int v_min,int v_max); extern bool wrap_igSliderInt3(const char* label,int v[3],int v_min,int v_max); extern bool wrap_igSliderInt4(const char* label,int v[4],int v_min,int v_max); -extern bool wrap_igSliderScalar(const char* label,ImGuiDataType data_type,void* p_data,const void* p_min,const void* p_max); -extern bool wrap_igSliderScalarN(const char* label,ImGuiDataType data_type,void* p_data,int components,const void* p_min,const void* p_max); +extern bool wrap_igSliderScalar(const char* label,ImGuiDataType data_type,uintptr_t p_data,uintptr_t p_min,uintptr_t p_max); +extern bool wrap_igSliderScalarN(const char* label,ImGuiDataType data_type,uintptr_t p_data,int components,uintptr_t p_min,uintptr_t p_max); extern bool wrap_igSplitterBehavior(const ImRect bb,ImGuiID id,ImGuiAxis axis,float* size1,float* size2,float min_size1,float min_size2); extern void wrap_igStyleColorsClassic(); extern void wrap_igStyleColorsDark(); @@ -299,7 +355,7 @@ extern void wrap_igTableNextRow(); extern void wrap_igTableOpenContextMenu(); extern void wrap_igTableSetBgColor(ImGuiTableBgTarget target,ImU32 color); extern void wrap_igTableSetupColumn(const char* label); -extern bool wrap_igTempInputScalar(const ImRect bb,ImGuiID id,const char* label,ImGuiDataType data_type,void* p_data,const char* format); +extern bool wrap_igTempInputScalar(const ImRect bb,ImGuiID id,const char* label,ImGuiDataType data_type,uintptr_t p_data,const char* format); extern void wrap_igTextEx(const char* text,const int text_len); extern void wrap_igTextUnformatted(const char* text,const int text_len); extern bool wrap_igTreeNodeBehavior(ImGuiID id,ImGuiTreeNodeFlags flags,const char* label); @@ -307,7 +363,7 @@ extern bool wrap_igTreeNodeEx_Str(const char* label); extern void wrap_igUnindent(); extern bool wrap_igVSliderFloat(const char* label,const ImVec2 size,float* v,float v_min,float v_max); extern bool wrap_igVSliderInt(const char* label,const ImVec2 size,int* v,int v_min,int v_max); -extern bool wrap_igVSliderScalar(const char* label,const ImVec2 size,ImGuiDataType data_type,void* p_data,const void* p_min,const void* p_max); +extern bool wrap_igVSliderScalar(const char* label,const ImVec2 size,ImGuiDataType data_type,uintptr_t p_data,uintptr_t p_min,uintptr_t p_max); extern void wrap_igValue_Float(const char* prefix,float v); #ifdef __cplusplus diff --git a/cimmarkdown_funcs.go b/cimmarkdown_funcs.go index 73974af95..a91d41bc0 100644 --- a/cimmarkdown_funcs.go +++ b/cimmarkdown_funcs.go @@ -7,7 +7,6 @@ package imgui // #include "cimmarkdown_structs_accessor.h" // #include "cimmarkdown_wrapper.h" import "C" -import "unsafe" func IsCharInsideWord(c_ rune) bool { return C.IsCharInsideWord(C.char(c_)) == C.bool(true) @@ -111,6 +110,10 @@ func (self *TextRegion) Destroy() { selfFin() } +func UnderLine(col_ Color) { + C.UnderLine(col_.toC()) +} + func RenderLinkTextWrapped(self *TextRegion, text_ string, link_ Link, markdown_ string, mdConfig_ MarkdownConfig, linkHoverStart_ []string) { selfArg, selfFin := self.handle() text_Arg, text_Fin := WrapString(text_) @@ -436,23 +439,6 @@ func (self *MarkdownConfig) LinkIcon() string { return C.GoString(C.wrap_MarkdownConfig_GetLinkIcon(selfArg)) } -func (self MarkdownConfig) SetUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_MarkdownConfig_SetUserData(selfArg, vArg) -} - -func (self *MarkdownConfig) UserData() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_MarkdownConfig_GetUserData(selfArg)) -} - func (self MarkdownFormatInfo) SetType(v MarkdownFormatType) { selfArg, selfFin := self.handle() defer selfFin() @@ -563,18 +549,11 @@ func (self *MarkdownImageData) UseLinkCallback() bool { } func (self MarkdownImageData) SetUsertextureid(v TextureID) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_MarkdownImageData_SetUser_texture_id(selfArg, C.ImTextureID(v)) -} + vArg, _ := v.c() -func (self *MarkdownImageData) Usertextureid() TextureID { selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TextureID(C.wrap_MarkdownImageData_GetUser_texture_id(selfArg)) + defer selfFin() + C.wrap_MarkdownImageData_SetUser_texture_id(selfArg, vArg) } func (self MarkdownImageData) SetSize(v Vec2) { @@ -716,23 +695,6 @@ func (self *MarkdownLinkCallbackData) LinkLength() int32 { return int32(C.wrap_MarkdownLinkCallbackData_GetLinkLength(selfArg)) } -func (self MarkdownLinkCallbackData) SetUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_MarkdownLinkCallbackData_SetUserData(selfArg, vArg) -} - -func (self *MarkdownLinkCallbackData) UserData() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_MarkdownLinkCallbackData_GetUserData(selfArg)) -} - func (self MarkdownLinkCallbackData) SetIsImage(v bool) { selfArg, selfFin := self.handle() defer selfFin() diff --git a/cimmarkdown_structs.go b/cimmarkdown_structs.go deleted file mode 100644 index 69a5567ef..000000000 --- a/cimmarkdown_structs.go +++ /dev/null @@ -1,437 +0,0 @@ -// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. -// DO NOT EDIT. - -package imgui - -// #include -// #include -// #include "extra_types.h" -// #include "cimmarkdown_wrapper.h" -import "C" -import "unsafe" - -type Emphasis struct { - FieldState EmphasisState - FieldText TextBlock - FieldSym rune -} - -func (self Emphasis) handle() (result *C.Emphasis, releaseFn func()) { - result = new(C.Emphasis) - FieldState := self.FieldState - - result.state = C.EmphasisState(FieldState) - FieldText := self.FieldText - FieldTextArg, FieldTextFin := FieldText.c() - result.text = FieldTextArg - FieldSym := self.FieldSym - - result.sym = C.char(FieldSym) - releaseFn = func() { - FieldTextFin() - } - return result, releaseFn -} - -func (self Emphasis) c() (result C.Emphasis, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newEmphasisFromC(cvalue *C.Emphasis) *Emphasis { - result := new(Emphasis) - result.FieldState = EmphasisState(cvalue.state) - result.FieldText = *newTextBlockFromC(func() *C.TextBlock { result := cvalue.text; return &result }()) - - result.FieldSym = rune(cvalue.sym) - return result -} - -type Line struct { - FieldIsHeading bool - FieldIsEmphasis bool - FieldIsUnorderedListStart bool - FieldIsLeadingSpace bool - FieldLeadSpaceCount int32 - FieldHeadingCount int32 - FieldEmphasisCount int32 - FieldLineStart int32 - FieldLineEnd int32 - FieldLastRenderPosition int32 -} - -func (self Line) handle() (result *C.Line, releaseFn func()) { - result = new(C.Line) - FieldIsHeading := self.FieldIsHeading - - result.isHeading = C.bool(FieldIsHeading) - FieldIsEmphasis := self.FieldIsEmphasis - - result.isEmphasis = C.bool(FieldIsEmphasis) - FieldIsUnorderedListStart := self.FieldIsUnorderedListStart - - result.isUnorderedListStart = C.bool(FieldIsUnorderedListStart) - FieldIsLeadingSpace := self.FieldIsLeadingSpace - - result.isLeadingSpace = C.bool(FieldIsLeadingSpace) - FieldLeadSpaceCount := self.FieldLeadSpaceCount - - result.leadSpaceCount = C.int(FieldLeadSpaceCount) - FieldHeadingCount := self.FieldHeadingCount - - result.headingCount = C.int(FieldHeadingCount) - FieldEmphasisCount := self.FieldEmphasisCount - - result.emphasisCount = C.int(FieldEmphasisCount) - FieldLineStart := self.FieldLineStart - - result.lineStart = C.int(FieldLineStart) - FieldLineEnd := self.FieldLineEnd - - result.lineEnd = C.int(FieldLineEnd) - FieldLastRenderPosition := self.FieldLastRenderPosition - - result.lastRenderPosition = C.int(FieldLastRenderPosition) - releaseFn = func() { - } - return result, releaseFn -} - -func (self Line) c() (result C.Line, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newLineFromC(cvalue *C.Line) *Line { - result := new(Line) - result.FieldIsHeading = cvalue.isHeading == C.bool(true) - result.FieldIsEmphasis = cvalue.isEmphasis == C.bool(true) - result.FieldIsUnorderedListStart = cvalue.isUnorderedListStart == C.bool(true) - result.FieldIsLeadingSpace = cvalue.isLeadingSpace == C.bool(true) - result.FieldLeadSpaceCount = int32(cvalue.leadSpaceCount) - result.FieldHeadingCount = int32(cvalue.headingCount) - result.FieldEmphasisCount = int32(cvalue.emphasisCount) - result.FieldLineStart = int32(cvalue.lineStart) - result.FieldLineEnd = int32(cvalue.lineEnd) - result.FieldLastRenderPosition = int32(cvalue.lastRenderPosition) - return result -} - -type Link struct { - FieldState LinkState - FieldText TextBlock - FieldUrl TextBlock - FieldIsImage bool - FieldNum_brackets_open int32 -} - -func (self Link) handle() (result *C.Link, releaseFn func()) { - result = new(C.Link) - FieldState := self.FieldState - - result.state = C.LinkState(FieldState) - FieldText := self.FieldText - FieldTextArg, FieldTextFin := FieldText.c() - result.text = FieldTextArg - FieldUrl := self.FieldUrl - FieldUrlArg, FieldUrlFin := FieldUrl.c() - result.url = FieldUrlArg - FieldIsImage := self.FieldIsImage - - result.isImage = C.bool(FieldIsImage) - FieldNum_brackets_open := self.FieldNum_brackets_open - - result.num_brackets_open = C.int(FieldNum_brackets_open) - releaseFn = func() { - FieldTextFin() - FieldUrlFin() - } - return result, releaseFn -} - -func (self Link) c() (result C.Link, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newLinkFromC(cvalue *C.Link) *Link { - result := new(Link) - result.FieldState = LinkState(cvalue.state) - result.FieldText = *newTextBlockFromC(func() *C.TextBlock { result := cvalue.text; return &result }()) - - result.FieldUrl = *newTextBlockFromC(func() *C.TextBlock { result := cvalue.url; return &result }()) - - result.FieldIsImage = cvalue.isImage == C.bool(true) - result.FieldNum_brackets_open = int32(cvalue.num_brackets_open) - return result -} - -type MarkdownConfig struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self MarkdownConfig) handle() (result *C.MarkdownConfig, releaseFn func()) { - result = (*C.MarkdownConfig)(self.data) - return result, func() {} -} - -func (self MarkdownConfig) c() (result C.MarkdownConfig, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newMarkdownConfigFromC(cvalue *C.MarkdownConfig) *MarkdownConfig { - result := new(MarkdownConfig) - result.data = unsafe.Pointer(cvalue) - return result -} - -type MarkdownFormatInfo struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self MarkdownFormatInfo) handle() (result *C.MarkdownFormatInfo, releaseFn func()) { - result = (*C.MarkdownFormatInfo)(self.data) - return result, func() {} -} - -func (self MarkdownFormatInfo) c() (result C.MarkdownFormatInfo, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newMarkdownFormatInfoFromC(cvalue *C.MarkdownFormatInfo) *MarkdownFormatInfo { - result := new(MarkdownFormatInfo) - result.data = unsafe.Pointer(cvalue) - return result -} - -type MarkdownHeadingFormat struct { - FieldFont *Font - FieldSeparator bool -} - -func (self MarkdownHeadingFormat) handle() (result *C.MarkdownHeadingFormat, releaseFn func()) { - result = new(C.MarkdownHeadingFormat) - FieldFont := self.FieldFont - FieldFontArg, FieldFontFin := FieldFont.handle() - result.font = FieldFontArg - FieldSeparator := self.FieldSeparator - - result.separator = C.bool(FieldSeparator) - releaseFn = func() { - FieldFontFin() - } - return result, releaseFn -} - -func (self MarkdownHeadingFormat) c() (result C.MarkdownHeadingFormat, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newMarkdownHeadingFormatFromC(cvalue *C.MarkdownHeadingFormat) *MarkdownHeadingFormat { - result := new(MarkdownHeadingFormat) - result.FieldFont = newFontFromC(cvalue.font) - result.FieldSeparator = cvalue.separator == C.bool(true) - return result -} - -type MarkdownImageData struct { - FieldIsValid bool - FieldUseLinkCallback bool - FieldUser_texture_id TextureID - FieldSize Vec2 - FieldUv0 Vec2 - FieldUv1 Vec2 - FieldTint_col Vec4 - FieldBorder_col Vec4 -} - -func (self MarkdownImageData) handle() (result *C.MarkdownImageData, releaseFn func()) { - result = new(C.MarkdownImageData) - FieldIsValid := self.FieldIsValid - - result.isValid = C.bool(FieldIsValid) - FieldUseLinkCallback := self.FieldUseLinkCallback - - result.useLinkCallback = C.bool(FieldUseLinkCallback) - FieldUser_texture_id := self.FieldUser_texture_id - - result.user_texture_id = C.ImTextureID(FieldUser_texture_id) - FieldSize := self.FieldSize - - result.size = FieldSize.toC() - FieldUv0 := self.FieldUv0 - - result.uv0 = FieldUv0.toC() - FieldUv1 := self.FieldUv1 - - result.uv1 = FieldUv1.toC() - FieldTint_col := self.FieldTint_col - - result.tint_col = FieldTint_col.toC() - FieldBorder_col := self.FieldBorder_col - - result.border_col = FieldBorder_col.toC() - releaseFn = func() { - } - return result, releaseFn -} - -func (self MarkdownImageData) c() (result C.MarkdownImageData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newMarkdownImageDataFromC(cvalue *C.MarkdownImageData) *MarkdownImageData { - result := new(MarkdownImageData) - result.FieldIsValid = cvalue.isValid == C.bool(true) - result.FieldUseLinkCallback = cvalue.useLinkCallback == C.bool(true) - result.FieldUser_texture_id = TextureID(cvalue.user_texture_id) - result.FieldSize = *(&Vec2{}).fromC(cvalue.size) - result.FieldUv0 = *(&Vec2{}).fromC(cvalue.uv0) - result.FieldUv1 = *(&Vec2{}).fromC(cvalue.uv1) - result.FieldTint_col = *(&Vec4{}).fromC(cvalue.tint_col) - result.FieldBorder_col = *(&Vec4{}).fromC(cvalue.border_col) - return result -} - -type MarkdownLinkCallbackData struct { - FieldText string - FieldTextLength int32 - FieldLink string - FieldLinkLength int32 - FieldUserData unsafe.Pointer - FieldIsImage bool -} - -func (self MarkdownLinkCallbackData) handle() (result *C.MarkdownLinkCallbackData, releaseFn func()) { - result = new(C.MarkdownLinkCallbackData) - FieldText := self.FieldText - FieldTextArg, FieldTextFin := WrapString(FieldText) - result.text = FieldTextArg - FieldTextLength := self.FieldTextLength - - result.textLength = C.int(FieldTextLength) - FieldLink := self.FieldLink - FieldLinkArg, FieldLinkFin := WrapString(FieldLink) - result.link = FieldLinkArg - FieldLinkLength := self.FieldLinkLength - - result.linkLength = C.int(FieldLinkLength) - FieldUserData := self.FieldUserData - FieldUserDataArg, FieldUserDataFin := WrapVoidPtr(FieldUserData) - result.userData = FieldUserDataArg - FieldIsImage := self.FieldIsImage - - result.isImage = C.bool(FieldIsImage) - releaseFn = func() { - FieldTextFin() - - FieldLinkFin() - - FieldUserDataFin() - } - return result, releaseFn -} - -func (self MarkdownLinkCallbackData) c() (result C.MarkdownLinkCallbackData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newMarkdownLinkCallbackDataFromC(cvalue *C.MarkdownLinkCallbackData) *MarkdownLinkCallbackData { - result := new(MarkdownLinkCallbackData) - result.FieldText = C.GoString(cvalue.text) - result.FieldTextLength = int32(cvalue.textLength) - result.FieldLink = C.GoString(cvalue.link) - result.FieldLinkLength = int32(cvalue.linkLength) - result.FieldUserData = unsafe.Pointer(cvalue.userData) - result.FieldIsImage = cvalue.isImage == C.bool(true) - return result -} - -type MarkdownTooltipCallbackData struct { - FieldLinkData MarkdownLinkCallbackData - FieldLinkIcon string -} - -func (self MarkdownTooltipCallbackData) handle() (result *C.MarkdownTooltipCallbackData, releaseFn func()) { - result = new(C.MarkdownTooltipCallbackData) - FieldLinkData := self.FieldLinkData - FieldLinkDataArg, FieldLinkDataFin := FieldLinkData.c() - result.linkData = FieldLinkDataArg - FieldLinkIcon := self.FieldLinkIcon - FieldLinkIconArg, FieldLinkIconFin := WrapString(FieldLinkIcon) - result.linkIcon = FieldLinkIconArg - releaseFn = func() { - FieldLinkDataFin() - FieldLinkIconFin() - } - return result, releaseFn -} - -func (self MarkdownTooltipCallbackData) c() (result C.MarkdownTooltipCallbackData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newMarkdownTooltipCallbackDataFromC(cvalue *C.MarkdownTooltipCallbackData) *MarkdownTooltipCallbackData { - result := new(MarkdownTooltipCallbackData) - result.FieldLinkData = *newMarkdownLinkCallbackDataFromC(func() *C.MarkdownLinkCallbackData { result := cvalue.linkData; return &result }()) - - result.FieldLinkIcon = C.GoString(cvalue.linkIcon) - return result -} - -type TextBlock struct { - FieldStart int32 - FieldStop int32 -} - -func (self TextBlock) handle() (result *C.TextBlock, releaseFn func()) { - result = new(C.TextBlock) - FieldStart := self.FieldStart - - result.start = C.int(FieldStart) - FieldStop := self.FieldStop - - result.stop = C.int(FieldStop) - releaseFn = func() { - } - return result, releaseFn -} - -func (self TextBlock) c() (result C.TextBlock, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newTextBlockFromC(cvalue *C.TextBlock) *TextBlock { - result := new(TextBlock) - result.FieldStart = int32(cvalue.start) - result.FieldStop = int32(cvalue.stop) - return result -} - -type TextRegion struct{} - -func (self TextRegion) handle() (result *C.TextRegion, releaseFn func()) { - result = new(C.TextRegion) - releaseFn = func() { - } - return result, releaseFn -} - -func (self TextRegion) c() (result C.TextRegion, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newTextRegionFromC(cvalue *C.TextRegion) *TextRegion { - result := new(TextRegion) - return result -} diff --git a/cimmarkdown_typedefs.cpp b/cimmarkdown_typedefs.cpp new file mode 100644 index 000000000..a219dbdf3 --- /dev/null +++ b/cimmarkdown_typedefs.cpp @@ -0,0 +1,6 @@ +// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. +// DO NOT EDIT. + + +#include "cimmarkdown_typedefs.h" +#include "cimgui/cimmarkdown.h" diff --git a/cimmarkdown_typedefs.go b/cimmarkdown_typedefs.go new file mode 100644 index 000000000..c9c6be6a2 --- /dev/null +++ b/cimmarkdown_typedefs.go @@ -0,0 +1,198 @@ +// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. +// DO NOT EDIT. + +package imgui + +// #include +// #include +// #include "extra_types.h" +// #include "cimmarkdown_wrapper.h" +// #include "cimmarkdown_typedefs.h" +import "C" + +type Emphasis struct { + CData *C.Emphasis +} + +func (self *Emphasis) handle() (result *C.Emphasis, fin func()) { + return self.CData, func() {} +} + +func (self Emphasis) c() (C.Emphasis, func()) { + result, fn := self.handle() + return *result, fn +} + +func newEmphasisFromC(cvalue *C.Emphasis) *Emphasis { + return &Emphasis{CData: cvalue} +} + +type Line struct { + CData *C.Line +} + +func (self *Line) handle() (result *C.Line, fin func()) { + return self.CData, func() {} +} + +func (self Line) c() (C.Line, func()) { + result, fn := self.handle() + return *result, fn +} + +func newLineFromC(cvalue *C.Line) *Line { + return &Line{CData: cvalue} +} + +type Link struct { + CData *C.Link +} + +func (self *Link) handle() (result *C.Link, fin func()) { + return self.CData, func() {} +} + +func (self Link) c() (C.Link, func()) { + result, fn := self.handle() + return *result, fn +} + +func newLinkFromC(cvalue *C.Link) *Link { + return &Link{CData: cvalue} +} + +type MarkdownConfig struct { + CData *C.MarkdownConfig +} + +func (self *MarkdownConfig) handle() (result *C.MarkdownConfig, fin func()) { + return self.CData, func() {} +} + +func (self MarkdownConfig) c() (C.MarkdownConfig, func()) { + result, fn := self.handle() + return *result, fn +} + +func newMarkdownConfigFromC(cvalue *C.MarkdownConfig) *MarkdownConfig { + return &MarkdownConfig{CData: cvalue} +} + +type MarkdownFormatInfo struct { + CData *C.MarkdownFormatInfo +} + +func (self *MarkdownFormatInfo) handle() (result *C.MarkdownFormatInfo, fin func()) { + return self.CData, func() {} +} + +func (self MarkdownFormatInfo) c() (C.MarkdownFormatInfo, func()) { + result, fn := self.handle() + return *result, fn +} + +func newMarkdownFormatInfoFromC(cvalue *C.MarkdownFormatInfo) *MarkdownFormatInfo { + return &MarkdownFormatInfo{CData: cvalue} +} + +type MarkdownHeadingFormat struct { + CData *C.MarkdownHeadingFormat +} + +func (self *MarkdownHeadingFormat) handle() (result *C.MarkdownHeadingFormat, fin func()) { + return self.CData, func() {} +} + +func (self MarkdownHeadingFormat) c() (C.MarkdownHeadingFormat, func()) { + result, fn := self.handle() + return *result, fn +} + +func newMarkdownHeadingFormatFromC(cvalue *C.MarkdownHeadingFormat) *MarkdownHeadingFormat { + return &MarkdownHeadingFormat{CData: cvalue} +} + +type MarkdownImageData struct { + CData *C.MarkdownImageData +} + +func (self *MarkdownImageData) handle() (result *C.MarkdownImageData, fin func()) { + return self.CData, func() {} +} + +func (self MarkdownImageData) c() (C.MarkdownImageData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newMarkdownImageDataFromC(cvalue *C.MarkdownImageData) *MarkdownImageData { + return &MarkdownImageData{CData: cvalue} +} + +type MarkdownLinkCallbackData struct { + CData *C.MarkdownLinkCallbackData +} + +func (self *MarkdownLinkCallbackData) handle() (result *C.MarkdownLinkCallbackData, fin func()) { + return self.CData, func() {} +} + +func (self MarkdownLinkCallbackData) c() (C.MarkdownLinkCallbackData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newMarkdownLinkCallbackDataFromC(cvalue *C.MarkdownLinkCallbackData) *MarkdownLinkCallbackData { + return &MarkdownLinkCallbackData{CData: cvalue} +} + +type MarkdownTooltipCallbackData struct { + CData *C.MarkdownTooltipCallbackData +} + +func (self *MarkdownTooltipCallbackData) handle() (result *C.MarkdownTooltipCallbackData, fin func()) { + return self.CData, func() {} +} + +func (self MarkdownTooltipCallbackData) c() (C.MarkdownTooltipCallbackData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newMarkdownTooltipCallbackDataFromC(cvalue *C.MarkdownTooltipCallbackData) *MarkdownTooltipCallbackData { + return &MarkdownTooltipCallbackData{CData: cvalue} +} + +type TextBlock struct { + CData *C.TextBlock +} + +func (self *TextBlock) handle() (result *C.TextBlock, fin func()) { + return self.CData, func() {} +} + +func (self TextBlock) c() (C.TextBlock, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTextBlockFromC(cvalue *C.TextBlock) *TextBlock { + return &TextBlock{CData: cvalue} +} + +type TextRegion struct { + CData *C.TextRegion +} + +func (self *TextRegion) handle() (result *C.TextRegion, fin func()) { + return self.CData, func() {} +} + +func (self TextRegion) c() (C.TextRegion, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTextRegionFromC(cvalue *C.TextRegion) *TextRegion { + return &TextRegion{CData: cvalue} +} diff --git a/cimmarkdown_typedefs.h b/cimmarkdown_typedefs.h new file mode 100644 index 000000000..64e34f05a --- /dev/null +++ b/cimmarkdown_typedefs.h @@ -0,0 +1,15 @@ +// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. +// DO NOT EDIT. + + +#pragma once + +#include "cimgui/cimmarkdown.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/cimnodes_funcs.go b/cimnodes_funcs.go index eea1b4c3c..1da66970d 100644 --- a/cimnodes_funcs.go +++ b/cimnodes_funcs.go @@ -63,51 +63,75 @@ func (self *MultipleSelectModifier) Destroy() { selfFin() } -// imnodesBeginInputAttributeV parameter default value hint: +// ImNodesBeginInputAttributeV parameter default value hint: // shape: ImNodesPinShape_CircleFilled -func imnodesBeginInputAttributeV(id int32, shape NodesPinShape) { +func ImNodesBeginInputAttributeV(id int32, shape NodesPinShape) { C.imnodes_BeginInputAttribute(C.int(id), C.ImNodesPinShape(shape)) } -func imnodesBeginNode(id int32) { +func ImNodesBeginNode(id int32) { C.imnodes_BeginNode(C.int(id)) } -func imnodesBeginNodeEditor() { +func ImNodesBeginNodeEditor() { C.imnodes_BeginNodeEditor() } -func imnodesBeginNodeTitleBar() { +func ImNodesBeginNodeTitleBar() { C.imnodes_BeginNodeTitleBar() } -// imnodesBeginOutputAttributeV parameter default value hint: +// ImNodesBeginOutputAttributeV parameter default value hint: // shape: ImNodesPinShape_CircleFilled -func imnodesBeginOutputAttributeV(id int32, shape NodesPinShape) { +func ImNodesBeginOutputAttributeV(id int32, shape NodesPinShape) { C.imnodes_BeginOutputAttribute(C.int(id), C.ImNodesPinShape(shape)) } -func imnodesBeginStaticAttribute(id int32) { +func ImNodesBeginStaticAttribute(id int32) { C.imnodes_BeginStaticAttribute(C.int(id)) } -func imnodesClearLinkSelectionInt(link_id int32) { +func ImNodesClearLinkSelectionInt(link_id int32) { C.imnodes_ClearLinkSelection_Int(C.int(link_id)) } -func imnodesClearLinkSelectionNil() { +func ImNodesClearLinkSelectionNil() { C.imnodes_ClearLinkSelection_Nil() } -func imnodesClearNodeSelectionInt(node_id int32) { +func ImNodesClearNodeSelectionInt(node_id int32) { C.imnodes_ClearNodeSelection_Int(C.int(node_id)) } -func imnodesClearNodeSelectionNil() { +func ImNodesClearNodeSelectionNil() { C.imnodes_ClearNodeSelection_Nil() } -func imnodesEditorContextGetPanning() Vec2 { +func ImNodesCreateContext() *NodesContext { + return newNodesContextFromC(C.imnodes_CreateContext()) +} + +// ImNodesDestroyContextV parameter default value hint: +// ctx: NULL +func ImNodesDestroyContextV(ctx *NodesContext) { + ctxArg, ctxFin := ctx.handle() + C.imnodes_DestroyContext(ctxArg) + + ctxFin() +} + +func ImNodesEditorContextCreate() *NodesEditorContext { + return newNodesEditorContextFromC(C.imnodes_EditorContextCreate()) +} + +func ImNodesEditorContextFree(noname1 *NodesEditorContext) { + noname1Arg, noname1Fin := noname1.handle() + C.imnodes_EditorContextFree(noname1Arg) + + noname1Fin() +} + +func ImNodesEditorContextGetPanning() Vec2 { pOut := new(Vec2) pOutArg, pOutFin := wrap[C.ImVec2, *Vec2](pOut) @@ -118,43 +142,54 @@ func imnodesEditorContextGetPanning() Vec2 { return *pOut } -func imnodesEditorContextMoveToNode(node_id int32) { +func ImNodesEditorContextMoveToNode(node_id int32) { C.imnodes_EditorContextMoveToNode(C.int(node_id)) } -func imnodesEditorContextResetPanning(pos Vec2) { +func ImNodesEditorContextResetPanning(pos Vec2) { C.imnodes_EditorContextResetPanning(pos.toC()) } -func imnodesEndInputAttribute() { +func ImNodesEditorContextSet(noname1 *NodesEditorContext) { + noname1Arg, noname1Fin := noname1.handle() + C.imnodes_EditorContextSet(noname1Arg) + + noname1Fin() +} + +func ImNodesEndInputAttribute() { C.imnodes_EndInputAttribute() } -func imnodesEndNode() { +func ImNodesEndNode() { C.imnodes_EndNode() } -func imnodesEndNodeEditor() { +func ImNodesEndNodeEditor() { C.imnodes_EndNodeEditor() } -func imnodesEndNodeTitleBar() { +func ImNodesEndNodeTitleBar() { C.imnodes_EndNodeTitleBar() } -func imnodesEndOutputAttribute() { +func ImNodesEndOutputAttribute() { C.imnodes_EndOutputAttribute() } -func imnodesEndStaticAttribute() { +func ImNodesEndStaticAttribute() { C.imnodes_EndStaticAttribute() } -func imnodesGetIO() *NodesIO { +func ImNodesGetCurrentContext() *NodesContext { + return newNodesContextFromC(C.imnodes_GetCurrentContext()) +} + +func ImNodesGetIO() *NodesIO { return newNodesIOFromC(C.imnodes_GetIO()) } -func imnodesGetNodeDimensions(id int32) Vec2 { +func ImNodesGetNodeDimensions(id int32) Vec2 { pOut := new(Vec2) pOutArg, pOutFin := wrap[C.ImVec2, *Vec2](pOut) @@ -165,7 +200,7 @@ func imnodesGetNodeDimensions(id int32) Vec2 { return *pOut } -func imnodesGetNodeEditorSpacePos(node_id int32) Vec2 { +func ImNodesGetNodeEditorSpacePos(node_id int32) Vec2 { pOut := new(Vec2) pOutArg, pOutFin := wrap[C.ImVec2, *Vec2](pOut) @@ -176,7 +211,7 @@ func imnodesGetNodeEditorSpacePos(node_id int32) Vec2 { return *pOut } -func imnodesGetNodeGridSpacePos(node_id int32) Vec2 { +func ImNodesGetNodeGridSpacePos(node_id int32) Vec2 { pOut := new(Vec2) pOutArg, pOutFin := wrap[C.ImVec2, *Vec2](pOut) @@ -187,7 +222,7 @@ func imnodesGetNodeGridSpacePos(node_id int32) Vec2 { return *pOut } -func imnodesGetNodeScreenSpacePos(node_id int32) Vec2 { +func ImNodesGetNodeScreenSpacePos(node_id int32) Vec2 { pOut := new(Vec2) pOutArg, pOutFin := wrap[C.ImVec2, *Vec2](pOut) @@ -198,27 +233,27 @@ func imnodesGetNodeScreenSpacePos(node_id int32) Vec2 { return *pOut } -func imnodesGetSelectedLinks(link_ids *int32) { +func ImNodesGetSelectedLinks(link_ids *int32) { link_idsArg, link_idsFin := WrapNumberPtr[C.int, int32](link_ids) C.imnodes_GetSelectedLinks(link_idsArg) link_idsFin() } -func imnodesGetSelectedNodes(node_ids *int32) { +func ImNodesGetSelectedNodes(node_ids *int32) { node_idsArg, node_idsFin := WrapNumberPtr[C.int, int32](node_ids) C.imnodes_GetSelectedNodes(node_idsArg) node_idsFin() } -func imnodesGetStyle() *NodesStyle { +func ImNodesGetStyle() *NodesStyle { return newNodesStyleFromC(C.imnodes_GetStyle()) } -// imnodesIsAnyAttributeActiveV parameter default value hint: +// ImNodesIsAnyAttributeActiveV parameter default value hint: // attribute_id: NULL -func imnodesIsAnyAttributeActiveV(attribute_id *int32) bool { +func ImNodesIsAnyAttributeActiveV(attribute_id *int32) bool { attribute_idArg, attribute_idFin := WrapNumberPtr[C.int, int32](attribute_id) defer func() { @@ -227,17 +262,17 @@ func imnodesIsAnyAttributeActiveV(attribute_id *int32) bool { return C.imnodes_IsAnyAttributeActive(attribute_idArg) == C.bool(true) } -func imnodesIsAttributeActive() bool { +func ImNodesIsAttributeActive() bool { return C.imnodes_IsAttributeActive() == C.bool(true) } -func imnodesIsEditorHovered() bool { +func ImNodesIsEditorHovered() bool { return C.imnodes_IsEditorHovered() == C.bool(true) } -// imnodesIsLinkCreatedBoolPtrV parameter default value hint: +// ImNodesIsLinkCreatedBoolPtrV parameter default value hint: // created_from_snap: NULL -func imnodesIsLinkCreatedBoolPtrV(started_at_attribute_id *int32, ended_at_attribute_id *int32, created_from_snap *bool) bool { +func ImNodesIsLinkCreatedBoolPtrV(started_at_attribute_id *int32, ended_at_attribute_id *int32, created_from_snap *bool) bool { started_at_attribute_idArg, started_at_attribute_idFin := WrapNumberPtr[C.int, int32](started_at_attribute_id) ended_at_attribute_idArg, ended_at_attribute_idFin := WrapNumberPtr[C.int, int32](ended_at_attribute_id) created_from_snapArg, created_from_snapFin := WrapBool(created_from_snap) @@ -250,9 +285,9 @@ func imnodesIsLinkCreatedBoolPtrV(started_at_attribute_id *int32, ended_at_attri return C.imnodes_IsLinkCreated_BoolPtr(started_at_attribute_idArg, ended_at_attribute_idArg, created_from_snapArg) == C.bool(true) } -// imnodesIsLinkCreatedIntPtrV parameter default value hint: +// ImNodesIsLinkCreatedIntPtrV parameter default value hint: // created_from_snap: NULL -func imnodesIsLinkCreatedIntPtrV(started_at_node_id *int32, started_at_attribute_id *int32, ended_at_node_id *int32, ended_at_attribute_id *int32, created_from_snap *bool) bool { +func ImNodesIsLinkCreatedIntPtrV(started_at_node_id *int32, started_at_attribute_id *int32, ended_at_node_id *int32, ended_at_attribute_id *int32, created_from_snap *bool) bool { started_at_node_idArg, started_at_node_idFin := WrapNumberPtr[C.int, int32](started_at_node_id) started_at_attribute_idArg, started_at_attribute_idFin := WrapNumberPtr[C.int, int32](started_at_attribute_id) ended_at_node_idArg, ended_at_node_idFin := WrapNumberPtr[C.int, int32](ended_at_node_id) @@ -269,7 +304,7 @@ func imnodesIsLinkCreatedIntPtrV(started_at_node_id *int32, started_at_attribute return C.imnodes_IsLinkCreated_IntPtr(started_at_node_idArg, started_at_attribute_idArg, ended_at_node_idArg, ended_at_attribute_idArg, created_from_snapArg) == C.bool(true) } -func imnodesIsLinkDestroyed(link_id *int32) bool { +func ImNodesIsLinkDestroyed(link_id *int32) bool { link_idArg, link_idFin := WrapNumberPtr[C.int, int32](link_id) defer func() { @@ -278,10 +313,10 @@ func imnodesIsLinkDestroyed(link_id *int32) bool { return C.imnodes_IsLinkDestroyed(link_idArg) == C.bool(true) } -// imnodesIsLinkDroppedV parameter default value hint: +// ImNodesIsLinkDroppedV parameter default value hint: // started_at_attribute_id: NULL // including_detached_links: true -func imnodesIsLinkDroppedV(started_at_attribute_id *int32, including_detached_links bool) bool { +func ImNodesIsLinkDroppedV(started_at_attribute_id *int32, including_detached_links bool) bool { started_at_attribute_idArg, started_at_attribute_idFin := WrapNumberPtr[C.int, int32](started_at_attribute_id) defer func() { @@ -290,7 +325,7 @@ func imnodesIsLinkDroppedV(started_at_attribute_id *int32, including_detached_li return C.imnodes_IsLinkDropped(started_at_attribute_idArg, C.bool(including_detached_links)) == C.bool(true) } -func imnodesIsLinkHovered(link_id *int32) bool { +func ImNodesIsLinkHovered(link_id *int32) bool { link_idArg, link_idFin := WrapNumberPtr[C.int, int32](link_id) defer func() { @@ -299,11 +334,11 @@ func imnodesIsLinkHovered(link_id *int32) bool { return C.imnodes_IsLinkHovered(link_idArg) == C.bool(true) } -func imnodesIsLinkSelected(link_id int32) bool { +func ImNodesIsLinkSelected(link_id int32) bool { return C.imnodes_IsLinkSelected(C.int(link_id)) == C.bool(true) } -func imnodesIsLinkStarted(started_at_attribute_id *int32) bool { +func ImNodesIsLinkStarted(started_at_attribute_id *int32) bool { started_at_attribute_idArg, started_at_attribute_idFin := WrapNumberPtr[C.int, int32](started_at_attribute_id) defer func() { @@ -312,7 +347,7 @@ func imnodesIsLinkStarted(started_at_attribute_id *int32) bool { return C.imnodes_IsLinkStarted(started_at_attribute_idArg) == C.bool(true) } -func imnodesIsNodeHovered(node_id *int32) bool { +func ImNodesIsNodeHovered(node_id *int32) bool { node_idArg, node_idFin := WrapNumberPtr[C.int, int32](node_id) defer func() { @@ -321,11 +356,11 @@ func imnodesIsNodeHovered(node_id *int32) bool { return C.imnodes_IsNodeHovered(node_idArg) == C.bool(true) } -func imnodesIsNodeSelected(node_id int32) bool { +func ImNodesIsNodeSelected(node_id int32) bool { return C.imnodes_IsNodeSelected(C.int(node_id)) == C.bool(true) } -func imnodesIsPinHovered(attribute_id *int32) bool { +func ImNodesIsPinHovered(attribute_id *int32) bool { attribute_idArg, attribute_idFin := WrapNumberPtr[C.int, int32](attribute_id) defer func() { @@ -334,154 +369,199 @@ func imnodesIsPinHovered(attribute_id *int32) bool { return C.imnodes_IsPinHovered(attribute_idArg) == C.bool(true) } -func imnodesLink(id int32, start_attribute_id int32, end_attribute_id int32) { +func ImNodesLink(id int32, start_attribute_id int32, end_attribute_id int32) { C.imnodes_Link(C.int(id), C.int(start_attribute_id), C.int(end_attribute_id)) } -func imnodesLoadCurrentEditorStateFromIniFile(file_name string) { +func ImNodesLoadCurrentEditorStateFromIniFile(file_name string) { file_nameArg, file_nameFin := WrapString(file_name) C.imnodes_LoadCurrentEditorStateFromIniFile(file_nameArg) file_nameFin() } -func imnodesLoadCurrentEditorStateFromIniString(data string, data_size uint64) { +func ImNodesLoadCurrentEditorStateFromIniString(data string, data_size uint64) { dataArg, dataFin := WrapString(data) C.imnodes_LoadCurrentEditorStateFromIniString(dataArg, C.xulong(data_size)) dataFin() } -func imnodesNumSelectedLinks() int32 { +func ImNodesLoadEditorStateFromIniFile(editor *NodesEditorContext, file_name string) { + editorArg, editorFin := editor.handle() + file_nameArg, file_nameFin := WrapString(file_name) + C.imnodes_LoadEditorStateFromIniFile(editorArg, file_nameArg) + + editorFin() + file_nameFin() +} + +func ImNodesLoadEditorStateFromIniString(editor *NodesEditorContext, data string, data_size uint64) { + editorArg, editorFin := editor.handle() + dataArg, dataFin := WrapString(data) + C.imnodes_LoadEditorStateFromIniString(editorArg, dataArg, C.xulong(data_size)) + + editorFin() + dataFin() +} + +func ImNodesNumSelectedLinks() int32 { return int32(C.imnodes_NumSelectedLinks()) } -func imnodesNumSelectedNodes() int32 { +func ImNodesNumSelectedNodes() int32 { return int32(C.imnodes_NumSelectedNodes()) } -func imnodesPopAttributeFlag() { +func ImNodesPopAttributeFlag() { C.imnodes_PopAttributeFlag() } -func imnodesPopColorStyle() { +func ImNodesPopColorStyle() { C.imnodes_PopColorStyle() } -// imnodesPopStyleVarV parameter default value hint: +// ImNodesPopStyleVarV parameter default value hint: // count: 1 -func imnodesPopStyleVarV(count int32) { +func ImNodesPopStyleVarV(count int32) { C.imnodes_PopStyleVar(C.int(count)) } -func imnodesPushAttributeFlag(flag NodesAttributeFlags) { +func ImNodesPushAttributeFlag(flag NodesAttributeFlags) { C.imnodes_PushAttributeFlag(C.ImNodesAttributeFlags(flag)) } -func imnodesPushColorStyle(item NodesCol, color uint32) { +func ImNodesPushColorStyle(item NodesCol, color uint32) { C.imnodes_PushColorStyle(C.ImNodesCol(item), C.uint(color)) } -func imnodesPushStyleVarFloat(style_item NodesStyleVar, value float32) { +func ImNodesPushStyleVarFloat(style_item NodesStyleVar, value float32) { C.imnodes_PushStyleVar_Float(C.ImNodesStyleVar(style_item), C.float(value)) } -func imnodesPushStyleVarVec2(style_item NodesStyleVar, value Vec2) { +func ImNodesPushStyleVarVec2(style_item NodesStyleVar, value Vec2) { C.imnodes_PushStyleVar_Vec2(C.ImNodesStyleVar(style_item), value.toC()) } -func imnodesSaveCurrentEditorStateToIniFile(file_name string) { +func ImNodesSaveCurrentEditorStateToIniFile(file_name string) { file_nameArg, file_nameFin := WrapString(file_name) C.imnodes_SaveCurrentEditorStateToIniFile(file_nameArg) file_nameFin() } -// imnodesSaveCurrentEditorStateToIniStringV parameter default value hint: +// ImNodesSaveCurrentEditorStateToIniStringV parameter default value hint: // data_size: NULL -func imnodesSaveCurrentEditorStateToIniStringV(data_size *uint64) string { +func ImNodesSaveCurrentEditorStateToIniStringV(data_size *uint64) string { return C.GoString(C.imnodes_SaveCurrentEditorStateToIniString((*C.xulong)(data_size))) } -func imnodesSelectLink(link_id int32) { +func ImNodesSaveEditorStateToIniFile(editor *NodesEditorContext, file_name string) { + editorArg, editorFin := editor.handle() + file_nameArg, file_nameFin := WrapString(file_name) + C.imnodes_SaveEditorStateToIniFile(editorArg, file_nameArg) + + editorFin() + file_nameFin() +} + +// ImNodesSaveEditorStateToIniStringV parameter default value hint: +// data_size: NULL +func ImNodesSaveEditorStateToIniStringV(editor *NodesEditorContext, data_size *uint64) string { + editorArg, editorFin := editor.handle() + + defer func() { + editorFin() + }() + return C.GoString(C.imnodes_SaveEditorStateToIniString(editorArg, (*C.xulong)(data_size))) +} + +func ImNodesSelectLink(link_id int32) { C.imnodes_SelectLink(C.int(link_id)) } -func imnodesSelectNode(node_id int32) { +func ImNodesSelectNode(node_id int32) { C.imnodes_SelectNode(C.int(node_id)) } -func imnodesSetImGuiContext(ctx *Context) { +func ImNodesSetCurrentContext(ctx *NodesContext) { + ctxArg, ctxFin := ctx.handle() + C.imnodes_SetCurrentContext(ctxArg) + + ctxFin() +} + +func ImNodesSetImGuiContext(ctx *Context) { ctxArg, ctxFin := ctx.handle() C.imnodes_SetImGuiContext(ctxArg) ctxFin() } -func imnodesSetNodeDraggable(node_id int32, draggable bool) { +func ImNodesSetNodeDraggable(node_id int32, draggable bool) { C.imnodes_SetNodeDraggable(C.int(node_id), C.bool(draggable)) } -func imnodesSetNodeEditorSpacePos(node_id int32, editor_space_pos Vec2) { +func ImNodesSetNodeEditorSpacePos(node_id int32, editor_space_pos Vec2) { C.imnodes_SetNodeEditorSpacePos(C.int(node_id), editor_space_pos.toC()) } -func imnodesSetNodeGridSpacePos(node_id int32, grid_pos Vec2) { +func ImNodesSetNodeGridSpacePos(node_id int32, grid_pos Vec2) { C.imnodes_SetNodeGridSpacePos(C.int(node_id), grid_pos.toC()) } -func imnodesSetNodeScreenSpacePos(node_id int32, screen_space_pos Vec2) { +func ImNodesSetNodeScreenSpacePos(node_id int32, screen_space_pos Vec2) { C.imnodes_SetNodeScreenSpacePos(C.int(node_id), screen_space_pos.toC()) } -func imnodesSnapNodeToGrid(node_id int32) { +func ImNodesSnapNodeToGrid(node_id int32) { C.imnodes_SnapNodeToGrid(C.int(node_id)) } -// imnodesStyleColorsClassicV parameter default value hint: +// ImNodesStyleColorsClassicV parameter default value hint: // dest: NULL -func imnodesStyleColorsClassicV(dest *NodesStyle) { +func ImNodesStyleColorsClassicV(dest *NodesStyle) { destArg, destFin := dest.handle() C.imnodes_StyleColorsClassic(destArg) destFin() } -// imnodesStyleColorsDarkV parameter default value hint: +// ImNodesStyleColorsDarkV parameter default value hint: // dest: NULL -func imnodesStyleColorsDarkV(dest *NodesStyle) { +func ImNodesStyleColorsDarkV(dest *NodesStyle) { destArg, destFin := dest.handle() C.imnodes_StyleColorsDark(destArg) destFin() } -// imnodesStyleColorsLightV parameter default value hint: +// ImNodesStyleColorsLightV parameter default value hint: // dest: NULL -func imnodesStyleColorsLightV(dest *NodesStyle) { +func ImNodesStyleColorsLightV(dest *NodesStyle) { destArg, destFin := dest.handle() C.imnodes_StyleColorsLight(destArg) destFin() } -func imnodesBeginInputAttribute(id int32) { +func ImNodesBeginInputAttribute(id int32) { C.wrap_imnodes_BeginInputAttribute(C.int(id)) } -func imnodesBeginOutputAttribute(id int32) { +func ImNodesBeginOutputAttribute(id int32) { C.wrap_imnodes_BeginOutputAttribute(C.int(id)) } -func imnodesDestroyContext() { +func ImNodesDestroyContext() { C.wrap_imnodes_DestroyContext() } -func imnodesIsAnyAttributeActive() bool { +func ImNodesIsAnyAttributeActive() bool { return C.wrap_imnodes_IsAnyAttributeActive() == C.bool(true) } -func imnodesIsLinkCreatedBoolPtr(started_at_attribute_id *int32, ended_at_attribute_id *int32) bool { +func ImNodesIsLinkCreatedBoolPtr(started_at_attribute_id *int32, ended_at_attribute_id *int32) bool { started_at_attribute_idArg, started_at_attribute_idFin := WrapNumberPtr[C.int, int32](started_at_attribute_id) ended_at_attribute_idArg, ended_at_attribute_idFin := WrapNumberPtr[C.int, int32](ended_at_attribute_id) @@ -492,7 +572,7 @@ func imnodesIsLinkCreatedBoolPtr(started_at_attribute_id *int32, ended_at_attrib return C.wrap_imnodes_IsLinkCreated_BoolPtr(started_at_attribute_idArg, ended_at_attribute_idArg) == C.bool(true) } -func imnodesIsLinkCreatedIntPtr(started_at_node_id *int32, started_at_attribute_id *int32, ended_at_node_id *int32, ended_at_attribute_id *int32) bool { +func ImNodesIsLinkCreatedIntPtr(started_at_node_id *int32, started_at_attribute_id *int32, ended_at_node_id *int32, ended_at_attribute_id *int32) bool { started_at_node_idArg, started_at_node_idFin := WrapNumberPtr[C.int, int32](started_at_node_id) started_at_attribute_idArg, started_at_attribute_idFin := WrapNumberPtr[C.int, int32](started_at_attribute_id) ended_at_node_idArg, ended_at_node_idFin := WrapNumberPtr[C.int, int32](ended_at_node_id) @@ -507,31 +587,40 @@ func imnodesIsLinkCreatedIntPtr(started_at_node_id *int32, started_at_attribute_ return C.wrap_imnodes_IsLinkCreated_IntPtr(started_at_node_idArg, started_at_attribute_idArg, ended_at_node_idArg, ended_at_attribute_idArg) == C.bool(true) } -func imnodesIsLinkDropped() bool { +func ImNodesIsLinkDropped() bool { return C.wrap_imnodes_IsLinkDropped() == C.bool(true) } -func imnodesMiniMap() { +func ImNodesMiniMap() { C.wrap_imnodes_MiniMap() } -func imnodesPopStyleVar() { +func ImNodesPopStyleVar() { C.wrap_imnodes_PopStyleVar() } -func imnodesSaveCurrentEditorStateToIniString() string { +func ImNodesSaveCurrentEditorStateToIniString() string { return C.GoString(C.wrap_imnodes_SaveCurrentEditorStateToIniString()) } -func imnodesStyleColorsClassic() { +func ImNodesSaveEditorStateToIniString(editor *NodesEditorContext) string { + editorArg, editorFin := editor.handle() + + defer func() { + editorFin() + }() + return C.GoString(C.wrap_imnodes_SaveEditorStateToIniString(editorArg)) +} + +func ImNodesStyleColorsClassic() { C.wrap_imnodes_StyleColorsClassic() } -func imnodesStyleColorsDark() { +func ImNodesStyleColorsDark() { C.wrap_imnodes_StyleColorsDark() } -func imnodesStyleColorsLight() { +func ImNodesStyleColorsLight() { C.wrap_imnodes_StyleColorsLight() } diff --git a/cimnodes_structs.go b/cimnodes_structs.go deleted file mode 100644 index 4c103f974..000000000 --- a/cimnodes_structs.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. -// DO NOT EDIT. - -package imgui - -// #include -// #include -// #include "extra_types.h" -// #include "cimnodes_wrapper.h" -import "C" -import "unsafe" - -type EmulateThreeButtonMouse struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self EmulateThreeButtonMouse) handle() (result *C.EmulateThreeButtonMouse, releaseFn func()) { - result = (*C.EmulateThreeButtonMouse)(self.data) - return result, func() {} -} - -func (self EmulateThreeButtonMouse) c() (result C.EmulateThreeButtonMouse, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newEmulateThreeButtonMouseFromC(cvalue *C.EmulateThreeButtonMouse) *EmulateThreeButtonMouse { - result := new(EmulateThreeButtonMouse) - result.data = unsafe.Pointer(cvalue) - return result -} - -type NodesIO struct { - FieldEmulateThreeButtonMouse EmulateThreeButtonMouse - FieldLinkDetachWithModifierClick LinkDetachWithModifierClick - FieldMultipleSelectModifier MultipleSelectModifier - FieldAltMouseButton int32 - FieldAutoPanningSpeed float32 -} - -func (self NodesIO) handle() (result *C.ImNodesIO, releaseFn func()) { - result = new(C.ImNodesIO) - FieldEmulateThreeButtonMouse := self.FieldEmulateThreeButtonMouse - FieldEmulateThreeButtonMouseArg, FieldEmulateThreeButtonMouseFin := FieldEmulateThreeButtonMouse.c() - result.EmulateThreeButtonMouse = FieldEmulateThreeButtonMouseArg - FieldLinkDetachWithModifierClick := self.FieldLinkDetachWithModifierClick - FieldLinkDetachWithModifierClickArg, FieldLinkDetachWithModifierClickFin := FieldLinkDetachWithModifierClick.c() - result.LinkDetachWithModifierClick = FieldLinkDetachWithModifierClickArg - FieldMultipleSelectModifier := self.FieldMultipleSelectModifier - FieldMultipleSelectModifierArg, FieldMultipleSelectModifierFin := FieldMultipleSelectModifier.c() - result.MultipleSelectModifier = FieldMultipleSelectModifierArg - FieldAltMouseButton := self.FieldAltMouseButton - - result.AltMouseButton = C.int(FieldAltMouseButton) - FieldAutoPanningSpeed := self.FieldAutoPanningSpeed - - result.AutoPanningSpeed = C.float(FieldAutoPanningSpeed) - releaseFn = func() { - FieldEmulateThreeButtonMouseFin() - FieldLinkDetachWithModifierClickFin() - FieldMultipleSelectModifierFin() - } - return result, releaseFn -} - -func (self NodesIO) c() (result C.ImNodesIO, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newNodesIOFromC(cvalue *C.ImNodesIO) *NodesIO { - result := new(NodesIO) - result.FieldEmulateThreeButtonMouse = *newEmulateThreeButtonMouseFromC(func() *C.EmulateThreeButtonMouse { result := cvalue.EmulateThreeButtonMouse; return &result }()) - - result.FieldLinkDetachWithModifierClick = *newLinkDetachWithModifierClickFromC(func() *C.LinkDetachWithModifierClick { result := cvalue.LinkDetachWithModifierClick; return &result }()) - - result.FieldMultipleSelectModifier = *newMultipleSelectModifierFromC(func() *C.MultipleSelectModifier { result := cvalue.MultipleSelectModifier; return &result }()) - - result.FieldAltMouseButton = int32(cvalue.AltMouseButton) - result.FieldAutoPanningSpeed = float32(cvalue.AutoPanningSpeed) - return result -} - -type NodesStyle struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self NodesStyle) handle() (result *C.ImNodesStyle, releaseFn func()) { - result = (*C.ImNodesStyle)(self.data) - return result, func() {} -} - -func (self NodesStyle) c() (result C.ImNodesStyle, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newNodesStyleFromC(cvalue *C.ImNodesStyle) *NodesStyle { - result := new(NodesStyle) - result.data = unsafe.Pointer(cvalue) - return result -} - -type LinkDetachWithModifierClick struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self LinkDetachWithModifierClick) handle() (result *C.LinkDetachWithModifierClick, releaseFn func()) { - result = (*C.LinkDetachWithModifierClick)(self.data) - return result, func() {} -} - -func (self LinkDetachWithModifierClick) c() (result C.LinkDetachWithModifierClick, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newLinkDetachWithModifierClickFromC(cvalue *C.LinkDetachWithModifierClick) *LinkDetachWithModifierClick { - result := new(LinkDetachWithModifierClick) - result.data = unsafe.Pointer(cvalue) - return result -} - -type MultipleSelectModifier struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self MultipleSelectModifier) handle() (result *C.MultipleSelectModifier, releaseFn func()) { - result = (*C.MultipleSelectModifier)(self.data) - return result, func() {} -} - -func (self MultipleSelectModifier) c() (result C.MultipleSelectModifier, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newMultipleSelectModifierFromC(cvalue *C.MultipleSelectModifier) *MultipleSelectModifier { - result := new(MultipleSelectModifier) - result.data = unsafe.Pointer(cvalue) - return result -} diff --git a/cimnodes_typedefs.cpp b/cimnodes_typedefs.cpp new file mode 100644 index 000000000..05ec478e5 --- /dev/null +++ b/cimnodes_typedefs.cpp @@ -0,0 +1,14 @@ +// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. +// DO NOT EDIT. + + +#include "cimnodes_typedefs.h" +#include "cimgui/cimnodes.h" + +uintptr_t ImNodesMiniMapNodeHoveringCallbackUserData_toUintptr(ImNodesMiniMapNodeHoveringCallbackUserData ptr) { + return (uintptr_t)ptr; +} + +ImNodesMiniMapNodeHoveringCallbackUserData ImNodesMiniMapNodeHoveringCallbackUserData_fromUintptr(uintptr_t ptr) { + return (ImNodesMiniMapNodeHoveringCallbackUserData)ptr; +} diff --git a/cimnodes_typedefs.go b/cimnodes_typedefs.go new file mode 100644 index 000000000..655cb844a --- /dev/null +++ b/cimnodes_typedefs.go @@ -0,0 +1,137 @@ +// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. +// DO NOT EDIT. + +package imgui + +// #include +// #include +// #include "extra_types.h" +// #include "cimnodes_wrapper.h" +// #include "cimnodes_typedefs.h" +import "C" + +type EmulateThreeButtonMouse struct { + CData *C.EmulateThreeButtonMouse +} + +func (self *EmulateThreeButtonMouse) handle() (result *C.EmulateThreeButtonMouse, fin func()) { + return self.CData, func() {} +} + +func (self EmulateThreeButtonMouse) c() (C.EmulateThreeButtonMouse, func()) { + result, fn := self.handle() + return *result, fn +} + +func newEmulateThreeButtonMouseFromC(cvalue *C.EmulateThreeButtonMouse) *EmulateThreeButtonMouse { + return &EmulateThreeButtonMouse{CData: cvalue} +} + +type NodesContext struct { + CData *C.ImNodesContext +} + +func (self *NodesContext) handle() (result *C.ImNodesContext, fin func()) { + return self.CData, func() {} +} + +func newNodesContextFromC(cvalue *C.ImNodesContext) *NodesContext { + return &NodesContext{CData: cvalue} +} + +type NodesEditorContext struct { + CData *C.ImNodesEditorContext +} + +func (self *NodesEditorContext) handle() (result *C.ImNodesEditorContext, fin func()) { + return self.CData, func() {} +} + +func newNodesEditorContextFromC(cvalue *C.ImNodesEditorContext) *NodesEditorContext { + return &NodesEditorContext{CData: cvalue} +} + +type NodesIO struct { + CData *C.ImNodesIO +} + +func (self *NodesIO) handle() (result *C.ImNodesIO, fin func()) { + return self.CData, func() {} +} + +func (self NodesIO) c() (C.ImNodesIO, func()) { + result, fn := self.handle() + return *result, fn +} + +func newNodesIOFromC(cvalue *C.ImNodesIO) *NodesIO { + return &NodesIO{CData: cvalue} +} + +type NodesMiniMapNodeHoveringCallbackUserData struct { + Data uintptr +} + +func (self *NodesMiniMapNodeHoveringCallbackUserData) handle() (result *C.ImNodesMiniMapNodeHoveringCallbackUserData, fin func()) { + r, f := self.c() + return &r, f +} + +func (self NodesMiniMapNodeHoveringCallbackUserData) c() (C.ImNodesMiniMapNodeHoveringCallbackUserData, func()) { + return (C.ImNodesMiniMapNodeHoveringCallbackUserData)(C.ImNodesMiniMapNodeHoveringCallbackUserData_fromUintptr(C.uintptr_t(self.Data))), func() {} +} + +func newNodesMiniMapNodeHoveringCallbackUserDataFromC(cvalue *C.ImNodesMiniMapNodeHoveringCallbackUserData) *NodesMiniMapNodeHoveringCallbackUserData { + return &NodesMiniMapNodeHoveringCallbackUserData{Data: (uintptr)(C.ImNodesMiniMapNodeHoveringCallbackUserData_toUintptr(*cvalue))} +} + +type NodesStyle struct { + CData *C.ImNodesStyle +} + +func (self *NodesStyle) handle() (result *C.ImNodesStyle, fin func()) { + return self.CData, func() {} +} + +func (self NodesStyle) c() (C.ImNodesStyle, func()) { + result, fn := self.handle() + return *result, fn +} + +func newNodesStyleFromC(cvalue *C.ImNodesStyle) *NodesStyle { + return &NodesStyle{CData: cvalue} +} + +type LinkDetachWithModifierClick struct { + CData *C.LinkDetachWithModifierClick +} + +func (self *LinkDetachWithModifierClick) handle() (result *C.LinkDetachWithModifierClick, fin func()) { + return self.CData, func() {} +} + +func (self LinkDetachWithModifierClick) c() (C.LinkDetachWithModifierClick, func()) { + result, fn := self.handle() + return *result, fn +} + +func newLinkDetachWithModifierClickFromC(cvalue *C.LinkDetachWithModifierClick) *LinkDetachWithModifierClick { + return &LinkDetachWithModifierClick{CData: cvalue} +} + +type MultipleSelectModifier struct { + CData *C.MultipleSelectModifier +} + +func (self *MultipleSelectModifier) handle() (result *C.MultipleSelectModifier, fin func()) { + return self.CData, func() {} +} + +func (self MultipleSelectModifier) c() (C.MultipleSelectModifier, func()) { + result, fn := self.handle() + return *result, fn +} + +func newMultipleSelectModifierFromC(cvalue *C.MultipleSelectModifier) *MultipleSelectModifier { + return &MultipleSelectModifier{CData: cvalue} +} diff --git a/cimnodes_typedefs.h b/cimnodes_typedefs.h new file mode 100644 index 000000000..f14f3dc3f --- /dev/null +++ b/cimnodes_typedefs.h @@ -0,0 +1,16 @@ +// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. +// DO NOT EDIT. + + +#pragma once + +#include "cimgui/cimnodes.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern uintptr_t ImNodesMiniMapNodeHoveringCallbackUserData_toUintptr(ImNodesMiniMapNodeHoveringCallbackUserData ptr); +extern ImNodesMiniMapNodeHoveringCallbackUserData ImNodesMiniMapNodeHoveringCallbackUserData_fromUintptr(uintptr_t ptr); +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/cimnodes_wrapper.cpp b/cimnodes_wrapper.cpp index 7c3e017db..a047cf64a 100644 --- a/cimnodes_wrapper.cpp +++ b/cimnodes_wrapper.cpp @@ -6,15 +6,15 @@ void wrap_imnodes_BeginInputAttribute(int id) { imnodes_BeginInputAttribute(id,ImNodesPinShape_CircleFilled); } void wrap_imnodes_BeginOutputAttribute(int id) { imnodes_BeginOutputAttribute(id,ImNodesPinShape_CircleFilled); } -void wrap_imnodes_DestroyContext() { imnodes_DestroyContext(NULL); } -bool wrap_imnodes_IsAnyAttributeActive() { return imnodes_IsAnyAttributeActive(NULL); } -bool wrap_imnodes_IsLinkCreated_BoolPtr(int* started_at_attribute_id,int* ended_at_attribute_id) { return imnodes_IsLinkCreated_BoolPtr(started_at_attribute_id,ended_at_attribute_id,NULL); } -bool wrap_imnodes_IsLinkCreated_IntPtr(int* started_at_node_id,int* started_at_attribute_id,int* ended_at_node_id,int* ended_at_attribute_id) { return imnodes_IsLinkCreated_IntPtr(started_at_node_id,started_at_attribute_id,ended_at_node_id,ended_at_attribute_id,NULL); } -bool wrap_imnodes_IsLinkDropped() { return imnodes_IsLinkDropped(NULL,true); } -void wrap_imnodes_MiniMap() { imnodes_MiniMap(0.2f,ImNodesMiniMapLocation_TopLeft,NULL,NULL); } +void wrap_imnodes_DestroyContext() { imnodes_DestroyContext(0); } +bool wrap_imnodes_IsAnyAttributeActive() { return imnodes_IsAnyAttributeActive(0); } +bool wrap_imnodes_IsLinkCreated_BoolPtr(int* started_at_attribute_id,int* ended_at_attribute_id) { return imnodes_IsLinkCreated_BoolPtr(started_at_attribute_id,ended_at_attribute_id,0); } +bool wrap_imnodes_IsLinkCreated_IntPtr(int* started_at_node_id,int* started_at_attribute_id,int* ended_at_node_id,int* ended_at_attribute_id) { return imnodes_IsLinkCreated_IntPtr(started_at_node_id,started_at_attribute_id,ended_at_node_id,ended_at_attribute_id,0); } +bool wrap_imnodes_IsLinkDropped() { return imnodes_IsLinkDropped(0,true); } +void wrap_imnodes_MiniMap() { imnodes_MiniMap(0.2f,ImNodesMiniMapLocation_TopLeft,0,0); } void wrap_imnodes_PopStyleVar() { imnodes_PopStyleVar(1); } -const char* wrap_imnodes_SaveCurrentEditorStateToIniString() { return imnodes_SaveCurrentEditorStateToIniString(NULL); } -const char* wrap_imnodes_SaveEditorStateToIniString(const ImNodesEditorContext* editor) { return imnodes_SaveEditorStateToIniString(editor,NULL); } -void wrap_imnodes_StyleColorsClassic() { imnodes_StyleColorsClassic(NULL); } -void wrap_imnodes_StyleColorsDark() { imnodes_StyleColorsDark(NULL); } -void wrap_imnodes_StyleColorsLight() { imnodes_StyleColorsLight(NULL); } +const char* wrap_imnodes_SaveCurrentEditorStateToIniString() { return imnodes_SaveCurrentEditorStateToIniString(0); } +const char* wrap_imnodes_SaveEditorStateToIniString(const ImNodesEditorContext* editor) { return imnodes_SaveEditorStateToIniString(editor,0); } +void wrap_imnodes_StyleColorsClassic() { imnodes_StyleColorsClassic(0); } +void wrap_imnodes_StyleColorsDark() { imnodes_StyleColorsDark(0); } +void wrap_imnodes_StyleColorsLight() { imnodes_StyleColorsLight(0); } diff --git a/cimplot_funcs.go b/cimplot_funcs.go index 72f5b5db8..8dfacb8d0 100644 --- a/cimplot_funcs.go +++ b/cimplot_funcs.go @@ -7,7 +7,6 @@ package imgui // #include "cimplot_structs_accessor.h" // #include "cimplot_wrapper.h" import "C" -import "unsafe" func (self *PlotAlignmentData) Begin() { selfArg, selfFin := self.handle() @@ -596,17 +595,6 @@ func (self *PlotItemGroup) ItemCount() int32 { return int32(C.ImPlotItemGroup_GetItemCount(selfArg)) } -func (self *PlotItemGroup) ItemID(label_id string) ID { - selfArg, selfFin := self.handle() - label_idArg, label_idFin := WrapString(label_id) - - defer func() { - selfFin() - label_idFin() - }() - return ID(C.ImPlotItemGroup_GetItemID(selfArg, label_idArg)) -} - func (self *PlotItemGroup) ItemIndex(item *PlotItem) int32 { selfArg, selfFin := self.handle() itemArg, itemFin := item.handle() @@ -620,11 +608,13 @@ func (self *PlotItemGroup) ItemIndex(item *PlotItem) int32 { func (self *PlotItemGroup) ItemByID(id ID) *PlotItem { selfArg, selfFin := self.handle() + idArg, idFin := id.c() defer func() { selfFin() + idFin() }() - return newPlotItemFromC(C.ImPlotItemGroup_GetItem_ID(selfArg, C.ImGuiID(id))) + return newPlotItemFromC(C.ImPlotItemGroup_GetItem_ID(selfArg, idArg)) } func (self *PlotItemGroup) ItemStr(label_id string) *PlotItem { @@ -667,11 +657,13 @@ func (self *PlotItemGroup) LegendLabel(i int32) string { func (self *PlotItemGroup) OrAddItem(id ID) *PlotItem { selfArg, selfFin := self.handle() + idArg, idFin := id.c() defer func() { selfFin() + idFin() }() - return newPlotItemFromC(C.ImPlotItemGroup_GetOrAddItem(selfArg, C.ImGuiID(id))) + return newPlotItemFromC(C.ImPlotItemGroup_GetOrAddItem(selfArg, idArg)) } func NewPlotItemGroup() *PlotItemGroup { @@ -1945,37 +1937,31 @@ func PlotFormatTime(t PlotTime, buffer string, size int32, fmt PlotTimeFmt, use_ return int32(C.ImPlot_FormatTime(t.toC(), bufferArg, C.int(size), C.ImPlotTimeFmt(fmt), C.bool(use_24_hr_clk))) } -func PlotFormatterDefault(value float64, buff string, size int32, data unsafe.Pointer) int32 { +func PlotFormatterDefault(value float64, buff string, size int32, data uintptr) int32 { buffArg, buffFin := WrapString(buff) - dataArg, dataFin := WrapVoidPtr(data) defer func() { buffFin() - dataFin() }() - return int32(C.ImPlot_Formatter_Default(C.double(value), buffArg, C.int(size), dataArg)) + return int32(C.wrap_ImPlot_Formatter_Default(C.double(value), buffArg, C.int(size), C.uintptr_t(data))) } -func PlotFormatterLogit(value float64, buff string, size int32, noname1 unsafe.Pointer) int32 { +func PlotFormatterLogit(value float64, buff string, size int32, noname1 uintptr) int32 { buffArg, buffFin := WrapString(buff) - noname1Arg, noname1Fin := WrapVoidPtr(noname1) defer func() { buffFin() - noname1Fin() }() - return int32(C.ImPlot_Formatter_Logit(C.double(value), buffArg, C.int(size), noname1Arg)) + return int32(C.wrap_ImPlot_Formatter_Logit(C.double(value), buffArg, C.int(size), C.uintptr_t(noname1))) } -func PlotFormatterTime(noname1 float64, buff string, size int32, data unsafe.Pointer) int32 { +func PlotFormatterTime(noname1 float64, buff string, size int32, data uintptr) int32 { buffArg, buffFin := WrapString(buff) - dataArg, dataFin := WrapVoidPtr(data) defer func() { buffFin() - dataFin() }() - return int32(C.ImPlot_Formatter_Time(C.double(noname1), buffArg, C.int(size), dataArg)) + return int32(C.wrap_ImPlot_Formatter_Time(C.double(noname1), buffArg, C.int(size), C.uintptr_t(data))) } func PlotGetAutoColor(idx PlotCol) Vec4 { @@ -5569,9 +5555,11 @@ func PlotPlotHistogramdoublePtrV(label_id string, values *[]float64, count int32 // flags: 0 func PlotPlotImageV(label_id string, user_texture_id TextureID, bounds_min PlotPoint, bounds_max PlotPoint, uv0 Vec2, uv1 Vec2, tint_col Vec4, flags PlotImageFlags) { label_idArg, label_idFin := WrapString(label_id) - C.ImPlot_PlotImage(label_idArg, C.ImTextureID(user_texture_id), bounds_min.toC(), bounds_max.toC(), uv0.toC(), uv1.toC(), tint_col.toC(), C.ImPlotImageFlags(flags)) + user_texture_idArg, user_texture_idFin := user_texture_id.c() + C.ImPlot_PlotImage(label_idArg, user_texture_idArg, bounds_min.toC(), bounds_max.toC(), uv0.toC(), uv1.toC(), tint_col.toC(), C.ImPlotImageFlags(flags)) label_idFin() + user_texture_idFin() } // PlotPlotInfLinesFloatPtrV parameter default value hint: @@ -9030,58 +9018,28 @@ func PlotTagYStr(y float64, col Vec4, fmt string) { fmtFin() } -func PlotTransformForwardLog10(v float64, noname1 unsafe.Pointer) float64 { - noname1Arg, noname1Fin := WrapVoidPtr(noname1) - - defer func() { - noname1Fin() - }() - return float64(C.ImPlot_TransformForward_Log10(C.double(v), noname1Arg)) +func PlotTransformForwardLog10(v float64, noname1 uintptr) float64 { + return float64(C.wrap_ImPlot_TransformForward_Log10(C.double(v), C.uintptr_t(noname1))) } -func PlotTransformForwardLogit(v float64, noname1 unsafe.Pointer) float64 { - noname1Arg, noname1Fin := WrapVoidPtr(noname1) - - defer func() { - noname1Fin() - }() - return float64(C.ImPlot_TransformForward_Logit(C.double(v), noname1Arg)) +func PlotTransformForwardLogit(v float64, noname1 uintptr) float64 { + return float64(C.wrap_ImPlot_TransformForward_Logit(C.double(v), C.uintptr_t(noname1))) } -func PlotTransformForwardSymLog(v float64, noname1 unsafe.Pointer) float64 { - noname1Arg, noname1Fin := WrapVoidPtr(noname1) - - defer func() { - noname1Fin() - }() - return float64(C.ImPlot_TransformForward_SymLog(C.double(v), noname1Arg)) +func PlotTransformForwardSymLog(v float64, noname1 uintptr) float64 { + return float64(C.wrap_ImPlot_TransformForward_SymLog(C.double(v), C.uintptr_t(noname1))) } -func PlotTransformInverseLog10(v float64, noname1 unsafe.Pointer) float64 { - noname1Arg, noname1Fin := WrapVoidPtr(noname1) - - defer func() { - noname1Fin() - }() - return float64(C.ImPlot_TransformInverse_Log10(C.double(v), noname1Arg)) +func PlotTransformInverseLog10(v float64, noname1 uintptr) float64 { + return float64(C.wrap_ImPlot_TransformInverse_Log10(C.double(v), C.uintptr_t(noname1))) } -func PlotTransformInverseLogit(v float64, noname1 unsafe.Pointer) float64 { - noname1Arg, noname1Fin := WrapVoidPtr(noname1) - - defer func() { - noname1Fin() - }() - return float64(C.ImPlot_TransformInverse_Logit(C.double(v), noname1Arg)) +func PlotTransformInverseLogit(v float64, noname1 uintptr) float64 { + return float64(C.wrap_ImPlot_TransformInverse_Logit(C.double(v), C.uintptr_t(noname1))) } -func PlotTransformInverseSymLog(v float64, noname1 unsafe.Pointer) float64 { - noname1Arg, noname1Fin := WrapVoidPtr(noname1) - - defer func() { - noname1Fin() - }() - return float64(C.ImPlot_TransformInverse_SymLog(C.double(v), noname1Arg)) +func PlotTransformInverseSymLog(v float64, noname1 uintptr) float64 { + return float64(C.wrap_ImPlot_TransformInverse_SymLog(C.double(v), C.uintptr_t(noname1))) } func (self *PlotAxis) SetMax(_max float64) bool { @@ -11146,9 +11104,11 @@ func PlotPlotHistogramdoublePtr(label_id string, values *[]float64, count int32) func PlotPlotImage(label_id string, user_texture_id TextureID, bounds_min PlotPoint, bounds_max PlotPoint) { label_idArg, label_idFin := WrapString(label_id) - C.wrap_ImPlot_PlotImage(label_idArg, C.ImTextureID(user_texture_id), bounds_min.toC(), bounds_max.toC()) + user_texture_idArg, user_texture_idFin := user_texture_id.c() + C.wrap_ImPlot_PlotImage(label_idArg, user_texture_idArg, bounds_min.toC(), bounds_max.toC()) label_idFin() + user_texture_idFin() } func PlotPlotInfLinesFloatPtr(label_id string, values []float32, count int32) { @@ -13541,15 +13501,6 @@ func (self *FormatterTimeData) TimeDataGetSpec() PlotDateTimeSpec { return *newPlotDateTimeSpecFromC(func() *C.ImPlotDateTimeSpec { result := result; return &result }()) } -func (self *FormatterTimeData) TimeDataGetUserFormatterData() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_Formatter_Time_Data_GetUserFormatterData(selfArg)) -} - func (self PlotAlignmentData) SetVertical(v bool) { selfArg, selfFin := self.handle() defer selfFin() @@ -13773,18 +13724,11 @@ func (self *PlotAnnotationCollection) Size() int32 { } func (self PlotAxis) SetID(v ID) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImPlotAxis_SetID(selfArg, C.ImGuiID(v)) -} + vArg, _ := v.c() -func (self *PlotAxis) ID() ID { selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return ID(C.wrap_ImPlotAxis_GetID(selfArg)) + defer selfFin() + C.wrap_ImPlotAxis_SetID(selfArg, vArg) } func (self PlotAxis) SetFlags(v PlotAxisFlags) { @@ -13959,23 +13903,6 @@ func (self *PlotAxis) Ticker() PlotTicker { return *newPlotTickerFromC(func() *C.ImPlotTicker { result := result; return &result }()) } -func (self PlotAxis) SetFormatterData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImPlotAxis_SetFormatterData(selfArg, vArg) -} - -func (self *PlotAxis) FormatterData() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_ImPlotAxis_GetFormatterData(selfArg)) -} - func (self PlotAxis) SetFormatSpec(v *[16]rune) { vArg := make([]C.char, len(v)) for i, vV := range v { @@ -14066,23 +13993,6 @@ func (self *PlotAxis) PickerTimeMax() PlotTime { return *(&PlotTime{}).fromC(C.wrap_ImPlotAxis_GetPickerTimeMax(selfArg)) } -func (self PlotAxis) SetTransformData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImPlotAxis_SetTransformData(selfArg, vArg) -} - -func (self *PlotAxis) TransformData() unsafe.Pointer { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return unsafe.Pointer(C.wrap_ImPlotAxis_GetTransformData(selfArg)) -} - func (self PlotAxis) SetPixelMin(v float32) { selfArg, selfFin := self.handle() defer selfFin() @@ -15394,18 +15304,11 @@ func (self *PlotInputMap) ZoomRate() float32 { } func (self PlotItem) SetID(v ID) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImPlotItem_SetID(selfArg, C.ImGuiID(v)) -} + vArg, _ := v.c() -func (self *PlotItem) ID() ID { selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return ID(C.wrap_ImPlotItem_GetID(selfArg)) + defer selfFin() + C.wrap_ImPlotItem_SetID(selfArg, vArg) } func (self PlotItem) SetColor(v uint32) { @@ -15499,18 +15402,11 @@ func (self *PlotItem) SeenThisFrame() bool { } func (self PlotItemGroup) SetID(v ID) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImPlotItemGroup_SetID(selfArg, C.ImGuiID(v)) -} + vArg, _ := v.c() -func (self *PlotItemGroup) ID() ID { selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return ID(C.wrap_ImPlotItemGroup_GetID(selfArg)) + defer selfFin() + C.wrap_ImPlotItemGroup_SetID(selfArg, vArg) } func (self PlotItemGroup) SetLegend(v PlotLegend) { @@ -15980,18 +15876,11 @@ func (self *PlotNextItemData) HiddenCond() PlotCond { } func (self PlotPlot) SetID(v ID) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImPlotPlot_SetID(selfArg, C.ImGuiID(v)) -} + vArg, _ := v.c() -func (self *PlotPlot) ID() ID { selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return ID(C.wrap_ImPlotPlot_GetID(selfArg)) + defer selfFin() + C.wrap_ImPlotPlot_SetID(selfArg, vArg) } func (self PlotPlot) SetFlags(v PlotFlags) { @@ -16956,18 +16845,11 @@ func (self *PlotStyle) Use24HourClock() bool { } func (self PlotSubplot) SetID(v ID) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImPlotSubplot_SetID(selfArg, C.ImGuiID(v)) -} + vArg, _ := v.c() -func (self *PlotSubplot) ID() ID { selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return ID(C.wrap_ImPlotSubplot_GetID(selfArg)) + defer selfFin() + C.wrap_ImPlotSubplot_SetID(selfArg, vArg) } func (self PlotSubplot) SetFlags(v PlotSubplotFlags) { diff --git a/cimplot_structs.go b/cimplot_structs.go deleted file mode 100644 index 53706085b..000000000 --- a/cimplot_structs.go +++ /dev/null @@ -1,939 +0,0 @@ -// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. -// DO NOT EDIT. - -package imgui - -// #include -// #include -// #include "extra_types.h" -// #include "cimplot_wrapper.h" -import "C" -import "unsafe" - -type FormatterTimeData struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self FormatterTimeData) handle() (result *C.Formatter_Time_Data, releaseFn func()) { - result = (*C.Formatter_Time_Data)(self.data) - return result, func() {} -} - -func (self FormatterTimeData) c() (result C.Formatter_Time_Data, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newFormatterTimeDataFromC(cvalue *C.Formatter_Time_Data) *FormatterTimeData { - result := new(FormatterTimeData) - result.data = unsafe.Pointer(cvalue) - return result -} - -type PlotAlignmentData struct { - FieldVertical bool - FieldPadA float32 - FieldPadB float32 - FieldPadAMax float32 - FieldPadBMax float32 -} - -func (self PlotAlignmentData) handle() (result *C.ImPlotAlignmentData, releaseFn func()) { - result = new(C.ImPlotAlignmentData) - FieldVertical := self.FieldVertical - - result.Vertical = C.bool(FieldVertical) - FieldPadA := self.FieldPadA - - result.PadA = C.float(FieldPadA) - FieldPadB := self.FieldPadB - - result.PadB = C.float(FieldPadB) - FieldPadAMax := self.FieldPadAMax - - result.PadAMax = C.float(FieldPadAMax) - FieldPadBMax := self.FieldPadBMax - - result.PadBMax = C.float(FieldPadBMax) - releaseFn = func() { - } - return result, releaseFn -} - -func (self PlotAlignmentData) c() (result C.ImPlotAlignmentData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPlotAlignmentDataFromC(cvalue *C.ImPlotAlignmentData) *PlotAlignmentData { - result := new(PlotAlignmentData) - result.FieldVertical = cvalue.Vertical == C.bool(true) - result.FieldPadA = float32(cvalue.PadA) - result.FieldPadB = float32(cvalue.PadB) - result.FieldPadAMax = float32(cvalue.PadAMax) - result.FieldPadBMax = float32(cvalue.PadBMax) - return result -} - -type PlotAnnotation struct { - FieldPos Vec2 - FieldOffset Vec2 - FieldColorBg uint32 - FieldColorFg uint32 - FieldTextOffset int32 - FieldClamp bool -} - -func (self PlotAnnotation) handle() (result *C.ImPlotAnnotation, releaseFn func()) { - result = new(C.ImPlotAnnotation) - FieldPos := self.FieldPos - - result.Pos = FieldPos.toC() - FieldOffset := self.FieldOffset - - result.Offset = FieldOffset.toC() - FieldColorBg := self.FieldColorBg - - result.ColorBg = C.ImU32(FieldColorBg) - FieldColorFg := self.FieldColorFg - - result.ColorFg = C.ImU32(FieldColorFg) - FieldTextOffset := self.FieldTextOffset - - result.TextOffset = C.int(FieldTextOffset) - FieldClamp := self.FieldClamp - - result.Clamp = C.bool(FieldClamp) - releaseFn = func() { - } - return result, releaseFn -} - -func (self PlotAnnotation) c() (result C.ImPlotAnnotation, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPlotAnnotationFromC(cvalue *C.ImPlotAnnotation) *PlotAnnotation { - result := new(PlotAnnotation) - result.FieldPos = *(&Vec2{}).fromC(cvalue.Pos) - result.FieldOffset = *(&Vec2{}).fromC(cvalue.Offset) - result.FieldColorBg = uint32(cvalue.ColorBg) - result.FieldColorFg = uint32(cvalue.ColorFg) - result.FieldTextOffset = int32(cvalue.TextOffset) - result.FieldClamp = cvalue.Clamp == C.bool(true) - return result -} - -type PlotAnnotationCollection struct { - FieldAnnotations Vector[*PlotAnnotation] - FieldTextBuffer TextBuffer - FieldSize int32 -} - -func (self PlotAnnotationCollection) handle() (result *C.ImPlotAnnotationCollection, releaseFn func()) { - result = new(C.ImPlotAnnotationCollection) - FieldAnnotations := self.FieldAnnotations - FieldAnnotationsData := FieldAnnotations.Data - FieldAnnotationsDataArg, FieldAnnotationsDataFin := FieldAnnotationsData.handle() - FieldAnnotationsVecArg := new(C.ImVector_ImPlotAnnotation) - FieldAnnotationsVecArg.Size = C.int(FieldAnnotations.Size) - FieldAnnotationsVecArg.Capacity = C.int(FieldAnnotations.Capacity) - FieldAnnotationsVecArg.Data = FieldAnnotationsDataArg - FieldAnnotations.pinner.Pin(FieldAnnotationsVecArg.Data) - - result.Annotations = *FieldAnnotationsVecArg - FieldTextBuffer := self.FieldTextBuffer - FieldTextBufferArg, FieldTextBufferFin := FieldTextBuffer.c() - result.TextBuffer = FieldTextBufferArg - FieldSize := self.FieldSize - - result.Size = C.int(FieldSize) - releaseFn = func() { - FieldAnnotationsDataFin() - FieldAnnotations.pinner.Unpin() - FieldTextBufferFin() - } - return result, releaseFn -} - -func (self PlotAnnotationCollection) c() (result C.ImPlotAnnotationCollection, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPlotAnnotationCollectionFromC(cvalue *C.ImPlotAnnotationCollection) *PlotAnnotationCollection { - result := new(PlotAnnotationCollection) - result.FieldAnnotations = newVectorFromC(cvalue.Annotations.Size, cvalue.Annotations.Capacity, newPlotAnnotationFromC(cvalue.Annotations.Data)) - result.FieldTextBuffer = *newTextBufferFromC(func() *C.ImGuiTextBuffer { result := cvalue.TextBuffer; return &result }()) - - result.FieldSize = int32(cvalue.Size) - return result -} - -type PlotAxis struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self PlotAxis) handle() (result *C.ImPlotAxis, releaseFn func()) { - result = (*C.ImPlotAxis)(self.data) - return result, func() {} -} - -func (self PlotAxis) c() (result C.ImPlotAxis, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPlotAxisFromC(cvalue *C.ImPlotAxis) *PlotAxis { - result := new(PlotAxis) - result.data = unsafe.Pointer(cvalue) - return result -} - -type PlotColormapData struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self PlotColormapData) handle() (result *C.ImPlotColormapData, releaseFn func()) { - result = (*C.ImPlotColormapData)(self.data) - return result, func() {} -} - -func (self PlotColormapData) c() (result C.ImPlotColormapData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPlotColormapDataFromC(cvalue *C.ImPlotColormapData) *PlotColormapData { - result := new(PlotColormapData) - result.data = unsafe.Pointer(cvalue) - return result -} - -type PlotContext struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self PlotContext) handle() (result *C.ImPlotContext, releaseFn func()) { - result = (*C.ImPlotContext)(self.data) - return result, func() {} -} - -func (self PlotContext) c() (result C.ImPlotContext, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPlotContextFromC(cvalue *C.ImPlotContext) *PlotContext { - result := new(PlotContext) - result.data = unsafe.Pointer(cvalue) - return result -} - -type PlotDateTimeSpec struct { - FieldDate PlotDateFmt - FieldTime PlotTimeFmt - FieldUseISO8601 bool - FieldUse24HourClock bool -} - -func (self PlotDateTimeSpec) handle() (result *C.ImPlotDateTimeSpec, releaseFn func()) { - result = new(C.ImPlotDateTimeSpec) - FieldDate := self.FieldDate - - result.Date = C.ImPlotDateFmt(FieldDate) - FieldTime := self.FieldTime - - result.Time = C.ImPlotTimeFmt(FieldTime) - FieldUseISO8601 := self.FieldUseISO8601 - - result.UseISO8601 = C.bool(FieldUseISO8601) - FieldUse24HourClock := self.FieldUse24HourClock - - result.Use24HourClock = C.bool(FieldUse24HourClock) - releaseFn = func() { - } - return result, releaseFn -} - -func (self PlotDateTimeSpec) c() (result C.ImPlotDateTimeSpec, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPlotDateTimeSpecFromC(cvalue *C.ImPlotDateTimeSpec) *PlotDateTimeSpec { - result := new(PlotDateTimeSpec) - result.FieldDate = PlotDateFmt(cvalue.Date) - result.FieldTime = PlotTimeFmt(cvalue.Time) - result.FieldUseISO8601 = cvalue.UseISO8601 == C.bool(true) - result.FieldUse24HourClock = cvalue.Use24HourClock == C.bool(true) - return result -} - -type PlotInputMap struct { - FieldPan MouseButton - FieldPanMod int32 - FieldFit MouseButton - FieldSelect MouseButton - FieldSelectCancel MouseButton - FieldSelectMod int32 - FieldSelectHorzMod int32 - FieldSelectVertMod int32 - FieldMenu MouseButton - FieldOverrideMod int32 - FieldZoomMod int32 - FieldZoomRate float32 -} - -func (self PlotInputMap) handle() (result *C.ImPlotInputMap, releaseFn func()) { - result = new(C.ImPlotInputMap) - FieldPan := self.FieldPan - - result.Pan = C.ImGuiMouseButton(FieldPan) - FieldPanMod := self.FieldPanMod - - result.PanMod = C.int(FieldPanMod) - FieldFit := self.FieldFit - - result.Fit = C.ImGuiMouseButton(FieldFit) - FieldSelect := self.FieldSelect - - result.Select = C.ImGuiMouseButton(FieldSelect) - FieldSelectCancel := self.FieldSelectCancel - - result.SelectCancel = C.ImGuiMouseButton(FieldSelectCancel) - FieldSelectMod := self.FieldSelectMod - - result.SelectMod = C.int(FieldSelectMod) - FieldSelectHorzMod := self.FieldSelectHorzMod - - result.SelectHorzMod = C.int(FieldSelectHorzMod) - FieldSelectVertMod := self.FieldSelectVertMod - - result.SelectVertMod = C.int(FieldSelectVertMod) - FieldMenu := self.FieldMenu - - result.Menu = C.ImGuiMouseButton(FieldMenu) - FieldOverrideMod := self.FieldOverrideMod - - result.OverrideMod = C.int(FieldOverrideMod) - FieldZoomMod := self.FieldZoomMod - - result.ZoomMod = C.int(FieldZoomMod) - FieldZoomRate := self.FieldZoomRate - - result.ZoomRate = C.float(FieldZoomRate) - releaseFn = func() { - } - return result, releaseFn -} - -func (self PlotInputMap) c() (result C.ImPlotInputMap, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPlotInputMapFromC(cvalue *C.ImPlotInputMap) *PlotInputMap { - result := new(PlotInputMap) - result.FieldPan = MouseButton(cvalue.Pan) - result.FieldPanMod = int32(cvalue.PanMod) - result.FieldFit = MouseButton(cvalue.Fit) - result.FieldSelect = MouseButton(cvalue.Select) - result.FieldSelectCancel = MouseButton(cvalue.SelectCancel) - result.FieldSelectMod = int32(cvalue.SelectMod) - result.FieldSelectHorzMod = int32(cvalue.SelectHorzMod) - result.FieldSelectVertMod = int32(cvalue.SelectVertMod) - result.FieldMenu = MouseButton(cvalue.Menu) - result.FieldOverrideMod = int32(cvalue.OverrideMod) - result.FieldZoomMod = int32(cvalue.ZoomMod) - result.FieldZoomRate = float32(cvalue.ZoomRate) - return result -} - -type PlotItem struct { - FieldID ID - FieldColor uint32 - FieldLegendHoverRect Rect - FieldNameOffset int32 - FieldShow bool - FieldLegendHovered bool - FieldSeenThisFrame bool -} - -func (self PlotItem) handle() (result *C.ImPlotItem, releaseFn func()) { - result = new(C.ImPlotItem) - FieldID := self.FieldID - - result.ID = C.ImGuiID(FieldID) - FieldColor := self.FieldColor - - result.Color = C.ImU32(FieldColor) - FieldLegendHoverRect := self.FieldLegendHoverRect - - result.LegendHoverRect = FieldLegendHoverRect.toC() - FieldNameOffset := self.FieldNameOffset - - result.NameOffset = C.int(FieldNameOffset) - FieldShow := self.FieldShow - - result.Show = C.bool(FieldShow) - FieldLegendHovered := self.FieldLegendHovered - - result.LegendHovered = C.bool(FieldLegendHovered) - FieldSeenThisFrame := self.FieldSeenThisFrame - - result.SeenThisFrame = C.bool(FieldSeenThisFrame) - releaseFn = func() { - } - return result, releaseFn -} - -func (self PlotItem) c() (result C.ImPlotItem, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPlotItemFromC(cvalue *C.ImPlotItem) *PlotItem { - result := new(PlotItem) - result.FieldID = ID(cvalue.ID) - result.FieldColor = uint32(cvalue.Color) - result.FieldLegendHoverRect = *(&Rect{}).fromC(cvalue.LegendHoverRect) - result.FieldNameOffset = int32(cvalue.NameOffset) - result.FieldShow = cvalue.Show == C.bool(true) - result.FieldLegendHovered = cvalue.LegendHovered == C.bool(true) - result.FieldSeenThisFrame = cvalue.SeenThisFrame == C.bool(true) - return result -} - -type PlotItemGroup struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self PlotItemGroup) handle() (result *C.ImPlotItemGroup, releaseFn func()) { - result = (*C.ImPlotItemGroup)(self.data) - return result, func() {} -} - -func (self PlotItemGroup) c() (result C.ImPlotItemGroup, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPlotItemGroupFromC(cvalue *C.ImPlotItemGroup) *PlotItemGroup { - result := new(PlotItemGroup) - result.data = unsafe.Pointer(cvalue) - return result -} - -type PlotLegend struct { - FieldFlags PlotLegendFlags - FieldPreviousFlags PlotLegendFlags - FieldLocation PlotLocation - FieldPreviousLocation PlotLocation - FieldScroll Vec2 - FieldIndices Vector[*int32] - FieldLabels TextBuffer - FieldRect Rect - FieldRectClamped Rect - FieldHovered bool - FieldHeld bool - FieldCanGoInside bool -} - -func (self PlotLegend) handle() (result *C.ImPlotLegend, releaseFn func()) { - result = new(C.ImPlotLegend) - FieldFlags := self.FieldFlags - - result.Flags = C.ImPlotLegendFlags(FieldFlags) - FieldPreviousFlags := self.FieldPreviousFlags - - result.PreviousFlags = C.ImPlotLegendFlags(FieldPreviousFlags) - FieldLocation := self.FieldLocation - - result.Location = C.ImPlotLocation(FieldLocation) - FieldPreviousLocation := self.FieldPreviousLocation - - result.PreviousLocation = C.ImPlotLocation(FieldPreviousLocation) - FieldScroll := self.FieldScroll - - result.Scroll = FieldScroll.toC() - FieldIndices := self.FieldIndices - FieldIndicesData := FieldIndices.Data - FieldIndicesDataArg, FieldIndicesDataFin := WrapNumberPtr[C.int, int32](FieldIndicesData) - FieldIndicesVecArg := new(C.ImVector_int) - FieldIndicesVecArg.Size = C.int(FieldIndices.Size) - FieldIndicesVecArg.Capacity = C.int(FieldIndices.Capacity) - FieldIndicesVecArg.Data = FieldIndicesDataArg - FieldIndices.pinner.Pin(FieldIndicesVecArg.Data) - - result.Indices = *FieldIndicesVecArg - FieldLabels := self.FieldLabels - FieldLabelsArg, FieldLabelsFin := FieldLabels.c() - result.Labels = FieldLabelsArg - FieldRect := self.FieldRect - - result.Rect = FieldRect.toC() - FieldRectClamped := self.FieldRectClamped - - result.RectClamped = FieldRectClamped.toC() - FieldHovered := self.FieldHovered - - result.Hovered = C.bool(FieldHovered) - FieldHeld := self.FieldHeld - - result.Held = C.bool(FieldHeld) - FieldCanGoInside := self.FieldCanGoInside - - result.CanGoInside = C.bool(FieldCanGoInside) - releaseFn = func() { - FieldIndicesDataFin() - FieldIndices.pinner.Unpin() - FieldLabelsFin() - } - return result, releaseFn -} - -func (self PlotLegend) c() (result C.ImPlotLegend, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPlotLegendFromC(cvalue *C.ImPlotLegend) *PlotLegend { - result := new(PlotLegend) - result.FieldFlags = PlotLegendFlags(cvalue.Flags) - result.FieldPreviousFlags = PlotLegendFlags(cvalue.PreviousFlags) - result.FieldLocation = PlotLocation(cvalue.Location) - result.FieldPreviousLocation = PlotLocation(cvalue.PreviousLocation) - result.FieldScroll = *(&Vec2{}).fromC(cvalue.Scroll) - result.FieldIndices = newVectorFromC(cvalue.Indices.Size, cvalue.Indices.Capacity, (*int32)(cvalue.Indices.Data)) - result.FieldLabels = *newTextBufferFromC(func() *C.ImGuiTextBuffer { result := cvalue.Labels; return &result }()) - - result.FieldRect = *(&Rect{}).fromC(cvalue.Rect) - result.FieldRectClamped = *(&Rect{}).fromC(cvalue.RectClamped) - result.FieldHovered = cvalue.Hovered == C.bool(true) - result.FieldHeld = cvalue.Held == C.bool(true) - result.FieldCanGoInside = cvalue.CanGoInside == C.bool(true) - return result -} - -type PlotNextItemData struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self PlotNextItemData) handle() (result *C.ImPlotNextItemData, releaseFn func()) { - result = (*C.ImPlotNextItemData)(self.data) - return result, func() {} -} - -func (self PlotNextItemData) c() (result C.ImPlotNextItemData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPlotNextItemDataFromC(cvalue *C.ImPlotNextItemData) *PlotNextItemData { - result := new(PlotNextItemData) - result.data = unsafe.Pointer(cvalue) - return result -} - -type PlotNextPlotData struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self PlotNextPlotData) handle() (result *C.ImPlotNextPlotData, releaseFn func()) { - result = (*C.ImPlotNextPlotData)(self.data) - return result, func() {} -} - -func (self PlotNextPlotData) c() (result C.ImPlotNextPlotData, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPlotNextPlotDataFromC(cvalue *C.ImPlotNextPlotData) *PlotNextPlotData { - result := new(PlotNextPlotData) - result.data = unsafe.Pointer(cvalue) - return result -} - -type PlotPlot struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self PlotPlot) handle() (result *C.ImPlotPlot, releaseFn func()) { - result = (*C.ImPlotPlot)(self.data) - return result, func() {} -} - -func (self PlotPlot) c() (result C.ImPlotPlot, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPlotPlotFromC(cvalue *C.ImPlotPlot) *PlotPlot { - result := new(PlotPlot) - result.data = unsafe.Pointer(cvalue) - return result -} - -type PlotPointError struct { - FieldX float64 - FieldY float64 - FieldNeg float64 - FieldPos float64 -} - -func (self PlotPointError) handle() (result *C.ImPlotPointError, releaseFn func()) { - result = new(C.ImPlotPointError) - FieldX := self.FieldX - - result.X = C.double(FieldX) - FieldY := self.FieldY - - result.Y = C.double(FieldY) - FieldNeg := self.FieldNeg - - result.Neg = C.double(FieldNeg) - FieldPos := self.FieldPos - - result.Pos = C.double(FieldPos) - releaseFn = func() { - } - return result, releaseFn -} - -func (self PlotPointError) c() (result C.ImPlotPointError, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPlotPointErrorFromC(cvalue *C.ImPlotPointError) *PlotPointError { - result := new(PlotPointError) - result.FieldX = float64(cvalue.X) - result.FieldY = float64(cvalue.Y) - result.FieldNeg = float64(cvalue.Neg) - result.FieldPos = float64(cvalue.Pos) - return result -} - -type PlotRange struct { - FieldMin float64 - FieldMax float64 -} - -func (self PlotRange) handle() (result *C.ImPlotRange, releaseFn func()) { - result = new(C.ImPlotRange) - FieldMin := self.FieldMin - - result.Min = C.double(FieldMin) - FieldMax := self.FieldMax - - result.Max = C.double(FieldMax) - releaseFn = func() { - } - return result, releaseFn -} - -func (self PlotRange) c() (result C.ImPlotRange, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPlotRangeFromC(cvalue *C.ImPlotRange) *PlotRange { - result := new(PlotRange) - result.FieldMin = float64(cvalue.Min) - result.FieldMax = float64(cvalue.Max) - return result -} - -type PlotRect struct { - FieldX PlotRange - FieldY PlotRange -} - -func (self PlotRect) handle() (result *C.ImPlotRect, releaseFn func()) { - result = new(C.ImPlotRect) - FieldX := self.FieldX - FieldXArg, FieldXFin := FieldX.c() - result.X = FieldXArg - FieldY := self.FieldY - FieldYArg, FieldYFin := FieldY.c() - result.Y = FieldYArg - releaseFn = func() { - FieldXFin() - FieldYFin() - } - return result, releaseFn -} - -func (self PlotRect) c() (result C.ImPlotRect, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPlotRectFromC(cvalue *C.ImPlotRect) *PlotRect { - result := new(PlotRect) - result.FieldX = *newPlotRangeFromC(func() *C.ImPlotRange { result := cvalue.X; return &result }()) - - result.FieldY = *newPlotRangeFromC(func() *C.ImPlotRange { result := cvalue.Y; return &result }()) - - return result -} - -type PlotStyle struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self PlotStyle) handle() (result *C.ImPlotStyle, releaseFn func()) { - result = (*C.ImPlotStyle)(self.data) - return result, func() {} -} - -func (self PlotStyle) c() (result C.ImPlotStyle, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPlotStyleFromC(cvalue *C.ImPlotStyle) *PlotStyle { - result := new(PlotStyle) - result.data = unsafe.Pointer(cvalue) - return result -} - -type PlotSubplot struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self PlotSubplot) handle() (result *C.ImPlotSubplot, releaseFn func()) { - result = (*C.ImPlotSubplot)(self.data) - return result, func() {} -} - -func (self PlotSubplot) c() (result C.ImPlotSubplot, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPlotSubplotFromC(cvalue *C.ImPlotSubplot) *PlotSubplot { - result := new(PlotSubplot) - result.data = unsafe.Pointer(cvalue) - return result -} - -type PlotTag struct { - FieldAxis PlotAxisEnum - FieldValue float64 - FieldColorBg uint32 - FieldColorFg uint32 - FieldTextOffset int32 -} - -func (self PlotTag) handle() (result *C.ImPlotTag, releaseFn func()) { - result = new(C.ImPlotTag) - FieldAxis := self.FieldAxis - - result.Axis = C.ImAxis(FieldAxis) - FieldValue := self.FieldValue - - result.Value = C.double(FieldValue) - FieldColorBg := self.FieldColorBg - - result.ColorBg = C.ImU32(FieldColorBg) - FieldColorFg := self.FieldColorFg - - result.ColorFg = C.ImU32(FieldColorFg) - FieldTextOffset := self.FieldTextOffset - - result.TextOffset = C.int(FieldTextOffset) - releaseFn = func() { - } - return result, releaseFn -} - -func (self PlotTag) c() (result C.ImPlotTag, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPlotTagFromC(cvalue *C.ImPlotTag) *PlotTag { - result := new(PlotTag) - result.FieldAxis = PlotAxisEnum(cvalue.Axis) - result.FieldValue = float64(cvalue.Value) - result.FieldColorBg = uint32(cvalue.ColorBg) - result.FieldColorFg = uint32(cvalue.ColorFg) - result.FieldTextOffset = int32(cvalue.TextOffset) - return result -} - -type PlotTagCollection struct { - FieldTags Vector[*PlotTag] - FieldTextBuffer TextBuffer - FieldSize int32 -} - -func (self PlotTagCollection) handle() (result *C.ImPlotTagCollection, releaseFn func()) { - result = new(C.ImPlotTagCollection) - FieldTags := self.FieldTags - FieldTagsData := FieldTags.Data - FieldTagsDataArg, FieldTagsDataFin := FieldTagsData.handle() - FieldTagsVecArg := new(C.ImVector_ImPlotTag) - FieldTagsVecArg.Size = C.int(FieldTags.Size) - FieldTagsVecArg.Capacity = C.int(FieldTags.Capacity) - FieldTagsVecArg.Data = FieldTagsDataArg - FieldTags.pinner.Pin(FieldTagsVecArg.Data) - - result.Tags = *FieldTagsVecArg - FieldTextBuffer := self.FieldTextBuffer - FieldTextBufferArg, FieldTextBufferFin := FieldTextBuffer.c() - result.TextBuffer = FieldTextBufferArg - FieldSize := self.FieldSize - - result.Size = C.int(FieldSize) - releaseFn = func() { - FieldTagsDataFin() - FieldTags.pinner.Unpin() - FieldTextBufferFin() - } - return result, releaseFn -} - -func (self PlotTagCollection) c() (result C.ImPlotTagCollection, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPlotTagCollectionFromC(cvalue *C.ImPlotTagCollection) *PlotTagCollection { - result := new(PlotTagCollection) - result.FieldTags = newVectorFromC(cvalue.Tags.Size, cvalue.Tags.Capacity, newPlotTagFromC(cvalue.Tags.Data)) - result.FieldTextBuffer = *newTextBufferFromC(func() *C.ImGuiTextBuffer { result := cvalue.TextBuffer; return &result }()) - - result.FieldSize = int32(cvalue.Size) - return result -} - -type PlotTick struct { - FieldPlotPos float64 - FieldPixelPos float32 - FieldLabelSize Vec2 - FieldTextOffset int32 - FieldMajor bool - FieldShowLabel bool - FieldLevel int32 - FieldIdx int32 -} - -func (self PlotTick) handle() (result *C.ImPlotTick, releaseFn func()) { - result = new(C.ImPlotTick) - FieldPlotPos := self.FieldPlotPos - - result.PlotPos = C.double(FieldPlotPos) - FieldPixelPos := self.FieldPixelPos - - result.PixelPos = C.float(FieldPixelPos) - FieldLabelSize := self.FieldLabelSize - - result.LabelSize = FieldLabelSize.toC() - FieldTextOffset := self.FieldTextOffset - - result.TextOffset = C.int(FieldTextOffset) - FieldMajor := self.FieldMajor - - result.Major = C.bool(FieldMajor) - FieldShowLabel := self.FieldShowLabel - - result.ShowLabel = C.bool(FieldShowLabel) - FieldLevel := self.FieldLevel - - result.Level = C.int(FieldLevel) - FieldIdx := self.FieldIdx - - result.Idx = C.int(FieldIdx) - releaseFn = func() { - } - return result, releaseFn -} - -func (self PlotTick) c() (result C.ImPlotTick, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPlotTickFromC(cvalue *C.ImPlotTick) *PlotTick { - result := new(PlotTick) - result.FieldPlotPos = float64(cvalue.PlotPos) - result.FieldPixelPos = float32(cvalue.PixelPos) - result.FieldLabelSize = *(&Vec2{}).fromC(cvalue.LabelSize) - result.FieldTextOffset = int32(cvalue.TextOffset) - result.FieldMajor = cvalue.Major == C.bool(true) - result.FieldShowLabel = cvalue.ShowLabel == C.bool(true) - result.FieldLevel = int32(cvalue.Level) - result.FieldIdx = int32(cvalue.Idx) - return result -} - -type PlotTicker struct { - FieldTicks Vector[*PlotTick] - FieldTextBuffer TextBuffer - FieldMaxSize Vec2 - FieldLateSize Vec2 - FieldLevels int32 -} - -func (self PlotTicker) handle() (result *C.ImPlotTicker, releaseFn func()) { - result = new(C.ImPlotTicker) - FieldTicks := self.FieldTicks - FieldTicksData := FieldTicks.Data - FieldTicksDataArg, FieldTicksDataFin := FieldTicksData.handle() - FieldTicksVecArg := new(C.ImVector_ImPlotTick) - FieldTicksVecArg.Size = C.int(FieldTicks.Size) - FieldTicksVecArg.Capacity = C.int(FieldTicks.Capacity) - FieldTicksVecArg.Data = FieldTicksDataArg - FieldTicks.pinner.Pin(FieldTicksVecArg.Data) - - result.Ticks = *FieldTicksVecArg - FieldTextBuffer := self.FieldTextBuffer - FieldTextBufferArg, FieldTextBufferFin := FieldTextBuffer.c() - result.TextBuffer = FieldTextBufferArg - FieldMaxSize := self.FieldMaxSize - - result.MaxSize = FieldMaxSize.toC() - FieldLateSize := self.FieldLateSize - - result.LateSize = FieldLateSize.toC() - FieldLevels := self.FieldLevels - - result.Levels = C.int(FieldLevels) - releaseFn = func() { - FieldTicksDataFin() - FieldTicks.pinner.Unpin() - FieldTextBufferFin() - } - return result, releaseFn -} - -func (self PlotTicker) c() (result C.ImPlotTicker, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn -} - -func newPlotTickerFromC(cvalue *C.ImPlotTicker) *PlotTicker { - result := new(PlotTicker) - result.FieldTicks = newVectorFromC(cvalue.Ticks.Size, cvalue.Ticks.Capacity, newPlotTickFromC(cvalue.Ticks.Data)) - result.FieldTextBuffer = *newTextBufferFromC(func() *C.ImGuiTextBuffer { result := cvalue.TextBuffer; return &result }()) - - result.FieldMaxSize = *(&Vec2{}).fromC(cvalue.MaxSize) - result.FieldLateSize = *(&Vec2{}).fromC(cvalue.LateSize) - result.FieldLevels = int32(cvalue.Levels) - return result -} diff --git a/cimplot_typedefs.cpp b/cimplot_typedefs.cpp new file mode 100644 index 000000000..06a82185e --- /dev/null +++ b/cimplot_typedefs.cpp @@ -0,0 +1,6 @@ +// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. +// DO NOT EDIT. + + +#include "cimplot_typedefs.h" +#include "cimgui/cimplot.h" diff --git a/cimplot_typedefs.go b/cimplot_typedefs.go new file mode 100644 index 000000000..e096a1092 --- /dev/null +++ b/cimplot_typedefs.go @@ -0,0 +1,431 @@ +// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. +// DO NOT EDIT. + +package imgui + +// #include +// #include +// #include "extra_types.h" +// #include "cimplot_wrapper.h" +// #include "cimplot_typedefs.h" +import "C" + +type FormatterTimeData struct { + CData *C.Formatter_Time_Data +} + +func (self *FormatterTimeData) handle() (result *C.Formatter_Time_Data, fin func()) { + return self.CData, func() {} +} + +func (self FormatterTimeData) c() (C.Formatter_Time_Data, func()) { + result, fn := self.handle() + return *result, fn +} + +func newFormatterTimeDataFromC(cvalue *C.Formatter_Time_Data) *FormatterTimeData { + return &FormatterTimeData{CData: cvalue} +} + +type PlotAlignmentData struct { + CData *C.ImPlotAlignmentData +} + +func (self *PlotAlignmentData) handle() (result *C.ImPlotAlignmentData, fin func()) { + return self.CData, func() {} +} + +func (self PlotAlignmentData) c() (C.ImPlotAlignmentData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotAlignmentDataFromC(cvalue *C.ImPlotAlignmentData) *PlotAlignmentData { + return &PlotAlignmentData{CData: cvalue} +} + +type PlotAnnotation struct { + CData *C.ImPlotAnnotation +} + +func (self *PlotAnnotation) handle() (result *C.ImPlotAnnotation, fin func()) { + return self.CData, func() {} +} + +func (self PlotAnnotation) c() (C.ImPlotAnnotation, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotAnnotationFromC(cvalue *C.ImPlotAnnotation) *PlotAnnotation { + return &PlotAnnotation{CData: cvalue} +} + +type PlotAnnotationCollection struct { + CData *C.ImPlotAnnotationCollection +} + +func (self *PlotAnnotationCollection) handle() (result *C.ImPlotAnnotationCollection, fin func()) { + return self.CData, func() {} +} + +func (self PlotAnnotationCollection) c() (C.ImPlotAnnotationCollection, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotAnnotationCollectionFromC(cvalue *C.ImPlotAnnotationCollection) *PlotAnnotationCollection { + return &PlotAnnotationCollection{CData: cvalue} +} + +type PlotAxis struct { + CData *C.ImPlotAxis +} + +func (self *PlotAxis) handle() (result *C.ImPlotAxis, fin func()) { + return self.CData, func() {} +} + +func (self PlotAxis) c() (C.ImPlotAxis, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotAxisFromC(cvalue *C.ImPlotAxis) *PlotAxis { + return &PlotAxis{CData: cvalue} +} + +type PlotAxisColor struct { + CData *C.ImPlotAxisColor +} + +func (self *PlotAxisColor) handle() (result *C.ImPlotAxisColor, fin func()) { + return self.CData, func() {} +} + +func newPlotAxisColorFromC(cvalue *C.ImPlotAxisColor) *PlotAxisColor { + return &PlotAxisColor{CData: cvalue} +} + +type PlotColormapData struct { + CData *C.ImPlotColormapData +} + +func (self *PlotColormapData) handle() (result *C.ImPlotColormapData, fin func()) { + return self.CData, func() {} +} + +func (self PlotColormapData) c() (C.ImPlotColormapData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotColormapDataFromC(cvalue *C.ImPlotColormapData) *PlotColormapData { + return &PlotColormapData{CData: cvalue} +} + +type PlotContext struct { + CData *C.ImPlotContext +} + +func (self *PlotContext) handle() (result *C.ImPlotContext, fin func()) { + return self.CData, func() {} +} + +func (self PlotContext) c() (C.ImPlotContext, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotContextFromC(cvalue *C.ImPlotContext) *PlotContext { + return &PlotContext{CData: cvalue} +} + +type PlotDateTimeSpec struct { + CData *C.ImPlotDateTimeSpec +} + +func (self *PlotDateTimeSpec) handle() (result *C.ImPlotDateTimeSpec, fin func()) { + return self.CData, func() {} +} + +func (self PlotDateTimeSpec) c() (C.ImPlotDateTimeSpec, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotDateTimeSpecFromC(cvalue *C.ImPlotDateTimeSpec) *PlotDateTimeSpec { + return &PlotDateTimeSpec{CData: cvalue} +} + +type PlotInputMap struct { + CData *C.ImPlotInputMap +} + +func (self *PlotInputMap) handle() (result *C.ImPlotInputMap, fin func()) { + return self.CData, func() {} +} + +func (self PlotInputMap) c() (C.ImPlotInputMap, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotInputMapFromC(cvalue *C.ImPlotInputMap) *PlotInputMap { + return &PlotInputMap{CData: cvalue} +} + +type PlotItem struct { + CData *C.ImPlotItem +} + +func (self *PlotItem) handle() (result *C.ImPlotItem, fin func()) { + return self.CData, func() {} +} + +func (self PlotItem) c() (C.ImPlotItem, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotItemFromC(cvalue *C.ImPlotItem) *PlotItem { + return &PlotItem{CData: cvalue} +} + +type PlotItemGroup struct { + CData *C.ImPlotItemGroup +} + +func (self *PlotItemGroup) handle() (result *C.ImPlotItemGroup, fin func()) { + return self.CData, func() {} +} + +func (self PlotItemGroup) c() (C.ImPlotItemGroup, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotItemGroupFromC(cvalue *C.ImPlotItemGroup) *PlotItemGroup { + return &PlotItemGroup{CData: cvalue} +} + +type PlotLegend struct { + CData *C.ImPlotLegend +} + +func (self *PlotLegend) handle() (result *C.ImPlotLegend, fin func()) { + return self.CData, func() {} +} + +func (self PlotLegend) c() (C.ImPlotLegend, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotLegendFromC(cvalue *C.ImPlotLegend) *PlotLegend { + return &PlotLegend{CData: cvalue} +} + +type PlotNextItemData struct { + CData *C.ImPlotNextItemData +} + +func (self *PlotNextItemData) handle() (result *C.ImPlotNextItemData, fin func()) { + return self.CData, func() {} +} + +func (self PlotNextItemData) c() (C.ImPlotNextItemData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotNextItemDataFromC(cvalue *C.ImPlotNextItemData) *PlotNextItemData { + return &PlotNextItemData{CData: cvalue} +} + +type PlotNextPlotData struct { + CData *C.ImPlotNextPlotData +} + +func (self *PlotNextPlotData) handle() (result *C.ImPlotNextPlotData, fin func()) { + return self.CData, func() {} +} + +func (self PlotNextPlotData) c() (C.ImPlotNextPlotData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotNextPlotDataFromC(cvalue *C.ImPlotNextPlotData) *PlotNextPlotData { + return &PlotNextPlotData{CData: cvalue} +} + +type PlotPlot struct { + CData *C.ImPlotPlot +} + +func (self *PlotPlot) handle() (result *C.ImPlotPlot, fin func()) { + return self.CData, func() {} +} + +func (self PlotPlot) c() (C.ImPlotPlot, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotPlotFromC(cvalue *C.ImPlotPlot) *PlotPlot { + return &PlotPlot{CData: cvalue} +} + +type PlotPointError struct { + CData *C.ImPlotPointError +} + +func (self *PlotPointError) handle() (result *C.ImPlotPointError, fin func()) { + return self.CData, func() {} +} + +func (self PlotPointError) c() (C.ImPlotPointError, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotPointErrorFromC(cvalue *C.ImPlotPointError) *PlotPointError { + return &PlotPointError{CData: cvalue} +} + +type PlotRange struct { + CData *C.ImPlotRange +} + +func (self *PlotRange) handle() (result *C.ImPlotRange, fin func()) { + return self.CData, func() {} +} + +func (self PlotRange) c() (C.ImPlotRange, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotRangeFromC(cvalue *C.ImPlotRange) *PlotRange { + return &PlotRange{CData: cvalue} +} + +type PlotRect struct { + CData *C.ImPlotRect +} + +func (self *PlotRect) handle() (result *C.ImPlotRect, fin func()) { + return self.CData, func() {} +} + +func (self PlotRect) c() (C.ImPlotRect, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotRectFromC(cvalue *C.ImPlotRect) *PlotRect { + return &PlotRect{CData: cvalue} +} + +type PlotStyle struct { + CData *C.ImPlotStyle +} + +func (self *PlotStyle) handle() (result *C.ImPlotStyle, fin func()) { + return self.CData, func() {} +} + +func (self PlotStyle) c() (C.ImPlotStyle, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotStyleFromC(cvalue *C.ImPlotStyle) *PlotStyle { + return &PlotStyle{CData: cvalue} +} + +type PlotSubplot struct { + CData *C.ImPlotSubplot +} + +func (self *PlotSubplot) handle() (result *C.ImPlotSubplot, fin func()) { + return self.CData, func() {} +} + +func (self PlotSubplot) c() (C.ImPlotSubplot, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotSubplotFromC(cvalue *C.ImPlotSubplot) *PlotSubplot { + return &PlotSubplot{CData: cvalue} +} + +type PlotTag struct { + CData *C.ImPlotTag +} + +func (self *PlotTag) handle() (result *C.ImPlotTag, fin func()) { + return self.CData, func() {} +} + +func (self PlotTag) c() (C.ImPlotTag, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotTagFromC(cvalue *C.ImPlotTag) *PlotTag { + return &PlotTag{CData: cvalue} +} + +type PlotTagCollection struct { + CData *C.ImPlotTagCollection +} + +func (self *PlotTagCollection) handle() (result *C.ImPlotTagCollection, fin func()) { + return self.CData, func() {} +} + +func (self PlotTagCollection) c() (C.ImPlotTagCollection, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotTagCollectionFromC(cvalue *C.ImPlotTagCollection) *PlotTagCollection { + return &PlotTagCollection{CData: cvalue} +} + +type PlotTick struct { + CData *C.ImPlotTick +} + +func (self *PlotTick) handle() (result *C.ImPlotTick, fin func()) { + return self.CData, func() {} +} + +func (self PlotTick) c() (C.ImPlotTick, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotTickFromC(cvalue *C.ImPlotTick) *PlotTick { + return &PlotTick{CData: cvalue} +} + +type PlotTicker struct { + CData *C.ImPlotTicker +} + +func (self *PlotTicker) handle() (result *C.ImPlotTicker, fin func()) { + return self.CData, func() {} +} + +func (self PlotTicker) c() (C.ImPlotTicker, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotTickerFromC(cvalue *C.ImPlotTicker) *PlotTicker { + return &PlotTicker{CData: cvalue} +} diff --git a/cimplot_typedefs.h b/cimplot_typedefs.h new file mode 100644 index 000000000..138b9ac22 --- /dev/null +++ b/cimplot_typedefs.h @@ -0,0 +1,15 @@ +// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go. +// DO NOT EDIT. + + +#pragma once + +#include "cimgui/cimplot.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/cimplot_wrapper.cpp b/cimplot_wrapper.cpp index 29c42394e..fd652872e 100644 --- a/cimplot_wrapper.cpp +++ b/cimplot_wrapper.cpp @@ -6,11 +6,33 @@ void wrap_ImPlotAnnotationCollection_Append(ImPlotAnnotationCollection* self,const ImVec2 pos,const ImVec2 off,ImU32 bg,ImU32 fg,bool clamp,const char* fmt) { ImPlotAnnotationCollection_Append(self,pos,off,bg,fg,clamp,fmt); } void wrap_ImPlotTagCollection_Append(ImPlotTagCollection* self,ImAxis axis,double value,ImU32 bg,ImU32 fg,const char* fmt) { ImPlotTagCollection_Append(self,axis,value,bg,fg,fmt); } +ImPlotTick* wrap_ImPlotTicker_AddTick_doublePlotFormatter(ImPlotTicker* self,double value,bool major,int level,bool show_label,ImPlotFormatter formatter,uintptr_t data) { return ImPlotTicker_AddTick_doublePlotFormatter(self,value,major,level,show_label,formatter,(void*)(uintptr_t)data); } void wrap_ImPlot_AddTextCenteredV(ImDrawList* DrawList,ImVec2 top_center,ImU32 col,const char* text_begin) { ImPlot_AddTextCentered(DrawList,top_center,col,text_begin,0); } void wrap_ImPlot_AddTextVerticalV(ImDrawList* DrawList,ImVec2 pos,ImU32 col,const char* text_begin) { ImPlot_AddTextVertical(DrawList,pos,col,text_begin,0); } void wrap_ImPlot_Annotation_Str(double x,double y,const ImVec4 col,const ImVec2 pix_offset,bool clamp,const char* fmt) { ImPlot_Annotation_Str(x,y,col,pix_offset,clamp,fmt); } +int wrap_ImPlot_Formatter_Default(double value,char* buff,int size,uintptr_t data) { return ImPlot_Formatter_Default(value,buff,size,(void*)(uintptr_t)data); } +int wrap_ImPlot_Formatter_Logit(double value,char* buff,int size,uintptr_t noname1) { return ImPlot_Formatter_Logit(value,buff,size,(void*)(uintptr_t)noname1); } +int wrap_ImPlot_Formatter_Time(double noname1,char* buff,int size,uintptr_t data) { return ImPlot_Formatter_Time(noname1,buff,size,(void*)(uintptr_t)data); } +void wrap_ImPlot_Locator_Default(ImPlotTicker* ticker,const ImPlotRange range,float pixels,bool vertical,ImPlotFormatter formatter,uintptr_t formatter_data) { ImPlot_Locator_Default(ticker,range,pixels,vertical,formatter,(void*)(uintptr_t)formatter_data); } +void wrap_ImPlot_Locator_Log10(ImPlotTicker* ticker,const ImPlotRange range,float pixels,bool vertical,ImPlotFormatter formatter,uintptr_t formatter_data) { ImPlot_Locator_Log10(ticker,range,pixels,vertical,formatter,(void*)(uintptr_t)formatter_data); } +void wrap_ImPlot_Locator_SymLog(ImPlotTicker* ticker,const ImPlotRange range,float pixels,bool vertical,ImPlotFormatter formatter,uintptr_t formatter_data) { ImPlot_Locator_SymLog(ticker,range,pixels,vertical,formatter,(void*)(uintptr_t)formatter_data); } +void wrap_ImPlot_Locator_Time(ImPlotTicker* ticker,const ImPlotRange range,float pixels,bool vertical,ImPlotFormatter formatter,uintptr_t formatter_data) { ImPlot_Locator_Time(ticker,range,pixels,vertical,formatter,(void*)(uintptr_t)formatter_data); } +void wrap_ImPlot_PlotBarsGV(const char* label_id,ImPlotPoint_getter getter,uintptr_t data,int count,double bar_size,ImPlotBarsFlags flags) { ImPlot_PlotBarsG(label_id,getter,(void*)(uintptr_t)data,count,bar_size,flags); } +void wrap_ImPlot_PlotDigitalGV(const char* label_id,ImPlotPoint_getter getter,uintptr_t data,int count,ImPlotDigitalFlags flags) { ImPlot_PlotDigitalG(label_id,getter,(void*)(uintptr_t)data,count,flags); } +void wrap_ImPlot_PlotLineGV(const char* label_id,ImPlotPoint_getter getter,uintptr_t data,int count,ImPlotLineFlags flags) { ImPlot_PlotLineG(label_id,getter,(void*)(uintptr_t)data,count,flags); } +void wrap_ImPlot_PlotScatterGV(const char* label_id,ImPlotPoint_getter getter,uintptr_t data,int count,ImPlotScatterFlags flags) { ImPlot_PlotScatterG(label_id,getter,(void*)(uintptr_t)data,count,flags); } +void wrap_ImPlot_PlotShadedGV(const char* label_id,ImPlotPoint_getter getter1,uintptr_t data1,ImPlotPoint_getter getter2,uintptr_t data2,int count,ImPlotShadedFlags flags) { ImPlot_PlotShadedG(label_id,getter1,(void*)(uintptr_t)data1,getter2,(void*)(uintptr_t)data2,count,flags); } +void wrap_ImPlot_PlotStairsGV(const char* label_id,ImPlotPoint_getter getter,uintptr_t data,int count,ImPlotStairsFlags flags) { ImPlot_PlotStairsG(label_id,getter,(void*)(uintptr_t)data,count,flags); } +void wrap_ImPlot_SetupAxisFormat_PlotFormatterV(ImAxis axis,ImPlotFormatter formatter,uintptr_t data) { ImPlot_SetupAxisFormat_PlotFormatter(axis,formatter,(void*)(uintptr_t)data); } +void wrap_ImPlot_SetupAxisScale_PlotTransformV(ImAxis axis,ImPlotTransform forward,ImPlotTransform inverse,uintptr_t data) { ImPlot_SetupAxisScale_PlotTransform(axis,forward,inverse,(void*)(uintptr_t)data); } void wrap_ImPlot_TagX_Str(double x,const ImVec4 col,const char* fmt) { ImPlot_TagX_Str(x,col,fmt); } void wrap_ImPlot_TagY_Str(double y,const ImVec4 col,const char* fmt) { ImPlot_TagY_Str(y,col,fmt); } +double wrap_ImPlot_TransformForward_Log10(double v,uintptr_t noname1) { return ImPlot_TransformForward_Log10(v,(void*)(uintptr_t)noname1); } +double wrap_ImPlot_TransformForward_Logit(double v,uintptr_t noname1) { return ImPlot_TransformForward_Logit(v,(void*)(uintptr_t)noname1); } +double wrap_ImPlot_TransformForward_SymLog(double v,uintptr_t noname1) { return ImPlot_TransformForward_SymLog(v,(void*)(uintptr_t)noname1); } +double wrap_ImPlot_TransformInverse_Log10(double v,uintptr_t noname1) { return ImPlot_TransformInverse_Log10(v,(void*)(uintptr_t)noname1); } +double wrap_ImPlot_TransformInverse_Logit(double v,uintptr_t noname1) { return ImPlot_TransformInverse_Logit(v,(void*)(uintptr_t)noname1); } +double wrap_ImPlot_TransformInverse_SymLog(double v,uintptr_t noname1) { return ImPlot_TransformInverse_SymLog(v,(void*)(uintptr_t)noname1); } bool wrap_ImPlotAxis_SetMax(ImPlotAxis* self,double _max) { return ImPlotAxis_SetMax(self,_max,false); } bool wrap_ImPlotAxis_SetMin(ImPlotAxis* self,double _min) { return ImPlotAxis_SetMin(self,_min,false); } ImPlotColormap wrap_ImPlot_AddColormap_U32Ptr(const char* name,const ImU32* cols,int size) { return ImPlot_AddColormap_U32Ptr(name,cols,size,true); } @@ -25,16 +47,16 @@ bool wrap_ImPlot_BeginDragDropSourcePlot() { return ImPlot_BeginDragDropSourcePl bool wrap_ImPlot_BeginItem(const char* label_id) { return ImPlot_BeginItem(label_id,0,-1); } bool wrap_ImPlot_BeginLegendPopup(const char* label_id) { return ImPlot_BeginLegendPopup(label_id,1); } bool wrap_ImPlot_BeginPlot(const char* title_id) { return ImPlot_BeginPlot(title_id,(ImVec2){.x=-1, .y=0},0); } -bool wrap_ImPlot_BeginSubplots(const char* title_id,int rows,int cols,const ImVec2 size) { return ImPlot_BeginSubplots(title_id,rows,cols,size,0,nullptr,nullptr); } -void wrap_ImPlot_BustColorCache() { ImPlot_BustColorCache(nullptr); } +bool wrap_ImPlot_BeginSubplots(const char* title_id,int rows,int cols,const ImVec2 size) { return ImPlot_BeginSubplots(title_id,rows,cols,size,0,0,0); } +void wrap_ImPlot_BustColorCache() { ImPlot_BustColorCache(0); } bool wrap_ImPlot_ColormapButton(const char* label) { return ImPlot_ColormapButton(label,(ImVec2){.x=0, .y=0},-1); } void wrap_ImPlot_ColormapScale(const char* label,double scale_min,double scale_max) { ImPlot_ColormapScale(label,scale_min,scale_max,(ImVec2){.x=0, .y=0},"%g",0,-1); } -bool wrap_ImPlot_ColormapSlider(const char* label,float* t) { return ImPlot_ColormapSlider(label,t,nullptr,"",-1); } -void wrap_ImPlot_DestroyContext() { ImPlot_DestroyContext(nullptr); } -bool wrap_ImPlot_DragLineX(int id,double* x,const ImVec4 col) { return ImPlot_DragLineX(id,x,col,1,0,nullptr,nullptr,nullptr); } -bool wrap_ImPlot_DragLineY(int id,double* y,const ImVec4 col) { return ImPlot_DragLineY(id,y,col,1,0,nullptr,nullptr,nullptr); } -bool wrap_ImPlot_DragPoint(int id,double* x,double* y,const ImVec4 col) { return ImPlot_DragPoint(id,x,y,col,4,0,nullptr,nullptr,nullptr); } -bool wrap_ImPlot_DragRect(int id,double* x1,double* y1,double* x2,double* y2,const ImVec4 col) { return ImPlot_DragRect(id,x1,y1,x2,y2,col,0,nullptr,nullptr,nullptr); } +bool wrap_ImPlot_ColormapSlider(const char* label,float* t) { return ImPlot_ColormapSlider(label,t,0,"",-1); } +void wrap_ImPlot_DestroyContext() { ImPlot_DestroyContext(0); } +bool wrap_ImPlot_DragLineX(int id,double* x,const ImVec4 col) { return ImPlot_DragLineX(id,x,col,1,0,0,0,0); } +bool wrap_ImPlot_DragLineY(int id,double* y,const ImVec4 col) { return ImPlot_DragLineY(id,y,col,1,0,0,0,0); } +bool wrap_ImPlot_DragPoint(int id,double* x,double* y,const ImVec4 col) { return ImPlot_DragPoint(id,x,y,col,4,0,0,0,0); } +bool wrap_ImPlot_DragRect(int id,double* x1,double* y1,double* x2,double* y2,const ImVec4 col) { return ImPlot_DragRect(id,x1,y1,x2,y2,col,0,0,0,0); } void wrap_ImPlot_GetColormapColor(ImVec4* pOut,int idx) { ImPlot_GetColormapColor(pOut,idx,-1); } int wrap_ImPlot_GetColormapSize() { return ImPlot_GetColormapSize(-1); } void wrap_ImPlot_GetLocationPos(ImVec2* pOut,const ImRect outer_rect,const ImVec2 inner_size,ImPlotLocation location) { ImPlot_GetLocationPos(pOut,outer_rect,inner_size,location,(ImVec2){.x=0, .y=0}); } @@ -45,8 +67,8 @@ void wrap_ImPlot_HideNextItem() { ImPlot_HideNextItem(true,ImPlotCond_Once); } bool wrap_ImPlot_ImAlmostEqual(double v1,double v2) { return ImPlot_ImAlmostEqual(v1,v2,2); } void wrap_ImPlot_LabelAxisValue(const ImPlotAxis axis,double value,char* buff,int size) { ImPlot_LabelAxisValue(axis,value,buff,size,false); } void wrap_ImPlot_MakeTime(ImPlotTime* pOut,int year) { ImPlot_MakeTime(pOut,year,0,1,0,0,0,0); } -void wrap_ImPlot_MapInputDefault() { ImPlot_MapInputDefault(nullptr); } -void wrap_ImPlot_MapInputReverse() { ImPlot_MapInputReverse(nullptr); } +void wrap_ImPlot_MapInputDefault() { ImPlot_MapInputDefault(0); } +void wrap_ImPlot_MapInputReverse() { ImPlot_MapInputReverse(0); } void wrap_ImPlot_PixelsToPlot_Float(ImPlotPoint* pOut,float x,float y) { ImPlot_PixelsToPlot_Float(pOut,x,y,-1,-1); } void wrap_ImPlot_PixelsToPlot_Vec2(ImPlotPoint* pOut,const ImVec2 pix) { ImPlot_PixelsToPlot_Vec2(pOut,pix,-1,-1); } void wrap_ImPlot_PlotBarGroups_FloatPtr(const char* const label_ids[],const float* values,int item_count,int group_count) { ImPlot_PlotBarGroups_FloatPtr(label_ids,values,item_count,group_count,0.67,0,0); } @@ -59,7 +81,7 @@ void wrap_ImPlot_PlotBarGroups_U32Ptr(const char* const label_ids[],const ImU32* void wrap_ImPlot_PlotBarGroups_U64Ptr(const char* const label_ids[],const ImU64* values,int item_count,int group_count) { ImPlot_PlotBarGroups_U64Ptr(label_ids,values,item_count,group_count,0.67,0,0); } void wrap_ImPlot_PlotBarGroups_U8Ptr(const char* const label_ids[],const ImU8* values,int item_count,int group_count) { ImPlot_PlotBarGroups_U8Ptr(label_ids,values,item_count,group_count,0.67,0,0); } void wrap_ImPlot_PlotBarGroups_doublePtr(const char* const label_ids[],const double* values,int item_count,int group_count) { ImPlot_PlotBarGroups_doublePtr(label_ids,values,item_count,group_count,0.67,0,0); } -void wrap_ImPlot_PlotBarsG(const char* label_id,ImPlotPoint_getter getter,void* data,int count,double bar_size) { ImPlot_PlotBarsG(label_id,getter,data,count,bar_size,0); } +void wrap_ImPlot_PlotBarsG(const char* label_id,ImPlotPoint_getter getter,uintptr_t data,int count,double bar_size) { wrap_ImPlot_PlotBarsGV(label_id,getter,data,count,bar_size,0); } void wrap_ImPlot_PlotBars_FloatPtrFloatPtr(const char* label_id,const float* xs,const float* ys,int count,double bar_size) { ImPlot_PlotBars_FloatPtrFloatPtr(label_id,xs,ys,count,bar_size,0,0,sizeof(float)); } void wrap_ImPlot_PlotBars_FloatPtrInt(const char* label_id,const float* values,int count) { ImPlot_PlotBars_FloatPtrInt(label_id,values,count,0.67,0,0,0,sizeof(float)); } void wrap_ImPlot_PlotBars_S16PtrInt(const char* label_id,const ImS16* values,int count) { ImPlot_PlotBars_S16PtrInt(label_id,values,count,0.67,0,0,0,sizeof(ImS16)); } @@ -80,7 +102,7 @@ void wrap_ImPlot_PlotBars_U8PtrInt(const char* label_id,const ImU8* values,int c void wrap_ImPlot_PlotBars_U8PtrU8Ptr(const char* label_id,const ImU8* xs,const ImU8* ys,int count,double bar_size) { ImPlot_PlotBars_U8PtrU8Ptr(label_id,xs,ys,count,bar_size,0,0,sizeof(ImU8)); } void wrap_ImPlot_PlotBars_doublePtrInt(const char* label_id,const double* values,int count) { ImPlot_PlotBars_doublePtrInt(label_id,values,count,0.67,0,0,0,sizeof(double)); } void wrap_ImPlot_PlotBars_doublePtrdoublePtr(const char* label_id,const double* xs,const double* ys,int count,double bar_size) { ImPlot_PlotBars_doublePtrdoublePtr(label_id,xs,ys,count,bar_size,0,0,sizeof(double)); } -void wrap_ImPlot_PlotDigitalG(const char* label_id,ImPlotPoint_getter getter,void* data,int count) { ImPlot_PlotDigitalG(label_id,getter,data,count,0); } +void wrap_ImPlot_PlotDigitalG(const char* label_id,ImPlotPoint_getter getter,uintptr_t data,int count) { wrap_ImPlot_PlotDigitalGV(label_id,getter,data,count,0); } void wrap_ImPlot_PlotDigital_FloatPtr(const char* label_id,const float* xs,const float* ys,int count) { ImPlot_PlotDigital_FloatPtr(label_id,xs,ys,count,0,0,sizeof(float)); } void wrap_ImPlot_PlotDigital_S16Ptr(const char* label_id,const ImS16* xs,const ImS16* ys,int count) { ImPlot_PlotDigital_S16Ptr(label_id,xs,ys,count,0,0,sizeof(ImS16)); } void wrap_ImPlot_PlotDigital_S32Ptr(const char* label_id,const ImS32* xs,const ImS32* ys,int count) { ImPlot_PlotDigital_S32Ptr(label_id,xs,ys,count,0,0,sizeof(ImS32)); } @@ -153,7 +175,7 @@ void wrap_ImPlot_PlotInfLines_U32Ptr(const char* label_id,const ImU32* values,in void wrap_ImPlot_PlotInfLines_U64Ptr(const char* label_id,const ImU64* values,int count) { ImPlot_PlotInfLines_U64Ptr(label_id,values,count,0,0,sizeof(ImU64)); } void wrap_ImPlot_PlotInfLines_U8Ptr(const char* label_id,const ImU8* values,int count) { ImPlot_PlotInfLines_U8Ptr(label_id,values,count,0,0,sizeof(ImU8)); } void wrap_ImPlot_PlotInfLines_doublePtr(const char* label_id,const double* values,int count) { ImPlot_PlotInfLines_doublePtr(label_id,values,count,0,0,sizeof(double)); } -void wrap_ImPlot_PlotLineG(const char* label_id,ImPlotPoint_getter getter,void* data,int count) { ImPlot_PlotLineG(label_id,getter,data,count,0); } +void wrap_ImPlot_PlotLineG(const char* label_id,ImPlotPoint_getter getter,uintptr_t data,int count) { wrap_ImPlot_PlotLineGV(label_id,getter,data,count,0); } void wrap_ImPlot_PlotLine_FloatPtrFloatPtr(const char* label_id,const float* xs,const float* ys,int count) { ImPlot_PlotLine_FloatPtrFloatPtr(label_id,xs,ys,count,0,0,sizeof(float)); } void wrap_ImPlot_PlotLine_FloatPtrInt(const char* label_id,const float* values,int count) { ImPlot_PlotLine_FloatPtrInt(label_id,values,count,1,0,0,0,sizeof(float)); } void wrap_ImPlot_PlotLine_S16PtrInt(const char* label_id,const ImS16* values,int count) { ImPlot_PlotLine_S16PtrInt(label_id,values,count,1,0,0,0,sizeof(ImS16)); } @@ -184,7 +206,7 @@ void wrap_ImPlot_PlotPieChart_U32Ptr(const char* const label_ids[],const ImU32* void wrap_ImPlot_PlotPieChart_U64Ptr(const char* const label_ids[],const ImU64* values,int count,double x,double y,double radius) { ImPlot_PlotPieChart_U64Ptr(label_ids,values,count,x,y,radius,"%.1f",90,0); } void wrap_ImPlot_PlotPieChart_U8Ptr(const char* const label_ids[],const ImU8* values,int count,double x,double y,double radius) { ImPlot_PlotPieChart_U8Ptr(label_ids,values,count,x,y,radius,"%.1f",90,0); } void wrap_ImPlot_PlotPieChart_doublePtr(const char* const label_ids[],const double* values,int count,double x,double y,double radius) { ImPlot_PlotPieChart_doublePtr(label_ids,values,count,x,y,radius,"%.1f",90,0); } -void wrap_ImPlot_PlotScatterG(const char* label_id,ImPlotPoint_getter getter,void* data,int count) { ImPlot_PlotScatterG(label_id,getter,data,count,0); } +void wrap_ImPlot_PlotScatterG(const char* label_id,ImPlotPoint_getter getter,uintptr_t data,int count) { wrap_ImPlot_PlotScatterGV(label_id,getter,data,count,0); } void wrap_ImPlot_PlotScatter_FloatPtrFloatPtr(const char* label_id,const float* xs,const float* ys,int count) { ImPlot_PlotScatter_FloatPtrFloatPtr(label_id,xs,ys,count,0,0,sizeof(float)); } void wrap_ImPlot_PlotScatter_FloatPtrInt(const char* label_id,const float* values,int count) { ImPlot_PlotScatter_FloatPtrInt(label_id,values,count,1,0,0,0,sizeof(float)); } void wrap_ImPlot_PlotScatter_S16PtrInt(const char* label_id,const ImS16* values,int count) { ImPlot_PlotScatter_S16PtrInt(label_id,values,count,1,0,0,0,sizeof(ImS16)); } @@ -205,7 +227,7 @@ void wrap_ImPlot_PlotScatter_U8PtrInt(const char* label_id,const ImU8* values,in void wrap_ImPlot_PlotScatter_U8PtrU8Ptr(const char* label_id,const ImU8* xs,const ImU8* ys,int count) { ImPlot_PlotScatter_U8PtrU8Ptr(label_id,xs,ys,count,0,0,sizeof(ImU8)); } void wrap_ImPlot_PlotScatter_doublePtrInt(const char* label_id,const double* values,int count) { ImPlot_PlotScatter_doublePtrInt(label_id,values,count,1,0,0,0,sizeof(double)); } void wrap_ImPlot_PlotScatter_doublePtrdoublePtr(const char* label_id,const double* xs,const double* ys,int count) { ImPlot_PlotScatter_doublePtrdoublePtr(label_id,xs,ys,count,0,0,sizeof(double)); } -void wrap_ImPlot_PlotShadedG(const char* label_id,ImPlotPoint_getter getter1,void* data1,ImPlotPoint_getter getter2,void* data2,int count) { ImPlot_PlotShadedG(label_id,getter1,data1,getter2,data2,count,0); } +void wrap_ImPlot_PlotShadedG(const char* label_id,ImPlotPoint_getter getter1,uintptr_t data1,ImPlotPoint_getter getter2,uintptr_t data2,int count) { wrap_ImPlot_PlotShadedGV(label_id,getter1,data1,getter2,data2,count,0); } void wrap_ImPlot_PlotShaded_FloatPtrFloatPtrFloatPtr(const char* label_id,const float* xs,const float* ys1,const float* ys2,int count) { ImPlot_PlotShaded_FloatPtrFloatPtrFloatPtr(label_id,xs,ys1,ys2,count,0,0,sizeof(float)); } void wrap_ImPlot_PlotShaded_FloatPtrFloatPtrInt(const char* label_id,const float* xs,const float* ys,int count) { ImPlot_PlotShaded_FloatPtrFloatPtrInt(label_id,xs,ys,count,0,0,0,sizeof(float)); } void wrap_ImPlot_PlotShaded_FloatPtrInt(const char* label_id,const float* values,int count) { ImPlot_PlotShaded_FloatPtrInt(label_id,values,count,0,1,0,0,0,sizeof(float)); } @@ -236,7 +258,7 @@ void wrap_ImPlot_PlotShaded_U8PtrU8PtrU8Ptr(const char* label_id,const ImU8* xs, void wrap_ImPlot_PlotShaded_doublePtrInt(const char* label_id,const double* values,int count) { ImPlot_PlotShaded_doublePtrInt(label_id,values,count,0,1,0,0,0,sizeof(double)); } void wrap_ImPlot_PlotShaded_doublePtrdoublePtrInt(const char* label_id,const double* xs,const double* ys,int count) { ImPlot_PlotShaded_doublePtrdoublePtrInt(label_id,xs,ys,count,0,0,0,sizeof(double)); } void wrap_ImPlot_PlotShaded_doublePtrdoublePtrdoublePtr(const char* label_id,const double* xs,const double* ys1,const double* ys2,int count) { ImPlot_PlotShaded_doublePtrdoublePtrdoublePtr(label_id,xs,ys1,ys2,count,0,0,sizeof(double)); } -void wrap_ImPlot_PlotStairsG(const char* label_id,ImPlotPoint_getter getter,void* data,int count) { ImPlot_PlotStairsG(label_id,getter,data,count,0); } +void wrap_ImPlot_PlotStairsG(const char* label_id,ImPlotPoint_getter getter,uintptr_t data,int count) { wrap_ImPlot_PlotStairsGV(label_id,getter,data,count,0); } void wrap_ImPlot_PlotStairs_FloatPtrFloatPtr(const char* label_id,const float* xs,const float* ys,int count) { ImPlot_PlotStairs_FloatPtrFloatPtr(label_id,xs,ys,count,0,0,sizeof(float)); } void wrap_ImPlot_PlotStairs_FloatPtrInt(const char* label_id,const float* values,int count) { ImPlot_PlotStairs_FloatPtrInt(label_id,values,count,1,0,0,0,sizeof(float)); } void wrap_ImPlot_PlotStairs_S16PtrInt(const char* label_id,const ImS16* values,int count) { ImPlot_PlotStairs_S16PtrInt(label_id,values,count,1,0,0,0,sizeof(ImS16)); } @@ -284,7 +306,7 @@ void wrap_ImPlot_PopColormap() { ImPlot_PopColormap(1); } void wrap_ImPlot_PopStyleColor() { ImPlot_PopStyleColor(1); } void wrap_ImPlot_PopStyleVar() { ImPlot_PopStyleVar(1); } void wrap_ImPlot_PushPlotClipRect() { ImPlot_PushPlotClipRect(0); } -ImPlotItem* wrap_ImPlot_RegisterOrGetItem(const char* label_id,ImPlotItemFlags flags) { return ImPlot_RegisterOrGetItem(label_id,flags,nullptr); } +ImPlotItem* wrap_ImPlot_RegisterOrGetItem(const char* label_id,ImPlotItemFlags flags) { return ImPlot_RegisterOrGetItem(label_id,flags,0); } void wrap_ImPlot_SampleColormap(ImVec4* pOut,float t) { ImPlot_SampleColormap(pOut,t,-1); } void wrap_ImPlot_SetNextAxesLimits(double x_min,double x_max,double y_min,double y_max) { ImPlot_SetNextAxesLimits(x_min,x_max,y_min,y_max,ImPlotCond_Once); } void wrap_ImPlot_SetNextAxisLimits(ImAxis axis,double v_min,double v_max) { ImPlot_SetNextAxisLimits(axis,v_min,v_max,ImPlotCond_Once); } @@ -294,23 +316,23 @@ void wrap_ImPlot_SetNextLineStyle() { ImPlot_SetNextLineStyle((ImVec4){.x=0, .y= void wrap_ImPlot_SetNextMarkerStyle() { ImPlot_SetNextMarkerStyle(-1,-1,(ImVec4){.x=0, .y=0, .z=0, .w=-1},-1,(ImVec4){.x=0, .y=0, .z=0, .w=-1}); } void wrap_ImPlot_SetupAxes(const char* x_label,const char* y_label) { ImPlot_SetupAxes(x_label,y_label,0,0); } void wrap_ImPlot_SetupAxesLimits(double x_min,double x_max,double y_min,double y_max) { ImPlot_SetupAxesLimits(x_min,x_max,y_min,y_max,ImPlotCond_Once); } -void wrap_ImPlot_SetupAxis(ImAxis axis) { ImPlot_SetupAxis(axis,nullptr,0); } -void wrap_ImPlot_SetupAxisFormat_PlotFormatter(ImAxis axis,ImPlotFormatter formatter) { ImPlot_SetupAxisFormat_PlotFormatter(axis,formatter,nullptr); } +void wrap_ImPlot_SetupAxis(ImAxis axis) { ImPlot_SetupAxis(axis,0,0); } +void wrap_ImPlot_SetupAxisFormat_PlotFormatter(ImAxis axis,ImPlotFormatter formatter) { wrap_ImPlot_SetupAxisFormat_PlotFormatterV(axis,formatter,0); } void wrap_ImPlot_SetupAxisLimits(ImAxis axis,double v_min,double v_max) { ImPlot_SetupAxisLimits(axis,v_min,v_max,ImPlotCond_Once); } -void wrap_ImPlot_SetupAxisScale_PlotTransform(ImAxis axis,ImPlotTransform forward,ImPlotTransform inverse) { ImPlot_SetupAxisScale_PlotTransform(axis,forward,inverse,nullptr); } -void wrap_ImPlot_SetupAxisTicks_double(ImAxis axis,double v_min,double v_max,int n_ticks) { ImPlot_SetupAxisTicks_double(axis,v_min,v_max,n_ticks,nullptr,false); } -void wrap_ImPlot_SetupAxisTicks_doublePtr(ImAxis axis,const double* values,int n_ticks) { ImPlot_SetupAxisTicks_doublePtr(axis,values,n_ticks,nullptr,false); } +void wrap_ImPlot_SetupAxisScale_PlotTransform(ImAxis axis,ImPlotTransform forward,ImPlotTransform inverse) { wrap_ImPlot_SetupAxisScale_PlotTransformV(axis,forward,inverse,0); } +void wrap_ImPlot_SetupAxisTicks_double(ImAxis axis,double v_min,double v_max,int n_ticks) { ImPlot_SetupAxisTicks_double(axis,v_min,v_max,n_ticks,0,false); } +void wrap_ImPlot_SetupAxisTicks_doublePtr(ImAxis axis,const double* values,int n_ticks) { ImPlot_SetupAxisTicks_doublePtr(axis,values,n_ticks,0,false); } void wrap_ImPlot_SetupLegend(ImPlotLocation location) { ImPlot_SetupLegend(location,0); } void wrap_ImPlot_SetupMouseText(ImPlotLocation location) { ImPlot_SetupMouseText(location,0); } void wrap_ImPlot_ShowAltLegend(const char* title_id) { ImPlot_ShowAltLegend(title_id,true,(ImVec2){.x=0, .y=0},true); } void wrap_ImPlot_ShowAxisContextMenu(ImPlotAxis* axis,ImPlotAxis* equal_axis) { ImPlot_ShowAxisContextMenu(axis,equal_axis,false); } -bool wrap_ImPlot_ShowDatePicker(const char* id,int* level,ImPlotTime* t) { return ImPlot_ShowDatePicker(id,level,t,nullptr,nullptr); } -void wrap_ImPlot_ShowDemoWindow() { ImPlot_ShowDemoWindow(nullptr); } -void wrap_ImPlot_ShowMetricsWindow() { ImPlot_ShowMetricsWindow(nullptr); } -void wrap_ImPlot_ShowStyleEditor() { ImPlot_ShowStyleEditor(nullptr); } -void wrap_ImPlot_StyleColorsAuto() { ImPlot_StyleColorsAuto(nullptr); } -void wrap_ImPlot_StyleColorsClassic() { ImPlot_StyleColorsClassic(nullptr); } -void wrap_ImPlot_StyleColorsDark() { ImPlot_StyleColorsDark(nullptr); } -void wrap_ImPlot_StyleColorsLight() { ImPlot_StyleColorsLight(nullptr); } +bool wrap_ImPlot_ShowDatePicker(const char* id,int* level,ImPlotTime* t) { return ImPlot_ShowDatePicker(id,level,t,0,0); } +void wrap_ImPlot_ShowDemoWindow() { ImPlot_ShowDemoWindow(0); } +void wrap_ImPlot_ShowMetricsWindow() { ImPlot_ShowMetricsWindow(0); } +void wrap_ImPlot_ShowStyleEditor() { ImPlot_ShowStyleEditor(0); } +void wrap_ImPlot_StyleColorsAuto() { ImPlot_StyleColorsAuto(0); } +void wrap_ImPlot_StyleColorsClassic() { ImPlot_StyleColorsClassic(0); } +void wrap_ImPlot_StyleColorsDark() { ImPlot_StyleColorsDark(0); } +void wrap_ImPlot_StyleColorsLight() { ImPlot_StyleColorsLight(0); } void wrap_ImPlot_TagX_Bool(double x,const ImVec4 col) { ImPlot_TagX_Bool(x,col,false); } void wrap_ImPlot_TagY_Bool(double y,const ImVec4 col) { ImPlot_TagY_Bool(y,col,false); } diff --git a/cimplot_wrapper.h b/cimplot_wrapper.h index a1b18e807..b4403183a 100644 --- a/cimplot_wrapper.h +++ b/cimplot_wrapper.h @@ -11,11 +11,33 @@ extern "C" { extern void wrap_ImPlotAnnotationCollection_Append(ImPlotAnnotationCollection* self,const ImVec2 pos,const ImVec2 off,ImU32 bg,ImU32 fg,bool clamp,const char* fmt); extern void wrap_ImPlotTagCollection_Append(ImPlotTagCollection* self,ImAxis axis,double value,ImU32 bg,ImU32 fg,const char* fmt); +extern ImPlotTick* wrap_ImPlotTicker_AddTick_doublePlotFormatter(ImPlotTicker* self,double value,bool major,int level,bool show_label,ImPlotFormatter formatter,uintptr_t data); extern void wrap_ImPlot_AddTextCenteredV(ImDrawList* DrawList,ImVec2 top_center,ImU32 col,const char* text_begin); extern void wrap_ImPlot_AddTextVerticalV(ImDrawList* DrawList,ImVec2 pos,ImU32 col,const char* text_begin); extern void wrap_ImPlot_Annotation_Str(double x,double y,const ImVec4 col,const ImVec2 pix_offset,bool clamp,const char* fmt); +extern int wrap_ImPlot_Formatter_Default(double value,char* buff,int size,uintptr_t data); +extern int wrap_ImPlot_Formatter_Logit(double value,char* buff,int size,uintptr_t noname1); +extern int wrap_ImPlot_Formatter_Time(double noname1,char* buff,int size,uintptr_t data); +extern void wrap_ImPlot_Locator_Default(ImPlotTicker* ticker,const ImPlotRange range,float pixels,bool vertical,ImPlotFormatter formatter,uintptr_t formatter_data); +extern void wrap_ImPlot_Locator_Log10(ImPlotTicker* ticker,const ImPlotRange range,float pixels,bool vertical,ImPlotFormatter formatter,uintptr_t formatter_data); +extern void wrap_ImPlot_Locator_SymLog(ImPlotTicker* ticker,const ImPlotRange range,float pixels,bool vertical,ImPlotFormatter formatter,uintptr_t formatter_data); +extern void wrap_ImPlot_Locator_Time(ImPlotTicker* ticker,const ImPlotRange range,float pixels,bool vertical,ImPlotFormatter formatter,uintptr_t formatter_data); +extern void wrap_ImPlot_PlotBarsGV(const char* label_id,ImPlotPoint_getter getter,uintptr_t data,int count,double bar_size,ImPlotBarsFlags flags); +extern void wrap_ImPlot_PlotDigitalGV(const char* label_id,ImPlotPoint_getter getter,uintptr_t data,int count,ImPlotDigitalFlags flags); +extern void wrap_ImPlot_PlotLineGV(const char* label_id,ImPlotPoint_getter getter,uintptr_t data,int count,ImPlotLineFlags flags); +extern void wrap_ImPlot_PlotScatterGV(const char* label_id,ImPlotPoint_getter getter,uintptr_t data,int count,ImPlotScatterFlags flags); +extern void wrap_ImPlot_PlotShadedGV(const char* label_id,ImPlotPoint_getter getter1,uintptr_t data1,ImPlotPoint_getter getter2,uintptr_t data2,int count,ImPlotShadedFlags flags); +extern void wrap_ImPlot_PlotStairsGV(const char* label_id,ImPlotPoint_getter getter,uintptr_t data,int count,ImPlotStairsFlags flags); +extern void wrap_ImPlot_SetupAxisFormat_PlotFormatterV(ImAxis axis,ImPlotFormatter formatter,uintptr_t data); +extern void wrap_ImPlot_SetupAxisScale_PlotTransformV(ImAxis axis,ImPlotTransform forward,ImPlotTransform inverse,uintptr_t data); extern void wrap_ImPlot_TagX_Str(double x,const ImVec4 col,const char* fmt); extern void wrap_ImPlot_TagY_Str(double y,const ImVec4 col,const char* fmt); +extern double wrap_ImPlot_TransformForward_Log10(double v,uintptr_t noname1); +extern double wrap_ImPlot_TransformForward_Logit(double v,uintptr_t noname1); +extern double wrap_ImPlot_TransformForward_SymLog(double v,uintptr_t noname1); +extern double wrap_ImPlot_TransformInverse_Log10(double v,uintptr_t noname1); +extern double wrap_ImPlot_TransformInverse_Logit(double v,uintptr_t noname1); +extern double wrap_ImPlot_TransformInverse_SymLog(double v,uintptr_t noname1); extern bool wrap_ImPlotAxis_SetMax(ImPlotAxis* self,double _max); extern bool wrap_ImPlotAxis_SetMin(ImPlotAxis* self,double _min); extern ImPlotColormap wrap_ImPlot_AddColormap_U32Ptr(const char* name,const ImU32* cols,int size); @@ -64,7 +86,7 @@ extern void wrap_ImPlot_PlotBarGroups_U32Ptr(const char* const label_ids[],const extern void wrap_ImPlot_PlotBarGroups_U64Ptr(const char* const label_ids[],const ImU64* values,int item_count,int group_count); extern void wrap_ImPlot_PlotBarGroups_U8Ptr(const char* const label_ids[],const ImU8* values,int item_count,int group_count); extern void wrap_ImPlot_PlotBarGroups_doublePtr(const char* const label_ids[],const double* values,int item_count,int group_count); -extern void wrap_ImPlot_PlotBarsG(const char* label_id,ImPlotPoint_getter getter,void* data,int count,double bar_size); +extern void wrap_ImPlot_PlotBarsG(const char* label_id,ImPlotPoint_getter getter,uintptr_t data,int count,double bar_size); extern void wrap_ImPlot_PlotBars_FloatPtrFloatPtr(const char* label_id,const float* xs,const float* ys,int count,double bar_size); extern void wrap_ImPlot_PlotBars_FloatPtrInt(const char* label_id,const float* values,int count); extern void wrap_ImPlot_PlotBars_S16PtrInt(const char* label_id,const ImS16* values,int count); @@ -85,7 +107,7 @@ extern void wrap_ImPlot_PlotBars_U8PtrInt(const char* label_id,const ImU8* value extern void wrap_ImPlot_PlotBars_U8PtrU8Ptr(const char* label_id,const ImU8* xs,const ImU8* ys,int count,double bar_size); extern void wrap_ImPlot_PlotBars_doublePtrInt(const char* label_id,const double* values,int count); extern void wrap_ImPlot_PlotBars_doublePtrdoublePtr(const char* label_id,const double* xs,const double* ys,int count,double bar_size); -extern void wrap_ImPlot_PlotDigitalG(const char* label_id,ImPlotPoint_getter getter,void* data,int count); +extern void wrap_ImPlot_PlotDigitalG(const char* label_id,ImPlotPoint_getter getter,uintptr_t data,int count); extern void wrap_ImPlot_PlotDigital_FloatPtr(const char* label_id,const float* xs,const float* ys,int count); extern void wrap_ImPlot_PlotDigital_S16Ptr(const char* label_id,const ImS16* xs,const ImS16* ys,int count); extern void wrap_ImPlot_PlotDigital_S32Ptr(const char* label_id,const ImS32* xs,const ImS32* ys,int count); @@ -158,7 +180,7 @@ extern void wrap_ImPlot_PlotInfLines_U32Ptr(const char* label_id,const ImU32* va extern void wrap_ImPlot_PlotInfLines_U64Ptr(const char* label_id,const ImU64* values,int count); extern void wrap_ImPlot_PlotInfLines_U8Ptr(const char* label_id,const ImU8* values,int count); extern void wrap_ImPlot_PlotInfLines_doublePtr(const char* label_id,const double* values,int count); -extern void wrap_ImPlot_PlotLineG(const char* label_id,ImPlotPoint_getter getter,void* data,int count); +extern void wrap_ImPlot_PlotLineG(const char* label_id,ImPlotPoint_getter getter,uintptr_t data,int count); extern void wrap_ImPlot_PlotLine_FloatPtrFloatPtr(const char* label_id,const float* xs,const float* ys,int count); extern void wrap_ImPlot_PlotLine_FloatPtrInt(const char* label_id,const float* values,int count); extern void wrap_ImPlot_PlotLine_S16PtrInt(const char* label_id,const ImS16* values,int count); @@ -189,7 +211,7 @@ extern void wrap_ImPlot_PlotPieChart_U32Ptr(const char* const label_ids[],const extern void wrap_ImPlot_PlotPieChart_U64Ptr(const char* const label_ids[],const ImU64* values,int count,double x,double y,double radius); extern void wrap_ImPlot_PlotPieChart_U8Ptr(const char* const label_ids[],const ImU8* values,int count,double x,double y,double radius); extern void wrap_ImPlot_PlotPieChart_doublePtr(const char* const label_ids[],const double* values,int count,double x,double y,double radius); -extern void wrap_ImPlot_PlotScatterG(const char* label_id,ImPlotPoint_getter getter,void* data,int count); +extern void wrap_ImPlot_PlotScatterG(const char* label_id,ImPlotPoint_getter getter,uintptr_t data,int count); extern void wrap_ImPlot_PlotScatter_FloatPtrFloatPtr(const char* label_id,const float* xs,const float* ys,int count); extern void wrap_ImPlot_PlotScatter_FloatPtrInt(const char* label_id,const float* values,int count); extern void wrap_ImPlot_PlotScatter_S16PtrInt(const char* label_id,const ImS16* values,int count); @@ -210,7 +232,7 @@ extern void wrap_ImPlot_PlotScatter_U8PtrInt(const char* label_id,const ImU8* va extern void wrap_ImPlot_PlotScatter_U8PtrU8Ptr(const char* label_id,const ImU8* xs,const ImU8* ys,int count); extern void wrap_ImPlot_PlotScatter_doublePtrInt(const char* label_id,const double* values,int count); extern void wrap_ImPlot_PlotScatter_doublePtrdoublePtr(const char* label_id,const double* xs,const double* ys,int count); -extern void wrap_ImPlot_PlotShadedG(const char* label_id,ImPlotPoint_getter getter1,void* data1,ImPlotPoint_getter getter2,void* data2,int count); +extern void wrap_ImPlot_PlotShadedG(const char* label_id,ImPlotPoint_getter getter1,uintptr_t data1,ImPlotPoint_getter getter2,uintptr_t data2,int count); extern void wrap_ImPlot_PlotShaded_FloatPtrFloatPtrFloatPtr(const char* label_id,const float* xs,const float* ys1,const float* ys2,int count); extern void wrap_ImPlot_PlotShaded_FloatPtrFloatPtrInt(const char* label_id,const float* xs,const float* ys,int count); extern void wrap_ImPlot_PlotShaded_FloatPtrInt(const char* label_id,const float* values,int count); @@ -241,7 +263,7 @@ extern void wrap_ImPlot_PlotShaded_U8PtrU8PtrU8Ptr(const char* label_id,const Im extern void wrap_ImPlot_PlotShaded_doublePtrInt(const char* label_id,const double* values,int count); extern void wrap_ImPlot_PlotShaded_doublePtrdoublePtrInt(const char* label_id,const double* xs,const double* ys,int count); extern void wrap_ImPlot_PlotShaded_doublePtrdoublePtrdoublePtr(const char* label_id,const double* xs,const double* ys1,const double* ys2,int count); -extern void wrap_ImPlot_PlotStairsG(const char* label_id,ImPlotPoint_getter getter,void* data,int count); +extern void wrap_ImPlot_PlotStairsG(const char* label_id,ImPlotPoint_getter getter,uintptr_t data,int count); extern void wrap_ImPlot_PlotStairs_FloatPtrFloatPtr(const char* label_id,const float* xs,const float* ys,int count); extern void wrap_ImPlot_PlotStairs_FloatPtrInt(const char* label_id,const float* values,int count); extern void wrap_ImPlot_PlotStairs_S16PtrInt(const char* label_id,const ImS16* values,int count); diff --git a/cmd/codegen/arguments_wrapper.go b/cmd/codegen/arguments_wrapper.go index 454af3e8b..af1f92f93 100644 --- a/cmd/codegen/arguments_wrapper.go +++ b/cmd/codegen/arguments_wrapper.go @@ -22,106 +22,108 @@ type ArgumentWrapperData struct { VarName string NoFin bool + + // CType is a valid type that will have VarName. + CType GoIdentifier } type argumentWrapper func(arg ArgDef) ArgumentWrapperData -func getArgWrapper(a *ArgDef, makeFirstArgReceiver, isGetter bool, structNames map[CIdentifier]bool, enumNames map[GoIdentifier]bool) (argDeclaration string, data ArgumentWrapperData, err error) { +func getArgWrapper( + a *ArgDef, + makeFirstArgReceiver, isGetter bool, + structNames map[CIdentifier]bool, + enumNames map[GoIdentifier]bool, + refTypedefs map[CIdentifier]string, // <- this may be empty map if generating cimgui and should be cimgui's typedefs_dict.json for other +) (argDeclaration string, data ArgumentWrapperData, err error) { argWrapperMap := map[CIdentifier]argumentWrapper{ - "char": simpleW("rune", "C.char"), - "char[5]": simplePtrArrayW(5, "C.char", "rune"), - "char[16]": simplePtrArrayW(16, "C.char", "rune"), - "char*": constCharW, - "const char*": constCharW, - "const char**": charPtrPtrW, - "const char* const[]": charPtrPtrW, - "unsigned char": simpleW("uint", "C.uchar"), - "unsigned char*": simplePtrW("uint", "C.uchar"), - "unsigned char**": uCharPtrW, - "size_t": simpleW("uint64", "C.xulong"), - "size_t*": sizeTPtrW, - "float": simpleW("float32", "C.float"), - "const float": simpleW("float32", "C.float"), - "float*": simplePtrW("float32", "C.float"), - "const float*": floatArrayW, - "short": simpleW("int16", "C.short"), - "unsigned short": simpleW("uint16", "C.ushort"), - "ImU8": simpleW("byte", "C.ImU8"), - "ImU8*": simplePtrW("byte", "C.ImU8"), - "const ImU8*": simplePtrSliceW("C.ImU8", "byte"), - "ImU16": simpleW("uint16", "C.ImU16"), - "ImU16*": simplePtrW("uint16", "C.ImU16"), - "const ImU16*": simplePtrSliceW("C.ImU16", "uint16"), - "ImU32": simpleW("uint32", "C.ImU32"), - "ImU32*": simplePtrW("uint32", "C.ImU32"), - "const ImU32*": simplePtrSliceW("C.ImU32", "uint32"), - "ImU64": simpleW("uint64", "C.ImU64"), - "ImU64*": simplePtrSliceW("C.ImU64", "uint64"), - "const ImU64*": uint64ArrayW, - "ImS8": simpleW("int", "C.ImS8"), - "ImS8*": simplePtrSliceW("C.ImS8", "int8"), - "const ImS8*": simplePtrSliceW("C.ImS8", "int8"), - "ImS16": simpleW("int", "C.ImS16"), - "ImS16*": simplePtrSliceW("C.ImS16", "int"), - "const ImS16*": simplePtrSliceW("C.ImS16", "int"), - "ImS32": simpleW("int", "C.ImS32"), - "ImS32*": simplePtrSliceW("C.ImS32", "int32"), - "const ImS32*": simplePtrSliceW("C.ImS32", "int32"), - "ImS64": simpleW("int64", "C.ImS64"), - "ImS64*": simplePtrW("int64", "C.ImS64"), - "const ImS64*": int64ArrayW, - "int": simpleW("int32", "C.int"), - "const int": simpleW("int32", "C.int"), - "int*": simplePtrW("int32", "C.int"), - "unsigned int": simpleW("uint32", "C.uint"), - "unsigned int*": simplePtrW("uint32", "C.uint"), - "double": simpleW("float64", "C.double"), - "double*": simplePtrW("float64", "C.double"), - "const double*": simplePtrSliceW("C.double", "float64"), - "bool": simpleW("bool", "C.bool"), - "const bool": simpleW("bool", "C.bool"), - "bool*": boolPtrW, - "int[2]": simplePtrArrayW(2, "C.int", "int32"), - "int[3]": simplePtrArrayW(3, "C.int", "int32"), - "int[4]": simplePtrArrayW(4, "C.int", "int32"), - "float[2]": simplePtrArrayW(2, "C.float", "float32"), - "float[3]": simplePtrArrayW(3, "C.float", "float32"), - "float[4]": simplePtrArrayW(4, "C.float", "float32"), - "ImWchar": simpleW("Wchar", "C.ImWchar"), - "ImWchar*": simpleW("(*Wchar)", "(*C.ImWchar)"), - "const ImWchar*": simpleW("(*Wchar)", "(*C.ImWchar)"), - "ImWchar16": simpleW("uint16", "C.ImWchar16"), - "ImGuiID": simpleW("ID", "C.ImGuiID"), - "ImGuiID*": simplePtrW("ID", "C.ImGuiID"), - "ImTextureID": simpleW("TextureID", "C.ImTextureID"), - "ImDrawIdx": simpleW("DrawIdx", "C.ImDrawIdx"), - "ImDrawIdx*": simplePtrW("DrawIdx", "C.ImDrawIdx"), - "ImGuiTableColumnIdx": simpleW("TableColumnIdx", "C.ImGuiTableColumnIdx"), - "ImGuiTableDrawChannelIdx": simpleW("TableDrawChannelIdx", "C.ImGuiTableDrawChannelIdx"), - "ImGuiKeyChord": simpleW("KeyChord", "C.ImGuiKeyChord"), - "void*": voidPtrW, - "const void*": simpleW("unsafe.Pointer", ""), - "const ImVec2": wrappableW("Vec2"), - "const ImVec2*": wrappablePtrW("*Vec2", "C.ImVec2"), - "ImVec2": wrappableW("Vec2"), - "ImVec2*": wrappablePtrW("*Vec2", "C.ImVec2"), - "ImVec2[2]": wrappablePtrArrayW(2, "C.ImVec2", "Vec2"), - "const ImVec4": wrappableW("Vec4"), - "const ImVec4*": wrappablePtrW("*Vec4", "C.ImVec4"), - "ImVec4": wrappableW("Vec4"), - "ImVec4*": wrappablePtrW("*Vec4", "C.ImVec4"), - "ImColor*": wrappablePtrW("*Color", "C.ImColor"), - "ImRect": wrappableW("Rect"), - "const ImRect": wrappableW("Rect"), - "ImRect*": wrappablePtrW("*Rect", "C.ImRect"), - "const ImRect*": wrappablePtrW("*Rect", "C.ImRect"), - "ImPlotPoint": wrappableW("PlotPoint"), - "const ImPlotPoint": wrappableW("PlotPoint"), - "ImPlotPoint*": wrappablePtrW("*PlotPoint", "C.ImPlotPoint"), - "ImPlotTime": wrappableW("PlotTime"), - "const ImPlotTime": wrappableW("PlotTime"), - "ImPlotTime*": wrappablePtrW("*PlotTime", "C.ImPlotTime"), - "const ImPlotTime*": wrappablePtrW("*PlotTime", "C.ImPlotTime"), + "char": simpleW("rune", "C.char"), + "char[5]": simplePtrArrayW(5, "C.char", "rune"), + "char[16]": simplePtrArrayW(16, "C.char", "rune"), + "char*": constCharW, + "const char*": constCharW, + "const char**": charPtrPtrW, + "const char* const[]": charPtrPtrW, + "unsigned char": simpleW("uint", "C.uchar"), + "unsigned char*": simplePtrW("uint", "C.uchar"), + "unsigned char**": uCharPtrW, + "size_t": simpleW("uint64", "C.xulong"), + "size_t*": sizeTPtrW, + "float": simpleW("float32", "C.float"), + "const float": simpleW("float32", "C.float"), + "float*": simplePtrW("float32", "C.float"), + "const float*": floatArrayW, + "short": simpleW("int16", "C.short"), + "unsigned short": simpleW("uint16", "C.ushort"), + "ImU8": simpleW("byte", "C.ImU8"), + "ImU8*": simplePtrW("byte", "C.ImU8"), + "const ImU8*": simplePtrSliceW("C.ImU8", "byte"), + "ImU16": simpleW("uint16", "C.ImU16"), + "ImU16*": simplePtrW("uint16", "C.ImU16"), + "const ImU16*": simplePtrSliceW("C.ImU16", "uint16"), + "ImU32": simpleW("uint32", "C.ImU32"), + "ImU32*": simplePtrW("uint32", "C.ImU32"), + "const ImU32*": simplePtrSliceW("C.ImU32", "uint32"), + "ImU64": simpleW("uint64", "C.ImU64"), + "ImU64*": simplePtrSliceW("C.ImU64", "uint64"), + "const ImU64*": uint64ArrayW, + "ImS8": simpleW("int", "C.ImS8"), + "ImS8*": simplePtrSliceW("C.ImS8", "int8"), + "const ImS8*": simplePtrSliceW("C.ImS8", "int8"), + "ImS16": simpleW("int", "C.ImS16"), + "ImS16*": simplePtrSliceW("C.ImS16", "int"), + "const ImS16*": simplePtrSliceW("C.ImS16", "int"), + "ImS32": simpleW("int", "C.ImS32"), + "ImS32*": simplePtrSliceW("C.ImS32", "int32"), + "const ImS32*": simplePtrSliceW("C.ImS32", "int32"), + "ImS64": simpleW("int64", "C.ImS64"), + "ImS64*": simplePtrW("int64", "C.ImS64"), + "const ImS64*": int64ArrayW, + "int": simpleW("int32", "C.int"), + "const int": simpleW("int32", "C.int"), + "int*": simplePtrW("int32", "C.int"), + "unsigned int": simpleW("uint32", "C.uint"), + "unsigned int*": simplePtrW("uint32", "C.uint"), + "double": simpleW("float64", "C.double"), + "double*": simplePtrW("float64", "C.double"), + "const double*": simplePtrSliceW("C.double", "float64"), + "bool": simpleW("bool", "C.bool"), + "const bool": simpleW("bool", "C.bool"), + "bool*": boolPtrW, + "int[2]": simplePtrArrayW(2, "C.int", "int32"), + "int[3]": simplePtrArrayW(3, "C.int", "int32"), + "int[4]": simplePtrArrayW(4, "C.int", "int32"), + "float[2]": simplePtrArrayW(2, "C.float", "float32"), + "float[3]": simplePtrArrayW(3, "C.float", "float32"), + "float[4]": simplePtrArrayW(4, "C.float", "float32"), + "ImWchar": simpleW("Wchar", "C.ImWchar"), + "ImWchar*": simpleW("(*Wchar)", "(*C.ImWchar)"), + "const ImWchar*": simpleW("(*Wchar)", "(*C.ImWchar)"), + "ImWchar16": simpleW("uint16", "C.ImWchar16"), + "uintptr_t": simpleW("uintptr", "C.uintptr_t"), + "const uintptr_t": simpleW("uintptr", "C.uintptr_t"), + "const ImVec2": wrappableW("Vec2", "C.ImVec2"), + "const ImVec2*": wrappablePtrW("*Vec2", "C.ImVec2"), + "ImVec2": wrappableW("Vec2", "C.ImVec2"), + "ImVec2*": wrappablePtrW("*Vec2", "C.ImVec2"), + "ImVec2[2]": wrappablePtrArrayW(2, "C.ImVec2", "Vec2"), + "const ImVec4": wrappableW("Vec4", "C.ImVec4"), + "const ImVec4*": wrappablePtrW("*Vec4", "C.ImVec4"), + "ImVec4": wrappableW("Vec4", "C.ImVec4"), + "ImVec4*": wrappablePtrW("*Vec4", "C.ImVec4"), + "ImColor": wrappableW("Color", "C.ImColor"), + "ImColor*": wrappablePtrW("*Color", "C.ImColor"), + "ImRect": wrappableW("Rect", "C.ImRect"), + "const ImRect": wrappableW("Rect", "C.ImRect"), + "ImRect*": wrappablePtrW("*Rect", "C.ImRect"), + "const ImRect*": wrappablePtrW("*Rect", "C.ImRect"), + "ImPlotPoint": wrappableW("PlotPoint", "C.ImPlotPoint"), + "const ImPlotPoint": wrappableW("PlotPoint", "C.ImPlotPoint"), + "ImPlotPoint*": wrappablePtrW("*PlotPoint", "C.ImPlotPoint"), + "ImPlotTime": wrappableW("PlotTime", "C.ImPlotTime"), + "const ImPlotTime": wrappableW("PlotTime", "C.ImPlotTime"), + "ImPlotTime*": wrappablePtrW("*PlotTime", "C.ImPlotTime"), + "const ImPlotTime*": wrappablePtrW("*PlotTime", "C.ImPlotTime"), } if a.Name == "type" || a.Name == "range" { @@ -172,8 +174,7 @@ func getArgWrapper(a *ArgDef, makeFirstArgReceiver, isGetter bool, structNames m _, w, err := getArgWrapper(&ArgDef{ Name: dataName, Type: pureType, - }, false, false, structNames, enumNames) - + }, false, false, structNames, enumNames, refTypedefs) if err != nil { return "", ArgumentWrapperData{}, fmt.Errorf("creating vector wrapper %w", err) } @@ -213,7 +214,9 @@ func getArgWrapper(a *ArgDef, makeFirstArgReceiver, isGetter bool, structNames m isPointer = true } - if structNames[pureType] { + _, isRefTypedef := refTypedefs[pureType] + _, shouldSkipRefTypedef := skippedTypedefs[pureType] + if structNames[pureType] || (isRefTypedef && !shouldSkipRefTypedef) { w := ArgumentWrapperData{ ArgType: pureType.renameGoIdentifier(), VarName: fmt.Sprintf("%sArg", a.Name), @@ -249,6 +252,7 @@ func constCharW(arg ArgDef) ArgumentWrapperData { ArgDef: fmt.Sprintf("%[1]sArg, %[1]sFin := WrapString(%[1]s)", arg.Name), ArgDefNoFin: fmt.Sprintf("%[1]sArg, _ := WrapString(%[1]s)", arg.Name), Finalizer: fmt.Sprintf("%sFin()", arg.Name), + CType: "*C.char", } } @@ -259,6 +263,7 @@ func charPtrPtrW(arg ArgDef) ArgumentWrapperData { ArgDef: fmt.Sprintf("%[1]sArg, %[1]sFin := WrapStringList(%[1]s)", arg.Name), ArgDefNoFin: fmt.Sprintf("%[1]sArg, _ := WrapStringList(%[1]s)", arg.Name), Finalizer: fmt.Sprintf("%sFin()", arg.Name), + CType: "**C.char", } } @@ -266,6 +271,7 @@ func uCharPtrW(arg ArgDef) ArgumentWrapperData { return ArgumentWrapperData{ ArgType: "*C.uchar", VarName: fmt.Sprintf("&%s", arg.Name), + CType: "*C.uchar", } } @@ -273,6 +279,7 @@ func sizeTPtrW(arg ArgDef) ArgumentWrapperData { return ArgumentWrapperData{ ArgType: "*uint64", VarName: fmt.Sprintf("(*C.xulong)(%s)", arg.Name), + CType: "*C.xulong", } } @@ -280,6 +287,7 @@ func floatArrayW(arg ArgDef) ArgumentWrapperData { return ArgumentWrapperData{ ArgType: "[]float32", VarName: fmt.Sprintf("(*C.float)(&(%s[0]))", arg.Name), + CType: "*C.float", } } @@ -290,6 +298,7 @@ func boolPtrW(arg ArgDef) ArgumentWrapperData { ArgDefNoFin: fmt.Sprintf("%[1]sArg, _ := WrapBool(%[1]s)", arg.Name), Finalizer: fmt.Sprintf("%[1]sFin()", arg.Name), VarName: fmt.Sprintf("%sArg", arg.Name), + CType: "*C.bool", } } @@ -297,6 +306,7 @@ func int64ArrayW(arg ArgDef) ArgumentWrapperData { return ArgumentWrapperData{ ArgType: "[]int64", VarName: fmt.Sprintf("(*C.longlong)(&(%s[0]))", arg.Name), + CType: "*C.longlong", } } @@ -304,33 +314,30 @@ func uint64ArrayW(arg ArgDef) ArgumentWrapperData { return ArgumentWrapperData{ ArgType: "[]uint64", VarName: fmt.Sprintf("(*C.ulonglong)(&(%s[0]))", arg.Name), + CType: "*C.ulonglong", } } -func voidPtrW(arg ArgDef) ArgumentWrapperData { - return ArgumentWrapperData{ - ArgType: "unsafe.Pointer", - ArgDef: fmt.Sprintf("%[1]sArg, %[1]sFin := WrapVoidPtr(%[1]s)", arg.Name), - ArgDefNoFin: fmt.Sprintf("%[1]sArg, _ := WrapVoidPtr(%[1]s)", arg.Name), - VarName: fmt.Sprintf("%sArg", arg.Name), - Finalizer: fmt.Sprintf("%sFin()", arg.Name), - } -} - -func inputeTextCallbackW(arg ArgDef) (argType string, def string, varName string) { - argType = "ImGuiInputTextCallback" - // TODO: implement me - return -} +//func voidPtrW(arg ArgDef) ArgumentWrapperData { +// return ArgumentWrapperData{ +// ArgType: "unsafe.Pointer", +// ArgDef: fmt.Sprintf("%[1]sArg, %[1]sFin := WrapVoidPtr(%[1]s)", arg.Name), +// ArgDefNoFin: fmt.Sprintf("%[1]sArg, _ := WrapVoidPtr(%[1]s)", arg.Name), +// VarName: fmt.Sprintf("%sArg", arg.Name), +// Finalizer: fmt.Sprintf("%sFin()", arg.Name), +// CType: "unsafe.Pointer", +// } +//} // generic wrappers: // C.int -> int32 -func simpleW(goType GoIdentifier, cType CIdentifier) argumentWrapper { +func simpleW(goType GoIdentifier, cType GoIdentifier) argumentWrapper { return func(arg ArgDef) ArgumentWrapperData { return ArgumentWrapperData{ ArgType: goType, VarName: fmt.Sprintf("%s(%s)", cType, arg.Name), + CType: cType, } } } @@ -338,7 +345,7 @@ func simpleW(goType GoIdentifier, cType CIdentifier) argumentWrapper { // C.int* -> *int32 // // return simplePtrW(arg.Name, "int16", "C.int") -func simplePtrW(goType GoIdentifier, cType CIdentifier) argumentWrapper { +func simplePtrW(goType GoIdentifier, cType GoIdentifier) argumentWrapper { return func(arg ArgDef) ArgumentWrapperData { return ArgumentWrapperData{ ArgType: GoIdentifier(fmt.Sprintf("*%s", goType)), @@ -346,12 +353,13 @@ func simplePtrW(goType GoIdentifier, cType CIdentifier) argumentWrapper { ArgDefNoFin: fmt.Sprintf("%[1]sArg, _ := WrapNumberPtr[%[2]s, %[3]s](%[1]s)", arg.Name, cType, goType), Finalizer: fmt.Sprintf("%[1]sFin()", arg.Name, cType, goType), VarName: fmt.Sprintf("%sArg", arg.Name), + CType: "*" + cType, } } } // C.int*, C.int[] as well as C.int[2] -> [2]*int32 -func simplePtrArrayW(size int, cArrayType CIdentifier, goArrayType GoIdentifier) argumentWrapper { +func simplePtrArrayW(size int, cArrayType GoIdentifier, goArrayType GoIdentifier) argumentWrapper { return func(arg ArgDef) ArgumentWrapperData { def := fmt.Sprintf(` %[1]sArg := make([]%[2]s, len(%[1]s)) @@ -369,12 +377,13 @@ for i, %[1]sV := range %[1]sArg { } `, arg.Name, cArrayType, goArrayType), + CType: "*" + cArrayType, } } } // C.int*, C.int[] -> *[]int32 -func simplePtrSliceW(cArrayType, goArrayType string) argumentWrapper { +func simplePtrSliceW(cArrayType, goArrayType GoIdentifier) argumentWrapper { return func(arg ArgDef) ArgumentWrapperData { def := fmt.Sprintf(`%[1]sArg := make([]%[2]s, len(*%[1]s)) for i, %[1]sV := range *%[1]s { @@ -391,22 +400,24 @@ for i, %[1]sV := range *%[1]s { } `, arg.Name, cArrayType, goArrayType), VarName: fmt.Sprintf("(*%s)(&%sArg[0])", cArrayType, arg.Name), + CType: "*" + cArrayType, } } } // C.ImVec2 -> ImVec2 -func wrappableW(sType GoIdentifier) argumentWrapper { +func wrappableW(goType, cType GoIdentifier) argumentWrapper { return func(arg ArgDef) ArgumentWrapperData { return ArgumentWrapperData{ - ArgType: sType, + ArgType: goType, VarName: fmt.Sprintf("%s.toC()", arg.Name), + CType: cType, } } } // C.ImVec2* -> *ImVec2 -func wrappablePtrW(goType GoIdentifier, cType CIdentifier) argumentWrapper { +func wrappablePtrW(goType, cType GoIdentifier) argumentWrapper { return func(arg ArgDef) ArgumentWrapperData { return ArgumentWrapperData{ ArgType: goType, @@ -414,11 +425,12 @@ func wrappablePtrW(goType GoIdentifier, cType CIdentifier) argumentWrapper { ArgDefNoFin: fmt.Sprintf("%[1]sArg, _ := wrap[%[3]s, %[2]s](%[1]s)", arg.Name, goType, cType), Finalizer: fmt.Sprintf("%[1]sFin()", arg.Name, goType, cType), VarName: fmt.Sprintf("%sArg", arg.Name), + CType: "*" + cType, } } } -func wrappablePtrArrayW(size int, cArrayType CIdentifier, goArrayType GoIdentifier) argumentWrapper { +func wrappablePtrArrayW(size int, cArrayType GoIdentifier, goArrayType GoIdentifier) argumentWrapper { return func(arg ArgDef) ArgumentWrapperData { def := fmt.Sprintf(`%[1]sArg := make([]%[2]s, len(%[1]s)) %[1]sFin := make([]func(), len(%[1]s)) @@ -438,6 +450,7 @@ for i, %[1]sV := range %[1]s { } `, arg.Name, cArrayType, goArrayType), VarName: fmt.Sprintf("(*%s)(&%sArg[0])", cArrayType, arg.Name), + CType: "*" + cArrayType, } } } diff --git a/cmd/codegen/gencpp.go b/cmd/codegen/gencpp.go index a79e82b5b..2d90a9cbe 100644 --- a/cmd/codegen/gencpp.go +++ b/cmd/codegen/gencpp.go @@ -55,7 +55,7 @@ extern "C" { shouldSkip := false - // Check func names + // Check func names (some of them are arbitrarly skipped) if HasPrefix(f.FuncName, "ImSpan") || HasPrefix(f.FuncName, "ImBitArray") { shouldSkip = true @@ -65,12 +65,12 @@ extern "C" { // Process custom_type for arg for i, a := range f.ArgsT { if len(a.CustomType) > 0 { - f.Args = Replace(f.Args, a.Type, a.CustomType, -1) + f.Args = ReplaceAll(f.Args, a.Type, a.CustomType) f.ArgsT[i].Type = a.CustomType } } - // Check args + // Check args (some arg formats are skipped) for _, a := range f.ArgsT { if Contains(a.Type, "const T*") || Contains(a.Type, "const T") || @@ -81,14 +81,13 @@ extern "C" { } } + // check if func name is valid if len(f.FuncName) == 0 { shouldSkip = true } - funcName := f.FuncName - // Check lower case for function - if !shouldExportFunc(funcName) { + if !shouldExportFunc(f.FuncName) { shouldSkip = true } @@ -96,6 +95,8 @@ extern "C" { continue } + funcName := f.FuncName + // Check lower case member function funcParts := Split(funcName, "_") if len(funcParts) == 2 && unicode.IsLower(rune(funcParts[1][0])) { @@ -114,6 +115,10 @@ extern "C" { // Remove text_end arg f.Args = strings.Replace(f.Args, ",const char* text_end_", fmt.Sprintf(",const int %s", textLenRegisteredName), 1) // sometimes happens in cimmarkdown f.Args = strings.Replace(f.Args, ",const char* text_end", fmt.Sprintf(",const int %s", textLenRegisteredName), 1) + ret := f.Ret + if ret == "void*" { + ret = "uintptr_t" + } var argsT []ArgDef var actualCallArgs []CIdentifier @@ -124,7 +129,7 @@ extern "C" { case a.Name == "...": continue case a.Name == "text_end", a.Name == "text_end_": - //chck if there is `text` argument + // chck if there is `text` argument var found bool for _, aa := range f.ArgsT { if aa.Name == "text" { @@ -143,16 +148,50 @@ extern "C" { actualCallArgs = append(actualCallArgs, "0") continue } + // this is here, because of a BUG in GO that throws a fatal panic + // when we attempt to print unsafe.Pointer which is valid for C but is not present + // on the GO stack. See https://go.dev/play/p/d09eyqUlVV0 + // see:https://github.com/golang/go/issues/64467 + // case Contains(a.Type, "void*"): + case a.Type == "void*" || a.Type == "const void*": + actualCallArgs = append(actualCallArgs, CIdentifier(fmt.Sprintf("(%s)(uintptr_t)%s", a.Type, a.Name))) + a.Type = "uintptr_t" + // do some trick: we can't replace void* in a.Args immediaely by using replace, because sometimes + // args are of form (void* user_data, (void* user_data)(int something)) + // we need to replace only "plain" arguments (not function-types) + // we will split Args by "," and check each argument to be equal to ("void* ", a.Name) + newArgs := TrimPrefix(f.Args, "(") + newArgs = TrimSuffix(newArgs, ")") + newArgsList := Split(newArgs, ",") + for i, arg := range newArgsList { + switch arg { + case fmt.Sprintf("void* %s", a.Name): + newArgsList[i] = fmt.Sprintf("uintptr_t %s", a.Name) + case fmt.Sprintf("const void* %s", a.Name): + newArgsList[i] = fmt.Sprintf("const uintptr_t %s", a.Name) + } + } + + f.Args = fmt.Sprintf("(%s)", Join(newArgsList, ",")) + + argsT = append(argsT, a) default: argsT = append(argsT, a) actualCallArgs = append(actualCallArgs, a.Name) } } - f.AllCallArgs = "(" + TrimSuffix(f.AllCallArgs, ",") + ")" + f.AllCallArgs = "(" + TrimSuffix(f.AllCallArgs, ",") + ")" f.ArgsT = argsT - // Generate shotter function which omits the default args + //f.Args = "(" + //for _, a := range argsT { + // f.Args += fmt.Sprintf("%s %s,", a.Type, a.Name) + //} + //f.Args = TrimSuffix(f.Args, ",") + //f.Args += ")" + + // Generate shorter function which omits the default args // Skip functions as function pointer arg shouldSkip = false for _, a := range f.ArgsT { @@ -252,6 +291,10 @@ extern "C" { v = "NULL" } + if v == "nullptr" || v == "NULL" { + v = "0" + } + if k == "text_end" || k == "text_end_" { v = "0" } @@ -276,7 +319,7 @@ extern "C" { Destructor: f.Destructor, StructSetter: false, StructGetter: false, - Ret: f.Ret, + Ret: ret, StName: f.StName, NonUDT: f.NonUDT, CWrapperFuncName: cWrapperFuncName + "V", @@ -304,7 +347,7 @@ extern "C" { Constructor: f.Constructor, Destructor: f.Destructor, InvocationStmt: f.InvocationStmt, - Ret: f.Ret, + Ret: ret, StName: f.StName, NonUDT: f.NonUDT, CWrapperFuncName: cWrapperFuncName, @@ -325,7 +368,8 @@ extern "C" { // cppSb.WriteString(fmt.Sprintf("// %#v\n", f)) - if string(f.AllCallArgs) == actualCallArgsStr { + // if needed, write extra stuff to cpp headers + if string(f.AllCallArgs) == actualCallArgsStr && ret == f.Ret { cWrapperFuncName = f.FuncName } else if f.Constructor { headerSb.WriteString(fmt.Sprintf("extern %s* %s%s;\n", f.StName, cWrapperFuncName, f.Args)) @@ -334,11 +378,14 @@ extern "C" { headerSb.WriteString(fmt.Sprintf("extern void %s%s;\n", cWrapperFuncName, f.Args)) cppSb.WriteString(fmt.Sprintf("void %s%s { %s%s; }\n", cWrapperFuncName, f.Args, invokeFunctionName, actualCallArgsStr)) } else { - headerSb.WriteString(fmt.Sprintf("extern %s %s%s;\n", f.Ret, cWrapperFuncName, f.Args)) + headerSb.WriteString(fmt.Sprintf("extern %s %s%s;\n", ret, cWrapperFuncName, f.Args)) - if f.Ret == "void" { + switch f.Ret { + case "void": cppSb.WriteString(fmt.Sprintf("%s %s%s { %s%s; }\n", f.Ret, cWrapperFuncName, f.Args, invokeFunctionName, actualCallArgsStr)) - } else { + case "void*": + cppSb.WriteString(fmt.Sprintf("uintptr_t %s%s { return (uintptr_t)%s%s; }\n", cWrapperFuncName, f.Args, invokeFunctionName, actualCallArgsStr)) + default: cppSb.WriteString(fmt.Sprintf("%s %s%s { return %s%s; }\n", f.Ret, cWrapperFuncName, f.Args, invokeFunctionName, actualCallArgsStr)) } } diff --git a/cmd/codegen/gengo.go b/cmd/codegen/gengo.go index a7126b55c..aa5c299c0 100644 --- a/cmd/codegen/gengo.go +++ b/cmd/codegen/gengo.go @@ -1,6 +1,7 @@ package main import ( + "regexp" "strings" ) @@ -36,6 +37,17 @@ var skippedStructs = map[CIdentifier]bool{ "ImPlotTime": true, } +var skippedTypedefs = map[CIdentifier]bool{ + "ImU8": true, + "ImU16": true, + "ImU32": true, + "ImU64": true, + "ImS8": true, + "ImS16": true, + "ImS32": true, + "ImS64": true, +} + var replace = map[CIdentifier]GoIdentifier{ "igGetDrawData": "CurrentDrawData", "igGetDrawListSharedData": "CurrentDrawListSharedData", @@ -73,6 +85,8 @@ func (c CIdentifier) renameGoIdentifier() GoIdentifier { c = "new" + c[3:].trimImGuiPrefix() case HasPrefix(c, "*"): c = "*" + c[1:].trimImGuiPrefix() + case HasPrefix(c, "imnodes"): + c = Replace(c, "imnodes", "ImNodes", 1) } c = TrimPrefix(c, "Get") @@ -85,3 +99,15 @@ func (c CIdentifier) renameGoIdentifier() GoIdentifier { func (c CIdentifier) renameEnum() GoIdentifier { return TrimSuffix(c, "_").renameGoIdentifier() } + +// returns true if s is of form TypeName<*> <(>Name<*><)>(args) +// (fragments in <> are optional) +func IsCallbackTypedef(s string) bool { + pattern := `\w*\**\(*\w*\**\)*\(.*\);` + b, err := regexp.MatchString(pattern, s) + if err != nil { + panic(err) + } + + return b +} diff --git a/cmd/codegen/gengo_funcs.go b/cmd/codegen/gengo_funcs.go index 8de82964d..65914fe14 100644 --- a/cmd/codegen/gengo_funcs.go +++ b/cmd/codegen/gengo_funcs.go @@ -33,11 +33,12 @@ const ( ) // generateGoFuncs generates given list of functions and writes them to file -func generateGoFuncs(prefix string, validFuncs []FuncDef, enumNames []GoIdentifier, structNames []CIdentifier) error { +func generateGoFuncs(prefix string, validFuncs []FuncDef, enumNames []GoIdentifier, structNames []CIdentifier, refTypedefs map[CIdentifier]string) error { generator := &goFuncsGenerator{ prefix: prefix, structNames: make(map[CIdentifier]bool), enumNames: make(map[GoIdentifier]bool), + refTypedefs: refTypedefs, } for _, v := range structNames { @@ -105,6 +106,7 @@ type goFuncsGenerator struct { prefix string structNames map[CIdentifier]bool enumNames map[GoIdentifier]bool + refTypedefs map[CIdentifier]string sb strings.Builder convertedFuncCount int @@ -135,7 +137,7 @@ func (g *goFuncsGenerator) GenerateFunction(f FuncDef, args []GoIdentifier, argW // determine kind of function: returnTypeType := returnTypeUnknown - _, err := getReturnWrapper(f.Ret, g.structNames, g.enumNames) // TODO: we call this twice now + _, err := getReturnWrapper(f.Ret, g.structNames, g.enumNames, g.refTypedefs) // TODO: we call this twice now if err == nil { returnTypeType = returnTypeKnown } @@ -210,7 +212,7 @@ func (g *goFuncsGenerator) GenerateFunction(f FuncDef, args []GoIdentifier, argW return false } - rw, err := getReturnWrapper(cReturnType, g.structNames, g.enumNames) + rw, err := getReturnWrapper(cReturnType, g.structNames, g.enumNames, g.refTypedefs) if err != nil { switch returnTypeType { case returnTypeKnown, returnTypeStructPtr, returnTypeConstructor, returnTypeStruct: @@ -366,8 +368,8 @@ func (g *goFuncsGenerator) generateFuncArgs(f FuncDef) (args []GoIdentifier, arg f.StructGetter && g.structNames[a.Type], g.structNames, g.enumNames, + g.refTypedefs, ) - if err != nil { glg.Debugf("Unknown argument type \"%s\" in function %s", a.Type, f.FuncName) break diff --git a/cmd/codegen/gengo_structs.go b/cmd/codegen/gengo_structs.go deleted file mode 100644 index 533f47bd5..000000000 --- a/cmd/codegen/gengo_structs.go +++ /dev/null @@ -1,249 +0,0 @@ -package main - -import "C" -import ( - "fmt" - "github.com/kpango/glg" - "os" - "strings" -) - -func generateGoStructs(prefix string, structs []StructDef, enums []EnumDef, refEnums []GoIdentifier, refStructs []CIdentifier) []CIdentifier { - glg.Infof("Generating %d structs", len(structs)) - var progress int - - var sb strings.Builder - - sb.WriteString(goPackageHeader) - sb.WriteString(fmt.Sprintf( - `// #include -// #include -// #include "extra_types.h" -// #include "%s_wrapper.h" -import "C" -import "unsafe" - -`, prefix)) - - // Save all struct name into a map - var structNames []CIdentifier - - for _, s := range structs { - if shouldSkipStruct(s.Name) { - progress++ - continue - } - - sb.WriteString(fmt.Sprintf("%s\n", s.CommentAbove)) - if generateStruct(s, structs, enums, refEnums, refStructs, &sb) { - progress++ - } - - structNames = append(structNames, s.Name) - } - - structFile, err := os.Create(fmt.Sprintf("%s_structs.go", prefix)) - if err != nil { - panic(err.Error()) - } - - defer structFile.Close() - - _, _ = structFile.WriteString(sb.String()) - - glg.Infof("%d of %d structs fully generated (%.2f %%)", - progress, - len(structs), - float32(progress)/float32(len(structs))*100, - ) - - return structNames -} - -func generateStruct(s StructDef, defs []StructDef, enumDefs []EnumDef, refEnums []GoIdentifier, refStructs []CIdentifier, sb *strings.Builder) (generationComplete bool) { - structs, enums := make(map[CIdentifier]bool), make(map[GoIdentifier]bool) - for _, s := range defs { - structs[s.Name] = true - } - for _, s := range refStructs { - structs[s] = true - } - - for _, e := range enumDefs { - enums[e.Name.renameEnum()] = true - } - for _, e := range refEnums { - enums[e] = true - } - - generationComplete = true - - type wrapper struct { - fromC returnWrapper - toC ArgumentWrapperData - } - - var wrappers = make(map[int]wrapper) - var isTODO bool // this will become true if some field is not implemented (e.g. union {...}) - var structBody *strings.Builder = &strings.Builder{} - - fmt.Fprintf(sb, "type %s struct {\n", s.Name.renameGoIdentifier()) - - // Generate struct fields: - for i, field := range s.Members { - var typeName GoIdentifier - - argDef := ArgDef{ - Name: CIdentifier(field.Name.renameStructField()), - Type: field.Type, - } - - _, toC, toCErr := getArgWrapper( - &argDef, - false, false, - structs, enums, - ) - - fromC, fromCErr := getReturnWrapper( - field.Type, - structs, enums, - ) - - switch { - case toCErr == nil && fromCErr == nil: - if toC.ArgType != fromC.returnType { // <- this absolutly shouldn't happen - panic(fmt.Sprintf(` -%s != %s -%s -`, toC.ArgType, fromC.returnType, field.Type)) - } - wrappers[i] = wrapper{ - toC: toC, - fromC: fromC, - } - - typeName = wrappers[i].toC.ArgType - default: - isTODO = true - } - - if field.Name == "" || // <- this means that type is union or something like that. - ContainsAny(field.Name, "[]") || // <- this means that it is an array; TODO - field.Bitfield != "" || - isTODO { - generationComplete = false - isTODO = true - /* - This may happen due to the following things: - - member has no name (the only case that I found is when field is "union {...}" - see https://github.com/cimgui/cimgui/issues/241 - - the field is an array - for some reason the [] is treated as part of name and that case - is simply not yet implemented (TODO) - - field is a bitfield and go does not (and is not going to) support it - see https://github.com/golang/go/issues/59982 - - or finally (I believe the most common reason) type of this field is not implemented - in argument_wrapper.go and return_wrapper.go. This should be present in both maps - in order to make this generator work for that type. - */ - glg.Failf("Cannot generate struct \"%s\", because its member \"%s\" (bitfield %v) is of unsupported type \"%s\" ", - s.Name, field.Name, field.Bitfield, field.Type, - ) - // reset struct body and fill it with temporary data - structBody = &strings.Builder{} - fmt.Fprint(structBody, ` -// TODO: contains unsupported fields -data unsafe.Pointer -`) - break - } - - if field.Comment.Above != "" { - field.Comment.Above += "\n" - } - - fmt.Fprintf(structBody, "%s%s %s %s\n", - field.Comment.Above, - field.Name.renameStructField(), typeName, - field.Comment.Sameline, - ) - } - - fmt.Fprintln(sb, structBody) - - fmt.Fprint(sb, "}\n") - - // handlers: - fmt.Fprintf(sb, ` -func (self %[1]s) handle() (result *C.%[2]s, releaseFn func()) { -`, s.Name.renameGoIdentifier(), s.Name) - - if isTODO { - fmt.Fprintf(sb, ` -result = (*C.%s)(self.data) -return result, func() {} -`, s.Name) - } else { - fmt.Fprintf(sb, "result = new(C.%s)\n", s.Name) - for i, m := range s.Members { - fmt.Fprintf(sb, - "%[4]s := self.%[4]s\n%[1]s\nresult.%[2]s = %[3]s\n", - wrappers[i].toC.ArgDef, - m.Name, wrappers[i].toC.VarName, - m.Name.renameStructField(), - ) - } - - // finalizer (release func) - fmt.Fprintf(sb, "releaseFn = func() {\n") - - for i := range s.Members { - fmt.Fprintf(sb, - "%s\n", - wrappers[i].toC.Finalizer) - } - - fmt.Fprintf(sb, "}\nreturn result, releaseFn\n") - } - - fmt.Fprintf(sb, "}\n") - - fmt.Fprintf(sb, ` - func (self %[1]s) c() (result C.%[2]s, fin func()) { - resultPtr, finFn := self.handle() - return *resultPtr, finFn - } -`, s.Name.renameGoIdentifier(), s.Name) - - // new X FromC - fmt.Fprintf(sb, "func new%[1]sFromC(cvalue *C.%[2]s) *%[1]s {\n", s.Name.renameGoIdentifier(), s.Name) - - fmt.Fprintf(sb, "result := new(%s)\n", s.Name.renameGoIdentifier()) - if isTODO { - fmt.Fprintf(sb, "result.data = unsafe.Pointer(cvalue)\n") - } else { - for i, m := range s.Members { - w := wrappers[i].fromC - stmt := fmt.Sprintf(w.returnStmt, fmt.Sprintf("cvalue.%s", m.Name)) - fmt.Fprintf(sb, "result.%s = %s\n", m.Name.renameStructField(), stmt) - } - } - - fmt.Fprintf(sb, "return result\n}\n") - - return -} - -func (c CIdentifier) renameStructField() GoIdentifier { - tmp := string(c) - tmp = strings.TrimPrefix(tmp, "_") - if len(tmp) == 0 { - return "" - } - - result := "Field" + strings.ToUpper(tmp[:1]) - if len(tmp) > 1 { - result += tmp[1:] - } - - return GoIdentifier(result) -} diff --git a/cmd/codegen/gengo_test.go b/cmd/codegen/gengo_test.go new file mode 100644 index 000000000..28ffbb2c4 --- /dev/null +++ b/cmd/codegen/gengo_test.go @@ -0,0 +1,25 @@ +package main + +import "testing" + +func TestIsCallbackTypedef(t *testing.T) { + type args struct { + } + tests := []struct { + name string + s string + want bool + }{ + {"variant with no extra * and ()", "void MarkdownFormalCallback(const MarkdownFormatInfo& markdownFormatInfo_,bool start_);", true}, + {"variant from cimgui", "int(*)(ImGuiInputTextCallbackData* data);", true}, + {"some random structdef that shouldn't be true", "struct ImGuiPlatformImeData", false}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := IsCallbackTypedef(tt.s); got != tt.want { + t.Errorf("IsCallbackTypedef() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go new file mode 100644 index 000000000..f7fbcd3a7 --- /dev/null +++ b/cmd/codegen/gengo_typedefs.go @@ -0,0 +1,348 @@ +package main + +import "C" +import ( + "fmt" + "github.com/kpango/glg" + "os" + "strings" +) + +// this function will proceed the following typedefs: +// - all structs thatare not present in struct_and_enums.json (they are supposed to be epaque) +// - everything that satisfies IsCallbackTypedef +func proceedTypedefs(prefix string, typedefs *Typedefs, structs []StructDef, enums []EnumDef, refTypedefs map[CIdentifier]string) (validTypeNames []CIdentifier, err error) { + // we need FILES + callbacksGoSb := &strings.Builder{} + callbacksGoSb.WriteString(goPackageHeader) + fmt.Fprintf(callbacksGoSb, + `// #include +// #include +// #include "extra_types.h" +// #include "%[1]s_wrapper.h" +// #include "%[1]s_typedefs.h" +import "C" +import "unsafe" + +`, prefix) + + typedefsHeaderSb := &strings.Builder{} + typedefsHeaderSb.WriteString(cppFileHeader) + fmt.Fprintf(typedefsHeaderSb, + ` +#pragma once + +#include "cimgui/%s.h" + +#ifdef __cplusplus +extern "C" { +#endif +`, prefix) + typedefsCppSb := &strings.Builder{} + typedefsCppSb.WriteString(cppFileHeader) + fmt.Fprintf(typedefsCppSb, + ` +#include "%[1]s_typedefs.h" +#include "cimgui/%[1]s.h" +`, prefix) + + // because go ranges through maps as if it was drunken, we need to sort keys. + keys := make([]CIdentifier, 0, len(typedefs.data)) + for k := range typedefs.data { + keys = append(keys, k) + } + + // sort keys + SortStrings(keys) + + for _, k := range keys { + typedef := typedefs.data[k] + if shouldSkip, ok := skippedTypedefs[k]; ok && shouldSkip { + glg.Infof("Arbitrarly skipping typedef %s", k) + continue + } + + if _, exists := refTypedefs[k]; exists { + glg.Infof("Duplicate of %s in reference typedefs. Skipping.", k) + continue + } + + if shouldSkipStruct(k) { + glg.Infof("Arbitrarly skipping struct %s", k) + continue + } + + if IsEnumName(k, enums) /*|| IsStructName(k, structs)*/ { + glg.Infof("typedef %s has extended deffinition in structs_and_enums.json. Will generate later", k) + continue + } + + if IsTemplateTypedef(typedef) { + glg.Infof("typedef %s is a template. not implemented yet", k) + continue + } + + isPtr := HasSuffix(typedef, "*") + + var knownReturnType, knownPtrReturnType returnWrapper + var knownArgType, knownPtrArgType ArgumentWrapperData + var argTypeErr, ptrArgTypeErr, returnTypeErr, ptrReturnTypeErr error + + if typedef == "void*" { + typedef = "uintptr_t" + } + + // Let's say our pureType is of form short + // the following code needs to handle two things: + // - int16 -> short (to know go type AND know how to proceed in c() func) + // - *int16 -> short* (for handle()) + // - short* -> *int16 (for newXXXFromC) + knownReturnType, returnTypeErr = getReturnWrapper( + CIdentifier(typedef), + map[CIdentifier]bool{}, + map[GoIdentifier]bool{}, + map[CIdentifier]string{}, + ) + + knownPtrReturnType, ptrReturnTypeErr = getReturnWrapper( + CIdentifier(typedef)+"*", + map[CIdentifier]bool{}, + map[GoIdentifier]bool{}, + map[CIdentifier]string{}, + ) + + _, knownArgType, argTypeErr = getArgWrapper( + &ArgDef{ + Name: "self", + Type: CIdentifier(typedef), + }, + false, false, + map[CIdentifier]bool{}, + map[GoIdentifier]bool{}, + map[CIdentifier]string{}, + ) + + _, knownPtrArgType, ptrArgTypeErr = getArgWrapper( + &ArgDef{ + Name: "self", + Type: CIdentifier(typedef) + "*", + }, + false, false, + map[CIdentifier]bool{}, + map[GoIdentifier]bool{}, + map[CIdentifier]string{}, + ) + + // check if k is a name of struct from structDefs + switch { + case typedefs.data[k] == "void*": + glg.Infof("typedef %s is an alias to void*.", k) + fmt.Fprintf(typedefsCppSb, + ` +uintptr_t %[1]s_toUintptr(%[1]s ptr) { + return (uintptr_t)ptr; +} + +%[1]s %[1]s_fromUintptr(uintptr_t ptr) { + return (%[1]s)ptr; +} +`, k) + fmt.Fprintf(typedefsHeaderSb, `extern uintptr_t %[1]s_toUintptr(%[1]s ptr); +extern %[1]s %[1]s_fromUintptr(uintptr_t ptr);`, k) + + // NOTE: in case of problems e.g. with Textures, here might be potential issue: + // handle() is incomplete - it doesn't have right finalizer (for now I think this will not affect code) + fmt.Fprintf(callbacksGoSb, ` +type %[1]s struct { + Data uintptr +} + +func (self *%[1]s) handle() (result *C.%[6]s, fin func()) { + r, f := self.c() + return &r, f +} + +func (self %[1]s) c() (C.%[6]s, func()) { + return (C.%[6]s)(C.%[6]s_fromUintptr(C.uintptr_t(self.Data))), func() { } +} + +func new%[1]sFromC(cvalue *C.%[6]s) *%[1]s { + return &%[1]s{Data: (uintptr)(C.%[6]s_toUintptr(*cvalue))} +} +`, + k.renameGoIdentifier(), + knownArgType.ArgType, + + knownPtrArgType.ArgDef, + knownPtrArgType.VarName, + knownPtrArgType.Finalizer, + + k, + + knownArgType.ArgDef, + knownArgType.VarName, + knownArgType.Finalizer, + + fmt.Sprintf(knownPtrReturnType.returnStmt, "cvalue"), + ) + + validTypeNames = append(validTypeNames, k) + case ptrReturnTypeErr == nil && argTypeErr == nil && ptrArgTypeErr == nil && !isPtr: + glg.Infof("typedef %s is an alias typedef.", k) + + fmt.Fprintf(callbacksGoSb, ` +type %[1]s %[2]s + +func (selfSrc *%[1]s) handle() (result *C.%[6]s, fin func()) { + self := (*%[2]s)(selfSrc) + %[3]s + return (*C.%[6]s)(%[4]s), func() { %[5]s } +} + +func (self %[1]s) c() (C.%[6]s, func()) { + %[7]s + return (C.%[6]s)(%[8]s), func() { %[9]s } +} + +func new%[1]sFromC(cvalue *C.%[6]s) *%[1]s { + return (*%[1]s)(%[10]s) +} +`, + k.renameGoIdentifier(), + knownArgType.ArgType, + + knownPtrArgType.ArgDef, + knownPtrArgType.VarName, + knownPtrArgType.Finalizer, + + k, + + knownArgType.ArgDef, + knownArgType.VarName, + knownArgType.Finalizer, + + fmt.Sprintf(knownPtrReturnType.returnStmt, "cvalue"), + ) + validTypeNames = append(validTypeNames, k) + case returnTypeErr == nil && argTypeErr == nil && isPtr: + // if it's a pointer type, I think we can proceed as above, but without handle() method... + // (handle proceeds pointer values and we don't want double pointers, really) + fmt.Fprintf(callbacksGoSb, ` +type %[1]s struct { + Data %[2]s +} + +func (self *%[1]s) handle() (*C.%[6]s, func()) { + result, fn := self.c() + return &result, fn +} + +func (selfStruct *%[1]s) c() (result C.%[6]s, fin func()) { + self := selfStruct.Data + %[3]s + return (C.%[6]s)(%[4]s), func() { %[5]s } +} + +func new%[1]sFromC(cvalue *C.%[6]s) *%[1]s { + v := (%[8]s)(*cvalue) + return &%[1]s{Data: %[7]s} +} +`, + k.renameGoIdentifier(), + knownArgType.ArgType, + + knownArgType.ArgDef, + knownArgType.VarName, + knownArgType.Finalizer, + + k, + + fmt.Sprintf(knownReturnType.returnStmt, "v"), + knownArgType.CType, + ) + + validTypeNames = append(validTypeNames, k) + case IsCallbackTypedef(typedefs.data[k]): + glg.Infof("typedef %s is a callback. Not implemented yet", k) + case HasPrefix(typedefs.data[k], "struct"): + isOpaque := !IsStructName(k, structs) + glg.Infof("typedef %s is a struct (is opaque? %v).", k, isOpaque) + writeOpaqueStruct(k, isOpaque, callbacksGoSb) + validTypeNames = append(validTypeNames, k) + } + } + + fmt.Fprint(typedefsHeaderSb, + ` +#ifdef __cplusplus +} +#endif`) + + if err := os.WriteFile(fmt.Sprintf("%s_typedefs.go", prefix), []byte(callbacksGoSb.String()), 0644); err != nil { + return nil, fmt.Errorf("cannot write %s_typedefs.go: %w", prefix, err) + } + + if err := os.WriteFile(fmt.Sprintf("%s_typedefs.cpp", prefix), []byte(typedefsCppSb.String()), 0644); err != nil { + return nil, fmt.Errorf("cannot write %s_typedefs.cpp: %w", prefix, err) + } + + if err := os.WriteFile(fmt.Sprintf("%s_typedefs.h", prefix), []byte(typedefsHeaderSb.String()), 0644); err != nil { + return nil, fmt.Errorf("cannot write %s_typedefs.h: %w", prefix, err) + } + + return validTypeNames, nil +} + +func writeOpaqueStruct(name CIdentifier, isOpaque bool, sb *strings.Builder) { + // this will be put only for structs that are NOT opaque (w can know the exact definition) + var toPlainValue string + if !isOpaque { + toPlainValue = fmt.Sprintf(` +func (self %[1]s) c() (C.%[2]s, func()) { + result, fn := self.handle() + return *result, fn +} +`, name.renameGoIdentifier(), name) + } + + // we need to make it a struct, because we need to hide C type (otherwise it will duplicate methods) + fmt.Fprintf(sb, ` +type %[1]s struct { + CData *C.%[2]s +} + +func (self *%[1]s) handle() (result *C.%[2]s, fin func()) { + return self.CData, func() {} +} + +%[3]s + +func new%[1]sFromC(cvalue *C.%[2]s) *%[1]s { + return &%[1]s{CData: cvalue} +} +`, name.renameGoIdentifier(), name, toPlainValue) +} + +func IsStructName(name CIdentifier, structs []StructDef) bool { + for _, s := range structs { + if s.Name == name { + return true + } + } + + return false +} + +func IsEnumName(name CIdentifier, enums []EnumDef) bool { + for _, e := range enums { + if e.Name.renameEnum() == name.renameEnum() { // compare GO equivalents because C names has _ at their end + return true + } + } + + return false +} + +func IsTemplateTypedef(s string) bool { + return strings.Contains(s, "<") +} diff --git a/cmd/codegen/helpers.go b/cmd/codegen/helpers.go index 732958c4a..67ac26c1b 100644 --- a/cmd/codegen/helpers.go +++ b/cmd/codegen/helpers.go @@ -1,6 +1,9 @@ package main -import "strings" +import ( + "sort" + "strings" +) func HasPrefix[s ~string](str s, prefix string) bool { return strings.HasPrefix(string(str), prefix) @@ -18,8 +21,8 @@ func TrimSuffix[s ~string](str s, suffix string) s { return s(strings.TrimSuffix(string(str), suffix)) } -func ReplaceAll[s ~string](str s, old, new string) s { - return s(strings.ReplaceAll(string(str), old, new)) +func ReplaceAll[s, t, u ~string](str s, old t, new u) s { + return s(strings.ReplaceAll(string(str), string(old), string(new))) } func Contains[s ~string](str s, substr string) bool { @@ -58,3 +61,9 @@ func Index[s ~string](str s, substr string) int { func Capitalize[s ~string](str s) s { return s(strings.ToUpper(string(str[0]))) + str[1:] } + +func SortStrings[s ~string](str []s) { + sort.Slice(str, func(i, j int) bool { + return str[i] < str[j] + }) +} diff --git a/cmd/codegen/main.go b/cmd/codegen/main.go index a4db328ee..87aff4fa3 100644 --- a/cmd/codegen/main.go +++ b/cmd/codegen/main.go @@ -40,7 +40,9 @@ func getEnumAndStructNames(enumJsonBytes []byte) (enumNames []GoIdentifier, stru func main() { defJsonPath := flag.String("d", "", "definitions json file path") enumsJsonpath := flag.String("e", "", "structs and enums json file path") + typedefsJsonpath := flag.String("t", "", "typedefs dict json file path") refEnumsJsonPath := flag.String("r", "", "reference structs and enums json file path") + refTypedefsJsonPath := flag.String("rt", "", "reference typedefs_dict.json file path") prefix := flag.String("p", "", "prefix for the generated file") include := flag.String("i", "", "include header file") @@ -63,6 +65,11 @@ func main() { log.Panic(err) } + typedefsJsonBytes, err := os.ReadFile(*typedefsJsonpath) + if err != nil { + log.Panic(err) + } + enumJsonBytes, err := os.ReadFile(*enumsJsonpath) if err != nil { log.Panic(err) @@ -76,6 +83,14 @@ func main() { } } + var refTypedefsJsonBytes []byte + if len(*refTypedefsJsonPath) > 0 { + refTypedefsJsonBytes, err = os.ReadFile(*refTypedefsJsonPath) + if err != nil { + log.Panic(err) + } + } + // get definitions from json file funcs, err := getFunDefs(defJsonBytes) if err != nil { @@ -87,6 +102,11 @@ func main() { log.Panic(err.Error()) } + typedefs, err := getTypedefs(typedefsJsonBytes) + if err != nil { + log.Panic(err.Error()) + } + structs, err := getStructDefs(enumJsonBytes) if err != nil { log.Panic(err.Error()) @@ -106,9 +126,22 @@ func main() { } } + var refTypedefs = make(map[CIdentifier]string) + if len(refTypedefsJsonBytes) > 0 { + typedefs, err := getTypedefs(refTypedefsJsonBytes) + if err != nil { + log.Panic(err) + } + + refTypedefs = typedefs.data + } + + callbacks, err := proceedTypedefs(*prefix, typedefs, structs, enums, refTypedefs) + // generate code enumNames := generateGoEnums(*prefix, enums) - structNames := generateGoStructs(*prefix, structs, enums, es, ss) + //structNames := generateGoStructs(*prefix, structs, enums, es, ss, refTypedefs) + structNames := make([]CIdentifier, 0) structAccessorFuncs, err := generateCppStructsAccessor(*prefix, validFuncs, structs) if err != nil { @@ -122,7 +155,9 @@ func main() { structNames = append(structNames, ss...) } - if err := generateGoFuncs(*prefix, validFuncs, enumNames, structNames); err != nil { + structNames = append(structNames, callbacks...) + + if err := generateGoFuncs(*prefix, validFuncs, enumNames, structNames, refTypedefs); err != nil { log.Panic(err) } } diff --git a/cmd/codegen/return_wrapper.go b/cmd/codegen/return_wrapper.go index b7671e249..637cf67a8 100644 --- a/cmd/codegen/return_wrapper.go +++ b/cmd/codegen/return_wrapper.go @@ -14,57 +14,58 @@ func getReturnWrapper( t CIdentifier, structNames map[CIdentifier]bool, enumNames map[GoIdentifier]bool, + refTypedefs map[CIdentifier]string, ) (returnWrapper, error) { returnWrapperMap := map[CIdentifier]returnWrapper{ - "bool": {"bool", "%s == C.bool(true)"}, - "char": simpleR("rune"), - "unsigned char": simpleR("uint"), - "unsigned char*": {"*uint", "(*uint)(unsafe.Pointer(%s))"}, // NOTE: This should work but I'm not 100% sure - "char*": {"string", "C.GoString(%s)"}, - "const char*": {"string", "C.GoString(%s)"}, - "const ImWchar*": simpleR("(*Wchar)"), - "ImWchar*": simpleR("(*Wchar)"), - "ImWchar": simpleR("Wchar"), - "ImWchar16": simpleR("uint16"), - "float": simpleR("float32"), - "float*": simplePtrR("float32"), - "double": simpleR("float64"), - "double*": simplePtrR("float64"), - "int": simpleR("int32"), - "int*": simplePtrR("int32"), - "unsigned int": simpleR("uint32"), - "unsigned int*": simplePtrR("uint32"), - "short": simpleR("int16"), - "unsigned short": simpleR("uint16"), - "ImS8": simpleR("int"), - "ImS16": simpleR("int"), - "ImS32": simpleR("int"), - "ImS64": simpleR("int64"), - "ImU8": simpleR("byte"), - "ImU8*": simplePtrR("byte"), - "ImU16": simpleR("uint16"), - "ImU16*": simplePtrR("uint16"), - "ImU32": simpleR("uint32"), - "ImU32*": simplePtrR("uint32"), - "ImU64": simpleR("uint64"), - "ImU64*": simplePtrR("uint64"), - "ImVec4": wrappableR("Vec4"), - "const ImVec4*": imVec4PtrReturnW(), - "ImGuiID": simpleR("ID"), - "ImTextureID": simpleR("TextureID"), - "ImVec2": wrappableR("Vec2"), - "ImColor": wrappableR("Color"), - "ImPlotPoint": wrappableR("PlotPoint"), - "ImRect": wrappableR("Rect"), - "ImPlotTime": wrappableR("PlotTime"), - "ImGuiTableColumnIdx": simpleR("TableColumnIdx"), - "ImGuiTableDrawChannelIdx": simpleR("TableDrawChannelIdx"), - "void*": simpleR("unsafe.Pointer"), // TODO: disabled due to https://github.com/AllenDang/cimgui-go/issues/184 - "size_t": simpleR("uint64"), - "ImDrawIdx": simpleR("DrawIdx"), - "ImDrawIdx*": simplePtrR("DrawIdx"), + "bool": {"bool", "%s == C.bool(true)"}, + "char": simpleR("rune"), + "unsigned char": simpleR("uint"), + "unsigned char*": {"*uint", "(*uint)(unsafe.Pointer(%s))"}, // NOTE: This should work but I'm not 100% sure + "char*": {"string", "C.GoString(%s)"}, + "const char*": {"string", "C.GoString(%s)"}, + "const ImWchar*": simpleR("(*Wchar)"), + "ImWchar*": simpleR("(*Wchar)"), + "ImWchar": simpleR("Wchar"), + "ImWchar16": simpleR("uint16"), + "float": simpleR("float32"), + "float*": simplePtrR("float32"), + "double": simpleR("float64"), + "double*": simplePtrR("float64"), + "int": simpleR("int32"), + "int*": simplePtrR("int32"), + "unsigned int": simpleR("uint32"), + "unsigned int*": simplePtrR("uint32"), + "short": simpleR("int16"), + "unsigned short": simpleR("uint16"), + "ImS8": simpleR("int"), + "ImS16": simpleR("int"), + "ImS32": simpleR("int"), + "ImS64": simpleR("int64"), + "ImU8": simpleR("byte"), + "ImU8*": simplePtrR("byte"), + "ImU16": simpleR("uint16"), + "ImU16*": simplePtrR("uint16"), + "ImU32": simpleR("uint32"), + "ImU32*": simplePtrR("uint32"), + "ImU64": simpleR("uint64"), + "ImU64*": simplePtrR("uint64"), + "ImVec4": wrappableR("Vec4"), + "const ImVec4*": imVec4PtrReturnW(), + "ImVec2": wrappableR("Vec2"), + "ImColor": wrappableR("Color"), + "ImPlotPoint": wrappableR("PlotPoint"), + "ImRect": wrappableR("Rect"), + "ImPlotTime": wrappableR("PlotTime"), + "uintptr_t": simpleR("uintptr"), + "size_t": simpleR("uint64"), } + pureType := TrimPrefix(TrimSuffix(t, "*"), "const ") + // check if pureType is a declared type (struct or something else from typedefs) + _, isRefStruct := refTypedefs[pureType] + _, shouldSkipRefTypedef := skippedTypedefs[pureType] + _, isStruct := structNames[pureType] + isStruct = isStruct || (isRefStruct && !shouldSkipRefTypedef) w, known := returnWrapperMap[t] switch { case known: @@ -83,7 +84,7 @@ func getReturnWrapper( case HasPrefix(t, "ImVector_") && !(HasSuffix(t, "*") || HasSuffix(t, "]")): pureType := CIdentifier(TrimPrefix(t, "ImVector_") + "*") - rw, err := getReturnWrapper(pureType, structNames, enumNames) + rw, err := getReturnWrapper(pureType, structNames, enumNames, refTypedefs) if err != nil { return returnWrapper{}, fmt.Errorf("creating vector wrapper %w", err) } @@ -91,16 +92,16 @@ func getReturnWrapper( returnType: GoIdentifier(fmt.Sprintf("Vector[%s]", rw.returnType)), returnStmt: fmt.Sprintf("newVectorFromC(%%[1]s.Size, %%[1]s.Capacity, %s)", fmt.Sprintf(rw.returnStmt, "%[1]s.Data")), }, nil - case HasSuffix(t, "*") && structNames[TrimPrefix(TrimSuffix(t, "*"), "const ")] && !shouldSkipStruct(TrimPrefix(TrimSuffix(t, "*"), "const ")): - return returnWrapper{ - returnType: "*" + TrimPrefix(TrimSuffix(t, "*"), "const ").renameGoIdentifier(), - returnStmt: fmt.Sprintf("new%sFromC(%%s)", TrimPrefix(TrimSuffix(t, "*"), "const ").renameGoIdentifier()), - }, nil case HasSuffix(t, "*") && isEnum(TrimSuffix(t, "*"), enumNames): return returnWrapper{ returnType: "*" + TrimSuffix(t, "*").renameEnum(), returnStmt: fmt.Sprintf("(*%s)(%%s)", TrimSuffix(t, "*").renameEnum()), }, nil + case HasSuffix(t, "*") && isStruct && !shouldSkipStruct(pureType): + return returnWrapper{ + returnType: "*" + TrimPrefix(TrimSuffix(t, "*"), "const ").renameGoIdentifier(), + returnStmt: fmt.Sprintf("new%sFromC(%%s)", TrimPrefix(TrimSuffix(t, "*"), "const ").renameGoIdentifier()), + }, nil default: return returnWrapper{}, fmt.Errorf("unknown return type %s", t) } diff --git a/cmd/codegen/typedefs.go b/cmd/codegen/typedefs.go new file mode 100644 index 000000000..a63f0190b --- /dev/null +++ b/cmd/codegen/typedefs.go @@ -0,0 +1,16 @@ +package main + +import "encoding/json" + +type Typedefs struct { + data map[CIdentifier]string +} + +func getTypedefs(data []byte) (*Typedefs, error) { + var ret map[CIdentifier]string + if err := json.Unmarshal(data, &ret); err != nil { + return nil, err + } + + return &Typedefs{data: ret}, nil +} diff --git a/extra_types.go b/extra_types.go index 862f7542d..3ff5813da 100644 --- a/extra_types.go +++ b/extra_types.go @@ -12,13 +12,7 @@ import ( ) type ( - Wchar C.uint - ID C.ImGuiID - TextureID C.ImTextureID - DrawIdx C.ImDrawIdx - TableColumnIdx C.ImGuiTableColumnIdx - TableDrawChannelIdx C.ImGuiTableDrawChannelIdx - KeyChord C.ImGuiKeyChord + Wchar C.uint ) var _ wrappableType[C.ImVec2, *Vec2] = &Vec2{} diff --git a/glfw_backend.go b/glfw_backend.go index 52b5410ff..92100ba06 100644 --- a/glfw_backend.go +++ b/glfw_backend.go @@ -347,15 +347,17 @@ func (b *GLFWBackend) Refresh() { } func (b *GLFWBackend) CreateTexture(pixels unsafe.Pointer, width, height int) TextureID { - return TextureID(C.igCreateTexture((*C.uchar)(pixels), C.int(width), C.int(height))) + tex := C.igCreateTexture((*C.uchar)(pixels), C.int(width), C.int(height)) + return *newTextureIDFromC(&tex) } func (b *GLFWBackend) CreateTextureRgba(img *image.RGBA, width, height int) TextureID { - return TextureID(C.igCreateTexture((*C.uchar)(&(img.Pix[0])), C.int(width), C.int(height))) + tex := C.igCreateTexture((*C.uchar)(&(img.Pix[0])), C.int(width), C.int(height)) + return *newTextureIDFromC(&tex) } func (b *GLFWBackend) DeleteTexture(id TextureID) { - C.igDeleteTexture(C.ImTextureID(id)) + C.igDeleteTexture(C.ImTextureID(id.Data)) } // SetDropCallback sets the drop callback which is called when an object diff --git a/sdl_backend.go b/sdl_backend.go index 2af375256..877394ce7 100644 --- a/sdl_backend.go +++ b/sdl_backend.go @@ -3,7 +3,7 @@ package imgui // #cgo amd64,linux LDFLAGS: ${SRCDIR}/lib/linux/x64/libSDL2.a -ldl -lGL -lX11 -// #cgo amd64,windows LDFLAGS: -L${SRCDIR}/lib/windows/x64 -Wl,-Bstatic -lmingw32 -lSDL2 -mwindows -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid -Wl,-Bdynamic +// #cgo amd64,windows LDFLAGS: -L${SRCDIR}/lib/windows/x64 -l:libSDL2.a -lgdi32 -lopengl32 -limm32 -mwindows -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid // #cgo darwin LDFLAGS: -framework Cocoa -framework IOKit -framework CoreVideo // #cgo amd64,darwin LDFLAGS: ${SRCDIR}/lib/macos/x64/libSDL2.a // #cgo arm64,darwin LDFLAGS: ${SRCDIR}/lib/macos/arm64/libSDL2.a @@ -353,15 +353,17 @@ func (b *SDLBackend) Refresh() { } func (b *SDLBackend) CreateTexture(pixels unsafe.Pointer, width, height int) TextureID { - return TextureID(C.igCreateTexture((*C.uchar)(pixels), C.int(width), C.int(height))) + tex := C.igCreateTexture((*C.uchar)(pixels), C.int(width), C.int(height)) + return *newTextureIDFromC(&tex) } func (b *SDLBackend) CreateTextureRgba(img *image.RGBA, width, height int) TextureID { - return TextureID(C.igCreateTexture((*C.uchar)(&(img.Pix[0])), C.int(width), C.int(height))) + tex := C.igCreateTexture((*C.uchar)(&(img.Pix[0])), C.int(width), C.int(height)) + return *newTextureIDFromC(&tex) } func (b *SDLBackend) DeleteTexture(id TextureID) { - C.igDeleteTexture(C.ImTextureID(id)) + C.igDeleteTexture(C.ImTextureID(id.Data)) } // SetDropCallback sets the drop callback which is called when an object diff --git a/texture.go b/texture.go index a7cf7588f..6c5731347 100644 --- a/texture.go +++ b/texture.go @@ -23,7 +23,7 @@ type Texture struct { func NewTextureFromRgba(rgba *image.RGBA) *Texture { texID := textureManager.CreateTextureRgba(rgba, rgba.Bounds().Dx(), rgba.Bounds().Dy()) - if texID == nil { + if texID.Data == 0 { return nil }