From 2ee3c03a8489a761bc99b5b6df81de920898ab04 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Tue, 26 Sep 2023 21:33:00 +0200 Subject: [PATCH 01/68] codegen: read typedefs_dict.json file --- Makefile | 13 +++++++------ cmd/codegen/main.go | 12 ++++++++++++ cmd/codegen/typedefs.go | 16 ++++++++++++++++ 3 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 cmd/codegen/typedefs.go diff --git a/Makefile b/Makefile index df1a7a9da..917daec67 100644 --- a/Makefile +++ b/Makefile @@ -17,10 +17,11 @@ 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 @@ -28,7 +29,7 @@ define generate 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 +38,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,cimtui/cimplot_templates/typedefs_dict.json,-r cimgui/cimgui_templates/structs_and_enums.json) endef ## cimplot: generate implot binding @@ -46,7 +47,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) endef ## cimnodes: generate imnodes binding @@ -55,7 +56,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) endef ## cimmarkdown: generate immarkdown binding diff --git a/cmd/codegen/main.go b/cmd/codegen/main.go index a4db328ee..1771b85d9 100644 --- a/cmd/codegen/main.go +++ b/cmd/codegen/main.go @@ -40,6 +40,7 @@ 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") prefix := flag.String("p", "", "prefix for the generated file") include := flag.String("i", "", "include header file") @@ -63,6 +64,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) @@ -87,6 +93,12 @@ func main() { log.Panic(err.Error()) } + typedefs, err := getTypedefs(typedefsJsonBytes) + if err != nil { + log.Panic(err.Error()) + } + fmt.Println(typedefs) + structs, err := getStructDefs(enumJsonBytes) if err != nil { log.Panic(err.Error()) diff --git a/cmd/codegen/typedefs.go b/cmd/codegen/typedefs.go new file mode 100644 index 000000000..ad39263f6 --- /dev/null +++ b/cmd/codegen/typedefs.go @@ -0,0 +1,16 @@ +package main + +import "encoding/json" + +type Typedefs struct { + data map[string]string +} + +func getTypedefs(data []byte) (*Typedefs, error) { + var ret map[string]string + if err := json.Unmarshal(data, &ret); err != nil { + return nil, err + } + + return &Typedefs{data: ret}, nil +} From 6f6f9eda7f41daf9fb9405133ed313691ce34788 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Tue, 26 Sep 2023 21:50:31 +0200 Subject: [PATCH 02/68] gengo: add IsCallbackTypedef and test for it generally I'm to lazy to write unittests, but in this particular case it is useful to state whether my regex works and to ensure that it will not crash in future --- cmd/codegen/gengo.go | 13 +++++++++++++ cmd/codegen/gengo_test.go | 25 +++++++++++++++++++++++++ cmd/codegen/main.go | 3 ++- 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 cmd/codegen/gengo_test.go diff --git a/cmd/codegen/gengo.go b/cmd/codegen/gengo.go index a7126b55c..53b6f3e60 100644 --- a/cmd/codegen/gengo.go +++ b/cmd/codegen/gengo.go @@ -1,6 +1,7 @@ package main import ( + "regexp" "strings" ) @@ -85,3 +86,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_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/main.go b/cmd/codegen/main.go index 1771b85d9..50a01106a 100644 --- a/cmd/codegen/main.go +++ b/cmd/codegen/main.go @@ -97,7 +97,8 @@ func main() { if err != nil { log.Panic(err.Error()) } - fmt.Println(typedefs) + + _ = typedefs structs, err := getStructDefs(enumJsonBytes) if err != nil { From 5f0216193267cce4b5ad32dba9664c10d6d798de Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Wed, 27 Sep 2023 09:29:00 +0200 Subject: [PATCH 03/68] proceed typedefs implement opaque structs and alias types --- Makefile | 2 +- cmd/codegen/arguments_wrapper.go | 4 +- cmd/codegen/gengo_typedefs.go | 133 +++++++++++++++++++++++++++++++ cmd/codegen/helpers.go | 11 ++- cmd/codegen/main.go | 6 +- cmd/codegen/typedefs.go | 4 +- 6 files changed, 153 insertions(+), 7 deletions(-) create mode 100644 cmd/codegen/gengo_typedefs.go diff --git a/Makefile b/Makefile index 917daec67..f25cf3b88 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,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,cimtui/cimplot_templates/typedefs_dict.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) endef ## cimplot: generate implot binding diff --git a/cmd/codegen/arguments_wrapper.go b/cmd/codegen/arguments_wrapper.go index 454af3e8b..dad4ed75d 100644 --- a/cmd/codegen/arguments_wrapper.go +++ b/cmd/codegen/arguments_wrapper.go @@ -22,6 +22,9 @@ type ArgumentWrapperData struct { VarName string NoFin bool + + // CType is a valid type that will have VarName. + CType GoIdentifier } type argumentWrapper func(arg ArgDef) ArgumentWrapperData @@ -173,7 +176,6 @@ func getArgWrapper(a *ArgDef, makeFirstArgReceiver, isGetter bool, structNames m Name: dataName, Type: pureType, }, false, false, structNames, enumNames) - if err != nil { return "", ArgumentWrapperData{}, fmt.Errorf("creating vector wrapper %w", err) } diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go new file mode 100644 index 000000000..4f90dfccf --- /dev/null +++ b/cmd/codegen/gengo_typedefs.go @@ -0,0 +1,133 @@ +package main + +import "C" +import ( + "fmt" + "github.com/kpango/glg" + "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(typedefs *Typedefs, structs []StructDef, enums []EnumDef) (validTypeNames []CIdentifier, err error) { + // we need FILES + callbacksGoSb := &strings.Builder{} + //callbacksCSb := &strings.Builder{} + + // 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 { + 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(typedefs.data[k]) { + glg.Infof("typedef %s is a template. not implemented yet", k) + continue + } + + knownReturnType, returnTypeErr := getReturnWrapper( + CIdentifier(typedefs.data[k]), + map[CIdentifier]bool{}, + map[GoIdentifier]bool{}, + ) + + _, knownArgType, argTypeErr := getArgWrapper( + &ArgDef{ + Name: "self", + Type: CIdentifier(typedefs.data[k]), + }, + false, false, + map[CIdentifier]bool{}, + map[GoIdentifier]bool{}, + ) + + // check if k is a name of struct from structDefs + switch { + case returnTypeErr == nil && argTypeErr == nil: + glg.Infof("typedef %s is an alias typedef.", k) + fmt.Fprintf(callbacksGoSb, ` +type %[1]s %[2]s + +func (self %[1]s) handle() (result *%[2]s, fin func()) { + %[3]s + return %[4]s, %[5]s +} + +func (self %[1]s) c() (%[2]s, func()) { + result, fin := self.handle() + return *result, fin +} + +func new%[1]sFromC(cvalue %[6]s) { + return %[7]s +} +`, k.renameGoIdentifier(), knownArgType.ArgType, knownArgType.ArgDef, knownArgType.VarName, knownArgType.Finalizer, knownArgType.CType, fmt.Sprintf(knownReturnType.returnStmt, "cvalue")) + + 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"): + glg.Infof("typedef %s is an opaque struct.", k) + writeOpaqueStruct(k, callbacksGoSb) + validTypeNames = append(validTypeNames, k) + } + } + + fmt.Println(callbacksGoSb.String()) + + return validTypeNames, nil +} + +func writeOpaqueStruct(name CIdentifier, sb *strings.Builder) { + fmt.Fprintf(sb, ` +type %[1]s C.%[2]s + +func (self %[1]s) handle() (result *C.%[2]s, fin func()) { + result = (*C.%[2]s)(unsafe.Pointer(&self)) + return result, func() {} +} + +func (self %[1]s) c() (C.%[2]s, func()) { + result, fin := self.handle() + return *result, fin +} + +func new%[2]sFromC(cvalue *C.%[2]s) *%[1]s { + return (*%[1]s)(cvalue) +} +`, name.renameGoIdentifier(), name) +} + +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..156d3024f 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) @@ -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 50a01106a..8c9e8dcf9 100644 --- a/cmd/codegen/main.go +++ b/cmd/codegen/main.go @@ -98,13 +98,13 @@ func main() { log.Panic(err.Error()) } - _ = typedefs - structs, err := getStructDefs(enumJsonBytes) if err != nil { log.Panic(err.Error()) } + callbacks, err := proceedTypedefs(typedefs, structs, enums) + validFuncs, err := generateCppWrapper(*prefix, *include, funcs) if err != nil { log.Panic(err) @@ -135,6 +135,8 @@ func main() { structNames = append(structNames, ss...) } + structNames = append(structNames, callbacks...) + if err := generateGoFuncs(*prefix, validFuncs, enumNames, structNames); err != nil { log.Panic(err) } diff --git a/cmd/codegen/typedefs.go b/cmd/codegen/typedefs.go index ad39263f6..a63f0190b 100644 --- a/cmd/codegen/typedefs.go +++ b/cmd/codegen/typedefs.go @@ -3,11 +3,11 @@ package main import "encoding/json" type Typedefs struct { - data map[string]string + data map[CIdentifier]string } func getTypedefs(data []byte) (*Typedefs, error) { - var ret map[string]string + var ret map[CIdentifier]string if err := json.Unmarshal(data, &ret); err != nil { return nil, err } From b14e614425ad7f8716446e36049c7f9106315b5a Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Wed, 27 Sep 2023 09:41:16 +0200 Subject: [PATCH 04/68] codegen: make it write down typedefs file --- Makefile | 1 + cmd/codegen/gengo_typedefs.go | 19 +++++++++++++++++-- cmd/codegen/main.go | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index f25cf3b88..6bc9978d6 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,7 @@ define generate 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 endef diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index 4f90dfccf..543a7fdbc 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -4,15 +4,26 @@ 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(typedefs *Typedefs, structs []StructDef, enums []EnumDef) (validTypeNames []CIdentifier, err error) { +func proceedTypedefs(prefix string, typedefs *Typedefs, structs []StructDef, enums []EnumDef) (validTypeNames []CIdentifier, err error) { // we need FILES callbacksGoSb := &strings.Builder{} + callbacksGoSb.WriteString(goPackageHeader) + fmt.Fprintf(callbacksGoSb, + `// #include +// #include +// #include "extra_types.h" +// #include "%s_wrapper.h" +import "C" +import "unsafe" + +`, prefix) //callbacksCSb := &strings.Builder{} // because go ranges through maps as if it was drunken, we need to sort keys. @@ -60,7 +71,7 @@ type %[1]s %[2]s func (self %[1]s) handle() (result *%[2]s, fin func()) { %[3]s - return %[4]s, %[5]s + return %[4]s, func() { %[5]s } } func (self %[1]s) c() (%[2]s, func()) { @@ -85,6 +96,10 @@ func new%[1]sFromC(cvalue %[6]s) { fmt.Println(callbacksGoSb.String()) + 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) + } + return validTypeNames, nil } diff --git a/cmd/codegen/main.go b/cmd/codegen/main.go index 8c9e8dcf9..dbbc209fb 100644 --- a/cmd/codegen/main.go +++ b/cmd/codegen/main.go @@ -103,7 +103,7 @@ func main() { log.Panic(err.Error()) } - callbacks, err := proceedTypedefs(typedefs, structs, enums) + callbacks, err := proceedTypedefs(*prefix, typedefs, structs, enums) validFuncs, err := generateCppWrapper(*prefix, *include, funcs) if err != nil { From 4ea591c3bf0acd1a7943e8c43b9c8fb1e3b89442 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Wed, 27 Sep 2023 10:27:16 +0200 Subject: [PATCH 05/68] codgen: implement CType; remove extra_types --- cmd/codegen/arguments_wrapper.go | 218 ++++++++++++++++--------------- cmd/codegen/return_wrapper.go | 88 ++++++------- extra_types.go | 8 +- 3 files changed, 152 insertions(+), 162 deletions(-) diff --git a/cmd/codegen/arguments_wrapper.go b/cmd/codegen/arguments_wrapper.go index dad4ed75d..a9c4ea9fd 100644 --- a/cmd/codegen/arguments_wrapper.go +++ b/cmd/codegen/arguments_wrapper.go @@ -31,100 +31,92 @@ 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) { 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"), + "void*": voidPtrW, + "const void*": simpleW("unsafe.Pointer", ""), + "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*": 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" { @@ -251,6 +243,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", } } @@ -261,6 +254,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", } } @@ -268,6 +262,7 @@ func uCharPtrW(arg ArgDef) ArgumentWrapperData { return ArgumentWrapperData{ ArgType: "*C.uchar", VarName: fmt.Sprintf("&%s", arg.Name), + CType: "*C.uchar", } } @@ -275,6 +270,7 @@ func sizeTPtrW(arg ArgDef) ArgumentWrapperData { return ArgumentWrapperData{ ArgType: "*uint64", VarName: fmt.Sprintf("(*C.xulong)(%s)", arg.Name), + CType: "*C.xulong", } } @@ -282,6 +278,7 @@ func floatArrayW(arg ArgDef) ArgumentWrapperData { return ArgumentWrapperData{ ArgType: "[]float32", VarName: fmt.Sprintf("(*C.float)(&(%s[0]))", arg.Name), + CType: "*C.float", } } @@ -292,6 +289,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", } } @@ -299,6 +297,7 @@ func int64ArrayW(arg ArgDef) ArgumentWrapperData { return ArgumentWrapperData{ ArgType: "[]int64", VarName: fmt.Sprintf("(*C.longlong)(&(%s[0]))", arg.Name), + CType: "*C.longlong", } } @@ -306,6 +305,7 @@ func uint64ArrayW(arg ArgDef) ArgumentWrapperData { return ArgumentWrapperData{ ArgType: "[]uint64", VarName: fmt.Sprintf("(*C.ulonglong)(&(%s[0]))", arg.Name), + CType: "*C.ulonglong", } } @@ -316,23 +316,19 @@ func voidPtrW(arg ArgDef) ArgumentWrapperData { 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", } } -func inputeTextCallbackW(arg ArgDef) (argType string, def string, varName string) { - argType = "ImGuiInputTextCallback" - // TODO: implement me - return -} - // 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, } } } @@ -340,7 +336,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)), @@ -348,12 +344,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)) @@ -371,12 +368,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 { @@ -393,22 +391,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, @@ -416,11 +416,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)) @@ -440,6 +441,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/return_wrapper.go b/cmd/codegen/return_wrapper.go index b7671e249..8ec8cf8dd 100644 --- a/cmd/codegen/return_wrapper.go +++ b/cmd/codegen/return_wrapper.go @@ -16,53 +16,47 @@ func getReturnWrapper( enumNames map[GoIdentifier]bool, ) (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"), + "void*": simpleR("unsafe.Pointer"), // TODO: disabled due to https://github.com/AllenDang/cimgui-go/issues/184 + "size_t": simpleR("uint64"), } w, known := returnWrapperMap[t] 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{} From d9441bae1c1fd2ae7a36bb49d904b9131521770e Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Wed, 27 Sep 2023 10:29:35 +0200 Subject: [PATCH 06/68] gngo: check if typedef should be skipped as struct --- cmd/codegen/gengo_typedefs.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index 543a7fdbc..e9d2f766b 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -36,6 +36,10 @@ import "unsafe" SortStrings(keys) for _, k := range keys { + if shouldSkipStruct(k) { + glg.Infof("Arbitrarly skipping struct %s", k) + } + if IsEnumName(k, enums) || IsStructName(k, structs) { glg.Infof("typedef %s has extended deffinition in structs_and_enums.json. Will generate later", k) continue From bba94c2c674140165360529738769801d0ab2576 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Wed, 27 Sep 2023 10:39:39 +0200 Subject: [PATCH 07/68] add missing continue --- cmd/codegen/gengo_typedefs.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index e9d2f766b..19197e71c 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -38,6 +38,7 @@ import "unsafe" for _, k := range keys { if shouldSkipStruct(k) { glg.Infof("Arbitrarly skipping struct %s", k) + continue } if IsEnumName(k, enums) || IsStructName(k, structs) { From c0e4626907242f7d9f45cff1ec959bf739629497 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Wed, 27 Sep 2023 10:40:05 +0200 Subject: [PATCH 08/68] regenerate code --- cimgui_funcs.go | 2424 +++++++++++++++++++++++++++++++-------- cimgui_structs.go | 1098 ++---------------- cimgui_typedefs.go | 302 +++++ cimmarkdown_funcs.go | 15 - cimmarkdown_structs.go | 49 +- cimmarkdown_typedefs.go | 11 + cimnodes_funcs.go | 89 ++ cimnodes_typedefs.go | 75 ++ cimplot_funcs.go | 123 -- cimplot_structs.go | 44 +- cimplot_typedefs.go | 27 + 11 files changed, 2535 insertions(+), 1722 deletions(-) create mode 100644 cimgui_typedefs.go create mode 100644 cimmarkdown_typedefs.go create mode 100644 cimnodes_typedefs.go create mode 100644 cimplot_typedefs.go diff --git a/cimgui_funcs.go b/cimgui_funcs.go index 40a4f7344..12ec9d1d0 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: @@ -675,9 +681,11 @@ func (self *DrawList) PrimVtx(pos Vec2, uv Vec2, col uint32) { func (self *DrawList) PrimWriteIdx(idx DrawIdx) { selfArg, selfFin := self.handle() - C.ImDrawList_PrimWriteIdx(selfArg, C.ImDrawIdx(idx)) + idxArg, idxFin := idx.c() + C.ImDrawList_PrimWriteIdx(selfArg, idxArg) selfFin() + idxFin() } func (self *DrawList) PrimWriteVtx(pos Vec2, uv Vec2, col uint32) { @@ -706,9 +714,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 { @@ -1127,9 +1137,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() { @@ -1476,7 +1488,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 +1690,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. @@ -2362,20 +2381,32 @@ 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 { + _keyArg, _keyFin := _key.c() _val_pArg, _val_pFin := WrapVoidPtr(_val_p) defer func() { + _keyFin() _val_pFin() }() - return newStoragePairFromC(C.ImGuiStoragePair_ImGuiStoragePair_Ptr(C.ImGuiID(_key), _val_pArg)) + return newStoragePairFromC(C.ImGuiStoragePair_ImGuiStoragePair_Ptr(_keyArg, _val_pArg)) } func (self *StoragePair) Destroy() { @@ -2403,65 +2434,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 { selfArg, selfFin := self.handle() + keyArg, keyFin := key.c() defer func() { selfFin() + keyFin() }() - return unsafe.Pointer(C.ImGuiStorage_GetVoidPtr(selfArg, C.ImGuiID(key))) + return unsafe.Pointer(C.ImGuiStorage_GetVoidPtr(selfArg, keyArg)) } func (self *Storage) SetAllInt(val int32) { @@ -2473,31 +2516,39 @@ 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) { selfArg, selfFin := self.handle() + keyArg, keyFin := key.c() valArg, valFin := WrapVoidPtr(val) - C.ImGuiStorage_SetVoidPtr(selfArg, C.ImGuiID(key), valArg) + C.ImGuiStorage_SetVoidPtr(selfArg, keyArg, valArg) selfFin() + keyFin() valFin() } @@ -3089,7 +3140,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,7 +3149,7 @@ 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 { @@ -3107,7 +3158,7 @@ func (self *Window) InternalIDPtr(ptr unsafe.Pointer) ID { defer func() { selfFin() }() - return ID(C.ImGuiWindow_GetID_Ptr(selfArg, (ptr))) + return *newIDFromC(func() *C.ImGuiID { result := C.ImGuiWindow_GetID_Ptr(selfArg, (ptr)); return &result }()) } // InternalIDStrV parameter default value hint: @@ -3122,7 +3173,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 +3531,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 +3545,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 +3597,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 +3623,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 +3668,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 +3722,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 +3839,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 +3917,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 +4004,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 +4173,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 +4202,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 +4426,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() @@ -4440,17 +4541,26 @@ func InternalDebugDrawLineExtentsV(col uint32) { } 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)) + idArg, idFin := id.c() + C.igDebugHookIdInfo(idArg, C.ImGuiDataType(data_type), (data_id), (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 +4752,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 +4774,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 +4882,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 +4898,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 +4913,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 +5039,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 +5069,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 +5094,23 @@ 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 { + idArg, idFin := id.c() p_vArg, p_vFin := WrapVoidPtr(p_v) formatArg, formatFin := WrapString(format) defer func() { + idFin() p_vFin() 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.igDragBehavior(idArg, C.ImGuiDataType(data_type), p_vArg, C.float(v_speed), (p_min), (p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) } // If v_min >= v_max we have no bound @@ -5376,11 +5543,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,7 +5574,12 @@ func InternalFindSettingsHandler(type_name string) *SettingsHandler { // this is a helper for backends. func FindViewportByID(id ID) *Viewport { - return newViewportFromC(C.igFindViewportByID(C.ImGuiID(id))) + idArg, idFin := id.c() + + defer func() { + idFin() + }() + 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.) @@ -5419,7 +5593,12 @@ func FindViewportByPlatformHandle(platform_handle unsafe.Pointer) *Viewport { } 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 +5620,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 +5681,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 +5767,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 +5811,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 +5896,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 +5961,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))) + return *newIDFromC(func() *C.ImGuiID { result := C.igGetID_Ptr((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 +6000,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 +6011,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 +6021,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 +6035,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 +6079,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 +6122,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 +6236,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 +6358,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 +6398,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 +6408,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 +6417,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 { @@ -6517,7 +6723,12 @@ 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))) + seedArg, seedFin := seed.c() + + defer func() { + seedFin() + }() + return *newIDFromC(func() *C.ImGuiID { result := C.igImHashData((data), C.xulong(data_size), seedArg); return &result }()) } // InternalImHashStrV parameter default value hint: @@ -6525,11 +6736,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 +7226,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 +7239,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 @@ -7267,7 +7492,10 @@ func InputScalarNV(label string, data_type DataType, p_data unsafe.Pointer, comp } 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 +7539,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 +7619,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 +7650,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 +7690,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 +7704,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 +7754,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 +7776,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 +7890,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 +7923,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,7 +8070,10 @@ 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) + + idFin() } func MemAlloc(size uint64) unsafe.Pointer { @@ -7943,7 +8224,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 +8245,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 +8374,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 @@ -8141,7 +8431,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 +8492,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,7 +8583,10 @@ 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. @@ -8453,12 +8751,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 +8810,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() } @@ -8606,14 +8910,19 @@ func SetDragDropPayloadV(typeArg string, data unsafe.Pointer, sz uint64, cond Co } 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 +8948,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 +8973,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 +8985,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) { @@ -8697,6 +9022,13 @@ func SetNextItemOpenV(is_open bool, cond Cond) { C.igSetNextItemOpen(C.bool(is_open), C.ImGuiCond(cond)) } +func InternalSetNextItemSelectionUserData(selection_user_data SelectionUserData) { + selection_user_dataArg, selection_user_dataFin := selection_user_data.c() + C.igSetNextItemSelectionUserData(selection_user_dataArg) + + selection_user_dataFin() +} + // set width of the _next_ common large "item+label" widget. >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -FLT_MIN always align width to the right side) func SetNextItemWidth(item_width float32) { C.igSetNextItemWidth(C.float(item_width)) @@ -8731,7 +9063,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 +9096,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 +9172,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 +9241,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 +9359,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. @@ -9136,16 +9490,18 @@ func SliderAngleV(label string, v_rad *float32, v_degrees_min float32, v_degrees } 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 { + idArg, idFin := id.c() p_vArg, p_vFin := WrapVoidPtr(p_v) formatArg, formatFin := WrapString(format) out_grab_bbArg, out_grab_bbFin := wrap[C.ImRect, *Rect](out_grab_bb) defer func() { + idFin() p_vFin() 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.igSliderBehavior(bb.toC(), idArg, C.ImGuiDataType(data_type), p_vArg, (p_min), (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. @@ -9377,14 +9733,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 +9820,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 +9907,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 +9977,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 +10057,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 +10164,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 +10210,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 +10351,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 +10374,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 +10433,64 @@ 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 { + 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.igTempInputScalar(bb.toC(), idArg, labelArg, C.ImGuiDataType(data_type), p_dataArg, formatArg, (p_clamp_min), (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,14 +10553,16 @@ 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 { @@ -10188,12 +10597,20 @@ 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) } // " @@ -10233,7 +10650,10 @@ func TreePop() { } func InternalTreePushOverrideID(id ID) { - C.igTreePushOverrideID(C.ImGuiID(id)) + idArg, idFin := id.c() + C.igTreePushOverrideID(idArg) + + idFin() } // " @@ -10467,23 +10887,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) { @@ -10726,47 +11152,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 +11242,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 +11273,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 +11413,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 +11432,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 +11618,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 +11638,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 { @@ -11425,7 +11883,7 @@ func InternalImFileLoadToMemory(filename string, mode string) unsafe.Pointer { } func InternalImHashData(data unsafe.Pointer, data_size uint64) ID { - return ID(C.wrap_igImHashData((data), C.xulong(data_size))) + return *newIDFromC(func() *C.ImGuiID { result := C.wrap_igImHashData((data), C.xulong(data_size)); return &result }()) } func InternalImHashStr(data string) ID { @@ -11434,7 +11892,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 +11907,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() { @@ -11671,7 +12141,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 +12154,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 +12205,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 +12300,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 +12311,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 +12377,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() { @@ -11994,11 +12488,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 +12516,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 +12551,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 +12614,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() { @@ -12295,14 +12810,16 @@ func SliderScalarN(label string, data_type DataType, p_data unsafe.Pointer, comp } 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 +12857,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() { @@ -12363,16 +12883,18 @@ func TableSetupColumn(label string) { } func InternalTempInputScalar(bb Rect, id ID, label string, data_type DataType, p_data unsafe.Pointer, 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), p_dataArg, formatArg) == C.bool(true) } func InternalTextEx(text string) { @@ -12390,12 +12912,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 { @@ -12508,7 +13032,7 @@ func (self *DrawChannel) CmdBuffer() Vector[*DrawCmd] { func (self DrawChannel) SetIdxBuffer(v Vector[*DrawIdx]) { vData := v.Data - vDataArg, _ := WrapNumberPtr[C.ImDrawIdx, DrawIdx](vData) + vDataArg, _ := vData.handle() vVecArg := new(C.ImVector_ImDrawIdx) vVecArg.Size = C.int(v.Size) vVecArg.Capacity = C.int(v.Capacity) @@ -12526,7 +13050,7 @@ func (self *DrawChannel) IdxBuffer() Vector[*DrawIdx] { 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 newVectorFromC(C.wrap_ImDrawChannel_Get_IdxBuffer(selfArg).Size, C.wrap_ImDrawChannel_Get_IdxBuffer(selfArg).Capacity, newDrawIdxFromC(C.wrap_ImDrawChannel_Get_IdxBuffer(selfArg).Data)) } func (self DrawCmd) SetClipRect(v Vec4) { @@ -12545,9 +13069,11 @@ func (self *DrawCmd) ClipRect() Vec4 { } func (self DrawCmd) SetTextureId(v TextureID) { + vArg, _ := v.c() + 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 +13082,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) { @@ -12637,9 +13165,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 +13178,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) { @@ -12813,7 +13345,7 @@ func (self *DrawList) CmdBuffer() Vector[*DrawCmd] { func (self DrawList) SetIdxBuffer(v Vector[*DrawIdx]) { vData := v.Data - vDataArg, _ := WrapNumberPtr[C.ImDrawIdx, DrawIdx](vData) + vDataArg, _ := vData.handle() vVecArg := new(C.ImVector_ImDrawIdx) vVecArg.Size = C.int(v.Size) vVecArg.Capacity = C.int(v.Capacity) @@ -12831,7 +13363,7 @@ func (self *DrawList) IdxBuffer() Vector[*DrawIdx] { defer func() { selfFin() }() - return newVectorFromC(C.wrap_ImDrawList_GetIdxBuffer(selfArg).Size, C.wrap_ImDrawList_GetIdxBuffer(selfArg).Capacity, (*DrawIdx)(C.wrap_ImDrawList_GetIdxBuffer(selfArg).Data)) + return newVectorFromC(C.wrap_ImDrawList_GetIdxBuffer(selfArg).Size, C.wrap_ImDrawList_GetIdxBuffer(selfArg).Capacity, newDrawIdxFromC(C.wrap_ImDrawList_GetIdxBuffer(selfArg).Data)) } func (self DrawList) SetVtxBuffer(v Vector[*DrawVert]) { @@ -12939,7 +13471,7 @@ func (self *DrawList) VtxWritePtr() *DrawVert { } func (self DrawList) SetIdxWritePtr(v *DrawIdx) { - vArg, _ := WrapNumberPtr[C.ImDrawIdx, DrawIdx](v) + vArg, _ := v.handle() selfArg, selfFin := self.handle() defer selfFin() @@ -12952,7 +13484,7 @@ func (self *DrawList) IdxWritePtr() *DrawIdx { defer func() { selfFin() }() - return (*DrawIdx)(C.wrap_ImDrawList_Get_IdxWritePtr(selfArg)) + return newDrawIdxFromC(C.wrap_ImDrawList_Get_IdxWritePtr(selfArg)) } func (self DrawList) SetClipRectStack(v Vector[*Vec4]) { @@ -12969,6 +13501,29 @@ func (self DrawList) SetClipRectStack(v Vector[*Vec4]) { C.wrap_ImDrawList_Set_ClipRectStack(selfArg, *vVecArg) } +func (self DrawList) SetTextureIdStack(v Vector[*TextureID]) { + vData := v.Data + vDataArg, _ := vData.handle() + vVecArg := new(C.ImVector_ImTextureID) + 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_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]) { vData := v.Data vDataArg, _ := wrap[C.ImVec2, *Vec2](vData) @@ -13284,7 +13839,9 @@ func (self *DrawVert) Col() uint32 { defer func() { selfFin() }() - return uint32(C.wrap_ImDrawVert_GetCol(selfArg)) + + result := C.wrap_ImDrawVert_GetCol(selfArg) + return uint32(result) } func (self Font) SetIndexAdvanceX(v Vector[*float32]) { @@ -15053,7 +15610,9 @@ func (self *Context) InputEventsNextEventId() uint32 { defer func() { selfFin() }() - return uint32(C.wrap_ImGuiContext_GetInputEventsNextEventId(selfArg)) + + result := C.wrap_ImGuiContext_GetInputEventsNextEventId(selfArg) + return uint32(result) } func (self Context) SetCurrentWindowStack(v Vector[*WindowStackData]) { @@ -15289,9 +15848,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 +15861,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 +15880,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 +15899,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 +15965,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 +15978,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 +15997,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 +16170,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 +16183,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 +16236,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 +16249,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) { @@ -15713,7 +16300,9 @@ func (self *Context) ActiveIdUsingNavDirMask() uint32 { defer func() { selfFin() }() - return uint32(C.wrap_ImGuiContext_GetActiveIdUsingNavDirMask(selfArg)) + + result := C.wrap_ImGuiContext_GetActiveIdUsingNavDirMask(selfArg) + return uint32(result) } func (self Context) SetActiveIdUsingAllKeyboardKeys(v bool) { @@ -15743,13 +16332,17 @@ func (self *Context) ActiveIdUsingNavInputMask() uint32 { defer func() { selfFin() }() - return uint32(C.wrap_ImGuiContext_GetActiveIdUsingNavInputMask(selfArg)) + + result := C.wrap_ImGuiContext_GetActiveIdUsingNavInputMask(selfArg) + return uint32(result) } 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 +16351,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 +16372,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 +16385,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 +16495,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 +16507,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 +16699,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 +16712,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 +16799,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 +16812,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 +16831,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 +16850,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 +16869,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 +16888,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 +16909,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 +16922,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 +16941,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 +16979,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) { @@ -16372,6 +17029,25 @@ func (self *Context) NavLayer() NavLayer { return NavLayer(C.wrap_ImGuiContext_GetNavLayer(selfArg)) } +func (self Context) SetNavLastValidSelectionUserData(v SelectionUserData) { + vArg, _ := v.c() + + selfArg, selfFin := self.handle() + defer selfFin() + C.wrap_ImGuiContext_SetNavLastValidSelectionUserData(selfArg, vArg) +} + +func (self *Context) NavLastValidSelectionUserData() SelectionUserData { + selfArg, selfFin := self.handle() + + defer func() { + selfFin() + }() + + result := C.wrap_ImGuiContext_GetNavLastValidSelectionUserData(selfArg) + return *newSelectionUserDataFromC(func() *C.ImGuiSelectionUserData { result := result; return &result }()) +} + func (self Context) SetNavIdIsAlive(v bool) { selfArg, selfFin := self.handle() defer selfFin() @@ -16572,9 +17248,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 +17463,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 +17766,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 +17779,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 +17815,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 +17828,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 +17847,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 +17868,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 +17881,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 +18089,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 +18102,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 +18121,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 +18157,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 +18170,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 +18189,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 +18297,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 +18310,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 +18331,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 +18344,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 +18363,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) { @@ -17651,7 +18410,9 @@ func (self *Context) ColorEditSavedColor() uint32 { defer func() { selfFin() }() - return uint32(C.wrap_ImGuiContext_GetColorEditSavedColor(selfArg)) + + result := C.wrap_ImGuiContext_GetColorEditSavedColor(selfArg) + return uint32(result) } func (self Context) SetColorPickerRef(v Vec4) { @@ -17878,7 +18639,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 +18651,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 +18718,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 +18731,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 +18851,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 +18864,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) { @@ -18314,7 +19092,9 @@ func (self *Context) DebugLogClipperAutoDisableFrames() byte { defer func() { selfFin() }() - return byte(C.wrap_ImGuiContext_GetDebugLogClipperAutoDisableFrames(selfArg)) + + result := C.wrap_ImGuiContext_GetDebugLogClipperAutoDisableFrames(selfArg) + return byte(result) } func (self Context) SetDebugLocateFrames(v byte) { @@ -18329,7 +19109,9 @@ func (self *Context) DebugLocateFrames() byte { defer func() { selfFin() }() - return byte(C.wrap_ImGuiContext_GetDebugLocateFrames(selfArg)) + + result := C.wrap_ImGuiContext_GetDebugLocateFrames(selfArg) + return byte(result) } func (self Context) SetDebugBeginReturnValueCullDepth(v int) { @@ -18374,13 +19156,17 @@ func (self *Context) DebugItemPickerMouseButton() byte { defer func() { selfFin() }() - return byte(C.wrap_ImGuiContext_GetDebugItemPickerMouseButton(selfArg)) + + result := C.wrap_ImGuiContext_GetDebugItemPickerMouseButton(selfArg) + return byte(result) } 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 +19175,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 +19349,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 +19362,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 +19383,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,7 +19396,9 @@ func (self *ContextHook) Owner() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiContextHook_GetOwner(selfArg)) + + result := C.wrap_ImGuiContextHook_GetOwner(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self ContextHook) SetUserData(v unsafe.Pointer) { @@ -18715,7 +19511,9 @@ func (self *DataVarInfo) Count() uint32 { defer func() { selfFin() }() - return uint32(C.wrap_ImGuiDataVarInfo_GetCount(selfArg)) + + result := C.wrap_ImGuiDataVarInfo_GetCount(selfArg) + return uint32(result) } func (self DataVarInfo) SetOffset(v uint32) { @@ -18730,7 +19528,9 @@ func (self *DataVarInfo) Offset() uint32 { defer func() { selfFin() }() - return uint32(C.wrap_ImGuiDataVarInfo_GetOffset(selfArg)) + + result := C.wrap_ImGuiDataVarInfo_GetOffset(selfArg) + return uint32(result) } func (self DockContext) SetNodes(v Storage) { @@ -18752,6 +19552,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 +19614,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 +19627,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) { @@ -18967,7 +19817,9 @@ func (self *DockNode) LastBgColor() uint32 { defer func() { selfFin() }() - return uint32(C.wrap_ImGuiDockNode_GetLastBgColor(selfArg)) + + result := C.wrap_ImGuiDockNode_GetLastBgColor(selfArg) + return uint32(result) } func (self DockNode) SetHostWindow(v *Window) { @@ -19099,9 +19951,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 +19964,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 +19983,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 +20002,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 +20021,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 +20237,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 +20250,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 +20354,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 +20367,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) { @@ -20558,9 +21434,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 +21447,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 +21513,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) { @@ -20755,7 +21648,9 @@ func (self *IO) InputQueueSurrogate() uint16 { defer func() { selfFin() }() - return uint16(C.wrap_ImGuiIO_GetInputQueueSurrogate(selfArg)) + + result := C.wrap_ImGuiIO_GetInputQueueSurrogate(selfArg) + return uint16(result) } func (self IO) SetInputQueueCharacters(v Vector[(*Wchar)]) { @@ -20823,7 +21718,9 @@ func (self *InputEvent) EventId() uint32 { defer func() { selfFin() }() - return uint32(C.wrap_ImGuiInputEvent_GetEventId(selfArg)) + + result := C.wrap_ImGuiInputEvent_GetEventId(selfArg) + return uint32(result) } func (self InputEvent) SetAddedByTestEngine(v bool) { @@ -20992,9 +21889,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 +21902,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) { @@ -21268,9 +22169,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 +22182,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 +22228,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 +22241,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 +22545,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 +22558,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 +22577,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) { @@ -21695,6 +22612,25 @@ func (self *KeyOwnerData) LockUntilRelease() bool { return C.wrap_ImGuiKeyOwnerData_GetLockUntilRelease(selfArg) == C.bool(true) } +func (self KeyRoutingData) SetNextEntryIndex(v KeyRoutingIndex) { + vArg, _ := v.c() + + selfArg, selfFin := self.handle() + defer selfFin() + C.wrap_ImGuiKeyRoutingData_SetNextEntryIndex(selfArg, vArg) +} + +func (self *KeyRoutingData) NextEntryIndex() KeyRoutingIndex { + selfArg, selfFin := self.handle() + + defer func() { + selfFin() + }() + + result := C.wrap_ImGuiKeyRoutingData_GetNextEntryIndex(selfArg) + return *newKeyRoutingIndexFromC(func() *C.ImGuiKeyRoutingIndex { result := result; return &result }()) +} + func (self KeyRoutingData) SetMods(v uint16) { selfArg, selfFin := self.handle() defer selfFin() @@ -21707,7 +22643,9 @@ func (self *KeyRoutingData) Mods() uint16 { defer func() { selfFin() }() - return uint16(C.wrap_ImGuiKeyRoutingData_GetMods(selfArg)) + + result := C.wrap_ImGuiKeyRoutingData_GetMods(selfArg) + return uint16(result) } func (self KeyRoutingData) SetRoutingNextScore(v byte) { @@ -21722,13 +22660,17 @@ func (self *KeyRoutingData) RoutingNextScore() byte { defer func() { selfFin() }() - return byte(C.wrap_ImGuiKeyRoutingData_GetRoutingNextScore(selfArg)) + + result := C.wrap_ImGuiKeyRoutingData_GetRoutingNextScore(selfArg) + return byte(result) } 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 +22679,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 +22698,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 +22750,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 +22763,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) { @@ -22204,7 +23156,9 @@ func (self *MenuColumns) TotalWidth() uint32 { defer func() { selfFin() }() - return uint32(C.wrap_ImGuiMenuColumns_GetTotalWidth(selfArg)) + + result := C.wrap_ImGuiMenuColumns_GetTotalWidth(selfArg) + return uint32(result) } func (self MenuColumns) SetNextTotalWidth(v uint32) { @@ -22219,7 +23173,9 @@ func (self *MenuColumns) NextTotalWidth() uint32 { defer func() { selfFin() }() - return uint32(C.wrap_ImGuiMenuColumns_GetNextTotalWidth(selfArg)) + + result := C.wrap_ImGuiMenuColumns_GetNextTotalWidth(selfArg) + return uint32(result) } func (self MenuColumns) SetSpacing(v uint16) { @@ -22234,7 +23190,9 @@ func (self *MenuColumns) Spacing() uint16 { defer func() { selfFin() }() - return uint16(C.wrap_ImGuiMenuColumns_GetSpacing(selfArg)) + + result := C.wrap_ImGuiMenuColumns_GetSpacing(selfArg) + return uint16(result) } func (self MenuColumns) SetOffsetIcon(v uint16) { @@ -22249,7 +23207,9 @@ func (self *MenuColumns) OffsetIcon() uint16 { defer func() { selfFin() }() - return uint16(C.wrap_ImGuiMenuColumns_GetOffsetIcon(selfArg)) + + result := C.wrap_ImGuiMenuColumns_GetOffsetIcon(selfArg) + return uint16(result) } func (self MenuColumns) SetOffsetLabel(v uint16) { @@ -22264,7 +23224,9 @@ func (self *MenuColumns) OffsetLabel() uint16 { defer func() { selfFin() }() - return uint16(C.wrap_ImGuiMenuColumns_GetOffsetLabel(selfArg)) + + result := C.wrap_ImGuiMenuColumns_GetOffsetLabel(selfArg) + return uint16(result) } func (self MenuColumns) SetOffsetShortcut(v uint16) { @@ -22279,7 +23241,9 @@ func (self *MenuColumns) OffsetShortcut() uint16 { defer func() { selfFin() }() - return uint16(C.wrap_ImGuiMenuColumns_GetOffsetShortcut(selfArg)) + + result := C.wrap_ImGuiMenuColumns_GetOffsetShortcut(selfArg) + return uint16(result) } func (self MenuColumns) SetOffsetMark(v uint16) { @@ -22294,7 +23258,9 @@ func (self *MenuColumns) OffsetMark() uint16 { defer func() { selfFin() }() - return uint16(C.wrap_ImGuiMenuColumns_GetOffsetMark(selfArg)) + + result := C.wrap_ImGuiMenuColumns_GetOffsetMark(selfArg) + return uint16(result) } func (self MetricsConfig) SetShowDebugLog(v bool) { @@ -22480,9 +23446,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 +23459,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 +23478,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) { @@ -22539,6 +23513,25 @@ func (self *NavItemData) InFlags() ItemFlags { return ItemFlags(C.wrap_ImGuiNavItemData_GetInFlags(selfArg)) } +func (self NavItemData) SetSelectionUserData(v SelectionUserData) { + vArg, _ := v.c() + + selfArg, selfFin := self.handle() + defer selfFin() + C.wrap_ImGuiNavItemData_SetSelectionUserData(selfArg, vArg) +} + +func (self *NavItemData) SelectionUserData() SelectionUserData { + selfArg, selfFin := self.handle() + + defer func() { + selfFin() + }() + + result := C.wrap_ImGuiNavItemData_GetSelectionUserData(selfArg) + return *newSelectionUserDataFromC(func() *C.ImGuiSelectionUserData { result := result; return &result }()) +} + func (self NavItemData) SetDistBox(v float32) { selfArg, selfFin := self.handle() defer selfFin() @@ -22585,9 +23578,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 +23591,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) { @@ -22674,6 +23671,25 @@ func (self *NextItemData) Width() float32 { return float32(C.wrap_ImGuiNextItemData_GetWidth(selfArg)) } +func (self NextItemData) SetSelectionUserData(v SelectionUserData) { + vArg, _ := v.c() + + selfArg, selfFin := self.handle() + defer selfFin() + C.wrap_ImGuiNextItemData_SetSelectionUserData(selfArg, vArg) +} + +func (self *NextItemData) SelectionUserData() SelectionUserData { + selfArg, selfFin := self.handle() + + defer func() { + selfFin() + }() + + result := C.wrap_ImGuiNextItemData_GetSelectionUserData(selfArg) + return *newSelectionUserDataFromC(func() *C.ImGuiSelectionUserData { result := result; return &result }()) +} + func (self NextItemData) SetOpenCond(v Cond) { selfArg, selfFin := self.handle() defer selfFin() @@ -22932,9 +23948,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 +23961,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 +23980,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 +24080,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 +24093,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) { @@ -23370,9 +24398,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 +24411,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 +24430,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) { @@ -23605,9 +24641,11 @@ func (self *PlatformMonitor) PlatformHandle() unsafe.Pointer { } 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 +24654,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 +24724,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 +24737,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) { @@ -23778,9 +24822,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,7 +24835,9 @@ func (self *SettingsHandler) TypeHash() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiSettingsHandler_GetTypeHash(selfArg)) + + result := C.wrap_ImGuiSettingsHandler_GetTypeHash(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self SettingsHandler) SetUserData(v unsafe.Pointer) { @@ -23917,9 +24965,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 +24978,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 +25194,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 +25207,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 +25289,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 +25302,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 +26111,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 +26124,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 +26143,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 +26162,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 +26181,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 +26412,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 +26425,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 +26600,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 +26613,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 +26801,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 +26814,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) { @@ -25780,6 +26868,63 @@ func (self *Table) TempData() *TableTempData { return newTableTempDataFromC(C.wrap_ImGuiTable_GetTempData(selfArg)) } +func (self Table) SetEnabledMaskByDisplayOrder(v BitArrayPtr) { + vArg, _ := v.c() + + selfArg, selfFin := self.handle() + defer selfFin() + C.wrap_ImGuiTable_SetEnabledMaskByDisplayOrder(selfArg, vArg) +} + +func (self *Table) EnabledMaskByDisplayOrder() BitArrayPtr { + selfArg, selfFin := self.handle() + + defer func() { + selfFin() + }() + + 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) { selfArg, selfFin := self.handle() defer selfFin() @@ -26047,7 +27192,9 @@ func (self *Table) BorderColorStrong() uint32 { defer func() { selfFin() }() - return uint32(C.wrap_ImGuiTable_GetBorderColorStrong(selfArg)) + + result := C.wrap_ImGuiTable_GetBorderColorStrong(selfArg) + return uint32(result) } func (self Table) SetBorderColorLight(v uint32) { @@ -26062,7 +27209,9 @@ func (self *Table) BorderColorLight() uint32 { defer func() { selfFin() }() - return uint32(C.wrap_ImGuiTable_GetBorderColorLight(selfArg)) + + result := C.wrap_ImGuiTable_GetBorderColorLight(selfArg) + return uint32(result) } func (self Table) SetBorderX1(v float32) { @@ -26599,9 +27748,11 @@ func (self *Table) SortSpecs() TableSortSpecs { } func (self Table) SetSortSpecsCount(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetSortSpecsCount(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTable_SetSortSpecsCount(selfArg, vArg) } func (self *Table) SortSpecsCount() TableColumnIdx { @@ -26610,13 +27761,17 @@ func (self *Table) SortSpecsCount() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTable_GetSortSpecsCount(selfArg)) + + result := C.wrap_ImGuiTable_GetSortSpecsCount(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self Table) SetColumnsEnabledCount(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetColumnsEnabledCount(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTable_SetColumnsEnabledCount(selfArg, vArg) } func (self *Table) ColumnsEnabledCount() TableColumnIdx { @@ -26625,13 +27780,17 @@ func (self *Table) ColumnsEnabledCount() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTable_GetColumnsEnabledCount(selfArg)) + + result := C.wrap_ImGuiTable_GetColumnsEnabledCount(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self Table) SetColumnsEnabledFixedCount(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetColumnsEnabledFixedCount(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTable_SetColumnsEnabledFixedCount(selfArg, vArg) } func (self *Table) ColumnsEnabledFixedCount() TableColumnIdx { @@ -26640,13 +27799,17 @@ func (self *Table) ColumnsEnabledFixedCount() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTable_GetColumnsEnabledFixedCount(selfArg)) + + result := C.wrap_ImGuiTable_GetColumnsEnabledFixedCount(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self Table) SetDeclColumnsCount(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetDeclColumnsCount(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTable_SetDeclColumnsCount(selfArg, vArg) } func (self *Table) DeclColumnsCount() TableColumnIdx { @@ -26655,13 +27818,17 @@ func (self *Table) DeclColumnsCount() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTable_GetDeclColumnsCount(selfArg)) + + result := C.wrap_ImGuiTable_GetDeclColumnsCount(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self Table) SetHoveredColumnBody(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetHoveredColumnBody(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTable_SetHoveredColumnBody(selfArg, vArg) } func (self *Table) HoveredColumnBody() TableColumnIdx { @@ -26670,13 +27837,17 @@ func (self *Table) HoveredColumnBody() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTable_GetHoveredColumnBody(selfArg)) + + result := C.wrap_ImGuiTable_GetHoveredColumnBody(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self Table) SetHoveredColumnBorder(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetHoveredColumnBorder(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTable_SetHoveredColumnBorder(selfArg, vArg) } func (self *Table) HoveredColumnBorder() TableColumnIdx { @@ -26685,13 +27856,17 @@ func (self *Table) HoveredColumnBorder() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTable_GetHoveredColumnBorder(selfArg)) + + result := C.wrap_ImGuiTable_GetHoveredColumnBorder(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self Table) SetAutoFitSingleColumn(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetAutoFitSingleColumn(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTable_SetAutoFitSingleColumn(selfArg, vArg) } func (self *Table) AutoFitSingleColumn() TableColumnIdx { @@ -26700,13 +27875,17 @@ func (self *Table) AutoFitSingleColumn() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTable_GetAutoFitSingleColumn(selfArg)) + + result := C.wrap_ImGuiTable_GetAutoFitSingleColumn(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self Table) SetResizedColumn(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetResizedColumn(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTable_SetResizedColumn(selfArg, vArg) } func (self *Table) ResizedColumn() TableColumnIdx { @@ -26715,13 +27894,17 @@ func (self *Table) ResizedColumn() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTable_GetResizedColumn(selfArg)) + + result := C.wrap_ImGuiTable_GetResizedColumn(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self Table) SetLastResizedColumn(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetLastResizedColumn(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTable_SetLastResizedColumn(selfArg, vArg) } func (self *Table) LastResizedColumn() TableColumnIdx { @@ -26730,13 +27913,17 @@ func (self *Table) LastResizedColumn() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTable_GetLastResizedColumn(selfArg)) + + result := C.wrap_ImGuiTable_GetLastResizedColumn(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self Table) SetHeldHeaderColumn(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetHeldHeaderColumn(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTable_SetHeldHeaderColumn(selfArg, vArg) } func (self *Table) HeldHeaderColumn() TableColumnIdx { @@ -26745,13 +27932,17 @@ func (self *Table) HeldHeaderColumn() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTable_GetHeldHeaderColumn(selfArg)) + + result := C.wrap_ImGuiTable_GetHeldHeaderColumn(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self Table) SetReorderColumn(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetReorderColumn(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTable_SetReorderColumn(selfArg, vArg) } func (self *Table) ReorderColumn() TableColumnIdx { @@ -26760,13 +27951,17 @@ func (self *Table) ReorderColumn() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTable_GetReorderColumn(selfArg)) + + result := C.wrap_ImGuiTable_GetReorderColumn(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self Table) SetReorderColumnDir(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetReorderColumnDir(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTable_SetReorderColumnDir(selfArg, vArg) } func (self *Table) ReorderColumnDir() TableColumnIdx { @@ -26775,13 +27970,17 @@ func (self *Table) ReorderColumnDir() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTable_GetReorderColumnDir(selfArg)) + + result := C.wrap_ImGuiTable_GetReorderColumnDir(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self Table) SetLeftMostEnabledColumn(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetLeftMostEnabledColumn(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTable_SetLeftMostEnabledColumn(selfArg, vArg) } func (self *Table) LeftMostEnabledColumn() TableColumnIdx { @@ -26790,13 +27989,17 @@ func (self *Table) LeftMostEnabledColumn() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTable_GetLeftMostEnabledColumn(selfArg)) + + result := C.wrap_ImGuiTable_GetLeftMostEnabledColumn(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self Table) SetRightMostEnabledColumn(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetRightMostEnabledColumn(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTable_SetRightMostEnabledColumn(selfArg, vArg) } func (self *Table) RightMostEnabledColumn() TableColumnIdx { @@ -26805,13 +28008,17 @@ func (self *Table) RightMostEnabledColumn() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTable_GetRightMostEnabledColumn(selfArg)) + + result := C.wrap_ImGuiTable_GetRightMostEnabledColumn(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self Table) SetLeftMostStretchedColumn(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetLeftMostStretchedColumn(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTable_SetLeftMostStretchedColumn(selfArg, vArg) } func (self *Table) LeftMostStretchedColumn() TableColumnIdx { @@ -26820,13 +28027,17 @@ func (self *Table) LeftMostStretchedColumn() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTable_GetLeftMostStretchedColumn(selfArg)) + + result := C.wrap_ImGuiTable_GetLeftMostStretchedColumn(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self Table) SetRightMostStretchedColumn(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetRightMostStretchedColumn(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTable_SetRightMostStretchedColumn(selfArg, vArg) } func (self *Table) RightMostStretchedColumn() TableColumnIdx { @@ -26835,13 +28046,17 @@ func (self *Table) RightMostStretchedColumn() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTable_GetRightMostStretchedColumn(selfArg)) + + result := C.wrap_ImGuiTable_GetRightMostStretchedColumn(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self Table) SetContextPopupColumn(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetContextPopupColumn(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTable_SetContextPopupColumn(selfArg, vArg) } func (self *Table) ContextPopupColumn() TableColumnIdx { @@ -26850,13 +28065,17 @@ func (self *Table) ContextPopupColumn() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTable_GetContextPopupColumn(selfArg)) + + result := C.wrap_ImGuiTable_GetContextPopupColumn(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self Table) SetFreezeRowsRequest(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetFreezeRowsRequest(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTable_SetFreezeRowsRequest(selfArg, vArg) } func (self *Table) FreezeRowsRequest() TableColumnIdx { @@ -26865,13 +28084,17 @@ func (self *Table) FreezeRowsRequest() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTable_GetFreezeRowsRequest(selfArg)) + + result := C.wrap_ImGuiTable_GetFreezeRowsRequest(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self Table) SetFreezeRowsCount(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetFreezeRowsCount(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTable_SetFreezeRowsCount(selfArg, vArg) } func (self *Table) FreezeRowsCount() TableColumnIdx { @@ -26880,13 +28103,17 @@ func (self *Table) FreezeRowsCount() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTable_GetFreezeRowsCount(selfArg)) + + result := C.wrap_ImGuiTable_GetFreezeRowsCount(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self Table) SetFreezeColumnsRequest(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetFreezeColumnsRequest(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTable_SetFreezeColumnsRequest(selfArg, vArg) } func (self *Table) FreezeColumnsRequest() TableColumnIdx { @@ -26895,13 +28122,17 @@ func (self *Table) FreezeColumnsRequest() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTable_GetFreezeColumnsRequest(selfArg)) + + result := C.wrap_ImGuiTable_GetFreezeColumnsRequest(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self Table) SetFreezeColumnsCount(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetFreezeColumnsCount(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTable_SetFreezeColumnsCount(selfArg, vArg) } func (self *Table) FreezeColumnsCount() TableColumnIdx { @@ -26910,13 +28141,17 @@ func (self *Table) FreezeColumnsCount() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTable_GetFreezeColumnsCount(selfArg)) + + result := C.wrap_ImGuiTable_GetFreezeColumnsCount(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self Table) SetRowCellDataCurrent(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetRowCellDataCurrent(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTable_SetRowCellDataCurrent(selfArg, vArg) } func (self *Table) RowCellDataCurrent() TableColumnIdx { @@ -26925,13 +28160,17 @@ func (self *Table) RowCellDataCurrent() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTable_GetRowCellDataCurrent(selfArg)) + + result := C.wrap_ImGuiTable_GetRowCellDataCurrent(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } 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 +28179,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 +28198,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 +28217,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) { @@ -27240,13 +28489,17 @@ func (self *TableCellData) BgColor() uint32 { defer func() { selfFin() }() - return uint32(C.wrap_ImGuiTableCellData_GetBgColor(selfArg)) + + result := C.wrap_ImGuiTableCellData_GetBgColor(selfArg) + return uint32(result) } func (self TableCellData) SetColumn(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTableCellData_SetColumn(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTableCellData_SetColumn(selfArg, vArg) } func (self *TableCellData) Column() TableColumnIdx { @@ -27255,7 +28508,9 @@ func (self *TableCellData) Column() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTableCellData_GetColumn(selfArg)) + + result := C.wrap_ImGuiTableCellData_GetColumn(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self TableColumn) SetFlags(v TableColumnFlags) { @@ -27394,9 +28649,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 +28662,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) { @@ -27529,9 +28788,11 @@ func (self *TableColumn) NameOffset() int { } func (self TableColumn) SetDisplayOrder(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTableColumn_SetDisplayOrder(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTableColumn_SetDisplayOrder(selfArg, vArg) } func (self *TableColumn) DisplayOrder() TableColumnIdx { @@ -27540,13 +28801,17 @@ func (self *TableColumn) DisplayOrder() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTableColumn_GetDisplayOrder(selfArg)) + + result := C.wrap_ImGuiTableColumn_GetDisplayOrder(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self TableColumn) SetIndexWithinEnabledSet(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTableColumn_SetIndexWithinEnabledSet(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTableColumn_SetIndexWithinEnabledSet(selfArg, vArg) } func (self *TableColumn) IndexWithinEnabledSet() TableColumnIdx { @@ -27555,13 +28820,17 @@ func (self *TableColumn) IndexWithinEnabledSet() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTableColumn_GetIndexWithinEnabledSet(selfArg)) + + result := C.wrap_ImGuiTableColumn_GetIndexWithinEnabledSet(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self TableColumn) SetPrevEnabledColumn(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTableColumn_SetPrevEnabledColumn(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTableColumn_SetPrevEnabledColumn(selfArg, vArg) } func (self *TableColumn) PrevEnabledColumn() TableColumnIdx { @@ -27570,13 +28839,17 @@ func (self *TableColumn) PrevEnabledColumn() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTableColumn_GetPrevEnabledColumn(selfArg)) + + result := C.wrap_ImGuiTableColumn_GetPrevEnabledColumn(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self TableColumn) SetNextEnabledColumn(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTableColumn_SetNextEnabledColumn(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTableColumn_SetNextEnabledColumn(selfArg, vArg) } func (self *TableColumn) NextEnabledColumn() TableColumnIdx { @@ -27585,13 +28858,17 @@ func (self *TableColumn) NextEnabledColumn() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTableColumn_GetNextEnabledColumn(selfArg)) + + result := C.wrap_ImGuiTableColumn_GetNextEnabledColumn(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self TableColumn) SetSortOrder(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTableColumn_SetSortOrder(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTableColumn_SetSortOrder(selfArg, vArg) } func (self *TableColumn) SortOrder() TableColumnIdx { @@ -27600,13 +28877,17 @@ func (self *TableColumn) SortOrder() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTableColumn_GetSortOrder(selfArg)) + + result := C.wrap_ImGuiTableColumn_GetSortOrder(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } 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 +28896,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 +28915,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 +28934,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) { @@ -27795,7 +29086,9 @@ func (self *TableColumn) AutoFitQueue() byte { defer func() { selfFin() }() - return byte(C.wrap_ImGuiTableColumn_GetAutoFitQueue(selfArg)) + + result := C.wrap_ImGuiTableColumn_GetAutoFitQueue(selfArg) + return byte(result) } func (self TableColumn) SetCannotSkipItemsQueue(v byte) { @@ -27810,7 +29103,9 @@ func (self *TableColumn) CannotSkipItemsQueue() byte { defer func() { selfFin() }() - return byte(C.wrap_ImGuiTableColumn_GetCannotSkipItemsQueue(selfArg)) + + result := C.wrap_ImGuiTableColumn_GetCannotSkipItemsQueue(selfArg) + return byte(result) } func (self TableColumn) SetSortDirection(v byte) { @@ -27825,7 +29120,9 @@ func (self *TableColumn) SortDirection() byte { defer func() { selfFin() }() - return byte(C.wrap_ImGuiTableColumn_GetSortDirection(selfArg)) + + result := C.wrap_ImGuiTableColumn_GetSortDirection(selfArg) + return byte(result) } func (self TableColumn) SetSortDirectionsAvailCount(v byte) { @@ -27840,7 +29137,9 @@ func (self *TableColumn) SortDirectionsAvailCount() byte { defer func() { selfFin() }() - return byte(C.wrap_ImGuiTableColumn_GetSortDirectionsAvailCount(selfArg)) + + result := C.wrap_ImGuiTableColumn_GetSortDirectionsAvailCount(selfArg) + return byte(result) } func (self TableColumn) SetSortDirectionsAvailMask(v byte) { @@ -27855,7 +29154,9 @@ func (self *TableColumn) SortDirectionsAvailMask() byte { defer func() { selfFin() }() - return byte(C.wrap_ImGuiTableColumn_GetSortDirectionsAvailMask(selfArg)) + + result := C.wrap_ImGuiTableColumn_GetSortDirectionsAvailMask(selfArg) + return byte(result) } func (self TableColumn) SetSortDirectionsAvailList(v byte) { @@ -27870,7 +29171,9 @@ func (self *TableColumn) SortDirectionsAvailList() byte { defer func() { selfFin() }() - return byte(C.wrap_ImGuiTableColumn_GetSortDirectionsAvailList(selfArg)) + + result := C.wrap_ImGuiTableColumn_GetSortDirectionsAvailList(selfArg) + return byte(result) } func (self TableColumnSettings) SetWidthOrWeight(v float32) { @@ -27889,9 +29192,11 @@ func (self *TableColumnSettings) WidthOrWeight() float32 { } func (self TableColumnSettings) SetUserID(v ID) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTableColumnSettings_SetUserID(selfArg, C.ImGuiID(v)) + C.wrap_ImGuiTableColumnSettings_SetUserID(selfArg, vArg) } func (self *TableColumnSettings) UserID() ID { @@ -27900,13 +29205,17 @@ func (self *TableColumnSettings) UserID() ID { defer func() { selfFin() }() - return ID(C.wrap_ImGuiTableColumnSettings_GetUserID(selfArg)) + + result := C.wrap_ImGuiTableColumnSettings_GetUserID(selfArg) + return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } func (self TableColumnSettings) SetIndex(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTableColumnSettings_SetIndex(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTableColumnSettings_SetIndex(selfArg, vArg) } func (self *TableColumnSettings) Index() TableColumnIdx { @@ -27915,13 +29224,17 @@ func (self *TableColumnSettings) Index() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTableColumnSettings_GetIndex(selfArg)) + + result := C.wrap_ImGuiTableColumnSettings_GetIndex(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self TableColumnSettings) SetDisplayOrder(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTableColumnSettings_SetDisplayOrder(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTableColumnSettings_SetDisplayOrder(selfArg, vArg) } func (self *TableColumnSettings) DisplayOrder() TableColumnIdx { @@ -27930,13 +29243,17 @@ func (self *TableColumnSettings) DisplayOrder() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTableColumnSettings_GetDisplayOrder(selfArg)) + + result := C.wrap_ImGuiTableColumnSettings_GetDisplayOrder(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self TableColumnSettings) SetSortOrder(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTableColumnSettings_SetSortOrder(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTableColumnSettings_SetSortOrder(selfArg, vArg) } func (self *TableColumnSettings) SortOrder() TableColumnIdx { @@ -27945,7 +29262,9 @@ func (self *TableColumnSettings) SortOrder() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTableColumnSettings_GetSortOrder(selfArg)) + + result := C.wrap_ImGuiTableColumnSettings_GetSortOrder(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self TableColumnSettings) SetSortDirection(v byte) { @@ -27960,7 +29279,9 @@ func (self *TableColumnSettings) SortDirection() byte { defer func() { selfFin() }() - return byte(C.wrap_ImGuiTableColumnSettings_GetSortDirection(selfArg)) + + result := C.wrap_ImGuiTableColumnSettings_GetSortDirection(selfArg) + return byte(result) } func (self TableColumnSettings) SetIsEnabled(v byte) { @@ -27975,7 +29296,9 @@ func (self *TableColumnSettings) IsEnabled() byte { defer func() { selfFin() }() - return byte(C.wrap_ImGuiTableColumnSettings_GetIsEnabled(selfArg)) + + result := C.wrap_ImGuiTableColumnSettings_GetIsEnabled(selfArg) + return byte(result) } func (self TableColumnSettings) SetIsStretch(v byte) { @@ -27990,13 +29313,17 @@ func (self *TableColumnSettings) IsStretch() byte { defer func() { selfFin() }() - return byte(C.wrap_ImGuiTableColumnSettings_GetIsStretch(selfArg)) + + result := C.wrap_ImGuiTableColumnSettings_GetIsStretch(selfArg) + return byte(result) } 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 +29332,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 +29383,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 +29396,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 +29477,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 +29490,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) { @@ -28189,9 +29526,11 @@ func (self *TableSettings) RefScale() float32 { } func (self TableSettings) SetColumnsCount(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTableSettings_SetColumnsCount(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTableSettings_SetColumnsCount(selfArg, vArg) } func (self *TableSettings) ColumnsCount() TableColumnIdx { @@ -28200,13 +29539,17 @@ func (self *TableSettings) ColumnsCount() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTableSettings_GetColumnsCount(selfArg)) + + result := C.wrap_ImGuiTableSettings_GetColumnsCount(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self TableSettings) SetColumnsCountMax(v TableColumnIdx) { + vArg, _ := v.c() + selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTableSettings_SetColumnsCountMax(selfArg, C.ImGuiTableColumnIdx(v)) + C.wrap_ImGuiTableSettings_SetColumnsCountMax(selfArg, vArg) } func (self *TableSettings) ColumnsCountMax() TableColumnIdx { @@ -28215,7 +29558,9 @@ func (self *TableSettings) ColumnsCountMax() TableColumnIdx { defer func() { selfFin() }() - return TableColumnIdx(C.wrap_ImGuiTableSettings_GetColumnsCountMax(selfArg)) + + result := C.wrap_ImGuiTableSettings_GetColumnsCountMax(selfArg) + return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) } func (self TableSettings) SetWantApply(v bool) { @@ -28713,9 +30058,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 +30071,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 +30122,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 +30135,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 +30231,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 +30244,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) { @@ -29119,9 +30476,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 +30489,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 +30758,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 +30771,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 +30843,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 +30856,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 +31132,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 +31145,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 +31164,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 +31183,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 +31564,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 +31577,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 +31809,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 +31821,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 +32288,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 +32301,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 +32480,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 +32493,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 +32529,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 +32542,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 +32561,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 +32657,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 +32670,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 +32689,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 +32708,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 +32727,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) { @@ -31824,7 +33250,9 @@ func (self *WindowTempData) TreeJumpToParentOnPopMask() uint32 { defer func() { selfFin() }() - return uint32(C.wrap_ImGuiWindowTempData_GetTreeJumpToParentOnPopMask(selfArg)) + + result := C.wrap_ImGuiWindowTempData_GetTreeJumpToParentOnPopMask(selfArg) + return uint32(result) } func (self WindowTempData) SetStateStorage(v *Storage) { diff --git a/cimgui_structs.go b/cimgui_structs.go index 95a60dba6..b5079c938 100644 --- a/cimgui_structs.go +++ b/cimgui_structs.go @@ -48,39 +48,13 @@ func newBitVectorFromC(cvalue *C.ImBitVector) *BitVector { // [Internal] For use by ImDrawListSplitter type DrawChannel struct { - FieldCmdBuffer Vector[*DrawCmd] - FieldIdxBuffer Vector[*DrawIdx] + // TODO: contains unsupported fields + data unsafe.Pointer } 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 + result = (*C.ImDrawChannel)(self.data) + return result, func() {} } func (self DrawChannel) c() (result C.ImDrawChannel, fin func()) { @@ -90,8 +64,7 @@ func (self DrawChannel) c() (result C.ImDrawChannel, fin func()) { 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)) + result.data = unsafe.Pointer(cvalue) return result } @@ -123,25 +96,13 @@ func newDrawCmdFromC(cvalue *C.ImDrawCmd) *DrawCmd { // [Internal] For use by ImDrawList type DrawCmdHeader struct { - FieldClipRect Vec4 - FieldTextureId TextureID - FieldVtxOffset uint32 + // TODO: contains unsupported fields + data unsafe.Pointer } 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 + result = (*C.ImDrawCmdHeader)(self.data) + return result, func() {} } func (self DrawCmdHeader) c() (result C.ImDrawCmdHeader, fin func()) { @@ -151,9 +112,7 @@ func (self DrawCmdHeader) c() (result C.ImDrawCmdHeader, fin func()) { 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) + result.data = unsafe.Pointer(cvalue) return result } @@ -832,59 +791,13 @@ func newDockNodeFromC(cvalue *C.ImGuiDockNode) *DockNode { // 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 + // TODO: contains unsupported fields + data unsafe.Pointer } 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 + result = (*C.ImGuiGroupData)(self.data) + return result, func() {} } func (self GroupData) c() (result C.ImGuiGroupData, fin func()) { @@ -894,19 +807,7 @@ func (self GroupData) c() (result C.ImGuiGroupData, fin func()) { 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) + result.data = unsafe.Pointer(cvalue) return result } @@ -1085,17 +986,13 @@ func newInputEventMousePosFromC(cvalue *C.ImGuiInputEventMousePos) *InputEventMo } type InputEventMouseViewport struct { - FieldHoveredViewportID ID + // TODO: contains unsupported fields + data unsafe.Pointer } 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 + result = (*C.ImGuiInputEventMouseViewport)(self.data) + return result, func() {} } func (self InputEventMouseViewport) c() (result C.ImGuiInputEventMouseViewport, fin func()) { @@ -1105,7 +1002,7 @@ func (self InputEventMouseViewport) c() (result C.ImGuiInputEventMouseViewport, func newInputEventMouseViewportFromC(cvalue *C.ImGuiInputEventMouseViewport) *InputEventMouseViewport { result := new(InputEventMouseViewport) - result.FieldHoveredViewportID = ID(cvalue.HoveredViewportID) + result.data = unsafe.Pointer(cvalue) return result } @@ -1273,30 +1170,13 @@ func newInputTextCallbackDataFromC(cvalue *C.ImGuiInputTextCallbackData) *InputT // 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 + // TODO: contains unsupported fields + data unsafe.Pointer } 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 + result = (*C.ImGuiInputTextDeactivatedState)(self.data) + return result, func() {} } func (self InputTextDeactivatedState) c() (result C.ImGuiInputTextDeactivatedState, fin func()) { @@ -1306,115 +1186,20 @@ func (self InputTextDeactivatedState) c() (result C.ImGuiInputTextDeactivatedSta 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)) + result.data = unsafe.Pointer(cvalue) 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. + // TODO: contains unsupported fields + data unsafe.Pointer } 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 + result = (*C.ImGuiInputTextState)(self.data) + return result, func() {} } func (self InputTextState) c() (result C.ImGuiInputTextState, fin func()) { @@ -1424,23 +1209,7 @@ func (self InputTextState) c() (result C.ImGuiInputTextState, fin func()) { 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) + result.data = unsafe.Pointer(cvalue) return result } @@ -1489,29 +1258,13 @@ func newKeyDataFromC(cvalue *C.ImGuiKeyData) *KeyData { // 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. + // TODO: contains unsupported fields + data unsafe.Pointer } 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 + result = (*C.ImGuiKeyOwnerData)(self.data) + return result, func() {} } func (self KeyOwnerData) c() (result C.ImGuiKeyOwnerData, fin func()) { @@ -1521,10 +1274,7 @@ func (self KeyOwnerData) c() (result C.ImGuiKeyOwnerData, fin func()) { 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) + result.data = unsafe.Pointer(cvalue) return result } @@ -1575,37 +1325,13 @@ func newKeyRoutingTableFromC(cvalue *C.ImGuiKeyRoutingTable) *KeyRoutingTable { // 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) + // TODO: contains unsupported fields + data unsafe.Pointer } 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 + result = (*C.ImGuiLastItemData)(self.data) + return result, func() {} } func (self LastItemData) c() (result C.ImGuiLastItemData, fin func()) { @@ -1615,12 +1341,7 @@ func (self LastItemData) c() (result C.ImGuiLastItemData, fin func()) { 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) + result.data = unsafe.Pointer(cvalue) return result } @@ -1962,25 +1683,13 @@ func newNavItemDataFromC(cvalue *C.ImGuiNavItemData) *NavItemData { // 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 + // TODO: contains unsupported fields + data unsafe.Pointer } 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 + result = (*C.ImGuiNavTreeNodeData)(self.data) + return result, func() {} } func (self NavTreeNodeData) c() (result C.ImGuiNavTreeNodeData, fin func()) { @@ -1990,9 +1699,7 @@ func (self NavTreeNodeData) c() (result C.ImGuiNavTreeNodeData, fin func()) { 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) + result.data = unsafe.Pointer(cvalue) return result } @@ -2080,91 +1787,13 @@ func newOldColumnDataFromC(cvalue *C.ImGuiOldColumnData) *OldColumnData { } 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 + // TODO: contains unsupported fields + data unsafe.Pointer } 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 + result = (*C.ImGuiOldColumns)(self.data) + return result, func() {} } func (self OldColumns) c() (result C.ImGuiOldColumns, fin func()) { @@ -2174,24 +1803,7 @@ func (self OldColumns) c() (result C.ImGuiOldColumns, fin func()) { 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 }()) - + result.data = unsafe.Pointer(cvalue) return result } @@ -2357,47 +1969,13 @@ func newPlatformMonitorFromC(cvalue *C.ImGuiPlatformMonitor) *PlatformMonitor { // 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 + // TODO: contains unsupported fields + data unsafe.Pointer } 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 + result = (*C.ImGuiPopupData)(self.data) + return result, func() {} } func (self PopupData) c() (result C.ImGuiPopupData, fin func()) { @@ -2407,14 +1985,7 @@ func (self PopupData) c() (result C.ImGuiPopupData, fin func()) { 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) + result.data = unsafe.Pointer(cvalue) return result } @@ -2636,46 +2207,13 @@ func newStackSizesFromC(cvalue *C.ImGuiStackSizes) *StackSizes { // 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 + // TODO: contains unsupported fields + data unsafe.Pointer } 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 + result = (*C.ImGuiStackTool)(self.data) + return result, func() {} } func (self StackTool) c() (result C.ImGuiStackTool, fin func()) { @@ -2685,12 +2223,7 @@ func (self StackTool) c() (result C.ImGuiStackTool, fin func()) { 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) + result.data = unsafe.Pointer(cvalue) return result } @@ -2803,156 +2336,13 @@ func newStyleModFromC(cvalue *C.ImGuiStyleMod) *StyleMod { // 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. + // TODO: contains unsupported fields + data unsafe.Pointer } 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 + result = (*C.ImGuiTabBar)(self.data) + return result, func() {} } func (self TabBar) c() (result C.ImGuiTabBar, fin func()) { @@ -2962,105 +2352,19 @@ func (self TabBar) c() (result C.ImGuiTabBar, fin func()) { 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 }()) - + result.data = unsafe.Pointer(cvalue) 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() + // TODO: contains unsupported fields + data unsafe.Pointer } 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 + result = (*C.ImGuiTabItem)(self.data) + return result, func() {} } func (self TabItem) c() (result C.ImGuiTabItem, fin func()) { @@ -3070,19 +2374,7 @@ func (self TabItem) c() (result C.ImGuiTabItem, fin func()) { 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) + result.data = unsafe.Pointer(cvalue) return result } @@ -3112,21 +2404,13 @@ func newTableFromC(cvalue *C.ImGuiTable) *Table { // Transient cell data stored per row. // sizeof() ~ 6 type TableCellData struct { - FieldBgColor uint32 // Actual color - FieldColumn TableColumnIdx // Column number + // TODO: contains unsupported fields + data unsafe.Pointer } 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 + result = (*C.ImGuiTableCellData)(self.data) + return result, func() {} } func (self TableCellData) c() (result C.ImGuiTableCellData, fin func()) { @@ -3136,8 +2420,7 @@ func (self TableCellData) c() (result C.ImGuiTableCellData, fin func()) { func newTableCellDataFromC(cvalue *C.ImGuiTableCellData) *TableCellData { result := new(TableCellData) - result.FieldBgColor = uint32(cvalue.BgColor) - result.FieldColumn = TableColumnIdx(cvalue.Column) + result.data = unsafe.Pointer(cvalue) return result } @@ -3212,37 +2495,13 @@ func newTableColumnSortSpecsFromC(cvalue *C.ImGuiTableColumnSortSpecs) *TableCol // 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. + // TODO: contains unsupported fields + data unsafe.Pointer } 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 + result = (*C.ImGuiTableInstanceData)(self.data) + return result, func() {} } func (self TableInstanceData) c() (result C.ImGuiTableInstanceData, fin func()) { @@ -3252,48 +2511,19 @@ func (self TableInstanceData) c() (result C.ImGuiTableInstanceData, fin func()) 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) + result.data = unsafe.Pointer(cvalue) 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) + // TODO: contains unsupported fields + data unsafe.Pointer } 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 + result = (*C.ImGuiTableSettings)(self.data) + return result, func() {} } func (self TableSettings) c() (result C.ImGuiTableSettings, fin func()) { @@ -3303,12 +2533,7 @@ func (self TableSettings) c() (result C.ImGuiTableSettings, fin func()) { 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) + result.data = unsafe.Pointer(cvalue) return result } @@ -3656,91 +2881,13 @@ func newTypingSelectStateFromC(cvalue *C.ImGuiTypingSelectState) *TypingSelectSt // - 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) + // TODO: contains unsupported fields + data unsafe.Pointer } 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 + result = (*C.ImGuiViewport)(self.data) + return result, func() {} } func (self Viewport) c() (result C.ImGuiViewport, fin func()) { @@ -3750,23 +2897,7 @@ func (self Viewport) c() (result C.ImGuiViewport, fin func()) { 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) + result.data = unsafe.Pointer(cvalue) return result } @@ -3823,45 +2954,13 @@ func newWindowFromC(cvalue *C.ImGuiWindow) *Window { // - 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? + // TODO: contains unsupported fields + data unsafe.Pointer } 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 + result = (*C.ImGuiWindowClass)(self.data) + return result, func() {} } func (self WindowClass) c() (result C.ImGuiWindowClass, fin func()) { @@ -3871,14 +2970,7 @@ func (self WindowClass) c() (result C.ImGuiWindowClass, fin func()) { 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) + result.data = unsafe.Pointer(cvalue) return result } diff --git a/cimgui_typedefs.go b/cimgui_typedefs.go new file mode 100644 index 000000000..30efa2a0c --- /dev/null +++ b/cimgui_typedefs.go @@ -0,0 +1,302 @@ +// 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" + +type BitArrayPtr *uint32 + +func (self BitArrayPtr) handle() (result **uint32, fin func()) { + selfArg, selfFin := WrapNumberPtr[C.ImU32, uint32](self) + return selfArg, func() { selfFin() } +} + +func (self BitArrayPtr) c() (*uint32, func()) { + result, fin := self.handle() + return *result, fin +} + +func newBitArrayPtrFromC(cvalue *C.ImU32) { + return (*uint32)(cvalue) +} + +type DrawIdx uint16 + +func (self DrawIdx) handle() (result *uint16, fin func()) { + return C.ushort(self), func() {} +} + +func (self DrawIdx) c() (uint16, func()) { + result, fin := self.handle() + return *result, fin +} + +func newDrawIdxFromC(cvalue C.ushort) { + return uint16(cvalue) +} + +type DockNodeSettings C.ImGuiDockNodeSettings + +func (self DockNodeSettings) handle() (result *C.ImGuiDockNodeSettings, fin func()) { + result = (*C.ImGuiDockNodeSettings)(unsafe.Pointer(&self)) + return result, func() {} +} + +func (self DockNodeSettings) c() (C.ImGuiDockNodeSettings, func()) { + result, fin := self.handle() + return *result, fin +} + +func newImGuiDockNodeSettingsFromC(cvalue *C.ImGuiDockNodeSettings) *DockNodeSettings { + return (*DockNodeSettings)(cvalue) +} + +type DockRequest C.ImGuiDockRequest + +func (self DockRequest) handle() (result *C.ImGuiDockRequest, fin func()) { + result = (*C.ImGuiDockRequest)(unsafe.Pointer(&self)) + return result, func() {} +} + +func (self DockRequest) c() (C.ImGuiDockRequest, func()) { + result, fin := self.handle() + return *result, fin +} + +func newImGuiDockRequestFromC(cvalue *C.ImGuiDockRequest) *DockRequest { + return (*DockRequest)(cvalue) +} + +type ID uint32 + +func (self ID) handle() (result *uint32, fin func()) { + return C.uint(self), func() {} +} + +func (self ID) c() (uint32, func()) { + result, fin := self.handle() + return *result, fin +} + +func newIDFromC(cvalue C.uint) { + return uint32(cvalue) +} + +type InputTextDeactivateData C.ImGuiInputTextDeactivateData + +func (self InputTextDeactivateData) handle() (result *C.ImGuiInputTextDeactivateData, fin func()) { + result = (*C.ImGuiInputTextDeactivateData)(unsafe.Pointer(&self)) + return result, func() {} +} + +func (self InputTextDeactivateData) c() (C.ImGuiInputTextDeactivateData, func()) { + result, fin := self.handle() + return *result, fin +} + +func newImGuiInputTextDeactivateDataFromC(cvalue *C.ImGuiInputTextDeactivateData) *InputTextDeactivateData { + return (*InputTextDeactivateData)(cvalue) +} + +type KeyChord int32 + +func (self KeyChord) handle() (result *int32, fin func()) { + return C.int(self), func() {} +} + +func (self KeyChord) c() (int32, func()) { + result, fin := self.handle() + return *result, fin +} + +func newKeyChordFromC(cvalue C.int) { + return int32(cvalue) +} + +type KeyRoutingIndex int + +func (self KeyRoutingIndex) handle() (result *int, fin func()) { + return C.ImS16(self), func() {} +} + +func (self KeyRoutingIndex) c() (int, func()) { + result, fin := self.handle() + return *result, fin +} + +func newKeyRoutingIndexFromC(cvalue C.ImS16) { + return int(cvalue) +} + +type SelectionUserData int64 + +func (self SelectionUserData) handle() (result *int64, fin func()) { + return C.ImS64(self), func() {} +} + +func (self SelectionUserData) c() (int64, func()) { + result, fin := self.handle() + return *result, fin +} + +func newSelectionUserDataFromC(cvalue C.ImS64) { + return int64(cvalue) +} + +type TableColumnIdx int + +func (self TableColumnIdx) handle() (result *int, fin func()) { + return C.ImS16(self), func() {} +} + +func (self TableColumnIdx) c() (int, func()) { + result, fin := self.handle() + return *result, fin +} + +func newTableColumnIdxFromC(cvalue C.ImS16) { + return int(cvalue) +} + +type TableColumnsSettings C.ImGuiTableColumnsSettings + +func (self TableColumnsSettings) handle() (result *C.ImGuiTableColumnsSettings, fin func()) { + result = (*C.ImGuiTableColumnsSettings)(unsafe.Pointer(&self)) + return result, func() {} +} + +func (self TableColumnsSettings) c() (C.ImGuiTableColumnsSettings, func()) { + result, fin := self.handle() + return *result, fin +} + +func newImGuiTableColumnsSettingsFromC(cvalue *C.ImGuiTableColumnsSettings) *TableColumnsSettings { + return (*TableColumnsSettings)(cvalue) +} + +type TableDrawChannelIdx uint16 + +func (self TableDrawChannelIdx) handle() (result *uint16, fin func()) { + return C.ImU16(self), func() {} +} + +func (self TableDrawChannelIdx) c() (uint16, func()) { + result, fin := self.handle() + return *result, fin +} + +func newTableDrawChannelIdxFromC(cvalue C.ImU16) { + return uint16(cvalue) +} + +type PoolIdx int32 + +func (self PoolIdx) handle() (result *int32, fin func()) { + return C.int(self), func() {} +} + +func (self PoolIdx) c() (int32, func()) { + result, fin := self.handle() + return *result, fin +} + +func newPoolIdxFromC(cvalue C.int) { + return int32(cvalue) +} + +type TextureID unsafe.Pointer + +func (self TextureID) handle() (result *unsafe.Pointer, fin func()) { + selfArg, selfFin := WrapVoidPtr(self) + return selfArg, func() { selfFin() } +} + +func (self TextureID) c() (unsafe.Pointer, func()) { + result, fin := self.handle() + return *result, fin +} + +func newTextureIDFromC(cvalue unsafe.Pointer) { + return unsafe.Pointer(cvalue) +} + +type U16 uint16 + +func (self U16) handle() (result *uint16, fin func()) { + return C.ushort(self), func() {} +} + +func (self U16) c() (uint16, func()) { + result, fin := self.handle() + return *result, fin +} + +func newU16FromC(cvalue C.ushort) { + return uint16(cvalue) +} + +type U32 uint32 + +func (self U32) handle() (result *uint32, fin func()) { + return C.uint(self), func() {} +} + +func (self U32) c() (uint32, func()) { + result, fin := self.handle() + return *result, fin +} + +func newU32FromC(cvalue C.uint) { + return uint32(cvalue) +} + +type U8 uint + +func (self U8) handle() (result *uint, fin func()) { + return C.uchar(self), func() {} +} + +func (self U8) c() (uint, func()) { + result, fin := self.handle() + return *result, fin +} + +func newU8FromC(cvalue C.uchar) { + return uint(cvalue) +} + +type Wchar16 uint16 + +func (self Wchar16) handle() (result *uint16, fin func()) { + return C.ushort(self), func() {} +} + +func (self Wchar16) c() (uint16, func()) { + result, fin := self.handle() + return *result, fin +} + +func newWchar16FromC(cvalue C.ushort) { + return uint16(cvalue) +} + +type Wchar32 uint32 + +func (self Wchar32) handle() (result *uint32, fin func()) { + return C.uint(self), func() {} +} + +func (self Wchar32) c() (uint32, func()) { + result, fin := self.handle() + return *result, fin +} + +func newWchar32FromC(cvalue C.uint) { + return uint32(cvalue) +} diff --git a/cimmarkdown_funcs.go b/cimmarkdown_funcs.go index 73974af95..397228aaa 100644 --- a/cimmarkdown_funcs.go +++ b/cimmarkdown_funcs.go @@ -562,21 +562,6 @@ func (self *MarkdownImageData) UseLinkCallback() bool { return C.wrap_MarkdownImageData_GetUseLinkCallback(selfArg) == C.bool(true) } -func (self MarkdownImageData) SetUsertextureid(v TextureID) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_MarkdownImageData_SetUser_texture_id(selfArg, C.ImTextureID(v)) -} - -func (self *MarkdownImageData) Usertextureid() TextureID { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return TextureID(C.wrap_MarkdownImageData_GetUser_texture_id(selfArg)) -} - func (self MarkdownImageData) SetSize(v Vec2) { selfArg, selfFin := self.handle() defer selfFin() diff --git a/cimmarkdown_structs.go b/cimmarkdown_structs.go index 69a5567ef..37f225315 100644 --- a/cimmarkdown_structs.go +++ b/cimmarkdown_structs.go @@ -240,45 +240,13 @@ func newMarkdownHeadingFormatFromC(cvalue *C.MarkdownHeadingFormat) *MarkdownHea } type MarkdownImageData struct { - FieldIsValid bool - FieldUseLinkCallback bool - FieldUser_texture_id TextureID - FieldSize Vec2 - FieldUv0 Vec2 - FieldUv1 Vec2 - FieldTint_col Vec4 - FieldBorder_col Vec4 + // TODO: contains unsupported fields + data unsafe.Pointer } 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 + result = (*C.MarkdownImageData)(self.data) + return result, func() {} } func (self MarkdownImageData) c() (result C.MarkdownImageData, fin func()) { @@ -288,14 +256,7 @@ func (self MarkdownImageData) c() (result C.MarkdownImageData, fin func()) { 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) + result.data = unsafe.Pointer(cvalue) return result } diff --git a/cimmarkdown_typedefs.go b/cimmarkdown_typedefs.go new file mode 100644 index 000000000..0c6846e99 --- /dev/null +++ b/cimmarkdown_typedefs.go @@ -0,0 +1,11 @@ +// 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" diff --git a/cimnodes_funcs.go b/cimnodes_funcs.go index eea1b4c3c..31d753582 100644 --- a/cimnodes_funcs.go +++ b/cimnodes_funcs.go @@ -107,6 +107,30 @@ func imnodesClearNodeSelectionNil() { C.imnodes_ClearNodeSelection_Nil() } +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) @@ -126,6 +150,13 @@ func imnodesEditorContextResetPanning(pos Vec2) { C.imnodes_EditorContextResetPanning(pos.toC()) } +func imnodesEditorContextSet(noname1 *NodesEditorContext) { + noname1Arg, noname1Fin := noname1.handle() + C.imnodes_EditorContextSet(noname1Arg) + + noname1Fin() +} + func imnodesEndInputAttribute() { C.imnodes_EndInputAttribute() } @@ -150,6 +181,10 @@ func imnodesEndStaticAttribute() { C.imnodes_EndStaticAttribute() } +func imnodesGetCurrentContext() *NodesContext { + return newNodesContextFromC(C.imnodes_GetCurrentContext()) +} + func imnodesGetIO() *NodesIO { return newNodesIOFromC(C.imnodes_GetIO()) } @@ -352,6 +387,24 @@ func imnodesLoadCurrentEditorStateFromIniString(data string, data_size uint64) { dataFin() } +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()) } @@ -403,6 +456,26 @@ func imnodesSaveCurrentEditorStateToIniStringV(data_size *uint64) string { return C.GoString(C.imnodes_SaveCurrentEditorStateToIniString((*C.xulong)(data_size))) } +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)) } @@ -411,6 +484,13 @@ func imnodesSelectNode(node_id int32) { C.imnodes_SelectNode(C.int(node_id)) } +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) @@ -523,6 +603,15 @@ func imnodesSaveCurrentEditorStateToIniString() string { return C.GoString(C.wrap_imnodes_SaveCurrentEditorStateToIniString()) } +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() } diff --git a/cimnodes_typedefs.go b/cimnodes_typedefs.go new file mode 100644 index 000000000..41860b680 --- /dev/null +++ b/cimnodes_typedefs.go @@ -0,0 +1,75 @@ +// 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 Context C.ImGuiContext + +func (self Context) handle() (result *C.ImGuiContext, fin func()) { + result = (*C.ImGuiContext)(unsafe.Pointer(&self)) + return result, func() {} +} + +func (self Context) c() (C.ImGuiContext, func()) { + result, fin := self.handle() + return *result, fin +} + +func newImGuiContextFromC(cvalue *C.ImGuiContext) *Context { + return (*Context)(cvalue) +} + +type NodesContext C.ImNodesContext + +func (self NodesContext) handle() (result *C.ImNodesContext, fin func()) { + result = (*C.ImNodesContext)(unsafe.Pointer(&self)) + return result, func() {} +} + +func (self NodesContext) c() (C.ImNodesContext, func()) { + result, fin := self.handle() + return *result, fin +} + +func newImNodesContextFromC(cvalue *C.ImNodesContext) *NodesContext { + return (*NodesContext)(cvalue) +} + +type NodesEditorContext C.ImNodesEditorContext + +func (self NodesEditorContext) handle() (result *C.ImNodesEditorContext, fin func()) { + result = (*C.ImNodesEditorContext)(unsafe.Pointer(&self)) + return result, func() {} +} + +func (self NodesEditorContext) c() (C.ImNodesEditorContext, func()) { + result, fin := self.handle() + return *result, fin +} + +func newImNodesEditorContextFromC(cvalue *C.ImNodesEditorContext) *NodesEditorContext { + return (*NodesEditorContext)(cvalue) +} + +type NodesMiniMapNodeHoveringCallbackUserData unsafe.Pointer + +func (self NodesMiniMapNodeHoveringCallbackUserData) handle() (result *unsafe.Pointer, fin func()) { + selfArg, selfFin := WrapVoidPtr(self) + return selfArg, func() { selfFin() } +} + +func (self NodesMiniMapNodeHoveringCallbackUserData) c() (unsafe.Pointer, func()) { + result, fin := self.handle() + return *result, fin +} + +func newNodesMiniMapNodeHoveringCallbackUserDataFromC(cvalue unsafe.Pointer) { + return unsafe.Pointer(cvalue) +} diff --git a/cimplot_funcs.go b/cimplot_funcs.go index 72f5b5db8..eaea5647b 100644 --- a/cimplot_funcs.go +++ b/cimplot_funcs.go @@ -596,17 +596,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() @@ -618,15 +607,6 @@ func (self *PlotItemGroup) ItemIndex(item *PlotItem) int32 { return int32(C.ImPlotItemGroup_GetItemIndex(selfArg, itemArg)) } -func (self *PlotItemGroup) ItemByID(id ID) *PlotItem { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return newPlotItemFromC(C.ImPlotItemGroup_GetItem_ID(selfArg, C.ImGuiID(id))) -} - func (self *PlotItemGroup) ItemStr(label_id string) *PlotItem { selfArg, selfFin := self.handle() label_idArg, label_idFin := WrapString(label_id) @@ -665,15 +645,6 @@ func (self *PlotItemGroup) LegendLabel(i int32) string { return C.GoString(C.ImPlotItemGroup_GetLegendLabel(selfArg, C.int(i))) } -func (self *PlotItemGroup) OrAddItem(id ID) *PlotItem { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return newPlotItemFromC(C.ImPlotItemGroup_GetOrAddItem(selfArg, C.ImGuiID(id))) -} - func NewPlotItemGroup() *PlotItemGroup { return newPlotItemGroupFromC(C.ImPlotItemGroup_ImPlotItemGroup()) } @@ -5562,18 +5533,6 @@ func PlotPlotHistogramdoublePtrV(label_id string, values *[]float64, count int32 return float64(C.ImPlot_PlotHistogram_doublePtr(label_idArg, (*C.double)(&valuesArg[0]), C.int(count), C.int(bins), C.double(bar_scale), rangeArgArg, C.ImPlotHistogramFlags(flags))) } -// PlotPlotImageV parameter default value hint: -// uv0: ImVec2(0,0) -// uv1: ImVec2(1,1) -// tint_col: ImVec4(1,1,1,1) -// 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)) - - label_idFin() -} - // PlotPlotInfLinesFloatPtrV parameter default value hint: // flags: 0 // offset: 0 @@ -11144,13 +11103,6 @@ func PlotPlotHistogramdoublePtr(label_id string, values *[]float64, count int32) return float64(C.wrap_ImPlot_PlotHistogram_doublePtr(label_idArg, (*C.double)(&valuesArg[0]), C.int(count))) } -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()) - - label_idFin() -} - func PlotPlotInfLinesFloatPtr(label_id string, values []float32, count int32) { label_idArg, label_idFin := WrapString(label_id) C.wrap_ImPlot_PlotInfLines_FloatPtr(label_idArg, (*C.float)(&(values[0])), C.int(count)) @@ -13772,21 +13724,6 @@ func (self *PlotAnnotationCollection) Size() int32 { return int32(C.wrap_ImPlotAnnotationCollection_GetSize(selfArg)) } -func (self PlotAxis) SetID(v ID) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImPlotAxis_SetID(selfArg, C.ImGuiID(v)) -} - -func (self *PlotAxis) ID() ID { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return ID(C.wrap_ImPlotAxis_GetID(selfArg)) -} - func (self PlotAxis) SetFlags(v PlotAxisFlags) { selfArg, selfFin := self.handle() defer selfFin() @@ -15393,21 +15330,6 @@ func (self *PlotInputMap) ZoomRate() float32 { return float32(C.wrap_ImPlotInputMap_GetZoomRate(selfArg)) } -func (self PlotItem) SetID(v ID) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImPlotItem_SetID(selfArg, C.ImGuiID(v)) -} - -func (self *PlotItem) ID() ID { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return ID(C.wrap_ImPlotItem_GetID(selfArg)) -} - func (self PlotItem) SetColor(v uint32) { selfArg, selfFin := self.handle() defer selfFin() @@ -15498,21 +15420,6 @@ func (self *PlotItem) SeenThisFrame() bool { return C.wrap_ImPlotItem_GetSeenThisFrame(selfArg) == C.bool(true) } -func (self PlotItemGroup) SetID(v ID) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImPlotItemGroup_SetID(selfArg, C.ImGuiID(v)) -} - -func (self *PlotItemGroup) ID() ID { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return ID(C.wrap_ImPlotItemGroup_GetID(selfArg)) -} - func (self PlotItemGroup) SetLegend(v PlotLegend) { vArg, _ := v.c() @@ -15979,21 +15886,6 @@ func (self *PlotNextItemData) HiddenCond() PlotCond { return PlotCond(C.wrap_ImPlotNextItemData_GetHiddenCond(selfArg)) } -func (self PlotPlot) SetID(v ID) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImPlotPlot_SetID(selfArg, C.ImGuiID(v)) -} - -func (self *PlotPlot) ID() ID { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return ID(C.wrap_ImPlotPlot_GetID(selfArg)) -} - func (self PlotPlot) SetFlags(v PlotFlags) { selfArg, selfFin := self.handle() defer selfFin() @@ -16955,21 +16847,6 @@ func (self *PlotStyle) Use24HourClock() bool { return C.wrap_ImPlotStyle_GetUse24HourClock(selfArg) == C.bool(true) } -func (self PlotSubplot) SetID(v ID) { - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImPlotSubplot_SetID(selfArg, C.ImGuiID(v)) -} - -func (self *PlotSubplot) ID() ID { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return ID(C.wrap_ImPlotSubplot_GetID(selfArg)) -} - func (self PlotSubplot) SetFlags(v PlotSubplotFlags) { selfArg, selfFin := self.handle() defer selfFin() diff --git a/cimplot_structs.go b/cimplot_structs.go index 53706085b..2ca118cab 100644 --- a/cimplot_structs.go +++ b/cimplot_structs.go @@ -356,41 +356,13 @@ func newPlotInputMapFromC(cvalue *C.ImPlotInputMap) *PlotInputMap { } type PlotItem struct { - FieldID ID - FieldColor uint32 - FieldLegendHoverRect Rect - FieldNameOffset int32 - FieldShow bool - FieldLegendHovered bool - FieldSeenThisFrame bool + // TODO: contains unsupported fields + data unsafe.Pointer } 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 + result = (*C.ImPlotItem)(self.data) + return result, func() {} } func (self PlotItem) c() (result C.ImPlotItem, fin func()) { @@ -400,13 +372,7 @@ func (self PlotItem) c() (result C.ImPlotItem, fin func()) { 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) + result.data = unsafe.Pointer(cvalue) return result } diff --git a/cimplot_typedefs.go b/cimplot_typedefs.go new file mode 100644 index 000000000..b34be3a09 --- /dev/null +++ b/cimplot_typedefs.go @@ -0,0 +1,27 @@ +// 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 PlotAxisColor C.ImPlotAxisColor + +func (self PlotAxisColor) handle() (result *C.ImPlotAxisColor, fin func()) { + result = (*C.ImPlotAxisColor)(unsafe.Pointer(&self)) + return result, func() {} +} + +func (self PlotAxisColor) c() (C.ImPlotAxisColor, func()) { + result, fin := self.handle() + return *result, fin +} + +func newImPlotAxisColorFromC(cvalue *C.ImPlotAxisColor) *PlotAxisColor { + return (*PlotAxisColor)(cvalue) +} From 9ea53a89d42fcf86230a3a16d54522c7443d45cd Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Wed, 27 Sep 2023 18:00:26 +0200 Subject: [PATCH 09/68] codegen: skip some types; update --- Makefile | 6 +++--- cmd/codegen/arguments_wrapper.go | 12 +++++++++--- cmd/codegen/gengo.go | 11 +++++++++++ cmd/codegen/gengo_funcs.go | 9 ++++++--- cmd/codegen/gengo_structs.go | 10 +++++----- cmd/codegen/gengo_typedefs.go | 7 +++++++ cmd/codegen/main.go | 23 +++++++++++++++++++++-- cmd/codegen/return_wrapper.go | 18 ++++++++++++------ 8 files changed, 74 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index 6bc9978d6..915562bf0 100644 --- a/Makefile +++ b/Makefile @@ -39,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,cimgui/cimplot_templates/typedefs_dict.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 @@ -48,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,cimgui/cimnodes_templates/typedefs_dict.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 @@ -57,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,cimgui/cimmarkdown_templates/typedefs_dict.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/cmd/codegen/arguments_wrapper.go b/cmd/codegen/arguments_wrapper.go index a9c4ea9fd..2ed222fd5 100644 --- a/cmd/codegen/arguments_wrapper.go +++ b/cmd/codegen/arguments_wrapper.go @@ -29,7 +29,13 @@ type ArgumentWrapperData struct { 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"), @@ -167,7 +173,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) } @@ -207,7 +213,7 @@ func getArgWrapper(a *ArgDef, makeFirstArgReceiver, isGetter bool, structNames m isPointer = true } - if structNames[pureType] { + if _, isRefTypedef := refTypedefs[pureType]; structNames[pureType] || isRefTypedef { w := ArgumentWrapperData{ ArgType: pureType.renameGoIdentifier(), VarName: fmt.Sprintf("%sArg", a.Name), diff --git a/cmd/codegen/gengo.go b/cmd/codegen/gengo.go index 53b6f3e60..b98a5714c 100644 --- a/cmd/codegen/gengo.go +++ b/cmd/codegen/gengo.go @@ -37,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", diff --git a/cmd/codegen/gengo_funcs.go b/cmd/codegen/gengo_funcs.go index 14e3a33b0..04afc9937 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: @@ -357,6 +359,7 @@ func (g *goFuncsGenerator) generateFuncArgs(f FuncDef) (args []GoIdentifier, arg f.StructGetter && g.structNames[a.Type], g.structNames, g.enumNames, + g.refTypedefs, ) if err != nil { diff --git a/cmd/codegen/gengo_structs.go b/cmd/codegen/gengo_structs.go index 533f47bd5..ab1a42c3e 100644 --- a/cmd/codegen/gengo_structs.go +++ b/cmd/codegen/gengo_structs.go @@ -8,7 +8,7 @@ import ( "strings" ) -func generateGoStructs(prefix string, structs []StructDef, enums []EnumDef, refEnums []GoIdentifier, refStructs []CIdentifier) []CIdentifier { +func generateGoStructs(prefix string, structs []StructDef, enums []EnumDef, refEnums []GoIdentifier, refStructs []CIdentifier, refTypedefs map[CIdentifier]string) []CIdentifier { glg.Infof("Generating %d structs", len(structs)) var progress int @@ -35,7 +35,7 @@ import "unsafe" } sb.WriteString(fmt.Sprintf("%s\n", s.CommentAbove)) - if generateStruct(s, structs, enums, refEnums, refStructs, &sb) { + if generateStruct(s, structs, enums, refEnums, refStructs, refTypedefs, &sb) { progress++ } @@ -60,7 +60,7 @@ import "unsafe" return structNames } -func generateStruct(s StructDef, defs []StructDef, enumDefs []EnumDef, refEnums []GoIdentifier, refStructs []CIdentifier, sb *strings.Builder) (generationComplete bool) { +func generateStruct(s StructDef, defs []StructDef, enumDefs []EnumDef, refEnums []GoIdentifier, refStructs []CIdentifier, refTypedefs map[CIdentifier]string, sb *strings.Builder) (generationComplete bool) { structs, enums := make(map[CIdentifier]bool), make(map[GoIdentifier]bool) for _, s := range defs { structs[s.Name] = true @@ -101,12 +101,12 @@ func generateStruct(s StructDef, defs []StructDef, enumDefs []EnumDef, refEnums _, toC, toCErr := getArgWrapper( &argDef, false, false, - structs, enums, + structs, enums, refTypedefs, ) fromC, fromCErr := getReturnWrapper( field.Type, - structs, enums, + structs, enums, refTypedefs, ) switch { diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index 19197e71c..a7d8df315 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -36,6 +36,11 @@ import "unsafe" SortStrings(keys) for _, k := range keys { + if shouldSkip, ok := skippedTypedefs[k]; ok && shouldSkip { + glg.Infof("Arbitrarly skipping typedef %s", k) + continue + } + if shouldSkipStruct(k) { glg.Infof("Arbitrarly skipping struct %s", k) continue @@ -55,6 +60,7 @@ import "unsafe" CIdentifier(typedefs.data[k]), map[CIdentifier]bool{}, map[GoIdentifier]bool{}, + map[CIdentifier]string{}, ) _, knownArgType, argTypeErr := getArgWrapper( @@ -65,6 +71,7 @@ import "unsafe" false, false, map[CIdentifier]bool{}, map[GoIdentifier]bool{}, + map[CIdentifier]string{}, ) // check if k is a name of struct from structDefs diff --git a/cmd/codegen/main.go b/cmd/codegen/main.go index dbbc209fb..c7d3c3323 100644 --- a/cmd/codegen/main.go +++ b/cmd/codegen/main.go @@ -42,6 +42,7 @@ func main() { 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") @@ -82,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 { @@ -119,9 +128,19 @@ 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 + } + // generate code enumNames := generateGoEnums(*prefix, enums) - structNames := generateGoStructs(*prefix, structs, enums, es, ss) + structNames := generateGoStructs(*prefix, structs, enums, es, ss, refTypedefs) structAccessorFuncs, err := generateCppStructsAccessor(*prefix, validFuncs, structs) if err != nil { @@ -137,7 +156,7 @@ func main() { structNames = append(structNames, callbacks...) - if err := generateGoFuncs(*prefix, validFuncs, enumNames, structNames); err != nil { + 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 8ec8cf8dd..3866253da 100644 --- a/cmd/codegen/return_wrapper.go +++ b/cmd/codegen/return_wrapper.go @@ -14,6 +14,7 @@ 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)"}, @@ -59,6 +60,11 @@ func getReturnWrapper( "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] + _, isStruct := structNames[pureType] + isStruct = isStruct || isRefStruct w, known := returnWrapperMap[t] switch { case known: @@ -77,7 +83,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) } @@ -85,16 +91,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) } From 0f967f922b012a4ec9a5949706f4e0c71781754e Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Wed, 27 Sep 2023 18:00:35 +0200 Subject: [PATCH 10/68] regenerate code --- cimgui_funcs.go | 136 +++++++++++-------------------------------- cimgui_typedefs.go | 45 -------------- cimmarkdown_funcs.go | 15 +++++ cimplot_funcs.go | 103 ++++++++++++++++++++++++++++++++ 4 files changed, 152 insertions(+), 147 deletions(-) diff --git a/cimgui_funcs.go b/cimgui_funcs.go index 12ec9d1d0..3d2199878 100644 --- a/cimgui_funcs.go +++ b/cimgui_funcs.go @@ -13839,9 +13839,7 @@ func (self *DrawVert) Col() uint32 { defer func() { selfFin() }() - - result := C.wrap_ImDrawVert_GetCol(selfArg) - return uint32(result) + return uint32(C.wrap_ImDrawVert_GetCol(selfArg)) } func (self Font) SetIndexAdvanceX(v Vector[*float32]) { @@ -15610,9 +15608,7 @@ func (self *Context) InputEventsNextEventId() uint32 { defer func() { selfFin() }() - - result := C.wrap_ImGuiContext_GetInputEventsNextEventId(selfArg) - return uint32(result) + return uint32(C.wrap_ImGuiContext_GetInputEventsNextEventId(selfArg)) } func (self Context) SetCurrentWindowStack(v Vector[*WindowStackData]) { @@ -16300,9 +16296,7 @@ func (self *Context) ActiveIdUsingNavDirMask() uint32 { defer func() { selfFin() }() - - result := C.wrap_ImGuiContext_GetActiveIdUsingNavDirMask(selfArg) - return uint32(result) + return uint32(C.wrap_ImGuiContext_GetActiveIdUsingNavDirMask(selfArg)) } func (self Context) SetActiveIdUsingAllKeyboardKeys(v bool) { @@ -16332,9 +16326,7 @@ func (self *Context) ActiveIdUsingNavInputMask() uint32 { defer func() { selfFin() }() - - result := C.wrap_ImGuiContext_GetActiveIdUsingNavInputMask(selfArg) - return uint32(result) + return uint32(C.wrap_ImGuiContext_GetActiveIdUsingNavInputMask(selfArg)) } func (self Context) SetCurrentFocusScopeId(v ID) { @@ -18410,9 +18402,7 @@ func (self *Context) ColorEditSavedColor() uint32 { defer func() { selfFin() }() - - result := C.wrap_ImGuiContext_GetColorEditSavedColor(selfArg) - return uint32(result) + return uint32(C.wrap_ImGuiContext_GetColorEditSavedColor(selfArg)) } func (self Context) SetColorPickerRef(v Vec4) { @@ -19092,9 +19082,7 @@ func (self *Context) DebugLogClipperAutoDisableFrames() byte { defer func() { selfFin() }() - - result := C.wrap_ImGuiContext_GetDebugLogClipperAutoDisableFrames(selfArg) - return byte(result) + return byte(C.wrap_ImGuiContext_GetDebugLogClipperAutoDisableFrames(selfArg)) } func (self Context) SetDebugLocateFrames(v byte) { @@ -19109,9 +19097,7 @@ func (self *Context) DebugLocateFrames() byte { defer func() { selfFin() }() - - result := C.wrap_ImGuiContext_GetDebugLocateFrames(selfArg) - return byte(result) + return byte(C.wrap_ImGuiContext_GetDebugLocateFrames(selfArg)) } func (self Context) SetDebugBeginReturnValueCullDepth(v int) { @@ -19156,9 +19142,7 @@ func (self *Context) DebugItemPickerMouseButton() byte { defer func() { selfFin() }() - - result := C.wrap_ImGuiContext_GetDebugItemPickerMouseButton(selfArg) - return byte(result) + return byte(C.wrap_ImGuiContext_GetDebugItemPickerMouseButton(selfArg)) } func (self Context) SetDebugItemPickerBreakId(v ID) { @@ -19511,9 +19495,7 @@ func (self *DataVarInfo) Count() uint32 { defer func() { selfFin() }() - - result := C.wrap_ImGuiDataVarInfo_GetCount(selfArg) - return uint32(result) + return uint32(C.wrap_ImGuiDataVarInfo_GetCount(selfArg)) } func (self DataVarInfo) SetOffset(v uint32) { @@ -19528,9 +19510,7 @@ func (self *DataVarInfo) Offset() uint32 { defer func() { selfFin() }() - - result := C.wrap_ImGuiDataVarInfo_GetOffset(selfArg) - return uint32(result) + return uint32(C.wrap_ImGuiDataVarInfo_GetOffset(selfArg)) } func (self DockContext) SetNodes(v Storage) { @@ -19817,9 +19797,7 @@ func (self *DockNode) LastBgColor() uint32 { defer func() { selfFin() }() - - result := C.wrap_ImGuiDockNode_GetLastBgColor(selfArg) - return uint32(result) + return uint32(C.wrap_ImGuiDockNode_GetLastBgColor(selfArg)) } func (self DockNode) SetHostWindow(v *Window) { @@ -21718,9 +21696,7 @@ func (self *InputEvent) EventId() uint32 { defer func() { selfFin() }() - - result := C.wrap_ImGuiInputEvent_GetEventId(selfArg) - return uint32(result) + return uint32(C.wrap_ImGuiInputEvent_GetEventId(selfArg)) } func (self InputEvent) SetAddedByTestEngine(v bool) { @@ -22643,9 +22619,7 @@ func (self *KeyRoutingData) Mods() uint16 { defer func() { selfFin() }() - - result := C.wrap_ImGuiKeyRoutingData_GetMods(selfArg) - return uint16(result) + return uint16(C.wrap_ImGuiKeyRoutingData_GetMods(selfArg)) } func (self KeyRoutingData) SetRoutingNextScore(v byte) { @@ -22660,9 +22634,7 @@ func (self *KeyRoutingData) RoutingNextScore() byte { defer func() { selfFin() }() - - result := C.wrap_ImGuiKeyRoutingData_GetRoutingNextScore(selfArg) - return byte(result) + return byte(C.wrap_ImGuiKeyRoutingData_GetRoutingNextScore(selfArg)) } func (self KeyRoutingData) SetRoutingCurr(v ID) { @@ -23156,9 +23128,7 @@ func (self *MenuColumns) TotalWidth() uint32 { defer func() { selfFin() }() - - result := C.wrap_ImGuiMenuColumns_GetTotalWidth(selfArg) - return uint32(result) + return uint32(C.wrap_ImGuiMenuColumns_GetTotalWidth(selfArg)) } func (self MenuColumns) SetNextTotalWidth(v uint32) { @@ -23173,9 +23143,7 @@ func (self *MenuColumns) NextTotalWidth() uint32 { defer func() { selfFin() }() - - result := C.wrap_ImGuiMenuColumns_GetNextTotalWidth(selfArg) - return uint32(result) + return uint32(C.wrap_ImGuiMenuColumns_GetNextTotalWidth(selfArg)) } func (self MenuColumns) SetSpacing(v uint16) { @@ -23190,9 +23158,7 @@ func (self *MenuColumns) Spacing() uint16 { defer func() { selfFin() }() - - result := C.wrap_ImGuiMenuColumns_GetSpacing(selfArg) - return uint16(result) + return uint16(C.wrap_ImGuiMenuColumns_GetSpacing(selfArg)) } func (self MenuColumns) SetOffsetIcon(v uint16) { @@ -23207,9 +23173,7 @@ func (self *MenuColumns) OffsetIcon() uint16 { defer func() { selfFin() }() - - result := C.wrap_ImGuiMenuColumns_GetOffsetIcon(selfArg) - return uint16(result) + return uint16(C.wrap_ImGuiMenuColumns_GetOffsetIcon(selfArg)) } func (self MenuColumns) SetOffsetLabel(v uint16) { @@ -23224,9 +23188,7 @@ func (self *MenuColumns) OffsetLabel() uint16 { defer func() { selfFin() }() - - result := C.wrap_ImGuiMenuColumns_GetOffsetLabel(selfArg) - return uint16(result) + return uint16(C.wrap_ImGuiMenuColumns_GetOffsetLabel(selfArg)) } func (self MenuColumns) SetOffsetShortcut(v uint16) { @@ -23241,9 +23203,7 @@ func (self *MenuColumns) OffsetShortcut() uint16 { defer func() { selfFin() }() - - result := C.wrap_ImGuiMenuColumns_GetOffsetShortcut(selfArg) - return uint16(result) + return uint16(C.wrap_ImGuiMenuColumns_GetOffsetShortcut(selfArg)) } func (self MenuColumns) SetOffsetMark(v uint16) { @@ -23258,9 +23218,7 @@ func (self *MenuColumns) OffsetMark() uint16 { defer func() { selfFin() }() - - result := C.wrap_ImGuiMenuColumns_GetOffsetMark(selfArg) - return uint16(result) + return uint16(C.wrap_ImGuiMenuColumns_GetOffsetMark(selfArg)) } func (self MetricsConfig) SetShowDebugLog(v bool) { @@ -27192,9 +27150,7 @@ func (self *Table) BorderColorStrong() uint32 { defer func() { selfFin() }() - - result := C.wrap_ImGuiTable_GetBorderColorStrong(selfArg) - return uint32(result) + return uint32(C.wrap_ImGuiTable_GetBorderColorStrong(selfArg)) } func (self Table) SetBorderColorLight(v uint32) { @@ -27209,9 +27165,7 @@ func (self *Table) BorderColorLight() uint32 { defer func() { selfFin() }() - - result := C.wrap_ImGuiTable_GetBorderColorLight(selfArg) - return uint32(result) + return uint32(C.wrap_ImGuiTable_GetBorderColorLight(selfArg)) } func (self Table) SetBorderX1(v float32) { @@ -28489,9 +28443,7 @@ func (self *TableCellData) BgColor() uint32 { defer func() { selfFin() }() - - result := C.wrap_ImGuiTableCellData_GetBgColor(selfArg) - return uint32(result) + return uint32(C.wrap_ImGuiTableCellData_GetBgColor(selfArg)) } func (self TableCellData) SetColumn(v TableColumnIdx) { @@ -29086,9 +29038,7 @@ func (self *TableColumn) AutoFitQueue() byte { defer func() { selfFin() }() - - result := C.wrap_ImGuiTableColumn_GetAutoFitQueue(selfArg) - return byte(result) + return byte(C.wrap_ImGuiTableColumn_GetAutoFitQueue(selfArg)) } func (self TableColumn) SetCannotSkipItemsQueue(v byte) { @@ -29103,9 +29053,7 @@ func (self *TableColumn) CannotSkipItemsQueue() byte { defer func() { selfFin() }() - - result := C.wrap_ImGuiTableColumn_GetCannotSkipItemsQueue(selfArg) - return byte(result) + return byte(C.wrap_ImGuiTableColumn_GetCannotSkipItemsQueue(selfArg)) } func (self TableColumn) SetSortDirection(v byte) { @@ -29120,9 +29068,7 @@ func (self *TableColumn) SortDirection() byte { defer func() { selfFin() }() - - result := C.wrap_ImGuiTableColumn_GetSortDirection(selfArg) - return byte(result) + return byte(C.wrap_ImGuiTableColumn_GetSortDirection(selfArg)) } func (self TableColumn) SetSortDirectionsAvailCount(v byte) { @@ -29137,9 +29083,7 @@ func (self *TableColumn) SortDirectionsAvailCount() byte { defer func() { selfFin() }() - - result := C.wrap_ImGuiTableColumn_GetSortDirectionsAvailCount(selfArg) - return byte(result) + return byte(C.wrap_ImGuiTableColumn_GetSortDirectionsAvailCount(selfArg)) } func (self TableColumn) SetSortDirectionsAvailMask(v byte) { @@ -29154,9 +29098,7 @@ func (self *TableColumn) SortDirectionsAvailMask() byte { defer func() { selfFin() }() - - result := C.wrap_ImGuiTableColumn_GetSortDirectionsAvailMask(selfArg) - return byte(result) + return byte(C.wrap_ImGuiTableColumn_GetSortDirectionsAvailMask(selfArg)) } func (self TableColumn) SetSortDirectionsAvailList(v byte) { @@ -29171,9 +29113,7 @@ func (self *TableColumn) SortDirectionsAvailList() byte { defer func() { selfFin() }() - - result := C.wrap_ImGuiTableColumn_GetSortDirectionsAvailList(selfArg) - return byte(result) + return byte(C.wrap_ImGuiTableColumn_GetSortDirectionsAvailList(selfArg)) } func (self TableColumnSettings) SetWidthOrWeight(v float32) { @@ -29279,9 +29219,7 @@ func (self *TableColumnSettings) SortDirection() byte { defer func() { selfFin() }() - - result := C.wrap_ImGuiTableColumnSettings_GetSortDirection(selfArg) - return byte(result) + return byte(C.wrap_ImGuiTableColumnSettings_GetSortDirection(selfArg)) } func (self TableColumnSettings) SetIsEnabled(v byte) { @@ -29296,9 +29234,7 @@ func (self *TableColumnSettings) IsEnabled() byte { defer func() { selfFin() }() - - result := C.wrap_ImGuiTableColumnSettings_GetIsEnabled(selfArg) - return byte(result) + return byte(C.wrap_ImGuiTableColumnSettings_GetIsEnabled(selfArg)) } func (self TableColumnSettings) SetIsStretch(v byte) { @@ -29313,9 +29249,7 @@ func (self *TableColumnSettings) IsStretch() byte { defer func() { selfFin() }() - - result := C.wrap_ImGuiTableColumnSettings_GetIsStretch(selfArg) - return byte(result) + return byte(C.wrap_ImGuiTableColumnSettings_GetIsStretch(selfArg)) } func (self TableColumnSortSpecs) SetColumnUserID(v ID) { @@ -33250,9 +33184,7 @@ func (self *WindowTempData) TreeJumpToParentOnPopMask() uint32 { defer func() { selfFin() }() - - result := C.wrap_ImGuiWindowTempData_GetTreeJumpToParentOnPopMask(selfArg) - return uint32(result) + return uint32(C.wrap_ImGuiWindowTempData_GetTreeJumpToParentOnPopMask(selfArg)) } func (self WindowTempData) SetStateStorage(v *Storage) { diff --git a/cimgui_typedefs.go b/cimgui_typedefs.go index 30efa2a0c..d60c0b5f2 100644 --- a/cimgui_typedefs.go +++ b/cimgui_typedefs.go @@ -226,51 +226,6 @@ func newTextureIDFromC(cvalue unsafe.Pointer) { return unsafe.Pointer(cvalue) } -type U16 uint16 - -func (self U16) handle() (result *uint16, fin func()) { - return C.ushort(self), func() {} -} - -func (self U16) c() (uint16, func()) { - result, fin := self.handle() - return *result, fin -} - -func newU16FromC(cvalue C.ushort) { - return uint16(cvalue) -} - -type U32 uint32 - -func (self U32) handle() (result *uint32, fin func()) { - return C.uint(self), func() {} -} - -func (self U32) c() (uint32, func()) { - result, fin := self.handle() - return *result, fin -} - -func newU32FromC(cvalue C.uint) { - return uint32(cvalue) -} - -type U8 uint - -func (self U8) handle() (result *uint, fin func()) { - return C.uchar(self), func() {} -} - -func (self U8) c() (uint, func()) { - result, fin := self.handle() - return *result, fin -} - -func newU8FromC(cvalue C.uchar) { - return uint(cvalue) -} - type Wchar16 uint16 func (self Wchar16) handle() (result *uint16, fin func()) { diff --git a/cimmarkdown_funcs.go b/cimmarkdown_funcs.go index 397228aaa..c2101d848 100644 --- a/cimmarkdown_funcs.go +++ b/cimmarkdown_funcs.go @@ -111,6 +111,13 @@ func (self *TextRegion) Destroy() { selfFin() } +func UnderLine(col_ Color) { + col_Arg, col_Fin := col_.c() + C.UnderLine(col_Arg) + + col_Fin() +} + func RenderLinkTextWrapped(self *TextRegion, text_ string, link_ Link, markdown_ string, mdConfig_ MarkdownConfig, linkHoverStart_ []string) { selfArg, selfFin := self.handle() text_Arg, text_Fin := WrapString(text_) @@ -562,6 +569,14 @@ func (self *MarkdownImageData) UseLinkCallback() bool { return C.wrap_MarkdownImageData_GetUseLinkCallback(selfArg) == C.bool(true) } +func (self MarkdownImageData) SetUsertextureid(v TextureID) { + vArg, _ := v.c() + + selfArg, selfFin := self.handle() + defer selfFin() + C.wrap_MarkdownImageData_SetUser_texture_id(selfArg, vArg) +} + func (self MarkdownImageData) SetSize(v Vec2) { selfArg, selfFin := self.handle() defer selfFin() diff --git a/cimplot_funcs.go b/cimplot_funcs.go index eaea5647b..e6138d91a 100644 --- a/cimplot_funcs.go +++ b/cimplot_funcs.go @@ -472,6 +472,15 @@ func (self *PlotColormapData) KeyCount(cmap PlotColormap) int32 { return int32(C.ImPlotColormapData_GetKeyCount(selfArg, C.ImPlotColormap(cmap))) } +func (self *PlotColormapData) Keys(cmap PlotColormap) *U32 { + selfArg, selfFin := self.handle() + + defer func() { + selfFin() + }() + return newU32FromC(C.ImPlotColormapData_GetKeys(selfArg, C.ImPlotColormap(cmap))) +} + func (self *PlotColormapData) Name(cmap PlotColormap) string { selfArg, selfFin := self.handle() @@ -481,6 +490,15 @@ func (self *PlotColormapData) Name(cmap PlotColormap) string { return C.GoString(C.ImPlotColormapData_GetName(selfArg, C.ImPlotColormap(cmap))) } +func (self *PlotColormapData) Table(cmap PlotColormap) *U32 { + selfArg, selfFin := self.handle() + + defer func() { + selfFin() + }() + return newU32FromC(C.ImPlotColormapData_GetTable(selfArg, C.ImPlotColormap(cmap))) +} + func (self *PlotColormapData) TableColor(cmap PlotColormap, idx int32) uint32 { selfArg, selfFin := self.handle() @@ -607,6 +625,17 @@ func (self *PlotItemGroup) ItemIndex(item *PlotItem) int32 { return int32(C.ImPlotItemGroup_GetItemIndex(selfArg, itemArg)) } +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, idArg)) +} + func (self *PlotItemGroup) ItemStr(label_id string) *PlotItem { selfArg, selfFin := self.handle() label_idArg, label_idFin := WrapString(label_id) @@ -645,6 +674,17 @@ func (self *PlotItemGroup) LegendLabel(i int32) string { return C.GoString(C.ImPlotItemGroup_GetLegendLabel(selfArg, C.int(i))) } +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, idArg)) +} + func NewPlotItemGroup() *PlotItemGroup { return newPlotItemGroupFromC(C.ImPlotItemGroup_ImPlotItemGroup()) } @@ -5533,6 +5573,20 @@ func PlotPlotHistogramdoublePtrV(label_id string, values *[]float64, count int32 return float64(C.ImPlot_PlotHistogram_doublePtr(label_idArg, (*C.double)(&valuesArg[0]), C.int(count), C.int(bins), C.double(bar_scale), rangeArgArg, C.ImPlotHistogramFlags(flags))) } +// PlotPlotImageV parameter default value hint: +// uv0: ImVec2(0,0) +// uv1: ImVec2(1,1) +// tint_col: ImVec4(1,1,1,1) +// 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) + 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: // flags: 0 // offset: 0 @@ -11103,6 +11157,15 @@ func PlotPlotHistogramdoublePtr(label_id string, values *[]float64, count int32) return float64(C.wrap_ImPlot_PlotHistogram_doublePtr(label_idArg, (*C.double)(&valuesArg[0]), C.int(count))) } +func PlotPlotImage(label_id string, user_texture_id TextureID, bounds_min PlotPoint, bounds_max PlotPoint) { + label_idArg, label_idFin := WrapString(label_id) + 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) { label_idArg, label_idFin := WrapString(label_id) C.wrap_ImPlot_PlotInfLines_FloatPtr(label_idArg, (*C.float)(&(values[0])), C.int(count)) @@ -13724,6 +13787,14 @@ func (self *PlotAnnotationCollection) Size() int32 { return int32(C.wrap_ImPlotAnnotationCollection_GetSize(selfArg)) } +func (self PlotAxis) SetID(v ID) { + vArg, _ := v.c() + + selfArg, selfFin := self.handle() + defer selfFin() + C.wrap_ImPlotAxis_SetID(selfArg, vArg) +} + func (self PlotAxis) SetFlags(v PlotAxisFlags) { selfArg, selfFin := self.handle() defer selfFin() @@ -15330,6 +15401,14 @@ func (self *PlotInputMap) ZoomRate() float32 { return float32(C.wrap_ImPlotInputMap_GetZoomRate(selfArg)) } +func (self PlotItem) SetID(v ID) { + vArg, _ := v.c() + + selfArg, selfFin := self.handle() + defer selfFin() + C.wrap_ImPlotItem_SetID(selfArg, vArg) +} + func (self PlotItem) SetColor(v uint32) { selfArg, selfFin := self.handle() defer selfFin() @@ -15420,6 +15499,14 @@ func (self *PlotItem) SeenThisFrame() bool { return C.wrap_ImPlotItem_GetSeenThisFrame(selfArg) == C.bool(true) } +func (self PlotItemGroup) SetID(v ID) { + vArg, _ := v.c() + + selfArg, selfFin := self.handle() + defer selfFin() + C.wrap_ImPlotItemGroup_SetID(selfArg, vArg) +} + func (self PlotItemGroup) SetLegend(v PlotLegend) { vArg, _ := v.c() @@ -15886,6 +15973,14 @@ func (self *PlotNextItemData) HiddenCond() PlotCond { return PlotCond(C.wrap_ImPlotNextItemData_GetHiddenCond(selfArg)) } +func (self PlotPlot) SetID(v ID) { + vArg, _ := v.c() + + selfArg, selfFin := self.handle() + defer selfFin() + C.wrap_ImPlotPlot_SetID(selfArg, vArg) +} + func (self PlotPlot) SetFlags(v PlotFlags) { selfArg, selfFin := self.handle() defer selfFin() @@ -16847,6 +16942,14 @@ func (self *PlotStyle) Use24HourClock() bool { return C.wrap_ImPlotStyle_GetUse24HourClock(selfArg) == C.bool(true) } +func (self PlotSubplot) SetID(v ID) { + vArg, _ := v.c() + + selfArg, selfFin := self.handle() + defer selfFin() + C.wrap_ImPlotSubplot_SetID(selfArg, vArg) +} + func (self PlotSubplot) SetFlags(v PlotSubplotFlags) { selfArg, selfFin := self.handle() defer selfFin() From e1fbece77c1ca45bd6c977439130130d90d80f03 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Wed, 27 Sep 2023 20:50:21 +0200 Subject: [PATCH 11/68] gengo: don't duplicate types --- cmd/codegen/gengo_typedefs.go | 9 ++++++--- cmd/codegen/main.go | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index a7d8df315..ef6ee39b5 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -11,7 +11,7 @@ import ( // 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) (validTypeNames []CIdentifier, err error) { +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) @@ -41,6 +41,11 @@ import "unsafe" 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 @@ -106,8 +111,6 @@ func new%[1]sFromC(cvalue %[6]s) { } } - fmt.Println(callbacksGoSb.String()) - 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) } diff --git a/cmd/codegen/main.go b/cmd/codegen/main.go index c7d3c3323..1df85884c 100644 --- a/cmd/codegen/main.go +++ b/cmd/codegen/main.go @@ -112,8 +112,6 @@ func main() { log.Panic(err.Error()) } - callbacks, err := proceedTypedefs(*prefix, typedefs, structs, enums) - validFuncs, err := generateCppWrapper(*prefix, *include, funcs) if err != nil { log.Panic(err) @@ -138,6 +136,8 @@ func main() { refTypedefs = typedefs.data } + callbacks, err := proceedTypedefs(*prefix, typedefs, structs, enums, refTypedefs) + // generate code enumNames := generateGoEnums(*prefix, enums) structNames := generateGoStructs(*prefix, structs, enums, es, ss, refTypedefs) From 2e2e6699b5eae4751bc0ab18f9205c1e0cc964ff Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Wed, 27 Sep 2023 20:50:29 +0200 Subject: [PATCH 12/68] regenerate code --- cimnodes_typedefs.go | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/cimnodes_typedefs.go b/cimnodes_typedefs.go index 41860b680..969b15258 100644 --- a/cimnodes_typedefs.go +++ b/cimnodes_typedefs.go @@ -10,22 +10,6 @@ package imgui import "C" import "unsafe" -type Context C.ImGuiContext - -func (self Context) handle() (result *C.ImGuiContext, fin func()) { - result = (*C.ImGuiContext)(unsafe.Pointer(&self)) - return result, func() {} -} - -func (self Context) c() (C.ImGuiContext, func()) { - result, fin := self.handle() - return *result, fin -} - -func newImGuiContextFromC(cvalue *C.ImGuiContext) *Context { - return (*Context)(cvalue) -} - type NodesContext C.ImNodesContext func (self NodesContext) handle() (result *C.ImNodesContext, fin func()) { From 894b086d83db4027aa282d68918c36584bc48e74 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Wed, 27 Sep 2023 21:15:44 +0200 Subject: [PATCH 13/68] gengo: check if type shouldn't be skipped --- cmd/codegen/arguments_wrapper.go | 4 +++- cmd/codegen/return_wrapper.go | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/codegen/arguments_wrapper.go b/cmd/codegen/arguments_wrapper.go index 2ed222fd5..772e2263a 100644 --- a/cmd/codegen/arguments_wrapper.go +++ b/cmd/codegen/arguments_wrapper.go @@ -213,7 +213,9 @@ func getArgWrapper( isPointer = true } - if _, isRefTypedef := refTypedefs[pureType]; structNames[pureType] || isRefTypedef { + _, isRefTypedef := refTypedefs[pureType] + _, shouldSkipRefTypedef := skippedTypedefs[pureType] + if structNames[pureType] || (isRefTypedef && !shouldSkipRefTypedef) { w := ArgumentWrapperData{ ArgType: pureType.renameGoIdentifier(), VarName: fmt.Sprintf("%sArg", a.Name), diff --git a/cmd/codegen/return_wrapper.go b/cmd/codegen/return_wrapper.go index 3866253da..9e3976a9e 100644 --- a/cmd/codegen/return_wrapper.go +++ b/cmd/codegen/return_wrapper.go @@ -63,8 +63,9 @@ func getReturnWrapper( 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 + isStruct = isStruct || (isRefStruct && !shouldSkipRefTypedef) w, known := returnWrapperMap[t] switch { case known: From 506db5a7af4410db753c2420dd7ed2a7ca75e475 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Wed, 27 Sep 2023 21:15:51 +0200 Subject: [PATCH 14/68] regenerate code --- cimplot_funcs.go | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/cimplot_funcs.go b/cimplot_funcs.go index e6138d91a..ca2d13a0e 100644 --- a/cimplot_funcs.go +++ b/cimplot_funcs.go @@ -472,15 +472,6 @@ func (self *PlotColormapData) KeyCount(cmap PlotColormap) int32 { return int32(C.ImPlotColormapData_GetKeyCount(selfArg, C.ImPlotColormap(cmap))) } -func (self *PlotColormapData) Keys(cmap PlotColormap) *U32 { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return newU32FromC(C.ImPlotColormapData_GetKeys(selfArg, C.ImPlotColormap(cmap))) -} - func (self *PlotColormapData) Name(cmap PlotColormap) string { selfArg, selfFin := self.handle() @@ -490,15 +481,6 @@ func (self *PlotColormapData) Name(cmap PlotColormap) string { return C.GoString(C.ImPlotColormapData_GetName(selfArg, C.ImPlotColormap(cmap))) } -func (self *PlotColormapData) Table(cmap PlotColormap) *U32 { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return newU32FromC(C.ImPlotColormapData_GetTable(selfArg, C.ImPlotColormap(cmap))) -} - func (self *PlotColormapData) TableColor(cmap PlotColormap, idx int32) uint32 { selfArg, selfFin := self.handle() From c5e6e27e399334b869cd4dbd9719e34a197a4335 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Wed, 4 Oct 2023 10:31:02 +0200 Subject: [PATCH 15/68] codegen: try to fix build errors --- cmd/codegen/gengo_typedefs.go | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index ef6ee39b5..778f1e9f7 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -86,20 +86,29 @@ import "unsafe" fmt.Fprintf(callbacksGoSb, ` type %[1]s %[2]s -func (self %[1]s) handle() (result *%[2]s, fin func()) { +func (self %[1]s) handle() (result *C.%[8]s, fin func()) { %[3]s - return %[4]s, func() { %[5]s } + return (*C.%[8]s)(%[4]s), func() { %[5]s } } -func (self %[1]s) c() (%[2]s, func()) { +func (self %[1]s) c() (C.%[8]s, func()) { result, fin := self.handle() return *result, fin } -func new%[1]sFromC(cvalue %[6]s) { +func new%[1]sFromC(cvalue *C.%[8]s) { return %[7]s } -`, k.renameGoIdentifier(), knownArgType.ArgType, knownArgType.ArgDef, knownArgType.VarName, knownArgType.Finalizer, knownArgType.CType, fmt.Sprintf(knownReturnType.returnStmt, "cvalue")) +`, + k.renameGoIdentifier(), + knownArgType.ArgType, + knownArgType.ArgDef, + knownArgType.VarName, + knownArgType.Finalizer, + knownArgType.CType, + fmt.Sprintf(knownReturnType.returnStmt, "cvalue"), + k, + ) validTypeNames = append(validTypeNames, k) case IsCallbackTypedef(typedefs.data[k]): From f9452c89090fe100b8a42a61fbb84e582b8d5fd4 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Wed, 4 Oct 2023 10:47:56 +0200 Subject: [PATCH 16/68] codegen: fix newXFromC in typedefs --- cmd/codegen/gengo_typedefs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index 778f1e9f7..e9038314d 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -96,7 +96,7 @@ func (self %[1]s) c() (C.%[8]s, func()) { return *result, fin } -func new%[1]sFromC(cvalue *C.%[8]s) { +func new%[1]sFromC(cvalue *C.%[8]s) %[1]s { return %[7]s } `, From cf732913b15ad5baf70d23cde4c5aeed31b4b33a Mon Sep 17 00:00:00 2001 From: gucio321 Date: Wed, 4 Oct 2023 11:00:00 +0200 Subject: [PATCH 17/68] fix return type --- cmd/codegen/gengo_typedefs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index e9038314d..26df0ff6f 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -96,7 +96,7 @@ func (self %[1]s) c() (C.%[8]s, func()) { return *result, fin } -func new%[1]sFromC(cvalue *C.%[8]s) %[1]s { +func new%[1]sFromC(cvalue *C.%[8]s) *%[1]s { return %[7]s } `, From 49920ec8b5478a619c8072402870d95a3d41aaca Mon Sep 17 00:00:00 2001 From: gucio321 Date: Wed, 4 Oct 2023 11:09:27 +0200 Subject: [PATCH 18/68] codegen: fix name of newXFromC in opaque structs --- cmd/codegen/gengo_typedefs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index 26df0ff6f..30bf81798 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -141,7 +141,7 @@ func (self %[1]s) c() (C.%[2]s, func()) { return *result, fin } -func new%[2]sFromC(cvalue *C.%[2]s) *%[1]s { +func new%[1]sFromC(cvalue *C.%[2]s) *%[1]s { return (*%[1]s)(cvalue) } `, name.renameGoIdentifier(), name) From 72fe85de94697526a6325d6e2d44ef2b88e01683 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Wed, 4 Oct 2023 13:30:20 +0200 Subject: [PATCH 19/68] typedefs: skip pointer types --- cmd/codegen/gengo_typedefs.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index 30bf81798..bc8c343ed 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -61,6 +61,10 @@ import "unsafe" continue } + if HasSuffix(typedefs.data[k], "*") { + glg.Infof("Typedef %v is a pointer. NotImplemented", k) + } + knownReturnType, returnTypeErr := getReturnWrapper( CIdentifier(typedefs.data[k]), map[CIdentifier]bool{}, From 830a7c06be4e39a98bd82755b1ad0e1e68993993 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Wed, 4 Oct 2023 13:32:34 +0200 Subject: [PATCH 20/68] add continue... --- cmd/codegen/gengo_typedefs.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index bc8c343ed..7f3460191 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -63,6 +63,7 @@ import "unsafe" if HasSuffix(typedefs.data[k], "*") { glg.Infof("Typedef %v is a pointer. NotImplemented", k) + continue } knownReturnType, returnTypeErr := getReturnWrapper( From 4fcf11299b44d1c52d138b9fb62dee4ba7f41345 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Wed, 4 Oct 2023 13:43:13 +0200 Subject: [PATCH 21/68] codegen: check if type is poiner on ints go identifier (not c) --- cmd/codegen/gengo_typedefs.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index 7f3460191..cb372884c 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -61,11 +61,6 @@ import "unsafe" continue } - if HasSuffix(typedefs.data[k], "*") { - glg.Infof("Typedef %v is a pointer. NotImplemented", k) - continue - } - knownReturnType, returnTypeErr := getReturnWrapper( CIdentifier(typedefs.data[k]), map[CIdentifier]bool{}, @@ -87,6 +82,11 @@ import "unsafe" // check if k is a name of struct from structDefs switch { case returnTypeErr == nil && argTypeErr == nil: + if HasPrefix(knownReturnType.returnType, "*") { + glg.Infof("Typedef %v is a pointer. NotImplemented", k) + continue + } + glg.Infof("typedef %s is an alias typedef.", k) fmt.Fprintf(callbacksGoSb, ` type %[1]s %[2]s From 7d2df8f5ba287e45bb4b2eec5bc9876812003ae5 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Sun, 8 Oct 2023 18:11:06 +0200 Subject: [PATCH 22/68] regenerate code --- cimgui_funcs.go | 57 ---------------------- cimgui_typedefs.go | 112 +++++++++++++++++++------------------------ cimnodes_typedefs.go | 12 ++--- cimplot_typedefs.go | 2 +- 4 files changed, 55 insertions(+), 128 deletions(-) diff --git a/cimgui_funcs.go b/cimgui_funcs.go index 3d2199878..63195efbd 100644 --- a/cimgui_funcs.go +++ b/cimgui_funcs.go @@ -26826,63 +26826,6 @@ func (self *Table) TempData() *TableTempData { return newTableTempDataFromC(C.wrap_ImGuiTable_GetTempData(selfArg)) } -func (self Table) SetEnabledMaskByDisplayOrder(v BitArrayPtr) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetEnabledMaskByDisplayOrder(selfArg, vArg) -} - -func (self *Table) EnabledMaskByDisplayOrder() BitArrayPtr { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - 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) { selfArg, selfFin := self.handle() defer selfFin() diff --git a/cimgui_typedefs.go b/cimgui_typedefs.go index d60c0b5f2..381b4e597 100644 --- a/cimgui_typedefs.go +++ b/cimgui_typedefs.go @@ -10,34 +10,18 @@ package imgui import "C" import "unsafe" -type BitArrayPtr *uint32 - -func (self BitArrayPtr) handle() (result **uint32, fin func()) { - selfArg, selfFin := WrapNumberPtr[C.ImU32, uint32](self) - return selfArg, func() { selfFin() } -} - -func (self BitArrayPtr) c() (*uint32, func()) { - result, fin := self.handle() - return *result, fin -} - -func newBitArrayPtrFromC(cvalue *C.ImU32) { - return (*uint32)(cvalue) -} - type DrawIdx uint16 -func (self DrawIdx) handle() (result *uint16, fin func()) { - return C.ushort(self), func() {} +func (self DrawIdx) handle() (result *C.ImDrawIdx, fin func()) { + return (*C.ImDrawIdx)(C.ushort(self)), func() {} } -func (self DrawIdx) c() (uint16, func()) { +func (self DrawIdx) c() (C.ImDrawIdx, func()) { result, fin := self.handle() return *result, fin } -func newDrawIdxFromC(cvalue C.ushort) { +func newDrawIdxFromC(cvalue *C.ImDrawIdx) *DrawIdx { return uint16(cvalue) } @@ -53,7 +37,7 @@ func (self DockNodeSettings) c() (C.ImGuiDockNodeSettings, func()) { return *result, fin } -func newImGuiDockNodeSettingsFromC(cvalue *C.ImGuiDockNodeSettings) *DockNodeSettings { +func newDockNodeSettingsFromC(cvalue *C.ImGuiDockNodeSettings) *DockNodeSettings { return (*DockNodeSettings)(cvalue) } @@ -69,22 +53,22 @@ func (self DockRequest) c() (C.ImGuiDockRequest, func()) { return *result, fin } -func newImGuiDockRequestFromC(cvalue *C.ImGuiDockRequest) *DockRequest { +func newDockRequestFromC(cvalue *C.ImGuiDockRequest) *DockRequest { return (*DockRequest)(cvalue) } type ID uint32 -func (self ID) handle() (result *uint32, fin func()) { - return C.uint(self), func() {} +func (self ID) handle() (result *C.ImGuiID, fin func()) { + return (*C.ImGuiID)(C.uint(self)), func() {} } -func (self ID) c() (uint32, func()) { +func (self ID) c() (C.ImGuiID, func()) { result, fin := self.handle() return *result, fin } -func newIDFromC(cvalue C.uint) { +func newIDFromC(cvalue *C.ImGuiID) *ID { return uint32(cvalue) } @@ -100,67 +84,67 @@ func (self InputTextDeactivateData) c() (C.ImGuiInputTextDeactivateData, func()) return *result, fin } -func newImGuiInputTextDeactivateDataFromC(cvalue *C.ImGuiInputTextDeactivateData) *InputTextDeactivateData { +func newInputTextDeactivateDataFromC(cvalue *C.ImGuiInputTextDeactivateData) *InputTextDeactivateData { return (*InputTextDeactivateData)(cvalue) } type KeyChord int32 -func (self KeyChord) handle() (result *int32, fin func()) { - return C.int(self), func() {} +func (self KeyChord) handle() (result *C.ImGuiKeyChord, fin func()) { + return (*C.ImGuiKeyChord)(C.int(self)), func() {} } -func (self KeyChord) c() (int32, func()) { +func (self KeyChord) c() (C.ImGuiKeyChord, func()) { result, fin := self.handle() return *result, fin } -func newKeyChordFromC(cvalue C.int) { +func newKeyChordFromC(cvalue *C.ImGuiKeyChord) *KeyChord { return int32(cvalue) } type KeyRoutingIndex int -func (self KeyRoutingIndex) handle() (result *int, fin func()) { - return C.ImS16(self), func() {} +func (self KeyRoutingIndex) handle() (result *C.ImGuiKeyRoutingIndex, fin func()) { + return (*C.ImGuiKeyRoutingIndex)(C.ImS16(self)), func() {} } -func (self KeyRoutingIndex) c() (int, func()) { +func (self KeyRoutingIndex) c() (C.ImGuiKeyRoutingIndex, func()) { result, fin := self.handle() return *result, fin } -func newKeyRoutingIndexFromC(cvalue C.ImS16) { +func newKeyRoutingIndexFromC(cvalue *C.ImGuiKeyRoutingIndex) *KeyRoutingIndex { return int(cvalue) } type SelectionUserData int64 -func (self SelectionUserData) handle() (result *int64, fin func()) { - return C.ImS64(self), func() {} +func (self SelectionUserData) handle() (result *C.ImGuiSelectionUserData, fin func()) { + return (*C.ImGuiSelectionUserData)(C.ImS64(self)), func() {} } -func (self SelectionUserData) c() (int64, func()) { +func (self SelectionUserData) c() (C.ImGuiSelectionUserData, func()) { result, fin := self.handle() return *result, fin } -func newSelectionUserDataFromC(cvalue C.ImS64) { +func newSelectionUserDataFromC(cvalue *C.ImGuiSelectionUserData) *SelectionUserData { return int64(cvalue) } type TableColumnIdx int -func (self TableColumnIdx) handle() (result *int, fin func()) { - return C.ImS16(self), func() {} +func (self TableColumnIdx) handle() (result *C.ImGuiTableColumnIdx, fin func()) { + return (*C.ImGuiTableColumnIdx)(C.ImS16(self)), func() {} } -func (self TableColumnIdx) c() (int, func()) { +func (self TableColumnIdx) c() (C.ImGuiTableColumnIdx, func()) { result, fin := self.handle() return *result, fin } -func newTableColumnIdxFromC(cvalue C.ImS16) { +func newTableColumnIdxFromC(cvalue *C.ImGuiTableColumnIdx) *TableColumnIdx { return int(cvalue) } @@ -176,82 +160,82 @@ func (self TableColumnsSettings) c() (C.ImGuiTableColumnsSettings, func()) { return *result, fin } -func newImGuiTableColumnsSettingsFromC(cvalue *C.ImGuiTableColumnsSettings) *TableColumnsSettings { +func newTableColumnsSettingsFromC(cvalue *C.ImGuiTableColumnsSettings) *TableColumnsSettings { return (*TableColumnsSettings)(cvalue) } type TableDrawChannelIdx uint16 -func (self TableDrawChannelIdx) handle() (result *uint16, fin func()) { - return C.ImU16(self), func() {} +func (self TableDrawChannelIdx) handle() (result *C.ImGuiTableDrawChannelIdx, fin func()) { + return (*C.ImGuiTableDrawChannelIdx)(C.ImU16(self)), func() {} } -func (self TableDrawChannelIdx) c() (uint16, func()) { +func (self TableDrawChannelIdx) c() (C.ImGuiTableDrawChannelIdx, func()) { result, fin := self.handle() return *result, fin } -func newTableDrawChannelIdxFromC(cvalue C.ImU16) { +func newTableDrawChannelIdxFromC(cvalue *C.ImGuiTableDrawChannelIdx) *TableDrawChannelIdx { return uint16(cvalue) } type PoolIdx int32 -func (self PoolIdx) handle() (result *int32, fin func()) { - return C.int(self), func() {} +func (self PoolIdx) handle() (result *C.ImPoolIdx, fin func()) { + return (*C.ImPoolIdx)(C.int(self)), func() {} } -func (self PoolIdx) c() (int32, func()) { +func (self PoolIdx) c() (C.ImPoolIdx, func()) { result, fin := self.handle() return *result, fin } -func newPoolIdxFromC(cvalue C.int) { +func newPoolIdxFromC(cvalue *C.ImPoolIdx) *PoolIdx { return int32(cvalue) } type TextureID unsafe.Pointer -func (self TextureID) handle() (result *unsafe.Pointer, fin func()) { +func (self TextureID) handle() (result *C.ImTextureID, fin func()) { selfArg, selfFin := WrapVoidPtr(self) - return selfArg, func() { selfFin() } + return (*C.ImTextureID)(selfArg), func() { selfFin() } } -func (self TextureID) c() (unsafe.Pointer, func()) { +func (self TextureID) c() (C.ImTextureID, func()) { result, fin := self.handle() return *result, fin } -func newTextureIDFromC(cvalue unsafe.Pointer) { +func newTextureIDFromC(cvalue *C.ImTextureID) *TextureID { return unsafe.Pointer(cvalue) } type Wchar16 uint16 -func (self Wchar16) handle() (result *uint16, fin func()) { - return C.ushort(self), func() {} +func (self Wchar16) handle() (result *C.ImWchar16, fin func()) { + return (*C.ImWchar16)(C.ushort(self)), func() {} } -func (self Wchar16) c() (uint16, func()) { +func (self Wchar16) c() (C.ImWchar16, func()) { result, fin := self.handle() return *result, fin } -func newWchar16FromC(cvalue C.ushort) { +func newWchar16FromC(cvalue *C.ImWchar16) *Wchar16 { return uint16(cvalue) } type Wchar32 uint32 -func (self Wchar32) handle() (result *uint32, fin func()) { - return C.uint(self), func() {} +func (self Wchar32) handle() (result *C.ImWchar32, fin func()) { + return (*C.ImWchar32)(C.uint(self)), func() {} } -func (self Wchar32) c() (uint32, func()) { +func (self Wchar32) c() (C.ImWchar32, func()) { result, fin := self.handle() return *result, fin } -func newWchar32FromC(cvalue C.uint) { +func newWchar32FromC(cvalue *C.ImWchar32) *Wchar32 { return uint32(cvalue) } diff --git a/cimnodes_typedefs.go b/cimnodes_typedefs.go index 969b15258..d1c2b7a45 100644 --- a/cimnodes_typedefs.go +++ b/cimnodes_typedefs.go @@ -22,7 +22,7 @@ func (self NodesContext) c() (C.ImNodesContext, func()) { return *result, fin } -func newImNodesContextFromC(cvalue *C.ImNodesContext) *NodesContext { +func newNodesContextFromC(cvalue *C.ImNodesContext) *NodesContext { return (*NodesContext)(cvalue) } @@ -38,22 +38,22 @@ func (self NodesEditorContext) c() (C.ImNodesEditorContext, func()) { return *result, fin } -func newImNodesEditorContextFromC(cvalue *C.ImNodesEditorContext) *NodesEditorContext { +func newNodesEditorContextFromC(cvalue *C.ImNodesEditorContext) *NodesEditorContext { return (*NodesEditorContext)(cvalue) } type NodesMiniMapNodeHoveringCallbackUserData unsafe.Pointer -func (self NodesMiniMapNodeHoveringCallbackUserData) handle() (result *unsafe.Pointer, fin func()) { +func (self NodesMiniMapNodeHoveringCallbackUserData) handle() (result *C.ImNodesMiniMapNodeHoveringCallbackUserData, fin func()) { selfArg, selfFin := WrapVoidPtr(self) - return selfArg, func() { selfFin() } + return (*C.ImNodesMiniMapNodeHoveringCallbackUserData)(selfArg), func() { selfFin() } } -func (self NodesMiniMapNodeHoveringCallbackUserData) c() (unsafe.Pointer, func()) { +func (self NodesMiniMapNodeHoveringCallbackUserData) c() (C.ImNodesMiniMapNodeHoveringCallbackUserData, func()) { result, fin := self.handle() return *result, fin } -func newNodesMiniMapNodeHoveringCallbackUserDataFromC(cvalue unsafe.Pointer) { +func newNodesMiniMapNodeHoveringCallbackUserDataFromC(cvalue *C.ImNodesMiniMapNodeHoveringCallbackUserData) *NodesMiniMapNodeHoveringCallbackUserData { return unsafe.Pointer(cvalue) } diff --git a/cimplot_typedefs.go b/cimplot_typedefs.go index b34be3a09..8b8578f3c 100644 --- a/cimplot_typedefs.go +++ b/cimplot_typedefs.go @@ -22,6 +22,6 @@ func (self PlotAxisColor) c() (C.ImPlotAxisColor, func()) { return *result, fin } -func newImPlotAxisColorFromC(cvalue *C.ImPlotAxisColor) *PlotAxisColor { +func newPlotAxisColorFromC(cvalue *C.ImPlotAxisColor) *PlotAxisColor { return (*PlotAxisColor)(cvalue) } From ba1e520829564edda74146a580c5cff6ad6cfb28 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Sun, 8 Oct 2023 18:58:15 +0200 Subject: [PATCH 23/68] fix receiver types --- cmd/codegen/gengo_typedefs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index cb372884c..794132322 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -91,12 +91,12 @@ import "unsafe" fmt.Fprintf(callbacksGoSb, ` type %[1]s %[2]s -func (self %[1]s) handle() (result *C.%[8]s, fin func()) { +func (self *%[1]s) handle() (result *C.%[8]s, fin func()) { %[3]s return (*C.%[8]s)(%[4]s), func() { %[5]s } } -func (self %[1]s) c() (C.%[8]s, func()) { +func (self *%[1]s) c() (C.%[8]s, func()) { result, fin := self.handle() return *result, fin } From 6830344499ff34ff457394f5043f33d5a9e50807 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Sun, 8 Oct 2023 19:07:39 +0200 Subject: [PATCH 24/68] Revert "fix receiver types" This reverts commit ea688fad9004b5032797df645c2ac8f198e975e0. --- cmd/codegen/gengo_typedefs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index 794132322..cb372884c 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -91,12 +91,12 @@ import "unsafe" fmt.Fprintf(callbacksGoSb, ` type %[1]s %[2]s -func (self *%[1]s) handle() (result *C.%[8]s, fin func()) { +func (self %[1]s) handle() (result *C.%[8]s, fin func()) { %[3]s return (*C.%[8]s)(%[4]s), func() { %[5]s } } -func (self *%[1]s) c() (C.%[8]s, func()) { +func (self %[1]s) c() (C.%[8]s, func()) { result, fin := self.handle() return *result, fin } From 312b782baefe3ad15066cd7d4de6dcfdbce16cb4 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Sun, 8 Oct 2023 19:15:26 +0200 Subject: [PATCH 25/68] codegen: fix non-pointer types generation --- cmd/codegen/gengo_typedefs.go | 53 +++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index cb372884c..c9898d273 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -61,6 +61,8 @@ import "unsafe" continue } + isPtr := HasSuffix(typedefs.data[k], "*") + knownReturnType, returnTypeErr := getReturnWrapper( CIdentifier(typedefs.data[k]), map[CIdentifier]bool{}, @@ -82,13 +84,14 @@ import "unsafe" // check if k is a name of struct from structDefs switch { case returnTypeErr == nil && argTypeErr == nil: - if HasPrefix(knownReturnType.returnType, "*") { + if HasPrefix(knownReturnType.returnType, "*") { // this is because: Invalid receiver type (pointer or interface) glg.Infof("Typedef %v is a pointer. NotImplemented", k) continue } glg.Infof("typedef %s is an alias typedef.", k) - fmt.Fprintf(callbacksGoSb, ` + if isPtr { + fmt.Fprintf(callbacksGoSb, ` type %[1]s %[2]s func (self %[1]s) handle() (result *C.%[8]s, fin func()) { @@ -105,15 +108,43 @@ func new%[1]sFromC(cvalue *C.%[8]s) *%[1]s { return %[7]s } `, - k.renameGoIdentifier(), - knownArgType.ArgType, - knownArgType.ArgDef, - knownArgType.VarName, - knownArgType.Finalizer, - knownArgType.CType, - fmt.Sprintf(knownReturnType.returnStmt, "cvalue"), - k, - ) + k.renameGoIdentifier(), + knownArgType.ArgType, + knownArgType.ArgDef, + knownArgType.VarName, + knownArgType.Finalizer, + knownArgType.CType, + fmt.Sprintf(knownReturnType.returnStmt, "cvalue"), + k, + ) + } else { + fmt.Fprintf(callbacksGoSb, ` +type %[1]s %[2]s + +func (self %[1]s) handle() (result *C.%[8]s, fin func()) { + result,fin = self.c() + return &result, fin +} + +func (self %[1]s) c() (C.%[8]s, func()) { + %[3]s + return (C.%[8]s)(%[4]s), func() { %[5]s } +} + +func new%[1]sFromC(cvalue *C.%[8]s) *%[1]s { + return %[7]s +} +`, + k.renameGoIdentifier(), + knownArgType.ArgType, + knownArgType.ArgDef, + knownArgType.VarName, + knownArgType.Finalizer, + knownArgType.CType, + fmt.Sprintf(knownReturnType.returnStmt, "cvalue"), + k, + ) + } validTypeNames = append(validTypeNames, k) case IsCallbackTypedef(typedefs.data[k]): From f810de5453e4f10cff30bee329a02ded31918a35 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Sun, 8 Oct 2023 19:21:00 +0200 Subject: [PATCH 26/68] codegen: fix --- cmd/codegen/gengo_typedefs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index c9898d273..18e3e77da 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -122,8 +122,8 @@ func new%[1]sFromC(cvalue *C.%[8]s) *%[1]s { type %[1]s %[2]s func (self %[1]s) handle() (result *C.%[8]s, fin func()) { - result,fin = self.c() - return &result, fin + cResult, cFin := self.c() + return &cResult, cFin } func (self %[1]s) c() (C.%[8]s, func()) { From cf393ddd913e56cfacbbf04522232be0dd8e220b Mon Sep 17 00:00:00 2001 From: gucio321 Date: Tue, 7 Nov 2023 14:47:37 +0100 Subject: [PATCH 27/68] codegen: change structs generation engine gengo_structs.go seemd to be extremely useful, however it generated several bugs that cannot be fixed using that engine. Some of the reported issues are: - https://github.com/AllenDang/cimgui-go/issues/206 --- cmd/codegen/gengo_typedefs.go | 18 ++++++++++-------- cmd/codegen/main.go | 3 ++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index 18e3e77da..47b4580fe 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -51,7 +51,7 @@ import "unsafe" continue } - if IsEnumName(k, enums) || IsStructName(k, structs) { + if IsEnumName(k, enums) /*|| IsStructName(k, structs)*/ { glg.Infof("typedef %s has extended deffinition in structs_and_enums.json. Will generate later", k) continue } @@ -164,21 +164,23 @@ func new%[1]sFromC(cvalue *C.%[8]s) *%[1]s { } func writeOpaqueStruct(name CIdentifier, sb *strings.Builder) { + // 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 C.%[2]s +type %[1]s struct { + data *C.%[2]s +} -func (self %[1]s) handle() (result *C.%[2]s, fin func()) { - result = (*C.%[2]s)(unsafe.Pointer(&self)) - return result, func() {} +func (self *%[1]s) handle() (result *C.%[2]s, fin func()) { + return self.data, func() {} } func (self %[1]s) c() (C.%[2]s, func()) { - result, fin := self.handle() - return *result, fin + result, fn := self.handle() + return *result, fn } func new%[1]sFromC(cvalue *C.%[2]s) *%[1]s { - return (*%[1]s)(cvalue) + return &%[1]s{data: cvalue} } `, name.renameGoIdentifier(), name) } diff --git a/cmd/codegen/main.go b/cmd/codegen/main.go index 1df85884c..87aff4fa3 100644 --- a/cmd/codegen/main.go +++ b/cmd/codegen/main.go @@ -140,7 +140,8 @@ func main() { // generate code enumNames := generateGoEnums(*prefix, enums) - structNames := generateGoStructs(*prefix, structs, enums, es, ss, refTypedefs) + //structNames := generateGoStructs(*prefix, structs, enums, es, ss, refTypedefs) + structNames := make([]CIdentifier, 0) structAccessorFuncs, err := generateCppStructsAccessor(*prefix, validFuncs, structs) if err != nil { From 38f5d8e56cde77bbf1f5bbcf0f0f6afe0a560f8f Mon Sep 17 00:00:00 2001 From: gucio321 Date: Wed, 8 Nov 2023 10:50:16 +0100 Subject: [PATCH 28/68] codegen: fix generation of typedefs generate 'known', non-pointer type wrappers --- cmd/codegen/gengo_typedefs.go | 141 ++++++++++++++++++++-------------- 1 file changed, 84 insertions(+), 57 deletions(-) diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index 47b4580fe..1ed2a8065 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -63,87 +63,114 @@ import "unsafe" isPtr := HasSuffix(typedefs.data[k], "*") - knownReturnType, returnTypeErr := getReturnWrapper( - CIdentifier(typedefs.data[k]), - map[CIdentifier]bool{}, - map[GoIdentifier]bool{}, - map[CIdentifier]string{}, - ) - - _, knownArgType, argTypeErr := getArgWrapper( - &ArgDef{ - Name: "self", - Type: CIdentifier(typedefs.data[k]), - }, - false, false, - map[CIdentifier]bool{}, - map[GoIdentifier]bool{}, - map[CIdentifier]string{}, - ) + var knownPtrReturnType returnWrapper + var knownArgType, knownPtrArgType ArgumentWrapperData + var argTypeErr, ptrArgTypeErr, ptrReturnTypeErr error + + // 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) + if !isPtr { + knownPtrReturnType, ptrReturnTypeErr = getReturnWrapper( + CIdentifier(typedefs.data[k])+"*", + map[CIdentifier]bool{}, + map[GoIdentifier]bool{}, + map[CIdentifier]string{}, + ) + + _, knownArgType, argTypeErr = getArgWrapper( + &ArgDef{ + Name: "self", + Type: CIdentifier(typedefs.data[k]), + }, + false, false, + map[CIdentifier]bool{}, + map[GoIdentifier]bool{}, + map[CIdentifier]string{}, + ) + + _, knownPtrArgType, ptrArgTypeErr = getArgWrapper( + &ArgDef{ + Name: "self", + Type: CIdentifier(typedefs.data[k]) + "*", + }, + false, false, + map[CIdentifier]bool{}, + map[GoIdentifier]bool{}, + map[CIdentifier]string{}, + ) + } // check if k is a name of struct from structDefs switch { - case returnTypeErr == nil && argTypeErr == nil: - if HasPrefix(knownReturnType.returnType, "*") { // this is because: Invalid receiver type (pointer or interface) - glg.Infof("Typedef %v is a pointer. NotImplemented", k) - continue - } - + case ptrReturnTypeErr == nil && argTypeErr == nil && ptrArgTypeErr == nil: glg.Infof("typedef %s is an alias typedef.", k) - if isPtr { + _ = knownPtrReturnType + _ = knownPtrArgType + if !isPtr { fmt.Fprintf(callbacksGoSb, ` type %[1]s %[2]s -func (self %[1]s) handle() (result *C.%[8]s, fin func()) { +func (self *%[1]s) handle() (result *C.%[6]s, fin func()) { %[3]s - return (*C.%[8]s)(%[4]s), func() { %[5]s } + return (*C.%[6]s)(%[4]s), func() { %[5]s } } -func (self %[1]s) c() (C.%[8]s, func()) { - result, fin := self.handle() - return *result, fin +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.%[8]s) *%[1]s { +func new%[1]sFromC(cvalue *C.%[6]s) *%[1]s { return %[7]s } `, k.renameGoIdentifier(), knownArgType.ArgType, - knownArgType.ArgDef, - knownArgType.VarName, - knownArgType.Finalizer, - knownArgType.CType, - fmt.Sprintf(knownReturnType.returnStmt, "cvalue"), - k, - ) - } else { - fmt.Fprintf(callbacksGoSb, ` -type %[1]s %[2]s -func (self %[1]s) handle() (result *C.%[8]s, fin func()) { - cResult, cFin := self.c() - return &cResult, cFin -} + knownPtrArgType.ArgDef, + knownPtrArgType.VarName, + knownPtrArgType.Finalizer, -func (self %[1]s) c() (C.%[8]s, func()) { - %[3]s - return (C.%[8]s)(%[4]s), func() { %[5]s } -} + k, -func new%[1]sFromC(cvalue *C.%[8]s) *%[1]s { - return %[7]s -} -`, - k.renameGoIdentifier(), - knownArgType.ArgType, knownArgType.ArgDef, knownArgType.VarName, knownArgType.Finalizer, - knownArgType.CType, - fmt.Sprintf(knownReturnType.returnStmt, "cvalue"), - k, + + fmt.Sprintf(knownPtrReturnType.returnStmt, "cvalue"), ) + } else { + // fmt.Fprintf(callbacksGoSb, ` + //type %[1]s %[2]s + // + //func (self %[1]s) handle() (result *C.%[8]s, fin func()) { + // cResult, cFin := self.c() + // return &cResult, cFin + //} + // + //func (self %[1]s) c() (C.%[8]s, func()) { + // %[3]s + // return (C.%[8]s)(%[4]s), func() { %[5]s } + //} + // + //func new%[1]sFromC(cvalue *C.%[8]s) *%[1]s { + // return %[7]s + //} + //`, + // k.renameGoIdentifier(), + // knownArgType.ArgType, + // knownArgType.ArgDef, + // knownArgType.VarName, + // knownArgType.Finalizer, + // knownArgType.CType, + // fmt.Sprintf(knownReturnType.returnStmt, "cvalue"), + // k, + // ) + glg.Infof("Typedef %v is a pointer. NotImplemented", k) + continue } validTypeNames = append(validTypeNames, k) From 9b552ea2ef5ba2cce7013f3041a2f92996e91bcf Mon Sep 17 00:00:00 2001 From: gucio321 Date: Wed, 8 Nov 2023 10:50:32 +0100 Subject: [PATCH 29/68] regenerate code --- cimgui_funcs.go | 1032 +-------------------- cimgui_typedefs.go | 1898 ++++++++++++++++++++++++++++++++++++--- cimmarkdown_typedefs.go | 187 ++++ cimnodes_typedefs.go | 117 ++- cimplot_typedefs.go | 423 ++++++++- 5 files changed, 2490 insertions(+), 1167 deletions(-) diff --git a/cimgui_funcs.go b/cimgui_funcs.go index 63195efbd..83d77766b 100644 --- a/cimgui_funcs.go +++ b/cimgui_funcs.go @@ -75,15 +75,6 @@ func (self *Color) Destroy() { selfFin() } -func (self *DrawCmd) TexID() TextureID { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return *newTextureIDFromC(func() *C.ImTextureID { result := C.ImDrawCmd_GetTexID(selfArg); return &result }()) -} - // Also ensure our padding fields are zeroed func NewDrawCmd() *DrawCmd { return newDrawCmdFromC(C.ImDrawCmd_ImDrawCmd()) @@ -299,45 +290,6 @@ func (self *DrawList) AddEllipseFilledV(center Vec2, radius_x float32, radius_y selfFin() } -// AddImageV parameter default value hint: -// uv_min: ImVec2(0,0) -// uv_max: ImVec2(1,1) -// 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() - 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: -// uv1: ImVec2(0,0) -// uv2: ImVec2(1,0) -// uv3: ImVec2(1,1) -// uv4: ImVec2(0,1) -// 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() - 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() - 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: // thickness: 1.0f func (self *DrawList) AddLineV(p1 Vec2, p2 Vec2, col uint32, thickness float32) { @@ -679,15 +631,6 @@ func (self *DrawList) PrimVtx(pos Vec2, uv Vec2, col uint32) { selfFin() } -func (self *DrawList) PrimWriteIdx(idx DrawIdx) { - selfArg, selfFin := self.handle() - idxArg, idxFin := idx.c() - C.ImDrawList_PrimWriteIdx(selfArg, idxArg) - - selfFin() - idxFin() -} - 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)) @@ -712,15 +655,6 @@ func (self *DrawList) PushClipRectFullScreen() { selfFin() } -func (self *DrawList) PushTextureID(texture_id TextureID) { - selfArg, selfFin := self.handle() - texture_idArg, texture_idFin := texture_id.c() - C.ImDrawList_PushTextureID(selfArg, texture_idArg) - - selfFin() - texture_idFin() -} - func (self *DrawList) CalcCircleAutoSegmentCount(radius float32) int32 { selfArg, selfFin := self.handle() @@ -1135,15 +1069,6 @@ func (self *FontAtlas) IsBuilt() bool { return C.ImFontAtlas_IsBuilt(selfArg) == C.bool(true) } -func (self *FontAtlas) SetTexID(id TextureID) { - selfArg, selfFin := self.handle() - idArg, idFin := id.c() - C.ImFontAtlas_SetTexID(selfArg, idArg) - - selfFin() - idFin() -} - func (self *FontAtlas) Destroy() { selfArg, selfFin := self.handle() C.ImFontAtlas_destroy(selfArg) @@ -7220,47 +7145,6 @@ func InternalImUpperPowerOfTwo(v int32) int32 { return int32(C.igImUpperPowerOfTwo(C.int(v))) } -// ImageV parameter default value hint: -// uv0: ImVec2(0,0) -// uv1: ImVec2(1,1) -// 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) { - 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: -// uv0: ImVec2(0,0) -// uv1: ImVec2(1,1) -// bg_col: ImVec4(0,0,0,0) -// 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, 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 { - 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 // IndentV parameter default value hint: // indent_w: 0.0f @@ -9022,13 +8906,6 @@ func SetNextItemOpenV(is_open bool, cond Cond) { C.igSetNextItemOpen(C.bool(is_open), C.ImGuiCond(cond)) } -func InternalSetNextItemSelectionUserData(selection_user_data SelectionUserData) { - selection_user_dataArg, selection_user_dataFin := selection_user_data.c() - C.igSetNextItemSelectionUserData(selection_user_dataArg) - - selection_user_dataFin() -} - // set width of the _next_ common large "item+label" widget. >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -FLT_MIN always align width to the right side) func SetNextItemWidth(item_width float32) { C.igSetNextItemWidth(C.float(item_width)) @@ -10885,33 +10762,6 @@ func (self *DrawList) AddEllipseFilled(center Vec2, radius_x float32, radius_y f selfFin() } -func (self *DrawList) AddImage(user_texture_id TextureID, p_min Vec2, p_max Vec2) { - selfArg, selfFin := self.handle() - 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() - 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() - 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) { selfArg, selfFin := self.handle() C.wrap_ImDrawList_AddLine(selfArg, p1.toC(), p2.toC(), C.ImU32(col)) @@ -11906,35 +11756,6 @@ func InternalImTextStrFromUtf8(out_buf *Wchar, out_buf_size int32, in_text strin return int32(C.wrap_igImTextStrFromUtf8((*C.ImWchar)(out_buf), C.int(out_buf_size), in_textArg, in_text_endArg)) } -func Image(user_texture_id TextureID, size Vec2) { - 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, 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 { - 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() { C.wrap_igIndent() } @@ -13030,29 +12851,6 @@ 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, _ := vData.handle() - 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_ImDrawChannel_Set_IdxBuffer(selfArg, *vVecArg) -} - -func (self *DrawChannel) IdxBuffer() Vector[*DrawIdx] { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - return newVectorFromC(C.wrap_ImDrawChannel_Get_IdxBuffer(selfArg).Size, C.wrap_ImDrawChannel_Get_IdxBuffer(selfArg).Capacity, newDrawIdxFromC(C.wrap_ImDrawChannel_Get_IdxBuffer(selfArg).Data)) -} - func (self DrawCmd) SetClipRect(v Vec4) { selfArg, selfFin := self.handle() defer selfFin() @@ -13068,25 +12866,6 @@ func (self *DrawCmd) ClipRect() Vec4 { return *(&Vec4{}).fromC(C.wrap_ImDrawCmd_GetClipRect(selfArg)) } -func (self DrawCmd) SetTextureId(v TextureID) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImDrawCmd_SetTextureId(selfArg, vArg) -} - -func (self *DrawCmd) TextureId() TextureID { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImDrawCmd_GetTextureId(selfArg) - return *newTextureIDFromC(func() *C.ImTextureID { result := result; return &result }()) -} - func (self DrawCmd) SetVtxOffset(v uint32) { selfArg, selfFin := self.handle() defer selfFin() @@ -13164,25 +12943,6 @@ func (self *DrawCmdHeader) ClipRect() Vec4 { return *(&Vec4{}).fromC(C.wrap_ImDrawCmdHeader_GetClipRect(selfArg)) } -func (self DrawCmdHeader) SetTextureId(v TextureID) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImDrawCmdHeader_SetTextureId(selfArg, vArg) -} - -func (self *DrawCmdHeader) TextureId() TextureID { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImDrawCmdHeader_GetTextureId(selfArg) - return *newTextureIDFromC(func() *C.ImTextureID { result := result; return &result }()) -} - func (self DrawCmdHeader) SetVtxOffset(v uint32) { selfArg, selfFin := self.handle() defer selfFin() @@ -13343,29 +13103,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, _ := vData.handle() - 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, newDrawIdxFromC(C.wrap_ImDrawList_GetIdxBuffer(selfArg).Data)) -} - func (self DrawList) SetVtxBuffer(v Vector[*DrawVert]) { vData := v.Data vDataArg, _ := vData.handle() @@ -13470,23 +13207,6 @@ func (self *DrawList) VtxWritePtr() *DrawVert { return newDrawVertFromC(C.wrap_ImDrawList_Get_VtxWritePtr(selfArg)) } -func (self DrawList) SetIdxWritePtr(v *DrawIdx) { - vArg, _ := v.handle() - - 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 newDrawIdxFromC(C.wrap_ImDrawList_Get_IdxWritePtr(selfArg)) -} - func (self DrawList) SetClipRectStack(v Vector[*Vec4]) { vData := v.Data vDataArg, _ := wrap[C.ImVec4, *Vec4](vData) @@ -13501,29 +13221,6 @@ func (self DrawList) SetClipRectStack(v Vector[*Vec4]) { C.wrap_ImDrawList_Set_ClipRectStack(selfArg, *vVecArg) } -func (self DrawList) SetTextureIdStack(v Vector[*TextureID]) { - vData := v.Data - vDataArg, _ := vData.handle() - vVecArg := new(C.ImVector_ImTextureID) - 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_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]) { vData := v.Data vDataArg, _ := wrap[C.ImVec2, *Vec2](vData) @@ -17021,25 +16718,6 @@ func (self *Context) NavLayer() NavLayer { return NavLayer(C.wrap_ImGuiContext_GetNavLayer(selfArg)) } -func (self Context) SetNavLastValidSelectionUserData(v SelectionUserData) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiContext_SetNavLastValidSelectionUserData(selfArg, vArg) -} - -func (self *Context) NavLastValidSelectionUserData() SelectionUserData { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiContext_GetNavLastValidSelectionUserData(selfArg) - return *newSelectionUserDataFromC(func() *C.ImGuiSelectionUserData { result := result; return &result }()) -} - func (self Context) SetNavIdIsAlive(v bool) { selfArg, selfFin := self.handle() defer selfFin() @@ -21626,9 +21304,7 @@ func (self *IO) InputQueueSurrogate() uint16 { defer func() { selfFin() }() - - result := C.wrap_ImGuiIO_GetInputQueueSurrogate(selfArg) - return uint16(result) + return uint16(C.wrap_ImGuiIO_GetInputQueueSurrogate(selfArg)) } func (self IO) SetInputQueueCharacters(v Vector[(*Wchar)]) { @@ -22588,25 +22264,6 @@ func (self *KeyOwnerData) LockUntilRelease() bool { return C.wrap_ImGuiKeyOwnerData_GetLockUntilRelease(selfArg) == C.bool(true) } -func (self KeyRoutingData) SetNextEntryIndex(v KeyRoutingIndex) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiKeyRoutingData_SetNextEntryIndex(selfArg, vArg) -} - -func (self *KeyRoutingData) NextEntryIndex() KeyRoutingIndex { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiKeyRoutingData_GetNextEntryIndex(selfArg) - return *newKeyRoutingIndexFromC(func() *C.ImGuiKeyRoutingIndex { result := result; return &result }()) -} - func (self KeyRoutingData) SetMods(v uint16) { selfArg, selfFin := self.handle() defer selfFin() @@ -23471,25 +23128,6 @@ func (self *NavItemData) InFlags() ItemFlags { return ItemFlags(C.wrap_ImGuiNavItemData_GetInFlags(selfArg)) } -func (self NavItemData) SetSelectionUserData(v SelectionUserData) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiNavItemData_SetSelectionUserData(selfArg, vArg) -} - -func (self *NavItemData) SelectionUserData() SelectionUserData { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiNavItemData_GetSelectionUserData(selfArg) - return *newSelectionUserDataFromC(func() *C.ImGuiSelectionUserData { result := result; return &result }()) -} - func (self NavItemData) SetDistBox(v float32) { selfArg, selfFin := self.handle() defer selfFin() @@ -23629,25 +23267,6 @@ func (self *NextItemData) Width() float32 { return float32(C.wrap_ImGuiNextItemData_GetWidth(selfArg)) } -func (self NextItemData) SetSelectionUserData(v SelectionUserData) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiNextItemData_SetSelectionUserData(selfArg, vArg) -} - -func (self *NextItemData) SelectionUserData() SelectionUserData { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiNextItemData_GetSelectionUserData(selfArg) - return *newSelectionUserDataFromC(func() *C.ImGuiSelectionUserData { result := result; return &result }()) -} - func (self NextItemData) SetOpenCond(v Cond) { selfArg, selfFin := self.handle() defer selfFin() @@ -27644,463 +27263,45 @@ func (self *Table) SortSpecs() TableSortSpecs { return *newTableSortSpecsFromC(func() *C.ImGuiTableSortSpecs { result := result; return &result }()) } -func (self Table) SetSortSpecsCount(v TableColumnIdx) { +func (self Table) SetDummyDrawChannel(v TableDrawChannelIdx) { vArg, _ := v.c() selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetSortSpecsCount(selfArg, vArg) + C.wrap_ImGuiTable_SetDummyDrawChannel(selfArg, vArg) } -func (self *Table) SortSpecsCount() TableColumnIdx { +func (self *Table) DummyDrawChannel() TableDrawChannelIdx { selfArg, selfFin := self.handle() defer func() { selfFin() }() - result := C.wrap_ImGuiTable_GetSortSpecsCount(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) + result := C.wrap_ImGuiTable_GetDummyDrawChannel(selfArg) + return *newTableDrawChannelIdxFromC(func() *C.ImGuiTableDrawChannelIdx { result := result; return &result }()) } -func (self Table) SetColumnsEnabledCount(v TableColumnIdx) { +func (self Table) SetBg2DrawChannelCurrent(v TableDrawChannelIdx) { vArg, _ := v.c() selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetColumnsEnabledCount(selfArg, vArg) + C.wrap_ImGuiTable_SetBg2DrawChannelCurrent(selfArg, vArg) } -func (self *Table) ColumnsEnabledCount() TableColumnIdx { +func (self *Table) Bg2DrawChannelCurrent() TableDrawChannelIdx { selfArg, selfFin := self.handle() defer func() { selfFin() }() - result := C.wrap_ImGuiTable_GetColumnsEnabledCount(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) + result := C.wrap_ImGuiTable_GetBg2DrawChannelCurrent(selfArg) + return *newTableDrawChannelIdxFromC(func() *C.ImGuiTableDrawChannelIdx { result := result; return &result }()) } -func (self Table) SetColumnsEnabledFixedCount(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetColumnsEnabledFixedCount(selfArg, vArg) -} - -func (self *Table) ColumnsEnabledFixedCount() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTable_GetColumnsEnabledFixedCount(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self Table) SetDeclColumnsCount(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetDeclColumnsCount(selfArg, vArg) -} - -func (self *Table) DeclColumnsCount() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTable_GetDeclColumnsCount(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self Table) SetHoveredColumnBody(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetHoveredColumnBody(selfArg, vArg) -} - -func (self *Table) HoveredColumnBody() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTable_GetHoveredColumnBody(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self Table) SetHoveredColumnBorder(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetHoveredColumnBorder(selfArg, vArg) -} - -func (self *Table) HoveredColumnBorder() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTable_GetHoveredColumnBorder(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self Table) SetAutoFitSingleColumn(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetAutoFitSingleColumn(selfArg, vArg) -} - -func (self *Table) AutoFitSingleColumn() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTable_GetAutoFitSingleColumn(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self Table) SetResizedColumn(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetResizedColumn(selfArg, vArg) -} - -func (self *Table) ResizedColumn() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTable_GetResizedColumn(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self Table) SetLastResizedColumn(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetLastResizedColumn(selfArg, vArg) -} - -func (self *Table) LastResizedColumn() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTable_GetLastResizedColumn(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self Table) SetHeldHeaderColumn(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetHeldHeaderColumn(selfArg, vArg) -} - -func (self *Table) HeldHeaderColumn() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTable_GetHeldHeaderColumn(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self Table) SetReorderColumn(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetReorderColumn(selfArg, vArg) -} - -func (self *Table) ReorderColumn() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTable_GetReorderColumn(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self Table) SetReorderColumnDir(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetReorderColumnDir(selfArg, vArg) -} - -func (self *Table) ReorderColumnDir() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTable_GetReorderColumnDir(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self Table) SetLeftMostEnabledColumn(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetLeftMostEnabledColumn(selfArg, vArg) -} - -func (self *Table) LeftMostEnabledColumn() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTable_GetLeftMostEnabledColumn(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self Table) SetRightMostEnabledColumn(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetRightMostEnabledColumn(selfArg, vArg) -} - -func (self *Table) RightMostEnabledColumn() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTable_GetRightMostEnabledColumn(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self Table) SetLeftMostStretchedColumn(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetLeftMostStretchedColumn(selfArg, vArg) -} - -func (self *Table) LeftMostStretchedColumn() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTable_GetLeftMostStretchedColumn(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self Table) SetRightMostStretchedColumn(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetRightMostStretchedColumn(selfArg, vArg) -} - -func (self *Table) RightMostStretchedColumn() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTable_GetRightMostStretchedColumn(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self Table) SetContextPopupColumn(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetContextPopupColumn(selfArg, vArg) -} - -func (self *Table) ContextPopupColumn() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTable_GetContextPopupColumn(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self Table) SetFreezeRowsRequest(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetFreezeRowsRequest(selfArg, vArg) -} - -func (self *Table) FreezeRowsRequest() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTable_GetFreezeRowsRequest(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self Table) SetFreezeRowsCount(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetFreezeRowsCount(selfArg, vArg) -} - -func (self *Table) FreezeRowsCount() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTable_GetFreezeRowsCount(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self Table) SetFreezeColumnsRequest(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetFreezeColumnsRequest(selfArg, vArg) -} - -func (self *Table) FreezeColumnsRequest() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTable_GetFreezeColumnsRequest(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self Table) SetFreezeColumnsCount(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetFreezeColumnsCount(selfArg, vArg) -} - -func (self *Table) FreezeColumnsCount() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTable_GetFreezeColumnsCount(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self Table) SetRowCellDataCurrent(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetRowCellDataCurrent(selfArg, vArg) -} - -func (self *Table) RowCellDataCurrent() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTable_GetRowCellDataCurrent(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self Table) SetDummyDrawChannel(v TableDrawChannelIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTable_SetDummyDrawChannel(selfArg, vArg) -} - -func (self *Table) DummyDrawChannel() TableDrawChannelIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - 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, vArg) -} - -func (self *Table) Bg2DrawChannelCurrent() TableDrawChannelIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTable_GetBg2DrawChannelCurrent(selfArg) - return *newTableDrawChannelIdxFromC(func() *C.ImGuiTableDrawChannelIdx { result := result; return &result }()) -} - -func (self Table) SetBg2DrawChannelUnfrozen(v TableDrawChannelIdx) { +func (self Table) SetBg2DrawChannelUnfrozen(v TableDrawChannelIdx) { vArg, _ := v.c() selfArg, selfFin := self.handle() @@ -28389,25 +27590,6 @@ func (self *TableCellData) BgColor() uint32 { return uint32(C.wrap_ImGuiTableCellData_GetBgColor(selfArg)) } -func (self TableCellData) SetColumn(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTableCellData_SetColumn(selfArg, vArg) -} - -func (self *TableCellData) Column() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTableCellData_GetColumn(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - func (self TableColumn) SetFlags(v TableColumnFlags) { selfArg, selfFin := self.handle() defer selfFin() @@ -28682,101 +27864,6 @@ func (self *TableColumn) NameOffset() int { return int(C.wrap_ImGuiTableColumn_GetNameOffset(selfArg)) } -func (self TableColumn) SetDisplayOrder(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTableColumn_SetDisplayOrder(selfArg, vArg) -} - -func (self *TableColumn) DisplayOrder() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTableColumn_GetDisplayOrder(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self TableColumn) SetIndexWithinEnabledSet(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTableColumn_SetIndexWithinEnabledSet(selfArg, vArg) -} - -func (self *TableColumn) IndexWithinEnabledSet() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTableColumn_GetIndexWithinEnabledSet(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self TableColumn) SetPrevEnabledColumn(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTableColumn_SetPrevEnabledColumn(selfArg, vArg) -} - -func (self *TableColumn) PrevEnabledColumn() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTableColumn_GetPrevEnabledColumn(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self TableColumn) SetNextEnabledColumn(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTableColumn_SetNextEnabledColumn(selfArg, vArg) -} - -func (self *TableColumn) NextEnabledColumn() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTableColumn_GetNextEnabledColumn(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self TableColumn) SetSortOrder(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTableColumn_SetSortOrder(selfArg, vArg) -} - -func (self *TableColumn) SortOrder() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTableColumn_GetSortOrder(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - func (self TableColumn) SetDrawChannelCurrent(v TableDrawChannelIdx) { vArg, _ := v.c() @@ -29093,63 +28180,6 @@ func (self *TableColumnSettings) UserID() ID { return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } -func (self TableColumnSettings) SetIndex(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTableColumnSettings_SetIndex(selfArg, vArg) -} - -func (self *TableColumnSettings) Index() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTableColumnSettings_GetIndex(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self TableColumnSettings) SetDisplayOrder(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTableColumnSettings_SetDisplayOrder(selfArg, vArg) -} - -func (self *TableColumnSettings) DisplayOrder() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTableColumnSettings_GetDisplayOrder(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self TableColumnSettings) SetSortOrder(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTableColumnSettings_SetSortOrder(selfArg, vArg) -} - -func (self *TableColumnSettings) SortOrder() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTableColumnSettings_GetSortOrder(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - func (self TableColumnSettings) SetSortDirection(v byte) { selfArg, selfFin := self.handle() defer selfFin() @@ -29402,44 +28432,6 @@ func (self *TableSettings) RefScale() float32 { return float32(C.wrap_ImGuiTableSettings_GetRefScale(selfArg)) } -func (self TableSettings) SetColumnsCount(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTableSettings_SetColumnsCount(selfArg, vArg) -} - -func (self *TableSettings) ColumnsCount() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTableSettings_GetColumnsCount(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - -func (self TableSettings) SetColumnsCountMax(v TableColumnIdx) { - vArg, _ := v.c() - - selfArg, selfFin := self.handle() - defer selfFin() - C.wrap_ImGuiTableSettings_SetColumnsCountMax(selfArg, vArg) -} - -func (self *TableSettings) ColumnsCountMax() TableColumnIdx { - selfArg, selfFin := self.handle() - - defer func() { - selfFin() - }() - - result := C.wrap_ImGuiTableSettings_GetColumnsCountMax(selfArg) - return *newTableColumnIdxFromC(func() *C.ImGuiTableColumnIdx { result := result; return &result }()) -} - func (self TableSettings) SetWantApply(v bool) { selfArg, selfFin := self.handle() defer selfFin() diff --git a/cimgui_typedefs.go b/cimgui_typedefs.go index 381b4e597..0b62b7f7b 100644 --- a/cimgui_typedefs.go +++ b/cimgui_typedefs.go @@ -10,232 +10,1896 @@ package imgui import "C" import "unsafe" -type DrawIdx uint16 +type BitVector struct { + data *C.ImBitVector +} + +func (self *BitVector) handle() (result *C.ImBitVector, fin func()) { + return self.data, func() {} +} + +func (self BitVector) c() (C.ImBitVector, func()) { + result, fn := self.handle() + return *result, fn +} + +func newBitVectorFromC(cvalue *C.ImBitVector) *BitVector { + return &BitVector{data: cvalue} +} + +type DrawChannel struct { + data *C.ImDrawChannel +} + +func (self *DrawChannel) handle() (result *C.ImDrawChannel, fin func()) { + return self.data, func() {} +} + +func (self DrawChannel) c() (C.ImDrawChannel, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDrawChannelFromC(cvalue *C.ImDrawChannel) *DrawChannel { + return &DrawChannel{data: cvalue} +} + +type DrawCmd struct { + data *C.ImDrawCmd +} + +func (self *DrawCmd) handle() (result *C.ImDrawCmd, fin func()) { + return self.data, func() {} +} + +func (self DrawCmd) c() (C.ImDrawCmd, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDrawCmdFromC(cvalue *C.ImDrawCmd) *DrawCmd { + return &DrawCmd{data: cvalue} +} + +type DrawCmdHeader struct { + data *C.ImDrawCmdHeader +} + +func (self *DrawCmdHeader) handle() (result *C.ImDrawCmdHeader, fin func()) { + return self.data, func() {} +} + +func (self DrawCmdHeader) c() (C.ImDrawCmdHeader, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDrawCmdHeaderFromC(cvalue *C.ImDrawCmdHeader) *DrawCmdHeader { + return &DrawCmdHeader{data: cvalue} +} + +type DrawData struct { + data *C.ImDrawData +} + +func (self *DrawData) handle() (result *C.ImDrawData, fin func()) { + return self.data, func() {} +} + +func (self DrawData) c() (C.ImDrawData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDrawDataFromC(cvalue *C.ImDrawData) *DrawData { + return &DrawData{data: cvalue} +} + +type DrawDataBuilder struct { + data *C.ImDrawDataBuilder +} + +func (self *DrawDataBuilder) handle() (result *C.ImDrawDataBuilder, fin func()) { + return self.data, func() {} +} + +func (self DrawDataBuilder) c() (C.ImDrawDataBuilder, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDrawDataBuilderFromC(cvalue *C.ImDrawDataBuilder) *DrawDataBuilder { + return &DrawDataBuilder{data: cvalue} +} + +type DrawList struct { + data *C.ImDrawList +} + +func (self *DrawList) handle() (result *C.ImDrawList, fin func()) { + return self.data, func() {} +} + +func (self DrawList) c() (C.ImDrawList, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDrawListFromC(cvalue *C.ImDrawList) *DrawList { + return &DrawList{data: cvalue} +} + +type DrawListSharedData struct { + data *C.ImDrawListSharedData +} + +func (self *DrawListSharedData) handle() (result *C.ImDrawListSharedData, fin func()) { + return self.data, func() {} +} + +func (self DrawListSharedData) c() (C.ImDrawListSharedData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDrawListSharedDataFromC(cvalue *C.ImDrawListSharedData) *DrawListSharedData { + return &DrawListSharedData{data: cvalue} +} + +type DrawListSplitter struct { + data *C.ImDrawListSplitter +} + +func (self *DrawListSplitter) handle() (result *C.ImDrawListSplitter, fin func()) { + return self.data, func() {} +} + +func (self DrawListSplitter) c() (C.ImDrawListSplitter, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDrawListSplitterFromC(cvalue *C.ImDrawListSplitter) *DrawListSplitter { + return &DrawListSplitter{data: cvalue} +} + +type DrawVert struct { + data *C.ImDrawVert +} + +func (self *DrawVert) handle() (result *C.ImDrawVert, fin func()) { + return self.data, func() {} +} + +func (self DrawVert) c() (C.ImDrawVert, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDrawVertFromC(cvalue *C.ImDrawVert) *DrawVert { + return &DrawVert{data: cvalue} +} + +type Font struct { + data *C.ImFont +} + +func (self *Font) handle() (result *C.ImFont, fin func()) { + return self.data, func() {} +} + +func (self Font) c() (C.ImFont, func()) { + result, fn := self.handle() + return *result, fn +} + +func newFontFromC(cvalue *C.ImFont) *Font { + return &Font{data: cvalue} +} + +type FontAtlas struct { + data *C.ImFontAtlas +} + +func (self *FontAtlas) handle() (result *C.ImFontAtlas, fin func()) { + return self.data, func() {} +} + +func (self FontAtlas) c() (C.ImFontAtlas, func()) { + result, fn := self.handle() + return *result, fn +} + +func newFontAtlasFromC(cvalue *C.ImFontAtlas) *FontAtlas { + return &FontAtlas{data: cvalue} +} + +type FontAtlasCustomRect struct { + data *C.ImFontAtlasCustomRect +} + +func (self *FontAtlasCustomRect) handle() (result *C.ImFontAtlasCustomRect, fin func()) { + return self.data, func() {} +} + +func (self FontAtlasCustomRect) c() (C.ImFontAtlasCustomRect, func()) { + result, fn := self.handle() + return *result, fn +} + +func newFontAtlasCustomRectFromC(cvalue *C.ImFontAtlasCustomRect) *FontAtlasCustomRect { + return &FontAtlasCustomRect{data: cvalue} +} + +type FontBuilderIO struct { + data *C.ImFontBuilderIO +} + +func (self *FontBuilderIO) handle() (result *C.ImFontBuilderIO, fin func()) { + return self.data, func() {} +} + +func (self FontBuilderIO) c() (C.ImFontBuilderIO, func()) { + result, fn := self.handle() + return *result, fn +} + +func newFontBuilderIOFromC(cvalue *C.ImFontBuilderIO) *FontBuilderIO { + return &FontBuilderIO{data: cvalue} +} + +type FontConfig struct { + data *C.ImFontConfig +} + +func (self *FontConfig) handle() (result *C.ImFontConfig, fin func()) { + return self.data, func() {} +} + +func (self FontConfig) c() (C.ImFontConfig, func()) { + result, fn := self.handle() + return *result, fn +} + +func newFontConfigFromC(cvalue *C.ImFontConfig) *FontConfig { + return &FontConfig{data: cvalue} +} + +type FontGlyph struct { + data *C.ImFontGlyph +} + +func (self *FontGlyph) handle() (result *C.ImFontGlyph, fin func()) { + return self.data, func() {} +} + +func (self FontGlyph) c() (C.ImFontGlyph, func()) { + result, fn := self.handle() + return *result, fn +} + +func newFontGlyphFromC(cvalue *C.ImFontGlyph) *FontGlyph { + return &FontGlyph{data: cvalue} +} + +type FontGlyphRangesBuilder struct { + data *C.ImFontGlyphRangesBuilder +} + +func (self *FontGlyphRangesBuilder) handle() (result *C.ImFontGlyphRangesBuilder, fin func()) { + return self.data, func() {} +} + +func (self FontGlyphRangesBuilder) c() (C.ImFontGlyphRangesBuilder, func()) { + result, fn := self.handle() + return *result, fn +} + +func newFontGlyphRangesBuilderFromC(cvalue *C.ImFontGlyphRangesBuilder) *FontGlyphRangesBuilder { + return &FontGlyphRangesBuilder{data: cvalue} +} + +type ColorMod struct { + data *C.ImGuiColorMod +} + +func (self *ColorMod) handle() (result *C.ImGuiColorMod, fin func()) { + return self.data, func() {} +} + +func (self ColorMod) c() (C.ImGuiColorMod, func()) { + result, fn := self.handle() + return *result, fn +} + +func newColorModFromC(cvalue *C.ImGuiColorMod) *ColorMod { + return &ColorMod{data: cvalue} +} + +type ComboPreviewData struct { + data *C.ImGuiComboPreviewData +} + +func (self *ComboPreviewData) handle() (result *C.ImGuiComboPreviewData, fin func()) { + return self.data, func() {} +} + +func (self ComboPreviewData) c() (C.ImGuiComboPreviewData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newComboPreviewDataFromC(cvalue *C.ImGuiComboPreviewData) *ComboPreviewData { + return &ComboPreviewData{data: cvalue} +} + +type Context struct { + data *C.ImGuiContext +} + +func (self *Context) handle() (result *C.ImGuiContext, fin func()) { + return self.data, func() {} +} + +func (self Context) c() (C.ImGuiContext, func()) { + result, fn := self.handle() + return *result, fn +} + +func newContextFromC(cvalue *C.ImGuiContext) *Context { + return &Context{data: cvalue} +} + +type ContextHook struct { + data *C.ImGuiContextHook +} + +func (self *ContextHook) handle() (result *C.ImGuiContextHook, fin func()) { + return self.data, func() {} +} + +func (self ContextHook) c() (C.ImGuiContextHook, func()) { + result, fn := self.handle() + return *result, fn +} + +func newContextHookFromC(cvalue *C.ImGuiContextHook) *ContextHook { + return &ContextHook{data: cvalue} +} + +type DataTypeInfo struct { + data *C.ImGuiDataTypeInfo +} + +func (self *DataTypeInfo) handle() (result *C.ImGuiDataTypeInfo, fin func()) { + return self.data, func() {} +} + +func (self DataTypeInfo) c() (C.ImGuiDataTypeInfo, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDataTypeInfoFromC(cvalue *C.ImGuiDataTypeInfo) *DataTypeInfo { + return &DataTypeInfo{data: cvalue} +} + +type DataTypeTempStorage struct { + data *C.ImGuiDataTypeTempStorage +} + +func (self *DataTypeTempStorage) handle() (result *C.ImGuiDataTypeTempStorage, fin func()) { + return self.data, func() {} +} + +func (self DataTypeTempStorage) c() (C.ImGuiDataTypeTempStorage, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDataTypeTempStorageFromC(cvalue *C.ImGuiDataTypeTempStorage) *DataTypeTempStorage { + return &DataTypeTempStorage{data: cvalue} +} + +type DataVarInfo struct { + data *C.ImGuiDataVarInfo +} + +func (self *DataVarInfo) handle() (result *C.ImGuiDataVarInfo, fin func()) { + return self.data, func() {} +} + +func (self DataVarInfo) c() (C.ImGuiDataVarInfo, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDataVarInfoFromC(cvalue *C.ImGuiDataVarInfo) *DataVarInfo { + return &DataVarInfo{data: cvalue} +} + +type DockContext struct { + data *C.ImGuiDockContext +} + +func (self *DockContext) handle() (result *C.ImGuiDockContext, fin func()) { + return self.data, func() {} +} + +func (self DockContext) c() (C.ImGuiDockContext, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDockContextFromC(cvalue *C.ImGuiDockContext) *DockContext { + return &DockContext{data: cvalue} +} + +type DockNode struct { + data *C.ImGuiDockNode +} + +func (self *DockNode) handle() (result *C.ImGuiDockNode, fin func()) { + return self.data, func() {} +} + +func (self DockNode) c() (C.ImGuiDockNode, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDockNodeFromC(cvalue *C.ImGuiDockNode) *DockNode { + return &DockNode{data: cvalue} +} + +type DockNodeSettings struct { + data *C.ImGuiDockNodeSettings +} + +func (self *DockNodeSettings) handle() (result *C.ImGuiDockNodeSettings, fin func()) { + return self.data, func() {} +} + +func (self DockNodeSettings) c() (C.ImGuiDockNodeSettings, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDockNodeSettingsFromC(cvalue *C.ImGuiDockNodeSettings) *DockNodeSettings { + return &DockNodeSettings{data: cvalue} +} + +type DockRequest struct { + data *C.ImGuiDockRequest +} + +func (self *DockRequest) handle() (result *C.ImGuiDockRequest, fin func()) { + return self.data, func() {} +} + +func (self DockRequest) c() (C.ImGuiDockRequest, func()) { + result, fn := self.handle() + return *result, fn +} + +func newDockRequestFromC(cvalue *C.ImGuiDockRequest) *DockRequest { + return &DockRequest{data: cvalue} +} + +type GroupData struct { + data *C.ImGuiGroupData +} + +func (self *GroupData) handle() (result *C.ImGuiGroupData, fin func()) { + return self.data, func() {} +} + +func (self GroupData) c() (C.ImGuiGroupData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newGroupDataFromC(cvalue *C.ImGuiGroupData) *GroupData { + return &GroupData{data: cvalue} +} + +type ID uint32 + +func (self *ID) handle() (result *C.ImGuiID, fin func()) { + 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 +} + +type IO struct { + data *C.ImGuiIO +} + +func (self *IO) handle() (result *C.ImGuiIO, fin func()) { + return self.data, func() {} +} + +func (self IO) c() (C.ImGuiIO, func()) { + result, fn := self.handle() + return *result, fn +} + +func newIOFromC(cvalue *C.ImGuiIO) *IO { + return &IO{data: cvalue} +} + +type InputEvent struct { + data *C.ImGuiInputEvent +} + +func (self *InputEvent) handle() (result *C.ImGuiInputEvent, fin func()) { + return self.data, func() {} +} + +func (self InputEvent) c() (C.ImGuiInputEvent, func()) { + result, fn := self.handle() + return *result, fn +} + +func newInputEventFromC(cvalue *C.ImGuiInputEvent) *InputEvent { + return &InputEvent{data: cvalue} +} + +type InputEventAppFocused struct { + data *C.ImGuiInputEventAppFocused +} + +func (self *InputEventAppFocused) handle() (result *C.ImGuiInputEventAppFocused, fin func()) { + return self.data, func() {} +} + +func (self InputEventAppFocused) c() (C.ImGuiInputEventAppFocused, func()) { + result, fn := self.handle() + return *result, fn +} + +func newInputEventAppFocusedFromC(cvalue *C.ImGuiInputEventAppFocused) *InputEventAppFocused { + return &InputEventAppFocused{data: cvalue} +} + +type InputEventKey struct { + data *C.ImGuiInputEventKey +} + +func (self *InputEventKey) handle() (result *C.ImGuiInputEventKey, fin func()) { + return self.data, func() {} +} + +func (self InputEventKey) c() (C.ImGuiInputEventKey, func()) { + result, fn := self.handle() + return *result, fn +} + +func newInputEventKeyFromC(cvalue *C.ImGuiInputEventKey) *InputEventKey { + return &InputEventKey{data: cvalue} +} + +type InputEventMouseButton struct { + data *C.ImGuiInputEventMouseButton +} + +func (self *InputEventMouseButton) handle() (result *C.ImGuiInputEventMouseButton, fin func()) { + return self.data, func() {} +} + +func (self InputEventMouseButton) c() (C.ImGuiInputEventMouseButton, func()) { + result, fn := self.handle() + return *result, fn +} + +func newInputEventMouseButtonFromC(cvalue *C.ImGuiInputEventMouseButton) *InputEventMouseButton { + return &InputEventMouseButton{data: cvalue} +} + +type InputEventMousePos struct { + data *C.ImGuiInputEventMousePos +} + +func (self *InputEventMousePos) handle() (result *C.ImGuiInputEventMousePos, fin func()) { + return self.data, func() {} +} + +func (self InputEventMousePos) c() (C.ImGuiInputEventMousePos, func()) { + result, fn := self.handle() + return *result, fn +} + +func newInputEventMousePosFromC(cvalue *C.ImGuiInputEventMousePos) *InputEventMousePos { + return &InputEventMousePos{data: cvalue} +} + +type InputEventMouseViewport struct { + data *C.ImGuiInputEventMouseViewport +} + +func (self *InputEventMouseViewport) handle() (result *C.ImGuiInputEventMouseViewport, fin func()) { + return self.data, func() {} +} + +func (self InputEventMouseViewport) c() (C.ImGuiInputEventMouseViewport, func()) { + result, fn := self.handle() + return *result, fn +} + +func newInputEventMouseViewportFromC(cvalue *C.ImGuiInputEventMouseViewport) *InputEventMouseViewport { + return &InputEventMouseViewport{data: cvalue} +} + +type InputEventMouseWheel struct { + data *C.ImGuiInputEventMouseWheel +} + +func (self *InputEventMouseWheel) handle() (result *C.ImGuiInputEventMouseWheel, fin func()) { + return self.data, func() {} +} + +func (self InputEventMouseWheel) c() (C.ImGuiInputEventMouseWheel, func()) { + result, fn := self.handle() + return *result, fn +} + +func newInputEventMouseWheelFromC(cvalue *C.ImGuiInputEventMouseWheel) *InputEventMouseWheel { + return &InputEventMouseWheel{data: cvalue} +} + +type InputEventText struct { + data *C.ImGuiInputEventText +} + +func (self *InputEventText) handle() (result *C.ImGuiInputEventText, fin func()) { + return self.data, func() {} +} + +func (self InputEventText) c() (C.ImGuiInputEventText, func()) { + result, fn := self.handle() + return *result, fn +} + +func newInputEventTextFromC(cvalue *C.ImGuiInputEventText) *InputEventText { + return &InputEventText{data: cvalue} +} + +type InputTextCallbackData struct { + data *C.ImGuiInputTextCallbackData +} + +func (self *InputTextCallbackData) handle() (result *C.ImGuiInputTextCallbackData, fin func()) { + return self.data, func() {} +} + +func (self InputTextCallbackData) c() (C.ImGuiInputTextCallbackData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newInputTextCallbackDataFromC(cvalue *C.ImGuiInputTextCallbackData) *InputTextCallbackData { + return &InputTextCallbackData{data: cvalue} +} + +type InputTextDeactivateData struct { + data *C.ImGuiInputTextDeactivateData +} + +func (self *InputTextDeactivateData) handle() (result *C.ImGuiInputTextDeactivateData, fin func()) { + return self.data, func() {} +} + +func (self InputTextDeactivateData) c() (C.ImGuiInputTextDeactivateData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newInputTextDeactivateDataFromC(cvalue *C.ImGuiInputTextDeactivateData) *InputTextDeactivateData { + return &InputTextDeactivateData{data: cvalue} +} + +type InputTextDeactivatedState struct { + data *C.ImGuiInputTextDeactivatedState +} + +func (self *InputTextDeactivatedState) handle() (result *C.ImGuiInputTextDeactivatedState, fin func()) { + return self.data, func() {} +} + +func (self InputTextDeactivatedState) c() (C.ImGuiInputTextDeactivatedState, func()) { + result, fn := self.handle() + return *result, fn +} + +func newInputTextDeactivatedStateFromC(cvalue *C.ImGuiInputTextDeactivatedState) *InputTextDeactivatedState { + return &InputTextDeactivatedState{data: cvalue} +} + +type InputTextState struct { + data *C.ImGuiInputTextState +} + +func (self *InputTextState) handle() (result *C.ImGuiInputTextState, fin func()) { + return self.data, func() {} +} + +func (self InputTextState) c() (C.ImGuiInputTextState, func()) { + result, fn := self.handle() + return *result, fn +} + +func newInputTextStateFromC(cvalue *C.ImGuiInputTextState) *InputTextState { + return &InputTextState{data: cvalue} +} + +type KeyChord int32 + +func (self *KeyChord) handle() (result *C.ImGuiKeyChord, fin func()) { + 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 +} + +type KeyData struct { + data *C.ImGuiKeyData +} + +func (self *KeyData) handle() (result *C.ImGuiKeyData, fin func()) { + return self.data, func() {} +} + +func (self KeyData) c() (C.ImGuiKeyData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newKeyDataFromC(cvalue *C.ImGuiKeyData) *KeyData { + return &KeyData{data: cvalue} +} + +type KeyOwnerData struct { + data *C.ImGuiKeyOwnerData +} + +func (self *KeyOwnerData) handle() (result *C.ImGuiKeyOwnerData, fin func()) { + return self.data, func() {} +} + +func (self KeyOwnerData) c() (C.ImGuiKeyOwnerData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newKeyOwnerDataFromC(cvalue *C.ImGuiKeyOwnerData) *KeyOwnerData { + return &KeyOwnerData{data: cvalue} +} + +type KeyRoutingData struct { + data *C.ImGuiKeyRoutingData +} + +func (self *KeyRoutingData) handle() (result *C.ImGuiKeyRoutingData, fin func()) { + return self.data, func() {} +} + +func (self KeyRoutingData) c() (C.ImGuiKeyRoutingData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newKeyRoutingDataFromC(cvalue *C.ImGuiKeyRoutingData) *KeyRoutingData { + return &KeyRoutingData{data: cvalue} +} + +type KeyRoutingTable struct { + data *C.ImGuiKeyRoutingTable +} + +func (self *KeyRoutingTable) handle() (result *C.ImGuiKeyRoutingTable, fin func()) { + return self.data, func() {} +} + +func (self KeyRoutingTable) c() (C.ImGuiKeyRoutingTable, func()) { + result, fn := self.handle() + return *result, fn +} + +func newKeyRoutingTableFromC(cvalue *C.ImGuiKeyRoutingTable) *KeyRoutingTable { + return &KeyRoutingTable{data: cvalue} +} + +type LastItemData struct { + data *C.ImGuiLastItemData +} + +func (self *LastItemData) handle() (result *C.ImGuiLastItemData, fin func()) { + return self.data, func() {} +} + +func (self LastItemData) c() (C.ImGuiLastItemData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newLastItemDataFromC(cvalue *C.ImGuiLastItemData) *LastItemData { + return &LastItemData{data: cvalue} +} + +type ListClipper struct { + data *C.ImGuiListClipper +} + +func (self *ListClipper) handle() (result *C.ImGuiListClipper, fin func()) { + return self.data, func() {} +} + +func (self ListClipper) c() (C.ImGuiListClipper, func()) { + result, fn := self.handle() + return *result, fn +} + +func newListClipperFromC(cvalue *C.ImGuiListClipper) *ListClipper { + return &ListClipper{data: cvalue} +} + +type ListClipperData struct { + data *C.ImGuiListClipperData +} + +func (self *ListClipperData) handle() (result *C.ImGuiListClipperData, fin func()) { + return self.data, func() {} +} + +func (self ListClipperData) c() (C.ImGuiListClipperData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newListClipperDataFromC(cvalue *C.ImGuiListClipperData) *ListClipperData { + return &ListClipperData{data: cvalue} +} + +type ListClipperRange struct { + data *C.ImGuiListClipperRange +} + +func (self *ListClipperRange) handle() (result *C.ImGuiListClipperRange, fin func()) { + return self.data, func() {} +} + +func (self ListClipperRange) c() (C.ImGuiListClipperRange, func()) { + result, fn := self.handle() + return *result, fn +} + +func newListClipperRangeFromC(cvalue *C.ImGuiListClipperRange) *ListClipperRange { + return &ListClipperRange{data: cvalue} +} + +type LocEntry struct { + data *C.ImGuiLocEntry +} + +func (self *LocEntry) handle() (result *C.ImGuiLocEntry, fin func()) { + return self.data, func() {} +} + +func (self LocEntry) c() (C.ImGuiLocEntry, func()) { + result, fn := self.handle() + return *result, fn +} + +func newLocEntryFromC(cvalue *C.ImGuiLocEntry) *LocEntry { + return &LocEntry{data: cvalue} +} + +type MenuColumns struct { + data *C.ImGuiMenuColumns +} + +func (self *MenuColumns) handle() (result *C.ImGuiMenuColumns, fin func()) { + return self.data, func() {} +} + +func (self MenuColumns) c() (C.ImGuiMenuColumns, func()) { + result, fn := self.handle() + return *result, fn +} + +func newMenuColumnsFromC(cvalue *C.ImGuiMenuColumns) *MenuColumns { + return &MenuColumns{data: cvalue} +} + +type MetricsConfig struct { + data *C.ImGuiMetricsConfig +} + +func (self *MetricsConfig) handle() (result *C.ImGuiMetricsConfig, fin func()) { + return self.data, func() {} +} + +func (self MetricsConfig) c() (C.ImGuiMetricsConfig, func()) { + result, fn := self.handle() + return *result, fn +} + +func newMetricsConfigFromC(cvalue *C.ImGuiMetricsConfig) *MetricsConfig { + return &MetricsConfig{data: cvalue} +} + +type NavItemData struct { + data *C.ImGuiNavItemData +} + +func (self *NavItemData) handle() (result *C.ImGuiNavItemData, fin func()) { + return self.data, func() {} +} + +func (self NavItemData) c() (C.ImGuiNavItemData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newNavItemDataFromC(cvalue *C.ImGuiNavItemData) *NavItemData { + return &NavItemData{data: cvalue} +} + +type NavTreeNodeData struct { + data *C.ImGuiNavTreeNodeData +} + +func (self *NavTreeNodeData) handle() (result *C.ImGuiNavTreeNodeData, fin func()) { + return self.data, func() {} +} + +func (self NavTreeNodeData) c() (C.ImGuiNavTreeNodeData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newNavTreeNodeDataFromC(cvalue *C.ImGuiNavTreeNodeData) *NavTreeNodeData { + return &NavTreeNodeData{data: cvalue} +} + +type NextItemData struct { + data *C.ImGuiNextItemData +} + +func (self *NextItemData) handle() (result *C.ImGuiNextItemData, fin func()) { + return self.data, func() {} +} + +func (self NextItemData) c() (C.ImGuiNextItemData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newNextItemDataFromC(cvalue *C.ImGuiNextItemData) *NextItemData { + return &NextItemData{data: cvalue} +} + +type NextWindowData struct { + data *C.ImGuiNextWindowData +} + +func (self *NextWindowData) handle() (result *C.ImGuiNextWindowData, fin func()) { + return self.data, func() {} +} + +func (self NextWindowData) c() (C.ImGuiNextWindowData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newNextWindowDataFromC(cvalue *C.ImGuiNextWindowData) *NextWindowData { + return &NextWindowData{data: cvalue} +} + +type OldColumnData struct { + data *C.ImGuiOldColumnData +} + +func (self *OldColumnData) handle() (result *C.ImGuiOldColumnData, fin func()) { + return self.data, func() {} +} + +func (self OldColumnData) c() (C.ImGuiOldColumnData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newOldColumnDataFromC(cvalue *C.ImGuiOldColumnData) *OldColumnData { + return &OldColumnData{data: cvalue} +} + +type OldColumns struct { + data *C.ImGuiOldColumns +} + +func (self *OldColumns) handle() (result *C.ImGuiOldColumns, fin func()) { + return self.data, func() {} +} + +func (self OldColumns) c() (C.ImGuiOldColumns, func()) { + result, fn := self.handle() + return *result, fn +} + +func newOldColumnsFromC(cvalue *C.ImGuiOldColumns) *OldColumns { + return &OldColumns{data: cvalue} +} + +type OnceUponAFrame struct { + data *C.ImGuiOnceUponAFrame +} + +func (self *OnceUponAFrame) handle() (result *C.ImGuiOnceUponAFrame, fin func()) { + return self.data, func() {} +} + +func (self OnceUponAFrame) c() (C.ImGuiOnceUponAFrame, func()) { + result, fn := self.handle() + return *result, fn +} + +func newOnceUponAFrameFromC(cvalue *C.ImGuiOnceUponAFrame) *OnceUponAFrame { + return &OnceUponAFrame{data: cvalue} +} + +type Payload struct { + data *C.ImGuiPayload +} + +func (self *Payload) handle() (result *C.ImGuiPayload, fin func()) { + return self.data, func() {} +} + +func (self Payload) c() (C.ImGuiPayload, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPayloadFromC(cvalue *C.ImGuiPayload) *Payload { + return &Payload{data: cvalue} +} + +type PlatformIO struct { + data *C.ImGuiPlatformIO +} + +func (self *PlatformIO) handle() (result *C.ImGuiPlatformIO, fin func()) { + return self.data, func() {} +} + +func (self PlatformIO) c() (C.ImGuiPlatformIO, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlatformIOFromC(cvalue *C.ImGuiPlatformIO) *PlatformIO { + return &PlatformIO{data: cvalue} +} + +type PlatformImeData struct { + data *C.ImGuiPlatformImeData +} + +func (self *PlatformImeData) handle() (result *C.ImGuiPlatformImeData, fin func()) { + return self.data, func() {} +} + +func (self PlatformImeData) c() (C.ImGuiPlatformImeData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlatformImeDataFromC(cvalue *C.ImGuiPlatformImeData) *PlatformImeData { + return &PlatformImeData{data: cvalue} +} + +type PlatformMonitor struct { + data *C.ImGuiPlatformMonitor +} + +func (self *PlatformMonitor) handle() (result *C.ImGuiPlatformMonitor, fin func()) { + return self.data, func() {} +} + +func (self PlatformMonitor) c() (C.ImGuiPlatformMonitor, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlatformMonitorFromC(cvalue *C.ImGuiPlatformMonitor) *PlatformMonitor { + return &PlatformMonitor{data: cvalue} +} + +type PopupData struct { + data *C.ImGuiPopupData +} + +func (self *PopupData) handle() (result *C.ImGuiPopupData, fin func()) { + return self.data, func() {} +} + +func (self PopupData) c() (C.ImGuiPopupData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPopupDataFromC(cvalue *C.ImGuiPopupData) *PopupData { + return &PopupData{data: cvalue} +} + +type PtrOrIndex struct { + data *C.ImGuiPtrOrIndex +} + +func (self *PtrOrIndex) handle() (result *C.ImGuiPtrOrIndex, fin func()) { + return self.data, func() {} +} + +func (self PtrOrIndex) c() (C.ImGuiPtrOrIndex, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPtrOrIndexFromC(cvalue *C.ImGuiPtrOrIndex) *PtrOrIndex { + return &PtrOrIndex{data: cvalue} +} + +type SettingsHandler struct { + data *C.ImGuiSettingsHandler +} + +func (self *SettingsHandler) handle() (result *C.ImGuiSettingsHandler, fin func()) { + return self.data, func() {} +} + +func (self SettingsHandler) c() (C.ImGuiSettingsHandler, func()) { + result, fn := self.handle() + return *result, fn +} + +func newSettingsHandlerFromC(cvalue *C.ImGuiSettingsHandler) *SettingsHandler { + return &SettingsHandler{data: cvalue} +} -func (self DrawIdx) handle() (result *C.ImDrawIdx, fin func()) { - return (*C.ImDrawIdx)(C.ushort(self)), func() {} +type ShrinkWidthItem struct { + data *C.ImGuiShrinkWidthItem } -func (self DrawIdx) c() (C.ImDrawIdx, func()) { - result, fin := self.handle() - return *result, fin +func (self *ShrinkWidthItem) handle() (result *C.ImGuiShrinkWidthItem, fin func()) { + return self.data, func() {} } -func newDrawIdxFromC(cvalue *C.ImDrawIdx) *DrawIdx { - return uint16(cvalue) +func (self ShrinkWidthItem) c() (C.ImGuiShrinkWidthItem, func()) { + result, fn := self.handle() + return *result, fn } -type DockNodeSettings C.ImGuiDockNodeSettings +func newShrinkWidthItemFromC(cvalue *C.ImGuiShrinkWidthItem) *ShrinkWidthItem { + return &ShrinkWidthItem{data: cvalue} +} -func (self DockNodeSettings) handle() (result *C.ImGuiDockNodeSettings, fin func()) { - result = (*C.ImGuiDockNodeSettings)(unsafe.Pointer(&self)) - return result, func() {} +type SizeCallbackData struct { + data *C.ImGuiSizeCallbackData } -func (self DockNodeSettings) c() (C.ImGuiDockNodeSettings, func()) { - result, fin := self.handle() - return *result, fin +func (self *SizeCallbackData) handle() (result *C.ImGuiSizeCallbackData, fin func()) { + return self.data, func() {} } -func newDockNodeSettingsFromC(cvalue *C.ImGuiDockNodeSettings) *DockNodeSettings { - return (*DockNodeSettings)(cvalue) +func (self SizeCallbackData) c() (C.ImGuiSizeCallbackData, func()) { + result, fn := self.handle() + return *result, fn } -type DockRequest C.ImGuiDockRequest +func newSizeCallbackDataFromC(cvalue *C.ImGuiSizeCallbackData) *SizeCallbackData { + return &SizeCallbackData{data: cvalue} +} -func (self DockRequest) handle() (result *C.ImGuiDockRequest, fin func()) { - result = (*C.ImGuiDockRequest)(unsafe.Pointer(&self)) - return result, func() {} +type StackLevelInfo struct { + data *C.ImGuiStackLevelInfo } -func (self DockRequest) c() (C.ImGuiDockRequest, func()) { - result, fin := self.handle() - return *result, fin +func (self *StackLevelInfo) handle() (result *C.ImGuiStackLevelInfo, fin func()) { + return self.data, func() {} } -func newDockRequestFromC(cvalue *C.ImGuiDockRequest) *DockRequest { - return (*DockRequest)(cvalue) +func (self StackLevelInfo) c() (C.ImGuiStackLevelInfo, func()) { + result, fn := self.handle() + return *result, fn } -type ID uint32 +func newStackLevelInfoFromC(cvalue *C.ImGuiStackLevelInfo) *StackLevelInfo { + return &StackLevelInfo{data: cvalue} +} -func (self ID) handle() (result *C.ImGuiID, fin func()) { - return (*C.ImGuiID)(C.uint(self)), func() {} +type StackSizes struct { + data *C.ImGuiStackSizes } -func (self ID) c() (C.ImGuiID, func()) { - result, fin := self.handle() - return *result, fin +func (self *StackSizes) handle() (result *C.ImGuiStackSizes, fin func()) { + return self.data, func() {} } -func newIDFromC(cvalue *C.ImGuiID) *ID { - return uint32(cvalue) +func (self StackSizes) c() (C.ImGuiStackSizes, func()) { + result, fn := self.handle() + return *result, fn } -type InputTextDeactivateData C.ImGuiInputTextDeactivateData +func newStackSizesFromC(cvalue *C.ImGuiStackSizes) *StackSizes { + return &StackSizes{data: cvalue} +} -func (self InputTextDeactivateData) handle() (result *C.ImGuiInputTextDeactivateData, fin func()) { - result = (*C.ImGuiInputTextDeactivateData)(unsafe.Pointer(&self)) - return result, func() {} +type StackTool struct { + data *C.ImGuiStackTool } -func (self InputTextDeactivateData) c() (C.ImGuiInputTextDeactivateData, func()) { - result, fin := self.handle() - return *result, fin +func (self *StackTool) handle() (result *C.ImGuiStackTool, fin func()) { + return self.data, func() {} } -func newInputTextDeactivateDataFromC(cvalue *C.ImGuiInputTextDeactivateData) *InputTextDeactivateData { - return (*InputTextDeactivateData)(cvalue) +func (self StackTool) c() (C.ImGuiStackTool, func()) { + result, fn := self.handle() + return *result, fn } -type KeyChord int32 +func newStackToolFromC(cvalue *C.ImGuiStackTool) *StackTool { + return &StackTool{data: cvalue} +} -func (self KeyChord) handle() (result *C.ImGuiKeyChord, fin func()) { - return (*C.ImGuiKeyChord)(C.int(self)), func() {} +type Storage struct { + data *C.ImGuiStorage } -func (self KeyChord) c() (C.ImGuiKeyChord, func()) { - result, fin := self.handle() - return *result, fin +func (self *Storage) handle() (result *C.ImGuiStorage, fin func()) { + return self.data, func() {} } -func newKeyChordFromC(cvalue *C.ImGuiKeyChord) *KeyChord { - return int32(cvalue) +func (self Storage) c() (C.ImGuiStorage, func()) { + result, fn := self.handle() + return *result, fn +} + +func newStorageFromC(cvalue *C.ImGuiStorage) *Storage { + return &Storage{data: cvalue} +} + +type StoragePair struct { + data *C.ImGuiStoragePair +} + +func (self *StoragePair) handle() (result *C.ImGuiStoragePair, fin func()) { + return self.data, func() {} +} + +func (self StoragePair) c() (C.ImGuiStoragePair, func()) { + result, fn := self.handle() + return *result, fn +} + +func newStoragePairFromC(cvalue *C.ImGuiStoragePair) *StoragePair { + return &StoragePair{data: cvalue} +} + +type Style struct { + data *C.ImGuiStyle +} + +func (self *Style) handle() (result *C.ImGuiStyle, fin func()) { + return self.data, func() {} +} + +func (self Style) c() (C.ImGuiStyle, func()) { + result, fn := self.handle() + return *result, fn +} + +func newStyleFromC(cvalue *C.ImGuiStyle) *Style { + return &Style{data: cvalue} +} + +type StyleMod struct { + data *C.ImGuiStyleMod +} + +func (self *StyleMod) handle() (result *C.ImGuiStyleMod, fin func()) { + return self.data, func() {} +} + +func (self StyleMod) c() (C.ImGuiStyleMod, func()) { + result, fn := self.handle() + return *result, fn +} + +func newStyleModFromC(cvalue *C.ImGuiStyleMod) *StyleMod { + return &StyleMod{data: cvalue} +} + +type TabBar struct { + data *C.ImGuiTabBar +} + +func (self *TabBar) handle() (result *C.ImGuiTabBar, fin func()) { + return self.data, func() {} +} + +func (self TabBar) c() (C.ImGuiTabBar, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTabBarFromC(cvalue *C.ImGuiTabBar) *TabBar { + return &TabBar{data: cvalue} +} + +type TabItem struct { + data *C.ImGuiTabItem +} + +func (self *TabItem) handle() (result *C.ImGuiTabItem, fin func()) { + return self.data, func() {} +} + +func (self TabItem) c() (C.ImGuiTabItem, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTabItemFromC(cvalue *C.ImGuiTabItem) *TabItem { + return &TabItem{data: cvalue} +} + +type Table struct { + data *C.ImGuiTable +} + +func (self *Table) handle() (result *C.ImGuiTable, fin func()) { + return self.data, func() {} } -type KeyRoutingIndex int +func (self Table) c() (C.ImGuiTable, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTableFromC(cvalue *C.ImGuiTable) *Table { + return &Table{data: cvalue} +} + +type TableCellData struct { + data *C.ImGuiTableCellData +} + +func (self *TableCellData) handle() (result *C.ImGuiTableCellData, fin func()) { + return self.data, func() {} +} + +func (self TableCellData) c() (C.ImGuiTableCellData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTableCellDataFromC(cvalue *C.ImGuiTableCellData) *TableCellData { + return &TableCellData{data: cvalue} +} + +type TableColumn struct { + data *C.ImGuiTableColumn +} -func (self KeyRoutingIndex) handle() (result *C.ImGuiKeyRoutingIndex, fin func()) { - return (*C.ImGuiKeyRoutingIndex)(C.ImS16(self)), func() {} +func (self *TableColumn) handle() (result *C.ImGuiTableColumn, fin func()) { + return self.data, func() {} } -func (self KeyRoutingIndex) c() (C.ImGuiKeyRoutingIndex, func()) { - result, fin := self.handle() - return *result, fin +func (self TableColumn) c() (C.ImGuiTableColumn, func()) { + result, fn := self.handle() + return *result, fn } -func newKeyRoutingIndexFromC(cvalue *C.ImGuiKeyRoutingIndex) *KeyRoutingIndex { - return int(cvalue) +func newTableColumnFromC(cvalue *C.ImGuiTableColumn) *TableColumn { + return &TableColumn{data: cvalue} } -type SelectionUserData int64 +type TableColumnSettings struct { + data *C.ImGuiTableColumnSettings +} -func (self SelectionUserData) handle() (result *C.ImGuiSelectionUserData, fin func()) { - return (*C.ImGuiSelectionUserData)(C.ImS64(self)), func() {} +func (self *TableColumnSettings) handle() (result *C.ImGuiTableColumnSettings, fin func()) { + return self.data, func() {} } -func (self SelectionUserData) c() (C.ImGuiSelectionUserData, func()) { - result, fin := self.handle() - return *result, fin +func (self TableColumnSettings) c() (C.ImGuiTableColumnSettings, func()) { + result, fn := self.handle() + return *result, fn } -func newSelectionUserDataFromC(cvalue *C.ImGuiSelectionUserData) *SelectionUserData { - return int64(cvalue) +func newTableColumnSettingsFromC(cvalue *C.ImGuiTableColumnSettings) *TableColumnSettings { + return &TableColumnSettings{data: cvalue} } -type TableColumnIdx int +type TableColumnSortSpecs struct { + data *C.ImGuiTableColumnSortSpecs +} -func (self TableColumnIdx) handle() (result *C.ImGuiTableColumnIdx, fin func()) { - return (*C.ImGuiTableColumnIdx)(C.ImS16(self)), func() {} +func (self *TableColumnSortSpecs) handle() (result *C.ImGuiTableColumnSortSpecs, fin func()) { + return self.data, func() {} } -func (self TableColumnIdx) c() (C.ImGuiTableColumnIdx, func()) { - result, fin := self.handle() - return *result, fin +func (self TableColumnSortSpecs) c() (C.ImGuiTableColumnSortSpecs, func()) { + result, fn := self.handle() + return *result, fn } -func newTableColumnIdxFromC(cvalue *C.ImGuiTableColumnIdx) *TableColumnIdx { - return int(cvalue) +func newTableColumnSortSpecsFromC(cvalue *C.ImGuiTableColumnSortSpecs) *TableColumnSortSpecs { + return &TableColumnSortSpecs{data: cvalue} } -type TableColumnsSettings C.ImGuiTableColumnsSettings +type TableColumnsSettings struct { + data *C.ImGuiTableColumnsSettings +} -func (self TableColumnsSettings) handle() (result *C.ImGuiTableColumnsSettings, fin func()) { - result = (*C.ImGuiTableColumnsSettings)(unsafe.Pointer(&self)) - return result, func() {} +func (self *TableColumnsSettings) handle() (result *C.ImGuiTableColumnsSettings, fin func()) { + return self.data, func() {} } func (self TableColumnsSettings) c() (C.ImGuiTableColumnsSettings, func()) { - result, fin := self.handle() - return *result, fin + result, fn := self.handle() + return *result, fn } func newTableColumnsSettingsFromC(cvalue *C.ImGuiTableColumnsSettings) *TableColumnsSettings { - return (*TableColumnsSettings)(cvalue) + return &TableColumnsSettings{data: cvalue} } type TableDrawChannelIdx uint16 -func (self TableDrawChannelIdx) handle() (result *C.ImGuiTableDrawChannelIdx, fin func()) { - return (*C.ImGuiTableDrawChannelIdx)(C.ImU16(self)), func() {} +func (self *TableDrawChannelIdx) handle() (result *C.ImGuiTableDrawChannelIdx, fin func()) { + selfArg, selfFin := WrapNumberPtr[C.ImU16, uint16](self) + return (*C.ImGuiTableDrawChannelIdx)(selfArg), func() { selfFin() } } func (self TableDrawChannelIdx) c() (C.ImGuiTableDrawChannelIdx, func()) { - result, fin := self.handle() - return *result, fin + return (C.ImGuiTableDrawChannelIdx)(C.ImU16(self)), func() {} } func newTableDrawChannelIdxFromC(cvalue *C.ImGuiTableDrawChannelIdx) *TableDrawChannelIdx { - return uint16(cvalue) + return } -type PoolIdx int32 +type TableInstanceData struct { + data *C.ImGuiTableInstanceData +} -func (self PoolIdx) handle() (result *C.ImPoolIdx, fin func()) { - return (*C.ImPoolIdx)(C.int(self)), func() {} +func (self *TableInstanceData) handle() (result *C.ImGuiTableInstanceData, fin func()) { + return self.data, func() {} } -func (self PoolIdx) c() (C.ImPoolIdx, func()) { - result, fin := self.handle() - return *result, fin +func (self TableInstanceData) c() (C.ImGuiTableInstanceData, func()) { + result, fn := self.handle() + return *result, fn } -func newPoolIdxFromC(cvalue *C.ImPoolIdx) *PoolIdx { - return int32(cvalue) +func newTableInstanceDataFromC(cvalue *C.ImGuiTableInstanceData) *TableInstanceData { + return &TableInstanceData{data: cvalue} +} + +type TableSettings struct { + data *C.ImGuiTableSettings +} + +func (self *TableSettings) handle() (result *C.ImGuiTableSettings, fin func()) { + return self.data, func() {} +} + +func (self TableSettings) c() (C.ImGuiTableSettings, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTableSettingsFromC(cvalue *C.ImGuiTableSettings) *TableSettings { + return &TableSettings{data: cvalue} +} + +type TableSortSpecs struct { + data *C.ImGuiTableSortSpecs +} + +func (self *TableSortSpecs) handle() (result *C.ImGuiTableSortSpecs, fin func()) { + return self.data, func() {} +} + +func (self TableSortSpecs) c() (C.ImGuiTableSortSpecs, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTableSortSpecsFromC(cvalue *C.ImGuiTableSortSpecs) *TableSortSpecs { + return &TableSortSpecs{data: cvalue} +} + +type TableTempData struct { + data *C.ImGuiTableTempData +} + +func (self *TableTempData) handle() (result *C.ImGuiTableTempData, fin func()) { + return self.data, func() {} +} + +func (self TableTempData) c() (C.ImGuiTableTempData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTableTempDataFromC(cvalue *C.ImGuiTableTempData) *TableTempData { + return &TableTempData{data: cvalue} +} + +type TextBuffer struct { + data *C.ImGuiTextBuffer +} + +func (self *TextBuffer) handle() (result *C.ImGuiTextBuffer, fin func()) { + return self.data, func() {} +} + +func (self TextBuffer) c() (C.ImGuiTextBuffer, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTextBufferFromC(cvalue *C.ImGuiTextBuffer) *TextBuffer { + return &TextBuffer{data: cvalue} +} + +type TextFilter struct { + data *C.ImGuiTextFilter +} + +func (self *TextFilter) handle() (result *C.ImGuiTextFilter, fin func()) { + return self.data, func() {} +} + +func (self TextFilter) c() (C.ImGuiTextFilter, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTextFilterFromC(cvalue *C.ImGuiTextFilter) *TextFilter { + return &TextFilter{data: cvalue} +} + +type TextIndex struct { + data *C.ImGuiTextIndex +} + +func (self *TextIndex) handle() (result *C.ImGuiTextIndex, fin func()) { + return self.data, func() {} } -type TextureID unsafe.Pointer +func (self TextIndex) c() (C.ImGuiTextIndex, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTextIndexFromC(cvalue *C.ImGuiTextIndex) *TextIndex { + return &TextIndex{data: cvalue} +} + +type TextRange struct { + data *C.ImGuiTextRange +} + +func (self *TextRange) handle() (result *C.ImGuiTextRange, fin func()) { + return self.data, func() {} +} + +func (self TextRange) c() (C.ImGuiTextRange, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTextRangeFromC(cvalue *C.ImGuiTextRange) *TextRange { + return &TextRange{data: cvalue} +} + +type TypingSelectRequest struct { + data *C.ImGuiTypingSelectRequest +} + +func (self *TypingSelectRequest) handle() (result *C.ImGuiTypingSelectRequest, fin func()) { + return self.data, func() {} +} + +func (self TypingSelectRequest) c() (C.ImGuiTypingSelectRequest, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTypingSelectRequestFromC(cvalue *C.ImGuiTypingSelectRequest) *TypingSelectRequest { + return &TypingSelectRequest{data: cvalue} +} + +type TypingSelectState struct { + data *C.ImGuiTypingSelectState +} + +func (self *TypingSelectState) handle() (result *C.ImGuiTypingSelectState, fin func()) { + return self.data, func() {} +} + +func (self TypingSelectState) c() (C.ImGuiTypingSelectState, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTypingSelectStateFromC(cvalue *C.ImGuiTypingSelectState) *TypingSelectState { + return &TypingSelectState{data: cvalue} +} + +type Viewport struct { + data *C.ImGuiViewport +} + +func (self *Viewport) handle() (result *C.ImGuiViewport, fin func()) { + return self.data, func() {} +} + +func (self Viewport) c() (C.ImGuiViewport, func()) { + result, fn := self.handle() + return *result, fn +} + +func newViewportFromC(cvalue *C.ImGuiViewport) *Viewport { + return &Viewport{data: cvalue} +} + +type ViewportP struct { + data *C.ImGuiViewportP +} + +func (self *ViewportP) handle() (result *C.ImGuiViewportP, fin func()) { + return self.data, func() {} +} + +func (self ViewportP) c() (C.ImGuiViewportP, func()) { + result, fn := self.handle() + return *result, fn +} + +func newViewportPFromC(cvalue *C.ImGuiViewportP) *ViewportP { + return &ViewportP{data: cvalue} +} + +type Window struct { + data *C.ImGuiWindow +} + +func (self *Window) handle() (result *C.ImGuiWindow, fin func()) { + return self.data, func() {} +} + +func (self Window) c() (C.ImGuiWindow, func()) { + result, fn := self.handle() + return *result, fn +} + +func newWindowFromC(cvalue *C.ImGuiWindow) *Window { + return &Window{data: cvalue} +} + +type WindowClass struct { + data *C.ImGuiWindowClass +} + +func (self *WindowClass) handle() (result *C.ImGuiWindowClass, fin func()) { + return self.data, func() {} +} + +func (self WindowClass) c() (C.ImGuiWindowClass, func()) { + result, fn := self.handle() + return *result, fn +} + +func newWindowClassFromC(cvalue *C.ImGuiWindowClass) *WindowClass { + return &WindowClass{data: cvalue} +} + +type WindowDockStyle struct { + data *C.ImGuiWindowDockStyle +} + +func (self *WindowDockStyle) handle() (result *C.ImGuiWindowDockStyle, fin func()) { + return self.data, func() {} +} + +func (self WindowDockStyle) c() (C.ImGuiWindowDockStyle, func()) { + result, fn := self.handle() + return *result, fn +} + +func newWindowDockStyleFromC(cvalue *C.ImGuiWindowDockStyle) *WindowDockStyle { + return &WindowDockStyle{data: cvalue} +} + +type WindowSettings struct { + data *C.ImGuiWindowSettings +} + +func (self *WindowSettings) handle() (result *C.ImGuiWindowSettings, fin func()) { + return self.data, func() {} +} + +func (self WindowSettings) c() (C.ImGuiWindowSettings, func()) { + result, fn := self.handle() + return *result, fn +} + +func newWindowSettingsFromC(cvalue *C.ImGuiWindowSettings) *WindowSettings { + return &WindowSettings{data: cvalue} +} + +type WindowStackData struct { + data *C.ImGuiWindowStackData +} + +func (self *WindowStackData) handle() (result *C.ImGuiWindowStackData, fin func()) { + return self.data, func() {} +} + +func (self WindowStackData) c() (C.ImGuiWindowStackData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newWindowStackDataFromC(cvalue *C.ImGuiWindowStackData) *WindowStackData { + return &WindowStackData{data: cvalue} +} + +type WindowTempData struct { + data *C.ImGuiWindowTempData +} + +func (self *WindowTempData) handle() (result *C.ImGuiWindowTempData, fin func()) { + return self.data, func() {} +} + +func (self WindowTempData) c() (C.ImGuiWindowTempData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newWindowTempDataFromC(cvalue *C.ImGuiWindowTempData) *WindowTempData { + return &WindowTempData{data: cvalue} +} + +type PoolIdx int32 -func (self TextureID) handle() (result *C.ImTextureID, fin func()) { - selfArg, selfFin := WrapVoidPtr(self) - return (*C.ImTextureID)(selfArg), func() { selfFin() } +func (self *PoolIdx) handle() (result *C.ImPoolIdx, fin func()) { + selfArg, selfFin := WrapNumberPtr[C.int, int32](self) + return (*C.ImPoolIdx)(selfArg), func() { selfFin() } } -func (self TextureID) c() (C.ImTextureID, func()) { - result, fin := self.handle() - return *result, fin +func (self PoolIdx) c() (C.ImPoolIdx, func()) { + return (C.ImPoolIdx)(C.int(self)), func() {} } -func newTextureIDFromC(cvalue *C.ImTextureID) *TextureID { - return unsafe.Pointer(cvalue) +func newPoolIdxFromC(cvalue *C.ImPoolIdx) *PoolIdx { + return } -type Wchar16 uint16 +type Vec1 struct { + data *C.ImVec1 +} -func (self Wchar16) handle() (result *C.ImWchar16, fin func()) { - return (*C.ImWchar16)(C.ushort(self)), func() {} +func (self *Vec1) handle() (result *C.ImVec1, fin func()) { + return self.data, func() {} } -func (self Wchar16) c() (C.ImWchar16, func()) { - result, fin := self.handle() - return *result, fin +func (self Vec1) c() (C.ImVec1, func()) { + result, fn := self.handle() + return *result, fn } -func newWchar16FromC(cvalue *C.ImWchar16) *Wchar16 { - return uint16(cvalue) +func newVec1FromC(cvalue *C.ImVec1) *Vec1 { + return &Vec1{data: cvalue} } type Wchar32 uint32 -func (self Wchar32) handle() (result *C.ImWchar32, fin func()) { - return (*C.ImWchar32)(C.uint(self)), func() {} +func (self *Wchar32) handle() (result *C.ImWchar32, fin func()) { + selfArg, selfFin := WrapNumberPtr[C.uint, uint32](self) + return (*C.ImWchar32)(selfArg), func() { selfFin() } } func (self Wchar32) c() (C.ImWchar32, func()) { - result, fin := self.handle() - return *result, fin + return (C.ImWchar32)(C.uint(self)), func() {} } func newWchar32FromC(cvalue *C.ImWchar32) *Wchar32 { - return uint32(cvalue) + return +} + +type STBTexteditState struct { + data *C.STB_TexteditState +} + +func (self *STBTexteditState) handle() (result *C.STB_TexteditState, fin func()) { + return self.data, 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{data: cvalue} +} + +type StbTexteditRow struct { + data *C.StbTexteditRow +} + +func (self *StbTexteditRow) handle() (result *C.StbTexteditRow, fin func()) { + return self.data, func() {} +} + +func (self StbTexteditRow) c() (C.StbTexteditRow, func()) { + result, fn := self.handle() + return *result, fn +} + +func newStbTexteditRowFromC(cvalue *C.StbTexteditRow) *StbTexteditRow { + return &StbTexteditRow{data: cvalue} +} + +type StbUndoRecord struct { + data *C.StbUndoRecord +} + +func (self *StbUndoRecord) handle() (result *C.StbUndoRecord, fin func()) { + return self.data, func() {} +} + +func (self StbUndoRecord) c() (C.StbUndoRecord, func()) { + result, fn := self.handle() + return *result, fn +} + +func newStbUndoRecordFromC(cvalue *C.StbUndoRecord) *StbUndoRecord { + return &StbUndoRecord{data: cvalue} +} + +type StbUndoState struct { + data *C.StbUndoState +} + +func (self *StbUndoState) handle() (result *C.StbUndoState, fin func()) { + return self.data, func() {} +} + +func (self StbUndoState) c() (C.StbUndoState, func()) { + result, fn := self.handle() + return *result, fn +} + +func newStbUndoStateFromC(cvalue *C.StbUndoState) *StbUndoState { + return &StbUndoState{data: cvalue} } diff --git a/cimmarkdown_typedefs.go b/cimmarkdown_typedefs.go index 0c6846e99..a50771433 100644 --- a/cimmarkdown_typedefs.go +++ b/cimmarkdown_typedefs.go @@ -9,3 +9,190 @@ package imgui // #include "cimmarkdown_wrapper.h" import "C" import "unsafe" + +type Emphasis struct { + data *C.Emphasis +} + +func (self *Emphasis) handle() (result *C.Emphasis, fin func()) { + return self.data, func() {} +} + +func (self Emphasis) c() (C.Emphasis, func()) { + result, fn := self.handle() + return *result, fn +} + +func newEmphasisFromC(cvalue *C.Emphasis) *Emphasis { + return &Emphasis{data: cvalue} +} + +type Line struct { + data *C.Line +} + +func (self *Line) handle() (result *C.Line, fin func()) { + return self.data, func() {} +} + +func (self Line) c() (C.Line, func()) { + result, fn := self.handle() + return *result, fn +} + +func newLineFromC(cvalue *C.Line) *Line { + return &Line{data: cvalue} +} + +type Link struct { + data *C.Link +} + +func (self *Link) handle() (result *C.Link, fin func()) { + return self.data, func() {} +} + +func (self Link) c() (C.Link, func()) { + result, fn := self.handle() + return *result, fn +} + +func newLinkFromC(cvalue *C.Link) *Link { + return &Link{data: cvalue} +} + +type MarkdownConfig struct { + data *C.MarkdownConfig +} + +func (self *MarkdownConfig) handle() (result *C.MarkdownConfig, fin func()) { + return self.data, func() {} +} + +func (self MarkdownConfig) c() (C.MarkdownConfig, func()) { + result, fn := self.handle() + return *result, fn +} + +func newMarkdownConfigFromC(cvalue *C.MarkdownConfig) *MarkdownConfig { + return &MarkdownConfig{data: cvalue} +} + +type MarkdownFormatInfo struct { + data *C.MarkdownFormatInfo +} + +func (self *MarkdownFormatInfo) handle() (result *C.MarkdownFormatInfo, fin func()) { + return self.data, func() {} +} + +func (self MarkdownFormatInfo) c() (C.MarkdownFormatInfo, func()) { + result, fn := self.handle() + return *result, fn +} + +func newMarkdownFormatInfoFromC(cvalue *C.MarkdownFormatInfo) *MarkdownFormatInfo { + return &MarkdownFormatInfo{data: cvalue} +} + +type MarkdownHeadingFormat struct { + data *C.MarkdownHeadingFormat +} + +func (self *MarkdownHeadingFormat) handle() (result *C.MarkdownHeadingFormat, fin func()) { + return self.data, func() {} +} + +func (self MarkdownHeadingFormat) c() (C.MarkdownHeadingFormat, func()) { + result, fn := self.handle() + return *result, fn +} + +func newMarkdownHeadingFormatFromC(cvalue *C.MarkdownHeadingFormat) *MarkdownHeadingFormat { + return &MarkdownHeadingFormat{data: cvalue} +} + +type MarkdownImageData struct { + data *C.MarkdownImageData +} + +func (self *MarkdownImageData) handle() (result *C.MarkdownImageData, fin func()) { + return self.data, func() {} +} + +func (self MarkdownImageData) c() (C.MarkdownImageData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newMarkdownImageDataFromC(cvalue *C.MarkdownImageData) *MarkdownImageData { + return &MarkdownImageData{data: cvalue} +} + +type MarkdownLinkCallbackData struct { + data *C.MarkdownLinkCallbackData +} + +func (self *MarkdownLinkCallbackData) handle() (result *C.MarkdownLinkCallbackData, fin func()) { + return self.data, func() {} +} + +func (self MarkdownLinkCallbackData) c() (C.MarkdownLinkCallbackData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newMarkdownLinkCallbackDataFromC(cvalue *C.MarkdownLinkCallbackData) *MarkdownLinkCallbackData { + return &MarkdownLinkCallbackData{data: cvalue} +} + +type MarkdownTooltipCallbackData struct { + data *C.MarkdownTooltipCallbackData +} + +func (self *MarkdownTooltipCallbackData) handle() (result *C.MarkdownTooltipCallbackData, fin func()) { + return self.data, func() {} +} + +func (self MarkdownTooltipCallbackData) c() (C.MarkdownTooltipCallbackData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newMarkdownTooltipCallbackDataFromC(cvalue *C.MarkdownTooltipCallbackData) *MarkdownTooltipCallbackData { + return &MarkdownTooltipCallbackData{data: cvalue} +} + +type TextBlock struct { + data *C.TextBlock +} + +func (self *TextBlock) handle() (result *C.TextBlock, fin func()) { + return self.data, func() {} +} + +func (self TextBlock) c() (C.TextBlock, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTextBlockFromC(cvalue *C.TextBlock) *TextBlock { + return &TextBlock{data: cvalue} +} + +type TextRegion struct { + data *C.TextRegion +} + +func (self *TextRegion) handle() (result *C.TextRegion, fin func()) { + return self.data, func() {} +} + +func (self TextRegion) c() (C.TextRegion, func()) { + result, fn := self.handle() + return *result, fn +} + +func newTextRegionFromC(cvalue *C.TextRegion) *TextRegion { + return &TextRegion{data: cvalue} +} diff --git a/cimnodes_typedefs.go b/cimnodes_typedefs.go index d1c2b7a45..4c764e14a 100644 --- a/cimnodes_typedefs.go +++ b/cimnodes_typedefs.go @@ -10,50 +10,121 @@ package imgui import "C" import "unsafe" -type NodesContext C.ImNodesContext +type EmulateThreeButtonMouse struct { + data *C.EmulateThreeButtonMouse +} + +func (self *EmulateThreeButtonMouse) handle() (result *C.EmulateThreeButtonMouse, fin func()) { + return self.data, func() {} +} + +func (self EmulateThreeButtonMouse) c() (C.EmulateThreeButtonMouse, func()) { + result, fn := self.handle() + return *result, fn +} + +func newEmulateThreeButtonMouseFromC(cvalue *C.EmulateThreeButtonMouse) *EmulateThreeButtonMouse { + return &EmulateThreeButtonMouse{data: cvalue} +} + +type NodesContext struct { + data *C.ImNodesContext +} -func (self NodesContext) handle() (result *C.ImNodesContext, fin func()) { - result = (*C.ImNodesContext)(unsafe.Pointer(&self)) - return result, func() {} +func (self *NodesContext) handle() (result *C.ImNodesContext, fin func()) { + return self.data, func() {} } func (self NodesContext) c() (C.ImNodesContext, func()) { - result, fin := self.handle() - return *result, fin + result, fn := self.handle() + return *result, fn } func newNodesContextFromC(cvalue *C.ImNodesContext) *NodesContext { - return (*NodesContext)(cvalue) + return &NodesContext{data: cvalue} } -type NodesEditorContext C.ImNodesEditorContext +type NodesEditorContext struct { + data *C.ImNodesEditorContext +} -func (self NodesEditorContext) handle() (result *C.ImNodesEditorContext, fin func()) { - result = (*C.ImNodesEditorContext)(unsafe.Pointer(&self)) - return result, func() {} +func (self *NodesEditorContext) handle() (result *C.ImNodesEditorContext, fin func()) { + return self.data, func() {} } func (self NodesEditorContext) c() (C.ImNodesEditorContext, func()) { - result, fin := self.handle() - return *result, fin + result, fn := self.handle() + return *result, fn } func newNodesEditorContextFromC(cvalue *C.ImNodesEditorContext) *NodesEditorContext { - return (*NodesEditorContext)(cvalue) + return &NodesEditorContext{data: cvalue} +} + +type NodesIO struct { + data *C.ImNodesIO +} + +func (self *NodesIO) handle() (result *C.ImNodesIO, fin func()) { + return self.data, func() {} +} + +func (self NodesIO) c() (C.ImNodesIO, func()) { + result, fn := self.handle() + return *result, fn +} + +func newNodesIOFromC(cvalue *C.ImNodesIO) *NodesIO { + return &NodesIO{data: cvalue} } -type NodesMiniMapNodeHoveringCallbackUserData unsafe.Pointer +type NodesStyle struct { + data *C.ImNodesStyle +} + +func (self *NodesStyle) handle() (result *C.ImNodesStyle, fin func()) { + return self.data, func() {} +} + +func (self NodesStyle) c() (C.ImNodesStyle, func()) { + result, fn := self.handle() + return *result, fn +} + +func newNodesStyleFromC(cvalue *C.ImNodesStyle) *NodesStyle { + return &NodesStyle{data: cvalue} +} + +type LinkDetachWithModifierClick struct { + data *C.LinkDetachWithModifierClick +} + +func (self *LinkDetachWithModifierClick) handle() (result *C.LinkDetachWithModifierClick, fin func()) { + return self.data, func() {} +} + +func (self LinkDetachWithModifierClick) c() (C.LinkDetachWithModifierClick, func()) { + result, fn := self.handle() + return *result, fn +} + +func newLinkDetachWithModifierClickFromC(cvalue *C.LinkDetachWithModifierClick) *LinkDetachWithModifierClick { + return &LinkDetachWithModifierClick{data: cvalue} +} + +type MultipleSelectModifier struct { + data *C.MultipleSelectModifier +} -func (self NodesMiniMapNodeHoveringCallbackUserData) handle() (result *C.ImNodesMiniMapNodeHoveringCallbackUserData, fin func()) { - selfArg, selfFin := WrapVoidPtr(self) - return (*C.ImNodesMiniMapNodeHoveringCallbackUserData)(selfArg), func() { selfFin() } +func (self *MultipleSelectModifier) handle() (result *C.MultipleSelectModifier, fin func()) { + return self.data, func() {} } -func (self NodesMiniMapNodeHoveringCallbackUserData) c() (C.ImNodesMiniMapNodeHoveringCallbackUserData, func()) { - result, fin := self.handle() - return *result, fin +func (self MultipleSelectModifier) c() (C.MultipleSelectModifier, func()) { + result, fn := self.handle() + return *result, fn } -func newNodesMiniMapNodeHoveringCallbackUserDataFromC(cvalue *C.ImNodesMiniMapNodeHoveringCallbackUserData) *NodesMiniMapNodeHoveringCallbackUserData { - return unsafe.Pointer(cvalue) +func newMultipleSelectModifierFromC(cvalue *C.MultipleSelectModifier) *MultipleSelectModifier { + return &MultipleSelectModifier{data: cvalue} } diff --git a/cimplot_typedefs.go b/cimplot_typedefs.go index 8b8578f3c..6ab0388f2 100644 --- a/cimplot_typedefs.go +++ b/cimplot_typedefs.go @@ -10,18 +10,427 @@ package imgui import "C" import "unsafe" -type PlotAxisColor C.ImPlotAxisColor +type FormatterTimeData struct { + data *C.Formatter_Time_Data +} + +func (self *FormatterTimeData) handle() (result *C.Formatter_Time_Data, fin func()) { + return self.data, 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{data: cvalue} +} + +type PlotAlignmentData struct { + data *C.ImPlotAlignmentData +} + +func (self *PlotAlignmentData) handle() (result *C.ImPlotAlignmentData, fin func()) { + return self.data, func() {} +} + +func (self PlotAlignmentData) c() (C.ImPlotAlignmentData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotAlignmentDataFromC(cvalue *C.ImPlotAlignmentData) *PlotAlignmentData { + return &PlotAlignmentData{data: cvalue} +} + +type PlotAnnotation struct { + data *C.ImPlotAnnotation +} + +func (self *PlotAnnotation) handle() (result *C.ImPlotAnnotation, fin func()) { + return self.data, func() {} +} + +func (self PlotAnnotation) c() (C.ImPlotAnnotation, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotAnnotationFromC(cvalue *C.ImPlotAnnotation) *PlotAnnotation { + return &PlotAnnotation{data: cvalue} +} + +type PlotAnnotationCollection struct { + data *C.ImPlotAnnotationCollection +} -func (self PlotAxisColor) handle() (result *C.ImPlotAxisColor, fin func()) { - result = (*C.ImPlotAxisColor)(unsafe.Pointer(&self)) - return result, func() {} +func (self *PlotAnnotationCollection) handle() (result *C.ImPlotAnnotationCollection, fin func()) { + return self.data, func() {} +} + +func (self PlotAnnotationCollection) c() (C.ImPlotAnnotationCollection, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotAnnotationCollectionFromC(cvalue *C.ImPlotAnnotationCollection) *PlotAnnotationCollection { + return &PlotAnnotationCollection{data: cvalue} +} + +type PlotAxis struct { + data *C.ImPlotAxis +} + +func (self *PlotAxis) handle() (result *C.ImPlotAxis, fin func()) { + return self.data, func() {} +} + +func (self PlotAxis) c() (C.ImPlotAxis, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotAxisFromC(cvalue *C.ImPlotAxis) *PlotAxis { + return &PlotAxis{data: cvalue} +} + +type PlotAxisColor struct { + data *C.ImPlotAxisColor +} + +func (self *PlotAxisColor) handle() (result *C.ImPlotAxisColor, fin func()) { + return self.data, func() {} } func (self PlotAxisColor) c() (C.ImPlotAxisColor, func()) { - result, fin := self.handle() - return *result, fin + result, fn := self.handle() + return *result, fn } func newPlotAxisColorFromC(cvalue *C.ImPlotAxisColor) *PlotAxisColor { - return (*PlotAxisColor)(cvalue) + return &PlotAxisColor{data: cvalue} +} + +type PlotColormapData struct { + data *C.ImPlotColormapData +} + +func (self *PlotColormapData) handle() (result *C.ImPlotColormapData, fin func()) { + return self.data, func() {} +} + +func (self PlotColormapData) c() (C.ImPlotColormapData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotColormapDataFromC(cvalue *C.ImPlotColormapData) *PlotColormapData { + return &PlotColormapData{data: cvalue} +} + +type PlotContext struct { + data *C.ImPlotContext +} + +func (self *PlotContext) handle() (result *C.ImPlotContext, fin func()) { + return self.data, func() {} +} + +func (self PlotContext) c() (C.ImPlotContext, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotContextFromC(cvalue *C.ImPlotContext) *PlotContext { + return &PlotContext{data: cvalue} +} + +type PlotDateTimeSpec struct { + data *C.ImPlotDateTimeSpec +} + +func (self *PlotDateTimeSpec) handle() (result *C.ImPlotDateTimeSpec, fin func()) { + return self.data, func() {} +} + +func (self PlotDateTimeSpec) c() (C.ImPlotDateTimeSpec, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotDateTimeSpecFromC(cvalue *C.ImPlotDateTimeSpec) *PlotDateTimeSpec { + return &PlotDateTimeSpec{data: cvalue} +} + +type PlotInputMap struct { + data *C.ImPlotInputMap +} + +func (self *PlotInputMap) handle() (result *C.ImPlotInputMap, fin func()) { + return self.data, func() {} +} + +func (self PlotInputMap) c() (C.ImPlotInputMap, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotInputMapFromC(cvalue *C.ImPlotInputMap) *PlotInputMap { + return &PlotInputMap{data: cvalue} +} + +type PlotItem struct { + data *C.ImPlotItem +} + +func (self *PlotItem) handle() (result *C.ImPlotItem, fin func()) { + return self.data, func() {} +} + +func (self PlotItem) c() (C.ImPlotItem, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotItemFromC(cvalue *C.ImPlotItem) *PlotItem { + return &PlotItem{data: cvalue} +} + +type PlotItemGroup struct { + data *C.ImPlotItemGroup +} + +func (self *PlotItemGroup) handle() (result *C.ImPlotItemGroup, fin func()) { + return self.data, func() {} +} + +func (self PlotItemGroup) c() (C.ImPlotItemGroup, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotItemGroupFromC(cvalue *C.ImPlotItemGroup) *PlotItemGroup { + return &PlotItemGroup{data: cvalue} +} + +type PlotLegend struct { + data *C.ImPlotLegend +} + +func (self *PlotLegend) handle() (result *C.ImPlotLegend, fin func()) { + return self.data, func() {} +} + +func (self PlotLegend) c() (C.ImPlotLegend, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotLegendFromC(cvalue *C.ImPlotLegend) *PlotLegend { + return &PlotLegend{data: cvalue} +} + +type PlotNextItemData struct { + data *C.ImPlotNextItemData +} + +func (self *PlotNextItemData) handle() (result *C.ImPlotNextItemData, fin func()) { + return self.data, func() {} +} + +func (self PlotNextItemData) c() (C.ImPlotNextItemData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotNextItemDataFromC(cvalue *C.ImPlotNextItemData) *PlotNextItemData { + return &PlotNextItemData{data: cvalue} +} + +type PlotNextPlotData struct { + data *C.ImPlotNextPlotData +} + +func (self *PlotNextPlotData) handle() (result *C.ImPlotNextPlotData, fin func()) { + return self.data, func() {} +} + +func (self PlotNextPlotData) c() (C.ImPlotNextPlotData, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotNextPlotDataFromC(cvalue *C.ImPlotNextPlotData) *PlotNextPlotData { + return &PlotNextPlotData{data: cvalue} +} + +type PlotPlot struct { + data *C.ImPlotPlot +} + +func (self *PlotPlot) handle() (result *C.ImPlotPlot, fin func()) { + return self.data, func() {} +} + +func (self PlotPlot) c() (C.ImPlotPlot, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotPlotFromC(cvalue *C.ImPlotPlot) *PlotPlot { + return &PlotPlot{data: cvalue} +} + +type PlotPointError struct { + data *C.ImPlotPointError +} + +func (self *PlotPointError) handle() (result *C.ImPlotPointError, fin func()) { + return self.data, func() {} +} + +func (self PlotPointError) c() (C.ImPlotPointError, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotPointErrorFromC(cvalue *C.ImPlotPointError) *PlotPointError { + return &PlotPointError{data: cvalue} +} + +type PlotRange struct { + data *C.ImPlotRange +} + +func (self *PlotRange) handle() (result *C.ImPlotRange, fin func()) { + return self.data, func() {} +} + +func (self PlotRange) c() (C.ImPlotRange, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotRangeFromC(cvalue *C.ImPlotRange) *PlotRange { + return &PlotRange{data: cvalue} +} + +type PlotRect struct { + data *C.ImPlotRect +} + +func (self *PlotRect) handle() (result *C.ImPlotRect, fin func()) { + return self.data, func() {} +} + +func (self PlotRect) c() (C.ImPlotRect, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotRectFromC(cvalue *C.ImPlotRect) *PlotRect { + return &PlotRect{data: cvalue} +} + +type PlotStyle struct { + data *C.ImPlotStyle +} + +func (self *PlotStyle) handle() (result *C.ImPlotStyle, fin func()) { + return self.data, func() {} +} + +func (self PlotStyle) c() (C.ImPlotStyle, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotStyleFromC(cvalue *C.ImPlotStyle) *PlotStyle { + return &PlotStyle{data: cvalue} +} + +type PlotSubplot struct { + data *C.ImPlotSubplot +} + +func (self *PlotSubplot) handle() (result *C.ImPlotSubplot, fin func()) { + return self.data, func() {} +} + +func (self PlotSubplot) c() (C.ImPlotSubplot, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotSubplotFromC(cvalue *C.ImPlotSubplot) *PlotSubplot { + return &PlotSubplot{data: cvalue} +} + +type PlotTag struct { + data *C.ImPlotTag +} + +func (self *PlotTag) handle() (result *C.ImPlotTag, fin func()) { + return self.data, func() {} +} + +func (self PlotTag) c() (C.ImPlotTag, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotTagFromC(cvalue *C.ImPlotTag) *PlotTag { + return &PlotTag{data: cvalue} +} + +type PlotTagCollection struct { + data *C.ImPlotTagCollection +} + +func (self *PlotTagCollection) handle() (result *C.ImPlotTagCollection, fin func()) { + return self.data, func() {} +} + +func (self PlotTagCollection) c() (C.ImPlotTagCollection, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotTagCollectionFromC(cvalue *C.ImPlotTagCollection) *PlotTagCollection { + return &PlotTagCollection{data: cvalue} +} + +type PlotTick struct { + data *C.ImPlotTick +} + +func (self *PlotTick) handle() (result *C.ImPlotTick, fin func()) { + return self.data, func() {} +} + +func (self PlotTick) c() (C.ImPlotTick, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotTickFromC(cvalue *C.ImPlotTick) *PlotTick { + return &PlotTick{data: cvalue} +} + +type PlotTicker struct { + data *C.ImPlotTicker +} + +func (self *PlotTicker) handle() (result *C.ImPlotTicker, fin func()) { + return self.data, func() {} +} + +func (self PlotTicker) c() (C.ImPlotTicker, func()) { + result, fn := self.handle() + return *result, fn +} + +func newPlotTickerFromC(cvalue *C.ImPlotTicker) *PlotTicker { + return &PlotTicker{data: cvalue} } From c2f8090e098a37c7a73b5c320da33f76075a3834 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Wed, 8 Nov 2023 16:07:24 +0100 Subject: [PATCH 30/68] codgene: fix generation of known typedefs of pointer type --- cmd/codegen/gengo_typedefs.go | 175 ++++++++++++++++++---------------- 1 file changed, 92 insertions(+), 83 deletions(-) diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index 1ed2a8065..dd13b12d8 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -63,54 +63,56 @@ import "unsafe" isPtr := HasSuffix(typedefs.data[k], "*") - var knownPtrReturnType returnWrapper + var knownReturnType, knownPtrReturnType returnWrapper var knownArgType, knownPtrArgType ArgumentWrapperData - var argTypeErr, ptrArgTypeErr, ptrReturnTypeErr error + var argTypeErr, ptrArgTypeErr, returnTypeErr, ptrReturnTypeErr error // 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) - if !isPtr { - knownPtrReturnType, ptrReturnTypeErr = getReturnWrapper( - CIdentifier(typedefs.data[k])+"*", - map[CIdentifier]bool{}, - map[GoIdentifier]bool{}, - map[CIdentifier]string{}, - ) - - _, knownArgType, argTypeErr = getArgWrapper( - &ArgDef{ - Name: "self", - Type: CIdentifier(typedefs.data[k]), - }, - false, false, - map[CIdentifier]bool{}, - map[GoIdentifier]bool{}, - map[CIdentifier]string{}, - ) - - _, knownPtrArgType, ptrArgTypeErr = getArgWrapper( - &ArgDef{ - Name: "self", - Type: CIdentifier(typedefs.data[k]) + "*", - }, - false, false, - map[CIdentifier]bool{}, - map[GoIdentifier]bool{}, - map[CIdentifier]string{}, - ) - } + knownReturnType, returnTypeErr = getReturnWrapper( + CIdentifier(typedefs.data[k]), + map[CIdentifier]bool{}, + map[GoIdentifier]bool{}, + map[CIdentifier]string{}, + ) + + knownPtrReturnType, ptrReturnTypeErr = getReturnWrapper( + CIdentifier(typedefs.data[k])+"*", + map[CIdentifier]bool{}, + map[GoIdentifier]bool{}, + map[CIdentifier]string{}, + ) + + _, knownArgType, argTypeErr = getArgWrapper( + &ArgDef{ + Name: "self", + Type: CIdentifier(typedefs.data[k]), + }, + false, false, + map[CIdentifier]bool{}, + map[GoIdentifier]bool{}, + map[CIdentifier]string{}, + ) + + _, knownPtrArgType, ptrArgTypeErr = getArgWrapper( + &ArgDef{ + Name: "self", + Type: CIdentifier(typedefs.data[k]) + "*", + }, + false, false, + map[CIdentifier]bool{}, + map[GoIdentifier]bool{}, + map[CIdentifier]string{}, + ) // check if k is a name of struct from structDefs switch { - case ptrReturnTypeErr == nil && argTypeErr == nil && ptrArgTypeErr == nil: + case ptrReturnTypeErr == nil && argTypeErr == nil && ptrArgTypeErr == nil && !isPtr: glg.Infof("typedef %s is an alias typedef.", k) - _ = knownPtrReturnType - _ = knownPtrArgType - if !isPtr { - fmt.Fprintf(callbacksGoSb, ` + fmt.Fprintf(callbacksGoSb, ` type %[1]s %[2]s func (self *%[1]s) handle() (result *C.%[6]s, fin func()) { @@ -124,54 +126,61 @@ func (self %[1]s) c() (C.%[6]s, func()) { } func new%[1]sFromC(cvalue *C.%[6]s) *%[1]s { - return %[7]s + return %[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, - - knownPtrArgType.ArgDef, - knownPtrArgType.VarName, - knownPtrArgType.Finalizer, - - k, - - knownArgType.ArgDef, - knownArgType.VarName, - knownArgType.Finalizer, - - fmt.Sprintf(knownPtrReturnType.returnStmt, "cvalue"), - ) - } else { - // fmt.Fprintf(callbacksGoSb, ` - //type %[1]s %[2]s - // - //func (self %[1]s) handle() (result *C.%[8]s, fin func()) { - // cResult, cFin := self.c() - // return &cResult, cFin - //} - // - //func (self %[1]s) c() (C.%[8]s, func()) { - // %[3]s - // return (C.%[8]s)(%[4]s), func() { %[5]s } - //} - // - //func new%[1]sFromC(cvalue *C.%[8]s) *%[1]s { - // return %[7]s - //} - //`, - // k.renameGoIdentifier(), - // knownArgType.ArgType, - // knownArgType.ArgDef, - // knownArgType.VarName, - // knownArgType.Finalizer, - // knownArgType.CType, - // fmt.Sprintf(knownReturnType.returnStmt, "cvalue"), - // k, - // ) - glg.Infof("Typedef %v is a pointer. NotImplemented", k) - continue - } + 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]): From c2e29fee3949c2ef024a12fd069cb9af374f718a Mon Sep 17 00:00:00 2001 From: gucio321 Date: Wed, 8 Nov 2023 16:08:01 +0100 Subject: [PATCH 31/68] regenerate code; update makefile --- Makefile | 1 - cimgui_funcs.go | 281 +++++++++++++++++++++++++++++++++++++++++++ cimgui_typedefs.go | 50 +++++++- cimnodes_typedefs.go | 20 +++ 4 files changed, 346 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 915562bf0..9d60c0437 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,6 @@ define generate @echo "Generating for $(1)" ./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 diff --git a/cimgui_funcs.go b/cimgui_funcs.go index 83d77766b..71ad67a71 100644 --- a/cimgui_funcs.go +++ b/cimgui_funcs.go @@ -75,6 +75,15 @@ func (self *Color) Destroy() { selfFin() } +func (self *DrawCmd) TexID() TextureID { + selfArg, selfFin := self.handle() + + defer func() { + selfFin() + }() + return *newTextureIDFromC(func() *C.ImTextureID { result := C.ImDrawCmd_GetTexID(selfArg); return &result }()) +} + // Also ensure our padding fields are zeroed func NewDrawCmd() *DrawCmd { return newDrawCmdFromC(C.ImDrawCmd_ImDrawCmd()) @@ -290,6 +299,45 @@ func (self *DrawList) AddEllipseFilledV(center Vec2, radius_x float32, radius_y selfFin() } +// AddImageV parameter default value hint: +// uv_min: ImVec2(0,0) +// uv_max: ImVec2(1,1) +// 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() + 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: +// uv1: ImVec2(0,0) +// uv2: ImVec2(1,0) +// uv3: ImVec2(1,1) +// uv4: ImVec2(0,1) +// 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() + 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() + 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: // thickness: 1.0f func (self *DrawList) AddLineV(p1 Vec2, p2 Vec2, col uint32, thickness float32) { @@ -655,6 +703,15 @@ func (self *DrawList) PushClipRectFullScreen() { selfFin() } +func (self *DrawList) PushTextureID(texture_id TextureID) { + selfArg, selfFin := self.handle() + texture_idArg, texture_idFin := texture_id.c() + C.ImDrawList_PushTextureID(selfArg, texture_idArg) + + selfFin() + texture_idFin() +} + func (self *DrawList) CalcCircleAutoSegmentCount(radius float32) int32 { selfArg, selfFin := self.handle() @@ -1069,6 +1126,15 @@ func (self *FontAtlas) IsBuilt() bool { return C.ImFontAtlas_IsBuilt(selfArg) == C.bool(true) } +func (self *FontAtlas) SetTexID(id TextureID) { + selfArg, selfFin := self.handle() + idArg, idFin := id.c() + C.ImFontAtlas_SetTexID(selfArg, idArg) + + selfFin() + idFin() +} + func (self *FontAtlas) Destroy() { selfArg, selfFin := self.handle() C.ImFontAtlas_destroy(selfArg) @@ -7145,6 +7211,47 @@ func InternalImUpperPowerOfTwo(v int32) int32 { return int32(C.igImUpperPowerOfTwo(C.int(v))) } +// ImageV parameter default value hint: +// uv0: ImVec2(0,0) +// uv1: ImVec2(1,1) +// 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) { + 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: +// uv0: ImVec2(0,0) +// uv1: ImVec2(1,1) +// bg_col: ImVec4(0,0,0,0) +// 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, 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 { + 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 // IndentV parameter default value hint: // indent_w: 0.0f @@ -10762,6 +10869,33 @@ func (self *DrawList) AddEllipseFilled(center Vec2, radius_x float32, radius_y f selfFin() } +func (self *DrawList) AddImage(user_texture_id TextureID, p_min Vec2, p_max Vec2) { + selfArg, selfFin := self.handle() + 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() + 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() + 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) { selfArg, selfFin := self.handle() C.wrap_ImDrawList_AddLine(selfArg, p1.toC(), p2.toC(), C.ImU32(col)) @@ -11756,6 +11890,35 @@ func InternalImTextStrFromUtf8(out_buf *Wchar, out_buf_size int32, in_text strin return int32(C.wrap_igImTextStrFromUtf8((*C.ImWchar)(out_buf), C.int(out_buf_size), in_textArg, in_text_endArg)) } +func Image(user_texture_id TextureID, size Vec2) { + 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, 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 { + 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() { C.wrap_igIndent() } @@ -12866,6 +13029,25 @@ func (self *DrawCmd) ClipRect() Vec4 { return *(&Vec4{}).fromC(C.wrap_ImDrawCmd_GetClipRect(selfArg)) } +func (self DrawCmd) SetTextureId(v TextureID) { + vArg, _ := v.c() + + selfArg, selfFin := self.handle() + defer selfFin() + C.wrap_ImDrawCmd_SetTextureId(selfArg, vArg) +} + +func (self *DrawCmd) TextureId() TextureID { + selfArg, selfFin := self.handle() + + defer func() { + selfFin() + }() + + result := C.wrap_ImDrawCmd_GetTextureId(selfArg) + return *newTextureIDFromC(func() *C.ImTextureID { result := result; return &result }()) +} + func (self DrawCmd) SetVtxOffset(v uint32) { selfArg, selfFin := self.handle() defer selfFin() @@ -12943,6 +13125,25 @@ func (self *DrawCmdHeader) ClipRect() Vec4 { return *(&Vec4{}).fromC(C.wrap_ImDrawCmdHeader_GetClipRect(selfArg)) } +func (self DrawCmdHeader) SetTextureId(v TextureID) { + vArg, _ := v.c() + + selfArg, selfFin := self.handle() + defer selfFin() + C.wrap_ImDrawCmdHeader_SetTextureId(selfArg, vArg) +} + +func (self *DrawCmdHeader) TextureId() TextureID { + selfArg, selfFin := self.handle() + + defer func() { + selfFin() + }() + + result := C.wrap_ImDrawCmdHeader_GetTextureId(selfArg) + return *newTextureIDFromC(func() *C.ImTextureID { result := result; return &result }()) +} + func (self DrawCmdHeader) SetVtxOffset(v uint32) { selfArg, selfFin := self.handle() defer selfFin() @@ -13221,6 +13422,29 @@ func (self DrawList) SetClipRectStack(v Vector[*Vec4]) { C.wrap_ImDrawList_Set_ClipRectStack(selfArg, *vVecArg) } +func (self DrawList) SetTextureIdStack(v Vector[*TextureID]) { + vData := v.Data + vDataArg, _ := vData.handle() + vVecArg := new(C.ImVector_ImTextureID) + 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_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]) { vData := v.Data vDataArg, _ := wrap[C.ImVec2, *Vec2](vData) @@ -26445,6 +26669,63 @@ func (self *Table) TempData() *TableTempData { return newTableTempDataFromC(C.wrap_ImGuiTable_GetTempData(selfArg)) } +func (self Table) SetEnabledMaskByDisplayOrder(v BitArrayPtr) { + vArg, _ := v.c() + + selfArg, selfFin := self.handle() + defer selfFin() + C.wrap_ImGuiTable_SetEnabledMaskByDisplayOrder(selfArg, vArg) +} + +func (self *Table) EnabledMaskByDisplayOrder() BitArrayPtr { + selfArg, selfFin := self.handle() + + defer func() { + selfFin() + }() + + 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) { selfArg, selfFin := self.handle() defer selfFin() diff --git a/cimgui_typedefs.go b/cimgui_typedefs.go index 0b62b7f7b..09d4c94ee 100644 --- a/cimgui_typedefs.go +++ b/cimgui_typedefs.go @@ -10,6 +10,26 @@ package imgui import "C" import "unsafe" +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 { data *C.ImBitVector } @@ -515,7 +535,7 @@ func (self ID) c() (C.ImGuiID, func()) { } func newIDFromC(cvalue *C.ImGuiID) *ID { - return + return (*uint32)(cvalue) } type IO struct { @@ -751,7 +771,7 @@ func (self KeyChord) c() (C.ImGuiKeyChord, func()) { } func newKeyChordFromC(cvalue *C.ImGuiKeyChord) *KeyChord { - return + return (*int32)(cvalue) } type KeyData struct { @@ -1480,7 +1500,7 @@ func (self TableDrawChannelIdx) c() (C.ImGuiTableDrawChannelIdx, func()) { } func newTableDrawChannelIdxFromC(cvalue *C.ImGuiTableDrawChannelIdx) *TableDrawChannelIdx { - return + return (*uint16)(cvalue) } type TableInstanceData struct { @@ -1801,7 +1821,27 @@ func (self PoolIdx) c() (C.ImPoolIdx, func()) { } func newPoolIdxFromC(cvalue *C.ImPoolIdx) *PoolIdx { - return + return (*int32)(cvalue) +} + +type TextureID struct { + Data unsafe.Pointer +} + +func (self *TextureID) handle() (*C.ImTextureID, func()) { + result, fn := self.c() + return &result, fn +} + +func (selfStruct *TextureID) c() (result C.ImTextureID, fin func()) { + self := selfStruct.Data + selfArg, selfFin := WrapVoidPtr(self) + return (C.ImTextureID)(selfArg), func() { selfFin() } +} + +func newTextureIDFromC(cvalue *C.ImTextureID) *TextureID { + v := (unsafe.Pointer)(*cvalue) + return &TextureID{Data: unsafe.Pointer(v)} } type Vec1 struct { @@ -1833,7 +1873,7 @@ func (self Wchar32) c() (C.ImWchar32, func()) { } func newWchar32FromC(cvalue *C.ImWchar32) *Wchar32 { - return + return (*uint32)(cvalue) } type STBTexteditState struct { diff --git a/cimnodes_typedefs.go b/cimnodes_typedefs.go index 4c764e14a..305488398 100644 --- a/cimnodes_typedefs.go +++ b/cimnodes_typedefs.go @@ -78,6 +78,26 @@ func newNodesIOFromC(cvalue *C.ImNodesIO) *NodesIO { return &NodesIO{data: cvalue} } +type NodesMiniMapNodeHoveringCallbackUserData struct { + Data unsafe.Pointer +} + +func (self *NodesMiniMapNodeHoveringCallbackUserData) handle() (*C.ImNodesMiniMapNodeHoveringCallbackUserData, func()) { + result, fn := self.c() + return &result, fn +} + +func (selfStruct *NodesMiniMapNodeHoveringCallbackUserData) c() (result C.ImNodesMiniMapNodeHoveringCallbackUserData, fin func()) { + self := selfStruct.Data + selfArg, selfFin := WrapVoidPtr(self) + return (C.ImNodesMiniMapNodeHoveringCallbackUserData)(selfArg), func() { selfFin() } +} + +func newNodesMiniMapNodeHoveringCallbackUserDataFromC(cvalue *C.ImNodesMiniMapNodeHoveringCallbackUserData) *NodesMiniMapNodeHoveringCallbackUserData { + v := (unsafe.Pointer)(*cvalue) + return &NodesMiniMapNodeHoveringCallbackUserData{Data: unsafe.Pointer(v)} +} + type NodesStyle struct { data *C.ImNodesStyle } From c28be5228b6c099106d654c1df398612714e77f0 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Wed, 8 Nov 2023 16:25:28 +0100 Subject: [PATCH 32/68] codegen: fix typedefs generation now it doesn't crash --- cmd/codegen/gengo_typedefs.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index dd13b12d8..6336f085f 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -115,7 +115,8 @@ import "unsafe" fmt.Fprintf(callbacksGoSb, ` type %[1]s %[2]s -func (self *%[1]s) handle() (result *C.%[6]s, fin func()) { +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 } } @@ -126,7 +127,7 @@ func (self %[1]s) c() (C.%[6]s, func()) { } func new%[1]sFromC(cvalue *C.%[6]s) *%[1]s { - return %[10]s + return (*%[1]s)(%[10]s) } `, k.renameGoIdentifier(), From 16acc34315510e0c537f34e660502305c657003a Mon Sep 17 00:00:00 2001 From: gucio321 Date: Wed, 8 Nov 2023 16:26:31 +0100 Subject: [PATCH 33/68] regenerate code --- cimgui_structs.go | 3326 ---------------------------------------- cimgui_typedefs.go | 25 +- cimmarkdown_structs.go | 398 ----- cimnodes_structs.go | 146 -- cimplot_structs.go | 905 ----------- 5 files changed, 15 insertions(+), 4785 deletions(-) delete mode 100644 cimgui_structs.go delete mode 100644 cimmarkdown_structs.go delete mode 100644 cimnodes_structs.go delete mode 100644 cimplot_structs.go diff --git a/cimgui_structs.go b/cimgui_structs.go deleted file mode 100644 index b5079c938..000000000 --- a/cimgui_structs.go +++ /dev/null @@ -1,3326 +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 { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self DrawChannel) handle() (result *C.ImDrawChannel, releaseFn func()) { - result = (*C.ImDrawChannel)(self.data) - return result, func() {} -} - -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.data = unsafe.Pointer(cvalue) - 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 { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self DrawCmdHeader) handle() (result *C.ImDrawCmdHeader, releaseFn func()) { - result = (*C.ImDrawCmdHeader)(self.data) - return result, func() {} -} - -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.data = unsafe.Pointer(cvalue) - 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 { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self GroupData) handle() (result *C.ImGuiGroupData, releaseFn func()) { - result = (*C.ImGuiGroupData)(self.data) - return result, func() {} -} - -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.data = unsafe.Pointer(cvalue) - 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 { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self InputEventMouseViewport) handle() (result *C.ImGuiInputEventMouseViewport, releaseFn func()) { - result = (*C.ImGuiInputEventMouseViewport)(self.data) - return result, func() {} -} - -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.data = unsafe.Pointer(cvalue) - 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 { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self InputTextDeactivatedState) handle() (result *C.ImGuiInputTextDeactivatedState, releaseFn func()) { - result = (*C.ImGuiInputTextDeactivatedState)(self.data) - return result, func() {} -} - -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.data = unsafe.Pointer(cvalue) - return result -} - -// Internal state of the currently focused/edited text input box -// For a given item ID, access with ImGui::GetInputTextState() -type InputTextState struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self InputTextState) handle() (result *C.ImGuiInputTextState, releaseFn func()) { - result = (*C.ImGuiInputTextState)(self.data) - return result, func() {} -} - -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.data = unsafe.Pointer(cvalue) - 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 { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self KeyOwnerData) handle() (result *C.ImGuiKeyOwnerData, releaseFn func()) { - result = (*C.ImGuiKeyOwnerData)(self.data) - return result, func() {} -} - -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.data = unsafe.Pointer(cvalue) - 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 { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self LastItemData) handle() (result *C.ImGuiLastItemData, releaseFn func()) { - result = (*C.ImGuiLastItemData)(self.data) - return result, func() {} -} - -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.data = unsafe.Pointer(cvalue) - 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 { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self NavTreeNodeData) handle() (result *C.ImGuiNavTreeNodeData, releaseFn func()) { - result = (*C.ImGuiNavTreeNodeData)(self.data) - return result, func() {} -} - -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.data = unsafe.Pointer(cvalue) - 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 { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self OldColumns) handle() (result *C.ImGuiOldColumns, releaseFn func()) { - result = (*C.ImGuiOldColumns)(self.data) - return result, func() {} -} - -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.data = unsafe.Pointer(cvalue) - 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 { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self PopupData) handle() (result *C.ImGuiPopupData, releaseFn func()) { - result = (*C.ImGuiPopupData)(self.data) - return result, func() {} -} - -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.data = unsafe.Pointer(cvalue) - 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 { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self StackTool) handle() (result *C.ImGuiStackTool, releaseFn func()) { - result = (*C.ImGuiStackTool)(self.data) - return result, func() {} -} - -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.data = unsafe.Pointer(cvalue) - 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 { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self TabBar) handle() (result *C.ImGuiTabBar, releaseFn func()) { - result = (*C.ImGuiTabBar)(self.data) - return result, func() {} -} - -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.data = unsafe.Pointer(cvalue) - return result -} - -// Storage for one active tab item (sizeof() 48 bytes) -type TabItem struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self TabItem) handle() (result *C.ImGuiTabItem, releaseFn func()) { - result = (*C.ImGuiTabItem)(self.data) - return result, func() {} -} - -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.data = unsafe.Pointer(cvalue) - 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 { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self TableCellData) handle() (result *C.ImGuiTableCellData, releaseFn func()) { - result = (*C.ImGuiTableCellData)(self.data) - return result, func() {} -} - -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.data = unsafe.Pointer(cvalue) - 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 { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self TableInstanceData) handle() (result *C.ImGuiTableInstanceData, releaseFn func()) { - result = (*C.ImGuiTableInstanceData)(self.data) - return result, func() {} -} - -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.data = unsafe.Pointer(cvalue) - return result -} - -// This is designed to be stored in a single ImChunkStream (1 header followed by N ImGuiTableColumnSettings, etc.) -type TableSettings struct { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self TableSettings) handle() (result *C.ImGuiTableSettings, releaseFn func()) { - result = (*C.ImGuiTableSettings)(self.data) - return result, func() {} -} - -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.data = unsafe.Pointer(cvalue) - 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 { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self Viewport) handle() (result *C.ImGuiViewport, releaseFn func()) { - result = (*C.ImGuiViewport)(self.data) - return result, func() {} -} - -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.data = unsafe.Pointer(cvalue) - 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 { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self WindowClass) handle() (result *C.ImGuiWindowClass, releaseFn func()) { - result = (*C.ImGuiWindowClass)(self.data) - return result, func() {} -} - -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.data = unsafe.Pointer(cvalue) - 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_typedefs.go b/cimgui_typedefs.go index 09d4c94ee..27eea9901 100644 --- a/cimgui_typedefs.go +++ b/cimgui_typedefs.go @@ -525,7 +525,8 @@ func newGroupDataFromC(cvalue *C.ImGuiGroupData) *GroupData { type ID uint32 -func (self *ID) handle() (result *C.ImGuiID, fin func()) { +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() } } @@ -535,7 +536,7 @@ func (self ID) c() (C.ImGuiID, func()) { } func newIDFromC(cvalue *C.ImGuiID) *ID { - return (*uint32)(cvalue) + return (*ID)((*uint32)(cvalue)) } type IO struct { @@ -761,7 +762,8 @@ func newInputTextStateFromC(cvalue *C.ImGuiInputTextState) *InputTextState { type KeyChord int32 -func (self *KeyChord) handle() (result *C.ImGuiKeyChord, fin func()) { +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() } } @@ -771,7 +773,7 @@ func (self KeyChord) c() (C.ImGuiKeyChord, func()) { } func newKeyChordFromC(cvalue *C.ImGuiKeyChord) *KeyChord { - return (*int32)(cvalue) + return (*KeyChord)((*int32)(cvalue)) } type KeyData struct { @@ -1490,7 +1492,8 @@ func newTableColumnsSettingsFromC(cvalue *C.ImGuiTableColumnsSettings) *TableCol type TableDrawChannelIdx uint16 -func (self *TableDrawChannelIdx) handle() (result *C.ImGuiTableDrawChannelIdx, fin func()) { +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() } } @@ -1500,7 +1503,7 @@ func (self TableDrawChannelIdx) c() (C.ImGuiTableDrawChannelIdx, func()) { } func newTableDrawChannelIdxFromC(cvalue *C.ImGuiTableDrawChannelIdx) *TableDrawChannelIdx { - return (*uint16)(cvalue) + return (*TableDrawChannelIdx)((*uint16)(cvalue)) } type TableInstanceData struct { @@ -1811,7 +1814,8 @@ func newWindowTempDataFromC(cvalue *C.ImGuiWindowTempData) *WindowTempData { type PoolIdx int32 -func (self *PoolIdx) handle() (result *C.ImPoolIdx, fin func()) { +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() } } @@ -1821,7 +1825,7 @@ func (self PoolIdx) c() (C.ImPoolIdx, func()) { } func newPoolIdxFromC(cvalue *C.ImPoolIdx) *PoolIdx { - return (*int32)(cvalue) + return (*PoolIdx)((*int32)(cvalue)) } type TextureID struct { @@ -1863,7 +1867,8 @@ func newVec1FromC(cvalue *C.ImVec1) *Vec1 { type Wchar32 uint32 -func (self *Wchar32) handle() (result *C.ImWchar32, fin func()) { +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() } } @@ -1873,7 +1878,7 @@ func (self Wchar32) c() (C.ImWchar32, func()) { } func newWchar32FromC(cvalue *C.ImWchar32) *Wchar32 { - return (*uint32)(cvalue) + return (*Wchar32)((*uint32)(cvalue)) } type STBTexteditState struct { diff --git a/cimmarkdown_structs.go b/cimmarkdown_structs.go deleted file mode 100644 index 37f225315..000000000 --- a/cimmarkdown_structs.go +++ /dev/null @@ -1,398 +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 { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self MarkdownImageData) handle() (result *C.MarkdownImageData, releaseFn func()) { - result = (*C.MarkdownImageData)(self.data) - return result, func() {} -} - -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.data = unsafe.Pointer(cvalue) - 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/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/cimplot_structs.go b/cimplot_structs.go deleted file mode 100644 index 2ca118cab..000000000 --- a/cimplot_structs.go +++ /dev/null @@ -1,905 +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 { - // TODO: contains unsupported fields - data unsafe.Pointer -} - -func (self PlotItem) handle() (result *C.ImPlotItem, releaseFn func()) { - result = (*C.ImPlotItem)(self.data) - return result, func() {} -} - -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.data = unsafe.Pointer(cvalue) - 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 -} From e0ff49b2d3b829cfff22139ced94551cb1c7de05 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Wed, 8 Nov 2023 16:31:02 +0100 Subject: [PATCH 34/68] fix bug in glfw_backend.go --- glfw_backend.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/glfw_backend.go b/glfw_backend.go index 52b5410ff..984a86480 100644 --- a/glfw_backend.go +++ b/glfw_backend.go @@ -347,15 +347,15 @@ 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))) + return *newTextureIDFromC(C.igCreateTexture((*C.uchar)(pixels), C.int(width), C.int(height))) } 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))) + return *newTextureIDFromC(C.igCreateTexture((*C.uchar)(&(img.Pix[0])), C.int(width), C.int(height))) } 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 From 1336dc5906c1a04c406ea82328a13a21b932442c Mon Sep 17 00:00:00 2001 From: gucio321 Date: Wed, 8 Nov 2023 16:31:08 +0100 Subject: [PATCH 35/68] update texture.go --- texture.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/texture.go b/texture.go index a7cf7588f..e3057e494 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 == nil { return nil } From fd3ee9f704e02d49ff4b97bb91e247023e7ced74 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Wed, 8 Nov 2023 16:38:34 +0100 Subject: [PATCH 36/68] hotfix in glfw_backend.go --- glfw_backend.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/glfw_backend.go b/glfw_backend.go index 984a86480..92100ba06 100644 --- a/glfw_backend.go +++ b/glfw_backend.go @@ -347,11 +347,13 @@ func (b *GLFWBackend) Refresh() { } func (b *GLFWBackend) CreateTexture(pixels unsafe.Pointer, width, height int) TextureID { - return *newTextureIDFromC(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 *newTextureIDFromC(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) { From 8f5169ced5ba6381d1926c765e95184314403cfb Mon Sep 17 00:00:00 2001 From: gucio321 Date: Wed, 8 Nov 2023 16:47:44 +0100 Subject: [PATCH 37/68] makefile: run goimport on typedefs.go --- Makefile | 1 + cimmarkdown_typedefs.go | 1 - cimplot_typedefs.go | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 9d60c0437..b2820a659 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,7 @@ define generate 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 diff --git a/cimmarkdown_typedefs.go b/cimmarkdown_typedefs.go index a50771433..0d8fa6894 100644 --- a/cimmarkdown_typedefs.go +++ b/cimmarkdown_typedefs.go @@ -8,7 +8,6 @@ package imgui // #include "extra_types.h" // #include "cimmarkdown_wrapper.h" import "C" -import "unsafe" type Emphasis struct { data *C.Emphasis diff --git a/cimplot_typedefs.go b/cimplot_typedefs.go index 6ab0388f2..f63b8244a 100644 --- a/cimplot_typedefs.go +++ b/cimplot_typedefs.go @@ -8,7 +8,6 @@ package imgui // #include "extra_types.h" // #include "cimplot_wrapper.h" import "C" -import "unsafe" type FormatterTimeData struct { data *C.Formatter_Time_Data From 396d976bf4e9fa1537bdc702fcb62e59f30aa6fa Mon Sep 17 00:00:00 2001 From: gucio321 Date: Wed, 8 Nov 2023 22:11:05 +0100 Subject: [PATCH 38/68] codegen: add missing arg type for ImColor --- cmd/codegen/arguments_wrapper.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/codegen/arguments_wrapper.go b/cmd/codegen/arguments_wrapper.go index 772e2263a..5e178a917 100644 --- a/cmd/codegen/arguments_wrapper.go +++ b/cmd/codegen/arguments_wrapper.go @@ -111,6 +111,7 @@ func getArgWrapper( "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"), From 27ef9defbcc7c547368dac03ee04f1f0641c7fd8 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Thu, 9 Nov 2023 16:56:48 +0100 Subject: [PATCH 39/68] codegen: fix build crash --- cmd/codegen/gengo_typedefs.go | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index 6336f085f..ca42fb8e0 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -187,8 +187,9 @@ func new%[1]sFromC(cvalue *C.%[6]s) *%[1]s { case IsCallbackTypedef(typedefs.data[k]): glg.Infof("typedef %s is a callback. Not implemented yet", k) case HasPrefix(typedefs.data[k], "struct"): - glg.Infof("typedef %s is an opaque struct.", k) - writeOpaqueStruct(k, callbacksGoSb) + isOpaque := !IsStructName(k, structs) + glg.Infof("typedef %s is a struct (is opaque? %v).", k, isOpaque) + writeOpaqueStruct(k, isOpaque, callbacksGoSb) validTypeNames = append(validTypeNames, k) } } @@ -200,7 +201,18 @@ func new%[1]sFromC(cvalue *C.%[6]s) *%[1]s { return validTypeNames, nil } -func writeOpaqueStruct(name CIdentifier, sb *strings.Builder) { +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 { @@ -211,15 +223,12 @@ func (self *%[1]s) handle() (result *C.%[2]s, fin func()) { return self.data, func() {} } -func (self %[1]s) c() (C.%[2]s, func()) { - result, fn := self.handle() - return *result, fn -} +%[3]s func new%[1]sFromC(cvalue *C.%[2]s) *%[1]s { return &%[1]s{data: cvalue} } -`, name.renameGoIdentifier(), name) +`, name.renameGoIdentifier(), name, toPlainValue) } func IsStructName(name CIdentifier, structs []StructDef) bool { From b58dedb94235773b4683bcd52c9bd5cd5cff4ee0 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Fri, 10 Nov 2023 11:51:49 +0100 Subject: [PATCH 40/68] regenerate code --- cimgui_typedefs.go | 20 -------------------- cimmarkdown_funcs.go | 5 +---- cimnodes_typedefs.go | 10 ---------- cimplot_typedefs.go | 5 ----- 4 files changed, 1 insertion(+), 39 deletions(-) diff --git a/cimgui_typedefs.go b/cimgui_typedefs.go index 27eea9901..643eff465 100644 --- a/cimgui_typedefs.go +++ b/cimgui_typedefs.go @@ -480,11 +480,6 @@ func (self *DockNodeSettings) handle() (result *C.ImGuiDockNodeSettings, fin fun return self.data, func() {} } -func (self DockNodeSettings) c() (C.ImGuiDockNodeSettings, func()) { - result, fn := self.handle() - return *result, fn -} - func newDockNodeSettingsFromC(cvalue *C.ImGuiDockNodeSettings) *DockNodeSettings { return &DockNodeSettings{data: cvalue} } @@ -497,11 +492,6 @@ func (self *DockRequest) handle() (result *C.ImGuiDockRequest, fin func()) { return self.data, func() {} } -func (self DockRequest) c() (C.ImGuiDockRequest, func()) { - result, fn := self.handle() - return *result, fn -} - func newDockRequestFromC(cvalue *C.ImGuiDockRequest) *DockRequest { return &DockRequest{data: cvalue} } @@ -717,11 +707,6 @@ func (self *InputTextDeactivateData) handle() (result *C.ImGuiInputTextDeactivat return self.data, func() {} } -func (self InputTextDeactivateData) c() (C.ImGuiInputTextDeactivateData, func()) { - result, fn := self.handle() - return *result, fn -} - func newInputTextDeactivateDataFromC(cvalue *C.ImGuiInputTextDeactivateData) *InputTextDeactivateData { return &InputTextDeactivateData{data: cvalue} } @@ -1481,11 +1466,6 @@ func (self *TableColumnsSettings) handle() (result *C.ImGuiTableColumnsSettings, return self.data, func() {} } -func (self TableColumnsSettings) c() (C.ImGuiTableColumnsSettings, func()) { - result, fn := self.handle() - return *result, fn -} - func newTableColumnsSettingsFromC(cvalue *C.ImGuiTableColumnsSettings) *TableColumnsSettings { return &TableColumnsSettings{data: cvalue} } diff --git a/cimmarkdown_funcs.go b/cimmarkdown_funcs.go index c2101d848..c08a6173c 100644 --- a/cimmarkdown_funcs.go +++ b/cimmarkdown_funcs.go @@ -112,10 +112,7 @@ func (self *TextRegion) Destroy() { } func UnderLine(col_ Color) { - col_Arg, col_Fin := col_.c() - C.UnderLine(col_Arg) - - col_Fin() + C.UnderLine(col_.toC()) } func RenderLinkTextWrapped(self *TextRegion, text_ string, link_ Link, markdown_ string, mdConfig_ MarkdownConfig, linkHoverStart_ []string) { diff --git a/cimnodes_typedefs.go b/cimnodes_typedefs.go index 305488398..3c2dc7cb8 100644 --- a/cimnodes_typedefs.go +++ b/cimnodes_typedefs.go @@ -35,11 +35,6 @@ func (self *NodesContext) handle() (result *C.ImNodesContext, fin func()) { return self.data, func() {} } -func (self NodesContext) c() (C.ImNodesContext, func()) { - result, fn := self.handle() - return *result, fn -} - func newNodesContextFromC(cvalue *C.ImNodesContext) *NodesContext { return &NodesContext{data: cvalue} } @@ -52,11 +47,6 @@ func (self *NodesEditorContext) handle() (result *C.ImNodesEditorContext, fin fu return self.data, func() {} } -func (self NodesEditorContext) c() (C.ImNodesEditorContext, func()) { - result, fn := self.handle() - return *result, fn -} - func newNodesEditorContextFromC(cvalue *C.ImNodesEditorContext) *NodesEditorContext { return &NodesEditorContext{data: cvalue} } diff --git a/cimplot_typedefs.go b/cimplot_typedefs.go index f63b8244a..780f88081 100644 --- a/cimplot_typedefs.go +++ b/cimplot_typedefs.go @@ -102,11 +102,6 @@ func (self *PlotAxisColor) handle() (result *C.ImPlotAxisColor, fin func()) { return self.data, func() {} } -func (self PlotAxisColor) c() (C.ImPlotAxisColor, func()) { - result, fn := self.handle() - return *result, fn -} - func newPlotAxisColorFromC(cvalue *C.ImPlotAxisColor) *PlotAxisColor { return &PlotAxisColor{data: cvalue} } From 642fd5b491a43a7e7c529d1e18218cdb61f516c3 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Tue, 14 Nov 2023 09:22:59 +0100 Subject: [PATCH 41/68] codegen: rename imNodes functions correctly --- cmd/codegen/gengo.go | 2 ++ cmd/codegen/gengo_funcs.go | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/codegen/gengo.go b/cmd/codegen/gengo.go index b98a5714c..aa5c299c0 100644 --- a/cmd/codegen/gengo.go +++ b/cmd/codegen/gengo.go @@ -85,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") diff --git a/cmd/codegen/gengo_funcs.go b/cmd/codegen/gengo_funcs.go index 04afc9937..bdfcd1b15 100644 --- a/cmd/codegen/gengo_funcs.go +++ b/cmd/codegen/gengo_funcs.go @@ -361,7 +361,6 @@ func (g *goFuncsGenerator) generateFuncArgs(f FuncDef) (args []GoIdentifier, arg g.enumNames, g.refTypedefs, ) - if err != nil { glg.Debugf("Unknown argument type \"%s\" in function %s", a.Type, f.FuncName) break From 66fbf4dc4e7d018c60a3ee6c639b4ddd744ddccc Mon Sep 17 00:00:00 2001 From: gucio321 Date: Tue, 14 Nov 2023 09:23:15 +0100 Subject: [PATCH 42/68] regenerate code --- cimnodes_funcs.go | 206 +++++++++++++++++++++++----------------------- 1 file changed, 103 insertions(+), 103 deletions(-) diff --git a/cimnodes_funcs.go b/cimnodes_funcs.go index 31d753582..1da66970d 100644 --- a/cimnodes_funcs.go +++ b/cimnodes_funcs.go @@ -63,75 +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 imnodesCreateContext() *NodesContext { +func ImNodesCreateContext() *NodesContext { return newNodesContextFromC(C.imnodes_CreateContext()) } -// imnodesDestroyContextV parameter default value hint: +// ImNodesDestroyContextV parameter default value hint: // ctx: NULL -func imnodesDestroyContextV(ctx *NodesContext) { +func ImNodesDestroyContextV(ctx *NodesContext) { ctxArg, ctxFin := ctx.handle() C.imnodes_DestroyContext(ctxArg) ctxFin() } -func imnodesEditorContextCreate() *NodesEditorContext { +func ImNodesEditorContextCreate() *NodesEditorContext { return newNodesEditorContextFromC(C.imnodes_EditorContextCreate()) } -func imnodesEditorContextFree(noname1 *NodesEditorContext) { +func ImNodesEditorContextFree(noname1 *NodesEditorContext) { noname1Arg, noname1Fin := noname1.handle() C.imnodes_EditorContextFree(noname1Arg) noname1Fin() } -func imnodesEditorContextGetPanning() Vec2 { +func ImNodesEditorContextGetPanning() Vec2 { pOut := new(Vec2) pOutArg, pOutFin := wrap[C.ImVec2, *Vec2](pOut) @@ -142,54 +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 imnodesEditorContextSet(noname1 *NodesEditorContext) { +func ImNodesEditorContextSet(noname1 *NodesEditorContext) { noname1Arg, noname1Fin := noname1.handle() C.imnodes_EditorContextSet(noname1Arg) noname1Fin() } -func imnodesEndInputAttribute() { +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 imnodesGetCurrentContext() *NodesContext { +func ImNodesGetCurrentContext() *NodesContext { return newNodesContextFromC(C.imnodes_GetCurrentContext()) } -func imnodesGetIO() *NodesIO { +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) @@ -200,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) @@ -211,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) @@ -222,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) @@ -233,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() { @@ -262,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) @@ -285,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) @@ -304,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() { @@ -313,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() { @@ -325,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() { @@ -334,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() { @@ -347,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() { @@ -356,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() { @@ -369,25 +369,25 @@ 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 imnodesLoadEditorStateFromIniFile(editor *NodesEditorContext, file_name string) { +func ImNodesLoadEditorStateFromIniFile(editor *NodesEditorContext, file_name string) { editorArg, editorFin := editor.handle() file_nameArg, file_nameFin := WrapString(file_name) C.imnodes_LoadEditorStateFromIniFile(editorArg, file_nameArg) @@ -396,7 +396,7 @@ func imnodesLoadEditorStateFromIniFile(editor *NodesEditorContext, file_name str file_nameFin() } -func imnodesLoadEditorStateFromIniString(editor *NodesEditorContext, data string, data_size uint64) { +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)) @@ -405,58 +405,58 @@ func imnodesLoadEditorStateFromIniString(editor *NodesEditorContext, data string dataFin() } -func imnodesNumSelectedLinks() int32 { +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 imnodesSaveEditorStateToIniFile(editor *NodesEditorContext, file_name string) { +func ImNodesSaveEditorStateToIniFile(editor *NodesEditorContext, file_name string) { editorArg, editorFin := editor.handle() file_nameArg, file_nameFin := WrapString(file_name) C.imnodes_SaveEditorStateToIniFile(editorArg, file_nameArg) @@ -465,9 +465,9 @@ func imnodesSaveEditorStateToIniFile(editor *NodesEditorContext, file_name strin file_nameFin() } -// imnodesSaveEditorStateToIniStringV parameter default value hint: +// ImNodesSaveEditorStateToIniStringV parameter default value hint: // data_size: NULL -func imnodesSaveEditorStateToIniStringV(editor *NodesEditorContext, data_size *uint64) string { +func ImNodesSaveEditorStateToIniStringV(editor *NodesEditorContext, data_size *uint64) string { editorArg, editorFin := editor.handle() defer func() { @@ -476,92 +476,92 @@ func imnodesSaveEditorStateToIniStringV(editor *NodesEditorContext, data_size *u return C.GoString(C.imnodes_SaveEditorStateToIniString(editorArg, (*C.xulong)(data_size))) } -func imnodesSelectLink(link_id int32) { +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 imnodesSetCurrentContext(ctx *NodesContext) { +func ImNodesSetCurrentContext(ctx *NodesContext) { ctxArg, ctxFin := ctx.handle() C.imnodes_SetCurrentContext(ctxArg) ctxFin() } -func imnodesSetImGuiContext(ctx *Context) { +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) @@ -572,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) @@ -587,23 +587,23 @@ 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 imnodesSaveEditorStateToIniString(editor *NodesEditorContext) string { +func ImNodesSaveEditorStateToIniString(editor *NodesEditorContext) string { editorArg, editorFin := editor.handle() defer func() { @@ -612,15 +612,15 @@ func imnodesSaveEditorStateToIniString(editor *NodesEditorContext) string { return C.GoString(C.wrap_imnodes_SaveEditorStateToIniString(editorArg)) } -func imnodesStyleColorsClassic() { +func ImNodesStyleColorsClassic() { C.wrap_imnodes_StyleColorsClassic() } -func imnodesStyleColorsDark() { +func ImNodesStyleColorsDark() { C.wrap_imnodes_StyleColorsDark() } -func imnodesStyleColorsLight() { +func ImNodesStyleColorsLight() { C.wrap_imnodes_StyleColorsLight() } From a801fa8ecdfb7921a52985f529a936287304aa02 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Thu, 30 Nov 2023 09:41:22 +0100 Subject: [PATCH 43/68] change wrapper of void* --- cmd/codegen/arguments_wrapper.go | 22 +++++++++++----------- cmd/codegen/return_wrapper.go | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cmd/codegen/arguments_wrapper.go b/cmd/codegen/arguments_wrapper.go index 5e178a917..c25b9b867 100644 --- a/cmd/codegen/arguments_wrapper.go +++ b/cmd/codegen/arguments_wrapper.go @@ -100,7 +100,7 @@ func getArgWrapper( "ImWchar*": simpleW("(*Wchar)", "(*C.ImWchar)"), "const ImWchar*": simpleW("(*Wchar)", "(*C.ImWchar)"), "ImWchar16": simpleW("uint16", "C.ImWchar16"), - "void*": voidPtrW, + "void*": simpleW("uintptr", "unsafe.Pointer"), "const void*": simpleW("unsafe.Pointer", ""), "const ImVec2": wrappableW("Vec2", "C.ImVec2"), "const ImVec2*": wrappablePtrW("*Vec2", "C.ImVec2"), @@ -318,16 +318,16 @@ func uint64ArrayW(arg ArgDef) ArgumentWrapperData { } } -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", - } -} +//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: diff --git a/cmd/codegen/return_wrapper.go b/cmd/codegen/return_wrapper.go index 9e3976a9e..c5b518cc7 100644 --- a/cmd/codegen/return_wrapper.go +++ b/cmd/codegen/return_wrapper.go @@ -56,7 +56,7 @@ func getReturnWrapper( "ImPlotPoint": wrappableR("PlotPoint"), "ImRect": wrappableR("Rect"), "ImPlotTime": wrappableR("PlotTime"), - "void*": simpleR("unsafe.Pointer"), // TODO: disabled due to https://github.com/AllenDang/cimgui-go/issues/184 + "void*": simpleR("uintptr"), "size_t": simpleR("uint64"), } From 26b274305ab09e86c1e662ca0f94803403ddec26 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Wed, 20 Dec 2023 10:20:17 +0100 Subject: [PATCH 44/68] regenerate code --- cimgui_funcs.go | 456 ++++++++++++++++--------------------------- cimgui_typedefs.go | 8 +- cimmarkdown_funcs.go | 20 +- cimnodes_typedefs.go | 8 +- cimplot_funcs.go | 96 +++------ 5 files changed, 210 insertions(+), 378 deletions(-) diff --git a/cimgui_funcs.go b/cimgui_funcs.go index 71ad67a71..4e34045a7 100644 --- a/cimgui_funcs.go +++ b/cimgui_funcs.go @@ -909,17 +909,15 @@ func (self *FontAtlas) AddFontFromMemoryCompressedTTFV(compressed_font_data unsa // 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.ImFontAtlas_AddFontFromMemoryTTF(selfArg, unsafe.Pointer(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. @@ -1456,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.ImGuiDataVarInfo_GetVarPtr(selfArg, unsafe.Pointer(parent))) } func InternalNewDockContext() *DockContext { @@ -2293,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.ImGuiPtrOrIndex_ImGuiPtrOrIndex_Ptr(unsafe.Pointer(ptr))) } func (self *PtrOrIndex) Destroy() { @@ -2389,15 +2380,13 @@ func NewStoragePairInt(_key ID, _val_i int32) *StoragePair { return newStoragePairFromC(C.ImGuiStoragePair_ImGuiStoragePair_Int(_keyArg, C.int(_val_i))) } -func NewStoragePairPtr(_key ID, _val_p unsafe.Pointer) *StoragePair { +func NewStoragePairPtr(_key ID, _val_p uintptr) *StoragePair { _keyArg, _keyFin := _key.c() - _val_pArg, _val_pFin := WrapVoidPtr(_val_p) defer func() { _keyFin() - _val_pFin() }() - return newStoragePairFromC(C.ImGuiStoragePair_ImGuiStoragePair_Ptr(_keyArg, _val_pArg)) + return newStoragePairFromC(C.ImGuiStoragePair_ImGuiStoragePair_Ptr(_keyArg, unsafe.Pointer(_val_p))) } func (self *StoragePair) Destroy() { @@ -2487,7 +2476,7 @@ func (self *Storage) IntRefV(key ID, default_val int32) *int32 { } // 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() @@ -2495,7 +2484,7 @@ func (self *Storage) VoidPtr(key ID) unsafe.Pointer { selfFin() keyFin() }() - return unsafe.Pointer(C.ImGuiStorage_GetVoidPtr(selfArg, keyArg)) + return uintptr(C.ImGuiStorage_GetVoidPtr(selfArg, keyArg)) } func (self *Storage) SetAllInt(val int32) { @@ -2532,15 +2521,13 @@ func (self *Storage) SetInt(key ID, val int32) { keyFin() } -func (self *Storage) SetVoidPtr(key ID, val unsafe.Pointer) { +func (self *Storage) SetVoidPtr(key ID, val uintptr) { selfArg, selfFin := self.handle() keyArg, keyFin := key.c() - valArg, valFin := WrapVoidPtr(val) - C.ImGuiStorage_SetVoidPtr(selfArg, keyArg, valArg) + C.ImGuiStorage_SetVoidPtr(selfArg, keyArg, unsafe.Pointer(val)) selfFin() keyFin() - valFin() } func InternalNewStyleModFloat(idx StyleVar, v float32) *StyleMod { @@ -4455,33 +4442,23 @@ 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.igDataTypeApplyFromText(bufArg, C.ImGuiDataType(data_type), unsafe.Pointer(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 unsafe.Pointer, arg_2 unsafe.Pointer) { + C.igDataTypeApplyOp(C.ImGuiDataType(data_type), C.int(op), unsafe.Pointer(output), (arg_1), (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 unsafe.Pointer, p_max unsafe.Pointer) bool { + return C.igDataTypeClamp(C.ImGuiDataType(data_type), unsafe.Pointer(p_data), (p_min), (p_max)) == C.bool(true) } func InternalDataTypeCompare(data_type DataType, arg_1 unsafe.Pointer, arg_2 unsafe.Pointer) int32 { @@ -5091,17 +5068,15 @@ func DockSpaceOverViewportV(viewport *Viewport, flags DockNodeFlags, window_clas }()) } -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 { +func InternalDragBehavior(id ID, data_type DataType, p_v uintptr, v_speed float32, p_min unsafe.Pointer, p_max unsafe.Pointer, format string, flags SliderFlags) bool { idArg, idFin := id.c() - p_vArg, p_vFin := WrapVoidPtr(p_v) formatArg, formatFin := WrapString(format) defer func() { idFin() - p_vFin() formatFin() }() - return C.igDragBehavior(idArg, C.ImGuiDataType(data_type), p_vArg, C.float(v_speed), (p_min), (p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) + return C.igDragBehavior(idArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_v), C.float(v_speed), (p_min), (p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) } // If v_min >= v_max we have no bound @@ -5360,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 unsafe.Pointer, p_max unsafe.Pointer, 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.igDragScalar(labelArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), C.float(v_speed), (p_min), (p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) } // DragScalarNV parameter default value hint: @@ -5379,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 unsafe.Pointer, p_max unsafe.Pointer, 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.igDragScalarN(labelArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), C.int(components), C.float(v_speed), (p_min), (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. @@ -5574,13 +5545,8 @@ func FindViewportByID(id ID) *Viewport { } // 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) - - defer func() { - platform_handleFin() - }() - return newViewportFromC(C.igFindViewportByPlatformHandle(platform_handleArg)) +func FindViewportByPlatformHandle(platform_handle uintptr) *Viewport { + return newViewportFromC(C.igFindViewportByPlatformHandle(unsafe.Pointer(platform_handle))) } func InternalFindWindowByID(id ID) *Window { @@ -6584,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) @@ -6592,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.igImFileLoadToMemory(filenameArg, modeArg, (*C.xulong)(out_file_size), C.int(padding_bytes))) } // Decent replacement for floorf() @@ -6640,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.igImFontAtlasBuildPackCustomRects(atlasArg, unsafe.Pointer(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) { @@ -7451,17 +7415,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 unsafe.Pointer, p_step_fast unsafe.Pointer, 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.igInputScalar(labelArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), (p_step), (p_step_fast), formatArg, C.ImGuiInputTextFlags(flags)) == C.bool(true) } // InputScalarNV parameter default value hint: @@ -7469,17 +7431,15 @@ 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 unsafe.Pointer, p_step_fast unsafe.Pointer, 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.igInputScalarN(labelArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), C.int(components), (p_step), (p_step_fast), formatArg, C.ImGuiInputTextFlags(flags)) == C.bool(true) } func InternalInputTextDeactivateHook(id ID) { @@ -8067,15 +8027,12 @@ func InternalMarkItemEdited(id ID) { idFin() } -func MemAlloc(size uint64) unsafe.Pointer { - return unsafe.Pointer(C.igMemAlloc(C.xulong(size))) +func MemAlloc(size uint64) uintptr { + return uintptr(C.igMemAlloc(C.xulong(size))) } -func MemFree(ptr unsafe.Pointer) { - ptrArg, ptrFin := WrapVoidPtr(ptr) - C.igMemFree(ptrArg) - - ptrFin() +func MemFree(ptr uintptr) { + C.igMemFree(unsafe.Pointer(ptr)) } // InternalMenuItemExV parameter default value hint: @@ -8584,13 +8541,8 @@ func InternalRenderNavHighlightV(bb Rect, id ID, flags NavHighlightFlags) { // 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.igRenderPlatformWindowsDefault(unsafe.Pointer(platform_render_arg), unsafe.Pointer(renderer_render_arg)) } func InternalRenderRectFilledRangeH(draw_list *DrawList, rect Rect, col uint32, x_start_norm float32, x_end_norm float32, rounding float32) { @@ -9473,19 +9425,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 { +func InternalSliderBehavior(bb Rect, id ID, data_type DataType, p_v uintptr, p_min unsafe.Pointer, p_max unsafe.Pointer, format string, flags SliderFlags, out_grab_bb *Rect) bool { idArg, idFin := id.c() - p_vArg, p_vFin := WrapVoidPtr(p_v) formatArg, formatFin := WrapString(format) out_grab_bbArg, out_grab_bbFin := wrap[C.ImRect, *Rect](out_grab_bb) defer func() { idFin() - p_vFin() formatFin() out_grab_bbFin() }() - return C.igSliderBehavior(bb.toC(), idArg, C.ImGuiDataType(data_type), p_vArg, (p_min), (p_max), formatArg, C.ImGuiSliderFlags(flags), out_grab_bbArg) == C.bool(true) + return C.igSliderBehavior(bb.toC(), idArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_v), (p_min), (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. @@ -9668,33 +9618,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 unsafe.Pointer, p_max unsafe.Pointer, 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.igSliderScalar(labelArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), (p_min), (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 unsafe.Pointer, p_max unsafe.Pointer, 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.igSliderScalarN(labelArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), C.int(components), (p_min), (p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) } // button with FramePadding=(0,0) to easily embed within text @@ -10428,19 +10374,17 @@ func InternalTempInputIsActive(id ID) bool { // 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 unsafe.Pointer, p_clamp_max unsafe.Pointer) 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(), idArg, labelArg, C.ImGuiDataType(data_type), p_dataArg, formatArg, (p_clamp_min), (p_clamp_max)) == C.bool(true) + return C.igTempInputScalar(bb.toC(), idArg, labelArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), formatArg, (p_clamp_min), (p_clamp_max)) == C.bool(true) } func InternalTempInputText(bb Rect, id ID, label string, buf string, buf_size int32, flags InputTextFlags) bool { @@ -10725,17 +10669,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 unsafe.Pointer, p_max unsafe.Pointer, 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.igVSliderScalar(labelArg, size.toC(), C.ImGuiDataType(data_type), unsafe.Pointer(p_data), (p_min), (p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) } func ValueBool(prefix string, b bool) { @@ -11058,15 +11000,13 @@ func (self *FontAtlas) AddFontFromMemoryCompressedTTF(compressed_font_data unsaf return newFontFromC(C.wrap_ImFontAtlas_AddFontFromMemoryCompressedTTF(selfArg, (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, unsafe.Pointer(font_data), C.int(font_data_size), C.float(size_pixels))) } func (self *FontGlyphRangesBuilder) AddText(text string) { @@ -11790,26 +11730,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), unsafe.Pointer(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), unsafe.Pointer(p_data), C.int(components)) == C.bool(true) } func InternalFindRenderedTextEnd(text string) string { @@ -11855,7 +11791,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) @@ -11863,7 +11799,7 @@ 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 { @@ -12064,26 +12000,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), unsafe.Pointer(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), unsafe.Pointer(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 { @@ -12771,26 +12703,22 @@ 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 unsafe.Pointer, p_max unsafe.Pointer) 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), unsafe.Pointer(p_data), (p_min), (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 unsafe.Pointer, p_max unsafe.Pointer) 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), unsafe.Pointer(p_data), C.int(components), (p_min), (p_max)) == C.bool(true) } func InternalSplitterBehavior(bb Rect, id ID, axis Axis, size1 *float32, size2 *float32, min_size1 float32, min_size2 float32) bool { @@ -12866,19 +12794,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(), idArg, labelArg, C.ImGuiDataType(data_type), p_dataArg, formatArg) == C.bool(true) + return C.wrap_igTempInputScalar(bb.toC(), idArg, labelArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), formatArg) == C.bool(true) } func InternalTextEx(text string) { @@ -12941,15 +12867,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 unsafe.Pointer, p_max unsafe.Pointer) 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), unsafe.Pointer(p_data), (p_min), (p_max)) == C.bool(true) } func ValueFloat(prefix string, v float32) { @@ -13093,21 +13017,19 @@ func (self *DrawCmd) ElemCount() uint32 { return uint32(C.wrap_ImDrawCmd_GetElemCount(selfArg)) } -func (self DrawCmd) SetUserCallbackData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self DrawCmd) SetUserCallbackData(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImDrawCmd_SetUserCallbackData(selfArg, vArg) + C.wrap_ImDrawCmd_SetUserCallbackData(selfArg, unsafe.Pointer(v)) } -func (self *DrawCmd) UserCallbackData() unsafe.Pointer { +func (self *DrawCmd) UserCallbackData() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImDrawCmd_GetUserCallbackData(selfArg)) + return uintptr(C.wrap_ImDrawCmd_GetUserCallbackData(selfArg)) } func (self DrawCmdHeader) SetClipRect(v Vec4) { @@ -14138,21 +14060,19 @@ func (self *FontAtlas) Locked() bool { return C.wrap_ImFontAtlas_GetLocked(selfArg) == C.bool(true) } -func (self FontAtlas) SetUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self FontAtlas) SetUserData(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImFontAtlas_SetUserData(selfArg, vArg) + C.wrap_ImFontAtlas_SetUserData(selfArg, unsafe.Pointer(v)) } -func (self *FontAtlas) UserData() unsafe.Pointer { +func (self *FontAtlas) UserData() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImFontAtlas_GetUserData(selfArg)) + return uintptr(C.wrap_ImFontAtlas_GetUserData(selfArg)) } func (self FontAtlas) SetTexReady(v bool) { @@ -14509,21 +14429,19 @@ func (self *FontAtlasCustomRect) Font() *Font { return newFontFromC(C.wrap_ImFontAtlasCustomRect_GetFont(selfArg)) } -func (self FontConfig) SetFontData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self FontConfig) SetFontData(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImFontConfig_SetFontData(selfArg, vArg) + C.wrap_ImFontConfig_SetFontData(selfArg, unsafe.Pointer(v)) } -func (self *FontConfig) FontData() unsafe.Pointer { +func (self *FontConfig) FontData() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImFontConfig_GetFontData(selfArg)) + return uintptr(C.wrap_ImFontConfig_GetFontData(selfArg)) } func (self FontConfig) SetFontDataSize(v int32) { @@ -15439,21 +15357,19 @@ func (self *Context) TestEngineHookItems() bool { return C.wrap_ImGuiContext_GetTestEngineHookItems(selfArg) == C.bool(true) } -func (self Context) SetTestEngine(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self Context) SetTestEngine(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContext_SetTestEngine(selfArg, vArg) + C.wrap_ImGuiContext_SetTestEngine(selfArg, unsafe.Pointer(v)) } -func (self *Context) TestEngine() unsafe.Pointer { +func (self *Context) TestEngine() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImGuiContext_GetTestEngine(selfArg)) + return uintptr(C.wrap_ImGuiContext_GetTestEngine(selfArg)) } func (self Context) SetInputEventsQueue(v Vector[*InputEvent]) { @@ -19287,21 +19203,19 @@ func (self *ContextHook) Owner() ID { return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } -func (self ContextHook) SetUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self ContextHook) SetUserData(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiContextHook_SetUserData(selfArg, vArg) + C.wrap_ImGuiContextHook_SetUserData(selfArg, unsafe.Pointer(v)) } -func (self *ContextHook) UserData() unsafe.Pointer { +func (self *ContextHook) UserData() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImGuiContextHook_GetUserData(selfArg)) + return uintptr(C.wrap_ImGuiContextHook_GetUserData(selfArg)) } func (self DataTypeInfo) SetSize(v uint64) { @@ -20406,21 +20320,19 @@ func (self *IO) LogFilename() string { return C.GoString(C.wrap_ImGuiIO_GetLogFilename(selfArg)) } -func (self IO) SetUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self IO) SetUserData(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiIO_SetUserData(selfArg, vArg) + C.wrap_ImGuiIO_SetUserData(selfArg, unsafe.Pointer(v)) } -func (self *IO) UserData() unsafe.Pointer { +func (self *IO) UserData() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImGuiIO_GetUserData(selfArg)) + return uintptr(C.wrap_ImGuiIO_GetUserData(selfArg)) } func (self IO) SetFonts(v *FontAtlas) { @@ -20926,89 +20838,79 @@ func (self *IO) BackendRendererName() string { return C.GoString(C.wrap_ImGuiIO_GetBackendRendererName(selfArg)) } -func (self IO) SetBackendPlatformUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self IO) SetBackendPlatformUserData(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiIO_SetBackendPlatformUserData(selfArg, vArg) + C.wrap_ImGuiIO_SetBackendPlatformUserData(selfArg, unsafe.Pointer(v)) } -func (self *IO) BackendPlatformUserData() unsafe.Pointer { +func (self *IO) BackendPlatformUserData() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImGuiIO_GetBackendPlatformUserData(selfArg)) + return uintptr(C.wrap_ImGuiIO_GetBackendPlatformUserData(selfArg)) } -func (self IO) SetBackendRendererUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self IO) SetBackendRendererUserData(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiIO_SetBackendRendererUserData(selfArg, vArg) + C.wrap_ImGuiIO_SetBackendRendererUserData(selfArg, unsafe.Pointer(v)) } -func (self *IO) BackendRendererUserData() unsafe.Pointer { +func (self *IO) BackendRendererUserData() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImGuiIO_GetBackendRendererUserData(selfArg)) + return uintptr(C.wrap_ImGuiIO_GetBackendRendererUserData(selfArg)) } -func (self IO) SetBackendLanguageUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self IO) SetBackendLanguageUserData(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiIO_SetBackendLanguageUserData(selfArg, vArg) + C.wrap_ImGuiIO_SetBackendLanguageUserData(selfArg, unsafe.Pointer(v)) } -func (self *IO) BackendLanguageUserData() unsafe.Pointer { +func (self *IO) BackendLanguageUserData() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImGuiIO_GetBackendLanguageUserData(selfArg)) + return uintptr(C.wrap_ImGuiIO_GetBackendLanguageUserData(selfArg)) } -func (self IO) SetClipboardUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self IO) SetClipboardUserData(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiIO_SetClipboardUserData(selfArg, vArg) + C.wrap_ImGuiIO_SetClipboardUserData(selfArg, unsafe.Pointer(v)) } -func (self *IO) ClipboardUserData() unsafe.Pointer { +func (self *IO) ClipboardUserData() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImGuiIO_GetClipboardUserData(selfArg)) + return uintptr(C.wrap_ImGuiIO_GetClipboardUserData(selfArg)) } -func (self IO) SetUnusedPadding(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self IO) SetUnusedPadding(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiIO_Set_UnusedPadding(selfArg, vArg) + C.wrap_ImGuiIO_Set_UnusedPadding(selfArg, unsafe.Pointer(v)) } -func (self *IO) UnusedPadding() unsafe.Pointer { +func (self *IO) UnusedPadding() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImGuiIO_Get_UnusedPadding(selfArg)) + return uintptr(C.wrap_ImGuiIO_Get_UnusedPadding(selfArg)) } func (self IO) SetPlatformLocaleDecimalPoint(v Wchar) { @@ -21890,21 +21792,19 @@ func (self *InputTextCallbackData) Flags() InputTextFlags { return InputTextFlags(C.wrap_ImGuiInputTextCallbackData_GetFlags(selfArg)) } -func (self InputTextCallbackData) SetUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self InputTextCallbackData) SetUserData(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiInputTextCallbackData_SetUserData(selfArg, vArg) + C.wrap_ImGuiInputTextCallbackData_SetUserData(selfArg, unsafe.Pointer(v)) } -func (self *InputTextCallbackData) UserData() unsafe.Pointer { +func (self *InputTextCallbackData) UserData() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImGuiInputTextCallbackData_GetUserData(selfArg)) + return uintptr(C.wrap_ImGuiInputTextCallbackData_GetUserData(selfArg)) } func (self InputTextCallbackData) SetEventChar(v Wchar) { @@ -22788,21 +22688,19 @@ func (self *ListClipper) StartPosY() float32 { return float32(C.wrap_ImGuiListClipper_GetStartPosY(selfArg)) } -func (self ListClipper) SetTempData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self ListClipper) SetTempData(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiListClipper_SetTempData(selfArg, vArg) + C.wrap_ImGuiListClipper_SetTempData(selfArg, unsafe.Pointer(v)) } -func (self *ListClipper) TempData() unsafe.Pointer { +func (self *ListClipper) TempData() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImGuiListClipper_GetTempData(selfArg)) + return uintptr(C.wrap_ImGuiListClipper_GetTempData(selfArg)) } func (self ListClipperData) SetListClipper(v *ListClipper) { @@ -23716,21 +23614,19 @@ func (self *NextWindowData) SizeConstraintRect() Rect { return *(&Rect{}).fromC(C.wrap_ImGuiNextWindowData_GetSizeConstraintRect(selfArg)) } -func (self NextWindowData) SetSizeCallbackUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self NextWindowData) SetSizeCallbackUserData(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiNextWindowData_SetSizeCallbackUserData(selfArg, vArg) + C.wrap_ImGuiNextWindowData_SetSizeCallbackUserData(selfArg, unsafe.Pointer(v)) } -func (self *NextWindowData) SizeCallbackUserData() unsafe.Pointer { +func (self *NextWindowData) SizeCallbackUserData() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImGuiNextWindowData_GetSizeCallbackUserData(selfArg)) + return uintptr(C.wrap_ImGuiNextWindowData_GetSizeCallbackUserData(selfArg)) } func (self NextWindowData) SetBgAlphaVal(v float32) { @@ -24166,21 +24062,19 @@ func (self *OnceUponAFrame) RefFrame() int32 { return int32(C.wrap_ImGuiOnceUponAFrame_GetRefFrame(selfArg)) } -func (self Payload) SetData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self Payload) SetData(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiPayload_SetData(selfArg, vArg) + C.wrap_ImGuiPayload_SetData(selfArg, unsafe.Pointer(v)) } -func (self *Payload) Data() unsafe.Pointer { +func (self *Payload) Data() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImGuiPayload_GetData(selfArg)) + return uintptr(C.wrap_ImGuiPayload_GetData(selfArg)) } func (self Payload) SetDataSize(v int32) { @@ -24424,21 +24318,19 @@ func (self *PlatformMonitor) DpiScale() float32 { return float32(C.wrap_ImGuiPlatformMonitor_GetDpiScale(selfArg)) } -func (self PlatformMonitor) SetPlatformHandle(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self PlatformMonitor) SetPlatformHandle(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiPlatformMonitor_SetPlatformHandle(selfArg, vArg) + C.wrap_ImGuiPlatformMonitor_SetPlatformHandle(selfArg, unsafe.Pointer(v)) } -func (self *PlatformMonitor) PlatformHandle() unsafe.Pointer { +func (self *PlatformMonitor) PlatformHandle() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImGuiPlatformMonitor_GetPlatformHandle(selfArg)) + return uintptr(C.wrap_ImGuiPlatformMonitor_GetPlatformHandle(selfArg)) } func (self PopupData) SetPopupId(v ID) { @@ -24573,21 +24465,19 @@ func (self *PopupData) OpenMousePos() Vec2 { return *(&Vec2{}).fromC(C.wrap_ImGuiPopupData_GetOpenMousePos(selfArg)) } -func (self PtrOrIndex) SetPtr(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self PtrOrIndex) SetPtr(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiPtrOrIndex_SetPtr(selfArg, vArg) + C.wrap_ImGuiPtrOrIndex_SetPtr(selfArg, unsafe.Pointer(v)) } -func (self *PtrOrIndex) Ptr() unsafe.Pointer { +func (self *PtrOrIndex) Ptr() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImGuiPtrOrIndex_GetPtr(selfArg)) + return uintptr(C.wrap_ImGuiPtrOrIndex_GetPtr(selfArg)) } func (self PtrOrIndex) SetIndex(v int32) { @@ -24641,21 +24531,19 @@ func (self *SettingsHandler) TypeHash() ID { return *newIDFromC(func() *C.ImGuiID { result := result; return &result }()) } -func (self SettingsHandler) SetUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self SettingsHandler) SetUserData(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiSettingsHandler_SetUserData(selfArg, vArg) + C.wrap_ImGuiSettingsHandler_SetUserData(selfArg, unsafe.Pointer(v)) } -func (self *SettingsHandler) UserData() unsafe.Pointer { +func (self *SettingsHandler) UserData() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImGuiSettingsHandler_GetUserData(selfArg)) + return uintptr(C.wrap_ImGuiSettingsHandler_GetUserData(selfArg)) } func (self ShrinkWidthItem) SetIndex(v int32) { @@ -24703,21 +24591,19 @@ func (self *ShrinkWidthItem) InitialWidth() float32 { return float32(C.wrap_ImGuiShrinkWidthItem_GetInitialWidth(selfArg)) } -func (self SizeCallbackData) SetUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self SizeCallbackData) SetUserData(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiSizeCallbackData_SetUserData(selfArg, vArg) + C.wrap_ImGuiSizeCallbackData_SetUserData(selfArg, unsafe.Pointer(v)) } -func (self *SizeCallbackData) UserData() unsafe.Pointer { +func (self *SizeCallbackData) UserData() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImGuiSizeCallbackData_GetUserData(selfArg)) + return uintptr(C.wrap_ImGuiSizeCallbackData_GetUserData(selfArg)) } func (self SizeCallbackData) SetPos(v Vec2) { @@ -26635,21 +26521,19 @@ 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) SetRawData(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiTable_SetRawData(selfArg, vArg) + C.wrap_ImGuiTable_SetRawData(selfArg, unsafe.Pointer(v)) } -func (self *Table) RawData() unsafe.Pointer { +func (self *Table) RawData() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImGuiTable_GetRawData(selfArg)) + return uintptr(C.wrap_ImGuiTable_GetRawData(selfArg)) } func (self Table) SetTempData(v *TableTempData) { @@ -29416,72 +29300,64 @@ func (self *Viewport) DrawData() *DrawData { return newDrawDataFromC(C.wrap_ImGuiViewport_GetDrawData(selfArg)) } -func (self Viewport) SetRendererUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self Viewport) SetRendererUserData(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiViewport_SetRendererUserData(selfArg, vArg) + C.wrap_ImGuiViewport_SetRendererUserData(selfArg, unsafe.Pointer(v)) } -func (self *Viewport) RendererUserData() unsafe.Pointer { +func (self *Viewport) RendererUserData() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImGuiViewport_GetRendererUserData(selfArg)) + return uintptr(C.wrap_ImGuiViewport_GetRendererUserData(selfArg)) } -func (self Viewport) SetPlatformUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self Viewport) SetPlatformUserData(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiViewport_SetPlatformUserData(selfArg, vArg) + C.wrap_ImGuiViewport_SetPlatformUserData(selfArg, unsafe.Pointer(v)) } -func (self *Viewport) PlatformUserData() unsafe.Pointer { +func (self *Viewport) PlatformUserData() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImGuiViewport_GetPlatformUserData(selfArg)) + return uintptr(C.wrap_ImGuiViewport_GetPlatformUserData(selfArg)) } -func (self Viewport) SetPlatformHandle(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self Viewport) SetPlatformHandle(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiViewport_SetPlatformHandle(selfArg, vArg) + C.wrap_ImGuiViewport_SetPlatformHandle(selfArg, unsafe.Pointer(v)) } -func (self *Viewport) PlatformHandle() unsafe.Pointer { +func (self *Viewport) PlatformHandle() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImGuiViewport_GetPlatformHandle(selfArg)) + return uintptr(C.wrap_ImGuiViewport_GetPlatformHandle(selfArg)) } -func (self Viewport) SetPlatformHandleRaw(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self Viewport) SetPlatformHandleRaw(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImGuiViewport_SetPlatformHandleRaw(selfArg, vArg) + C.wrap_ImGuiViewport_SetPlatformHandleRaw(selfArg, unsafe.Pointer(v)) } -func (self *Viewport) PlatformHandleRaw() unsafe.Pointer { +func (self *Viewport) PlatformHandleRaw() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImGuiViewport_GetPlatformHandleRaw(selfArg)) + return uintptr(C.wrap_ImGuiViewport_GetPlatformHandleRaw(selfArg)) } func (self Viewport) SetPlatformWindowCreated(v bool) { diff --git a/cimgui_typedefs.go b/cimgui_typedefs.go index 643eff465..6e9f0198c 100644 --- a/cimgui_typedefs.go +++ b/cimgui_typedefs.go @@ -1809,7 +1809,7 @@ func newPoolIdxFromC(cvalue *C.ImPoolIdx) *PoolIdx { } type TextureID struct { - Data unsafe.Pointer + Data uintptr } func (self *TextureID) handle() (*C.ImTextureID, func()) { @@ -1819,13 +1819,13 @@ func (self *TextureID) handle() (*C.ImTextureID, func()) { func (selfStruct *TextureID) c() (result C.ImTextureID, fin func()) { self := selfStruct.Data - selfArg, selfFin := WrapVoidPtr(self) - return (C.ImTextureID)(selfArg), func() { selfFin() } + + return (C.ImTextureID)(unsafe.Pointer(self)), func() {} } func newTextureIDFromC(cvalue *C.ImTextureID) *TextureID { v := (unsafe.Pointer)(*cvalue) - return &TextureID{Data: unsafe.Pointer(v)} + return &TextureID{Data: uintptr(v)} } type Vec1 struct { diff --git a/cimmarkdown_funcs.go b/cimmarkdown_funcs.go index c08a6173c..c54503f94 100644 --- a/cimmarkdown_funcs.go +++ b/cimmarkdown_funcs.go @@ -440,21 +440,19 @@ func (self *MarkdownConfig) LinkIcon() string { return C.GoString(C.wrap_MarkdownConfig_GetLinkIcon(selfArg)) } -func (self MarkdownConfig) SetUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self MarkdownConfig) SetUserData(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_MarkdownConfig_SetUserData(selfArg, vArg) + C.wrap_MarkdownConfig_SetUserData(selfArg, unsafe.Pointer(v)) } -func (self *MarkdownConfig) UserData() unsafe.Pointer { +func (self *MarkdownConfig) UserData() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_MarkdownConfig_GetUserData(selfArg)) + return uintptr(C.wrap_MarkdownConfig_GetUserData(selfArg)) } func (self MarkdownFormatInfo) SetType(v MarkdownFormatType) { @@ -713,21 +711,19 @@ func (self *MarkdownLinkCallbackData) LinkLength() int32 { return int32(C.wrap_MarkdownLinkCallbackData_GetLinkLength(selfArg)) } -func (self MarkdownLinkCallbackData) SetUserData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self MarkdownLinkCallbackData) SetUserData(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_MarkdownLinkCallbackData_SetUserData(selfArg, vArg) + C.wrap_MarkdownLinkCallbackData_SetUserData(selfArg, unsafe.Pointer(v)) } -func (self *MarkdownLinkCallbackData) UserData() unsafe.Pointer { +func (self *MarkdownLinkCallbackData) UserData() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_MarkdownLinkCallbackData_GetUserData(selfArg)) + return uintptr(C.wrap_MarkdownLinkCallbackData_GetUserData(selfArg)) } func (self MarkdownLinkCallbackData) SetIsImage(v bool) { diff --git a/cimnodes_typedefs.go b/cimnodes_typedefs.go index 3c2dc7cb8..946eb63a3 100644 --- a/cimnodes_typedefs.go +++ b/cimnodes_typedefs.go @@ -69,7 +69,7 @@ func newNodesIOFromC(cvalue *C.ImNodesIO) *NodesIO { } type NodesMiniMapNodeHoveringCallbackUserData struct { - Data unsafe.Pointer + Data uintptr } func (self *NodesMiniMapNodeHoveringCallbackUserData) handle() (*C.ImNodesMiniMapNodeHoveringCallbackUserData, func()) { @@ -79,13 +79,13 @@ func (self *NodesMiniMapNodeHoveringCallbackUserData) handle() (*C.ImNodesMiniMa func (selfStruct *NodesMiniMapNodeHoveringCallbackUserData) c() (result C.ImNodesMiniMapNodeHoveringCallbackUserData, fin func()) { self := selfStruct.Data - selfArg, selfFin := WrapVoidPtr(self) - return (C.ImNodesMiniMapNodeHoveringCallbackUserData)(selfArg), func() { selfFin() } + + return (C.ImNodesMiniMapNodeHoveringCallbackUserData)(unsafe.Pointer(self)), func() {} } func newNodesMiniMapNodeHoveringCallbackUserDataFromC(cvalue *C.ImNodesMiniMapNodeHoveringCallbackUserData) *NodesMiniMapNodeHoveringCallbackUserData { v := (unsafe.Pointer)(*cvalue) - return &NodesMiniMapNodeHoveringCallbackUserData{Data: unsafe.Pointer(v)} + return &NodesMiniMapNodeHoveringCallbackUserData{Data: uintptr(v)} } type NodesStyle struct { diff --git a/cimplot_funcs.go b/cimplot_funcs.go index ca2d13a0e..2f69d2a48 100644 --- a/cimplot_funcs.go +++ b/cimplot_funcs.go @@ -1938,37 +1938,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.ImPlot_Formatter_Default(C.double(value), buffArg, C.int(size), unsafe.Pointer(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.ImPlot_Formatter_Logit(C.double(value), buffArg, C.int(size), unsafe.Pointer(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.ImPlot_Formatter_Time(C.double(noname1), buffArg, C.int(size), unsafe.Pointer(data))) } func PlotGetAutoColor(idx PlotCol) Vec4 { @@ -9025,58 +9019,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.ImPlot_TransformForward_Log10(C.double(v), unsafe.Pointer(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.ImPlot_TransformForward_Logit(C.double(v), unsafe.Pointer(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.ImPlot_TransformForward_SymLog(C.double(v), unsafe.Pointer(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.ImPlot_TransformInverse_Log10(C.double(v), unsafe.Pointer(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.ImPlot_TransformInverse_Logit(C.double(v), unsafe.Pointer(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.ImPlot_TransformInverse_SymLog(C.double(v), unsafe.Pointer(noname1))) } func (self *PlotAxis) SetMax(_max float64) bool { @@ -13538,13 +13502,13 @@ func (self *FormatterTimeData) TimeDataGetSpec() PlotDateTimeSpec { return *newPlotDateTimeSpecFromC(func() *C.ImPlotDateTimeSpec { result := result; return &result }()) } -func (self *FormatterTimeData) TimeDataGetUserFormatterData() unsafe.Pointer { +func (self *FormatterTimeData) TimeDataGetUserFormatterData() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_Formatter_Time_Data_GetUserFormatterData(selfArg)) + return uintptr(C.wrap_Formatter_Time_Data_GetUserFormatterData(selfArg)) } func (self PlotAlignmentData) SetVertical(v bool) { @@ -13949,21 +13913,19 @@ func (self *PlotAxis) Ticker() PlotTicker { return *newPlotTickerFromC(func() *C.ImPlotTicker { result := result; return &result }()) } -func (self PlotAxis) SetFormatterData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self PlotAxis) SetFormatterData(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImPlotAxis_SetFormatterData(selfArg, vArg) + C.wrap_ImPlotAxis_SetFormatterData(selfArg, unsafe.Pointer(v)) } -func (self *PlotAxis) FormatterData() unsafe.Pointer { +func (self *PlotAxis) FormatterData() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImPlotAxis_GetFormatterData(selfArg)) + return uintptr(C.wrap_ImPlotAxis_GetFormatterData(selfArg)) } func (self PlotAxis) SetFormatSpec(v *[16]rune) { @@ -14056,21 +14018,19 @@ func (self *PlotAxis) PickerTimeMax() PlotTime { return *(&PlotTime{}).fromC(C.wrap_ImPlotAxis_GetPickerTimeMax(selfArg)) } -func (self PlotAxis) SetTransformData(v unsafe.Pointer) { - vArg, _ := WrapVoidPtr(v) - +func (self PlotAxis) SetTransformData(v uintptr) { selfArg, selfFin := self.handle() defer selfFin() - C.wrap_ImPlotAxis_SetTransformData(selfArg, vArg) + C.wrap_ImPlotAxis_SetTransformData(selfArg, unsafe.Pointer(v)) } -func (self *PlotAxis) TransformData() unsafe.Pointer { +func (self *PlotAxis) TransformData() uintptr { selfArg, selfFin := self.handle() defer func() { selfFin() }() - return unsafe.Pointer(C.wrap_ImPlotAxis_GetTransformData(selfArg)) + return uintptr(C.wrap_ImPlotAxis_GetTransformData(selfArg)) } func (self PlotAxis) SetPixelMin(v float32) { From c97b33e330964129716319c7d45935d7cc39e6c8 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Thu, 30 Nov 2023 14:19:23 +0100 Subject: [PATCH 45/68] fix build --- sdl_backend.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sdl_backend.go b/sdl_backend.go index 2af375256..f0ed319ee 100644 --- a/sdl_backend.go +++ b/sdl_backend.go @@ -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 From 2de5e33da63b3637fd2519f2de9a5a25f781d68a Mon Sep 17 00:00:00 2001 From: gucio321 Date: Thu, 30 Nov 2023 15:46:12 +0100 Subject: [PATCH 46/68] codegen: use export data to CData field fix #231 --- cmd/codegen/arguments_wrapper.go | 2 +- cmd/codegen/gengo_typedefs.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/codegen/arguments_wrapper.go b/cmd/codegen/arguments_wrapper.go index c25b9b867..a52c14ab6 100644 --- a/cmd/codegen/arguments_wrapper.go +++ b/cmd/codegen/arguments_wrapper.go @@ -101,7 +101,7 @@ func getArgWrapper( "const ImWchar*": simpleW("(*Wchar)", "(*C.ImWchar)"), "ImWchar16": simpleW("uint16", "C.ImWchar16"), "void*": simpleW("uintptr", "unsafe.Pointer"), - "const void*": simpleW("unsafe.Pointer", ""), + "const void*": simpleW("uintptr", "unsafe.Pointer"), "const ImVec2": wrappableW("Vec2", "C.ImVec2"), "const ImVec2*": wrappablePtrW("*Vec2", "C.ImVec2"), "ImVec2": wrappableW("Vec2", "C.ImVec2"), diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index ca42fb8e0..6bd84c0e3 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -216,17 +216,17 @@ func (self %[1]s) c() (C.%[2]s, func()) { // 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 { - data *C.%[2]s + CData *C.%[2]s } func (self *%[1]s) handle() (result *C.%[2]s, fin func()) { - return self.data, func() {} + return self.CData, func() {} } %[3]s func new%[1]sFromC(cvalue *C.%[2]s) *%[1]s { - return &%[1]s{data: cvalue} + return &%[1]s{CData: cvalue} } `, name.renameGoIdentifier(), name, toPlainValue) } From 9bc0016169f5bfd18a8c9801da2311b5c180d466 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Thu, 30 Nov 2023 15:56:28 +0100 Subject: [PATCH 47/68] regenerate code --- cimgui_funcs.go | 126 ++++---- cimgui_typedefs.go | 642 ++++++++++++++++++++-------------------- cimmarkdown_typedefs.go | 66 ++--- cimnodes_typedefs.go | 42 +-- cimplot_typedefs.go | 150 +++++----- 5 files changed, 516 insertions(+), 510 deletions(-) diff --git a/cimgui_funcs.go b/cimgui_funcs.go index 4e34045a7..054aa533f 100644 --- a/cimgui_funcs.go +++ b/cimgui_funcs.go @@ -894,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() @@ -902,7 +902,7 @@ 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.ImFontAtlas_AddFontFromMemoryCompressedTTF(selfArg, unsafe.Pointer(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. @@ -3130,13 +3130,13 @@ func (self *Window) InternalIDInt(n int32) ID { 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 *newIDFromC(func() *C.ImGuiID { result := C.ImGuiWindow_GetID_Ptr(selfArg, (ptr)); return &result }()) + return *newIDFromC(func() *C.ImGuiID { result := C.ImGuiWindow_GetID_Ptr(selfArg, unsafe.Pointer(ptr)); return &result }()) } // InternalIDStrV parameter default value hint: @@ -4453,19 +4453,19 @@ func InternalDataTypeApplyFromText(buf string, data_type DataType, p_data uintpt return C.igDataTypeApplyFromText(bufArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), formatArg) == C.bool(true) } -func InternalDataTypeApplyOp(data_type DataType, op int32, output uintptr, arg_1 unsafe.Pointer, arg_2 unsafe.Pointer) { - C.igDataTypeApplyOp(C.ImGuiDataType(data_type), C.int(op), unsafe.Pointer(output), (arg_1), (arg_2)) +func InternalDataTypeApplyOp(data_type DataType, op int32, output uintptr, arg_1 uintptr, arg_2 uintptr) { + C.igDataTypeApplyOp(C.ImGuiDataType(data_type), C.int(op), unsafe.Pointer(output), unsafe.Pointer(arg_1), unsafe.Pointer(arg_2)) } -func InternalDataTypeClamp(data_type DataType, p_data uintptr, p_min unsafe.Pointer, p_max unsafe.Pointer) bool { - return C.igDataTypeClamp(C.ImGuiDataType(data_type), unsafe.Pointer(p_data), (p_min), (p_max)) == C.bool(true) +func InternalDataTypeClamp(data_type DataType, p_data uintptr, p_min uintptr, p_max uintptr) bool { + return C.igDataTypeClamp(C.ImGuiDataType(data_type), unsafe.Pointer(p_data), unsafe.Pointer(p_min), unsafe.Pointer(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.igDataTypeCompare(C.ImGuiDataType(data_type), unsafe.Pointer(arg_1), unsafe.Pointer(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) @@ -4473,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.igDataTypeFormatString(bufArg, C.int(buf_size), C.ImGuiDataType(data_type), unsafe.Pointer(p_data), formatArg)) } func InternalDataTypeGetInfo(data_type DataType) *DataTypeInfo { @@ -4508,9 +4508,9 @@ 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) { +func InternalDebugHookIdInfo(id ID, data_type DataType, data_id uintptr, data_id_end uintptr) { idArg, idFin := id.c() - C.igDebugHookIdInfo(idArg, C.ImGuiDataType(data_type), (data_id), (data_id_end)) + C.igDebugHookIdInfo(idArg, C.ImGuiDataType(data_type), unsafe.Pointer(data_id), unsafe.Pointer(data_id_end)) idFin() } @@ -5068,7 +5068,7 @@ func DockSpaceOverViewportV(viewport *Viewport, flags DockNodeFlags, window_clas }()) } -func InternalDragBehavior(id ID, data_type DataType, p_v uintptr, v_speed float32, p_min unsafe.Pointer, p_max unsafe.Pointer, format string, flags SliderFlags) bool { +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) @@ -5076,7 +5076,7 @@ func InternalDragBehavior(id ID, data_type DataType, p_v uintptr, v_speed float3 idFin() formatFin() }() - return C.igDragBehavior(idArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_v), C.float(v_speed), (p_min), (p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) + return C.igDragBehavior(idArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_v), C.float(v_speed), unsafe.Pointer(p_min), unsafe.Pointer(p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) } // If v_min >= v_max we have no bound @@ -5335,7 +5335,7 @@ 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 uintptr, 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) formatArg, formatFin := WrapString(format) @@ -5343,7 +5343,7 @@ func DragScalarV(label string, data_type DataType, p_data uintptr, v_speed float labelFin() formatFin() }() - return C.igDragScalar(labelArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), C.float(v_speed), (p_min), (p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) + return C.igDragScalar(labelArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), C.float(v_speed), unsafe.Pointer(p_min), unsafe.Pointer(p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) } // DragScalarNV parameter default value hint: @@ -5352,7 +5352,7 @@ func DragScalarV(label string, data_type DataType, p_data uintptr, v_speed float // p_max: NULL // format: NULL // flags: 0 -func DragScalarNV(label string, data_type DataType, p_data uintptr, 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) formatArg, formatFin := WrapString(format) @@ -5360,7 +5360,7 @@ func DragScalarNV(label string, data_type DataType, p_data uintptr, components i labelFin() formatFin() }() - return C.igDragScalarN(labelArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), C.int(components), C.float(v_speed), (p_min), (p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) + return C.igDragScalarN(labelArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), C.int(components), C.float(v_speed), unsafe.Pointer(p_min), unsafe.Pointer(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. @@ -5946,8 +5946,8 @@ func InternalIDWithSeedStr(str_id_begin string, str_id_end string, seed ID) ID { }()) } -func IDPtr(ptr_id unsafe.Pointer) ID { - return *newIDFromC(func() *C.ImGuiID { result := C.igGetID_Ptr((ptr_id)); return &result }()) +func IDPtr(ptr_id uintptr) ID { + return *newIDFromC(func() *C.ImGuiID { result := C.igGetID_Ptr(unsafe.Pointer(ptr_id)); return &result }()) } // calculate unique ID (hash of whole ID stack + given parameter). e.g. if you want to query into ImGuiStorage yourself @@ -6677,13 +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 { +func InternalImHashDataV(data uintptr, data_size uint64, seed ID) ID { seedArg, seedFin := seed.c() defer func() { seedFin() }() - return *newIDFromC(func() *C.ImGuiID { result := C.igImHashData((data), C.xulong(data_size), seedArg); return &result }()) + return *newIDFromC(func() *C.ImGuiID { + result := C.igImHashData(unsafe.Pointer(data), C.xulong(data_size), seedArg) + return &result + }()) } // InternalImHashStrV parameter default value hint: @@ -7415,7 +7418,7 @@ 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 uintptr, 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) formatArg, formatFin := WrapString(format) @@ -7423,7 +7426,7 @@ func InputScalarV(label string, data_type DataType, p_data uintptr, p_step unsaf labelFin() formatFin() }() - return C.igInputScalar(labelArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), (p_step), (p_step_fast), formatArg, C.ImGuiInputTextFlags(flags)) == C.bool(true) + return C.igInputScalar(labelArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), unsafe.Pointer(p_step), unsafe.Pointer(p_step_fast), formatArg, C.ImGuiInputTextFlags(flags)) == C.bool(true) } // InputScalarNV parameter default value hint: @@ -7431,7 +7434,7 @@ func InputScalarV(label string, data_type DataType, p_data uintptr, p_step unsaf // p_step_fast: NULL // format: NULL // flags: 0 -func InputScalarNV(label string, data_type DataType, p_data uintptr, 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) formatArg, formatFin := WrapString(format) @@ -7439,7 +7442,7 @@ func InputScalarNV(label string, data_type DataType, p_data uintptr, components labelFin() formatFin() }() - return C.igInputScalarN(labelArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), C.int(components), (p_step), (p_step_fast), formatArg, C.ImGuiInputTextFlags(flags)) == C.bool(true) + return C.igInputScalarN(labelArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), C.int(components), unsafe.Pointer(p_step), unsafe.Pointer(p_step_fast), formatArg, C.ImGuiInputTextFlags(flags)) == C.bool(true) } func InternalInputTextDeactivateHook(id ID) { @@ -8342,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.igPushID_Ptr(unsafe.Pointer(ptr_id)) } // push string into the ID stack (will hash string). @@ -8843,13 +8846,13 @@ 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.igSetDragDropPayload(typeArgArg, unsafe.Pointer(data), C.xulong(sz), C.ImGuiCond(cond)) == C.bool(true) } func InternalSetFocusID(id ID, window *Window) { @@ -9425,7 +9428,7 @@ 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 uintptr, p_min unsafe.Pointer, p_max unsafe.Pointer, format string, flags SliderFlags, out_grab_bb *Rect) bool { +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) @@ -9435,7 +9438,7 @@ func InternalSliderBehavior(bb Rect, id ID, data_type DataType, p_v uintptr, p_m formatFin() out_grab_bbFin() }() - return C.igSliderBehavior(bb.toC(), idArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_v), (p_min), (p_max), formatArg, C.ImGuiSliderFlags(flags), out_grab_bbArg) == C.bool(true) + return C.igSliderBehavior(bb.toC(), idArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_v), unsafe.Pointer(p_min), unsafe.Pointer(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. @@ -9618,7 +9621,7 @@ 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 uintptr, 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) formatArg, formatFin := WrapString(format) @@ -9626,13 +9629,13 @@ func SliderScalarV(label string, data_type DataType, p_data uintptr, p_min unsaf labelFin() formatFin() }() - return C.igSliderScalar(labelArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), (p_min), (p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) + return C.igSliderScalar(labelArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), unsafe.Pointer(p_min), unsafe.Pointer(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 uintptr, 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) formatArg, formatFin := WrapString(format) @@ -9640,7 +9643,7 @@ func SliderScalarNV(label string, data_type DataType, p_data uintptr, components labelFin() formatFin() }() - return C.igSliderScalarN(labelArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), C.int(components), (p_min), (p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) + return C.igSliderScalarN(labelArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), C.int(components), unsafe.Pointer(p_min), unsafe.Pointer(p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) } // button with FramePadding=(0,0) to easily embed within text @@ -10374,7 +10377,7 @@ func InternalTempInputIsActive(id ID) bool { // 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 uintptr, 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) formatArg, formatFin := WrapString(format) @@ -10384,7 +10387,7 @@ func InternalTempInputScalarV(bb Rect, id ID, label string, data_type DataType, labelFin() formatFin() }() - return C.igTempInputScalar(bb.toC(), idArg, labelArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), formatArg, (p_clamp_min), (p_clamp_max)) == C.bool(true) + return C.igTempInputScalar(bb.toC(), idArg, labelArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), formatArg, unsafe.Pointer(p_clamp_min), unsafe.Pointer(p_clamp_max)) == C.bool(true) } func InternalTempInputText(bb Rect, id ID, label string, buf string, buf_size int32, flags InputTextFlags) bool { @@ -10493,13 +10496,13 @@ func InternalTreeNodeBehaviorV(id ID, flags TreeNodeFlags, label string, label_e 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(unsafe.Pointer(ptr_id), C.ImGuiTreeNodeFlags(flags), fmtArg) == C.bool(true) } // TreeNodeExStrV parameter default value hint: @@ -10542,13 +10545,13 @@ func InternalTreeNodeUpdateNextOpen(id ID, flags TreeNodeFlags) bool { } // " -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(unsafe.Pointer(ptr_id), fmtArg) == C.bool(true) } func TreeNodeStr(label string) bool { @@ -10585,8 +10588,8 @@ func InternalTreePushOverrideID(id ID) { } // " -func TreePushPtr(ptr_id unsafe.Pointer) { - C.igTreePush_Ptr((ptr_id)) +func TreePushPtr(ptr_id uintptr) { + C.igTreePush_Ptr(unsafe.Pointer(ptr_id)) } // ~ Indent()+PushId(). Already called by TreeNode() when returning true, but you can call TreePush/TreePop yourself if desired. @@ -10669,7 +10672,7 @@ 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 uintptr, 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) formatArg, formatFin := WrapString(format) @@ -10677,7 +10680,7 @@ func VSliderScalarV(label string, size Vec2, data_type DataType, p_data uintptr, labelFin() formatFin() }() - return C.igVSliderScalar(labelArg, size.toC(), C.ImGuiDataType(data_type), unsafe.Pointer(p_data), (p_min), (p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) + return C.igVSliderScalar(labelArg, size.toC(), C.ImGuiDataType(data_type), unsafe.Pointer(p_data), unsafe.Pointer(p_min), unsafe.Pointer(p_max), formatArg, C.ImGuiSliderFlags(flags)) == C.bool(true) } func ValueBool(prefix string, b bool) { @@ -10991,13 +10994,13 @@ 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, unsafe.Pointer(compressed_font_data), C.int(compressed_font_data_size), C.float(size_pixels))) } func (self *FontAtlas) AddFontFromMemoryTTF(font_data uintptr, font_data_size int32, size_pixels float32) *Font { @@ -11802,8 +11805,11 @@ func InternalImFileLoadToMemory(filename string, mode string) uintptr { return uintptr(C.wrap_igImFileLoadToMemory(filenameArg, modeArg)) } -func InternalImHashData(data unsafe.Pointer, data_size uint64) ID { - return *newIDFromC(func() *C.ImGuiID { result := C.wrap_igImHashData((data), C.xulong(data_size)); return &result }()) +func InternalImHashData(data uintptr, data_size uint64) ID { + return *newIDFromC(func() *C.ImGuiID { + result := C.wrap_igImHashData(unsafe.Pointer(data), C.xulong(data_size)) + return &result + }()) } func InternalImHashStr(data string) ID { @@ -12390,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, unsafe.Pointer(data), C.xulong(sz)) == C.bool(true) } func InternalSetItemKeyOwner(key Key) { @@ -12703,22 +12709,22 @@ 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 uintptr, 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) defer func() { labelFin() }() - return C.wrap_igSliderScalar(labelArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), (p_min), (p_max)) == C.bool(true) + return C.wrap_igSliderScalar(labelArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), unsafe.Pointer(p_min), unsafe.Pointer(p_max)) == C.bool(true) } -func SliderScalarN(label string, data_type DataType, p_data uintptr, 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) defer func() { labelFin() }() - return C.wrap_igSliderScalarN(labelArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), C.int(components), (p_min), (p_max)) == C.bool(true) + return C.wrap_igSliderScalarN(labelArg, C.ImGuiDataType(data_type), unsafe.Pointer(p_data), C.int(components), unsafe.Pointer(p_min), unsafe.Pointer(p_max)) == C.bool(true) } func InternalSplitterBehavior(bb Rect, id ID, axis Axis, size1 *float32, size2 *float32, min_size1 float32, min_size2 float32) bool { @@ -12867,13 +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 uintptr, 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) defer func() { labelFin() }() - return C.wrap_igVSliderScalar(labelArg, size.toC(), C.ImGuiDataType(data_type), unsafe.Pointer(p_data), (p_min), (p_max)) == C.bool(true) + return C.wrap_igVSliderScalar(labelArg, size.toC(), C.ImGuiDataType(data_type), unsafe.Pointer(p_data), unsafe.Pointer(p_min), unsafe.Pointer(p_max)) == C.bool(true) } func ValueFloat(prefix string, v float32) { diff --git a/cimgui_typedefs.go b/cimgui_typedefs.go index 6e9f0198c..b45547e65 100644 --- a/cimgui_typedefs.go +++ b/cimgui_typedefs.go @@ -31,11 +31,11 @@ func newBitArrayPtrFromC(cvalue *C.ImBitArrayPtr) *BitArrayPtr { } type BitVector struct { - data *C.ImBitVector + CData *C.ImBitVector } func (self *BitVector) handle() (result *C.ImBitVector, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self BitVector) c() (C.ImBitVector, func()) { @@ -44,15 +44,15 @@ func (self BitVector) c() (C.ImBitVector, func()) { } func newBitVectorFromC(cvalue *C.ImBitVector) *BitVector { - return &BitVector{data: cvalue} + return &BitVector{CData: cvalue} } type DrawChannel struct { - data *C.ImDrawChannel + CData *C.ImDrawChannel } func (self *DrawChannel) handle() (result *C.ImDrawChannel, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self DrawChannel) c() (C.ImDrawChannel, func()) { @@ -61,15 +61,15 @@ func (self DrawChannel) c() (C.ImDrawChannel, func()) { } func newDrawChannelFromC(cvalue *C.ImDrawChannel) *DrawChannel { - return &DrawChannel{data: cvalue} + return &DrawChannel{CData: cvalue} } type DrawCmd struct { - data *C.ImDrawCmd + CData *C.ImDrawCmd } func (self *DrawCmd) handle() (result *C.ImDrawCmd, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self DrawCmd) c() (C.ImDrawCmd, func()) { @@ -78,15 +78,15 @@ func (self DrawCmd) c() (C.ImDrawCmd, func()) { } func newDrawCmdFromC(cvalue *C.ImDrawCmd) *DrawCmd { - return &DrawCmd{data: cvalue} + return &DrawCmd{CData: cvalue} } type DrawCmdHeader struct { - data *C.ImDrawCmdHeader + CData *C.ImDrawCmdHeader } func (self *DrawCmdHeader) handle() (result *C.ImDrawCmdHeader, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self DrawCmdHeader) c() (C.ImDrawCmdHeader, func()) { @@ -95,15 +95,15 @@ func (self DrawCmdHeader) c() (C.ImDrawCmdHeader, func()) { } func newDrawCmdHeaderFromC(cvalue *C.ImDrawCmdHeader) *DrawCmdHeader { - return &DrawCmdHeader{data: cvalue} + return &DrawCmdHeader{CData: cvalue} } type DrawData struct { - data *C.ImDrawData + CData *C.ImDrawData } func (self *DrawData) handle() (result *C.ImDrawData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self DrawData) c() (C.ImDrawData, func()) { @@ -112,15 +112,15 @@ func (self DrawData) c() (C.ImDrawData, func()) { } func newDrawDataFromC(cvalue *C.ImDrawData) *DrawData { - return &DrawData{data: cvalue} + return &DrawData{CData: cvalue} } type DrawDataBuilder struct { - data *C.ImDrawDataBuilder + CData *C.ImDrawDataBuilder } func (self *DrawDataBuilder) handle() (result *C.ImDrawDataBuilder, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self DrawDataBuilder) c() (C.ImDrawDataBuilder, func()) { @@ -129,15 +129,15 @@ func (self DrawDataBuilder) c() (C.ImDrawDataBuilder, func()) { } func newDrawDataBuilderFromC(cvalue *C.ImDrawDataBuilder) *DrawDataBuilder { - return &DrawDataBuilder{data: cvalue} + return &DrawDataBuilder{CData: cvalue} } type DrawList struct { - data *C.ImDrawList + CData *C.ImDrawList } func (self *DrawList) handle() (result *C.ImDrawList, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self DrawList) c() (C.ImDrawList, func()) { @@ -146,15 +146,15 @@ func (self DrawList) c() (C.ImDrawList, func()) { } func newDrawListFromC(cvalue *C.ImDrawList) *DrawList { - return &DrawList{data: cvalue} + return &DrawList{CData: cvalue} } type DrawListSharedData struct { - data *C.ImDrawListSharedData + CData *C.ImDrawListSharedData } func (self *DrawListSharedData) handle() (result *C.ImDrawListSharedData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self DrawListSharedData) c() (C.ImDrawListSharedData, func()) { @@ -163,15 +163,15 @@ func (self DrawListSharedData) c() (C.ImDrawListSharedData, func()) { } func newDrawListSharedDataFromC(cvalue *C.ImDrawListSharedData) *DrawListSharedData { - return &DrawListSharedData{data: cvalue} + return &DrawListSharedData{CData: cvalue} } type DrawListSplitter struct { - data *C.ImDrawListSplitter + CData *C.ImDrawListSplitter } func (self *DrawListSplitter) handle() (result *C.ImDrawListSplitter, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self DrawListSplitter) c() (C.ImDrawListSplitter, func()) { @@ -180,15 +180,15 @@ func (self DrawListSplitter) c() (C.ImDrawListSplitter, func()) { } func newDrawListSplitterFromC(cvalue *C.ImDrawListSplitter) *DrawListSplitter { - return &DrawListSplitter{data: cvalue} + return &DrawListSplitter{CData: cvalue} } type DrawVert struct { - data *C.ImDrawVert + CData *C.ImDrawVert } func (self *DrawVert) handle() (result *C.ImDrawVert, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self DrawVert) c() (C.ImDrawVert, func()) { @@ -197,15 +197,15 @@ func (self DrawVert) c() (C.ImDrawVert, func()) { } func newDrawVertFromC(cvalue *C.ImDrawVert) *DrawVert { - return &DrawVert{data: cvalue} + return &DrawVert{CData: cvalue} } type Font struct { - data *C.ImFont + CData *C.ImFont } func (self *Font) handle() (result *C.ImFont, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self Font) c() (C.ImFont, func()) { @@ -214,15 +214,15 @@ func (self Font) c() (C.ImFont, func()) { } func newFontFromC(cvalue *C.ImFont) *Font { - return &Font{data: cvalue} + return &Font{CData: cvalue} } type FontAtlas struct { - data *C.ImFontAtlas + CData *C.ImFontAtlas } func (self *FontAtlas) handle() (result *C.ImFontAtlas, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self FontAtlas) c() (C.ImFontAtlas, func()) { @@ -231,15 +231,15 @@ func (self FontAtlas) c() (C.ImFontAtlas, func()) { } func newFontAtlasFromC(cvalue *C.ImFontAtlas) *FontAtlas { - return &FontAtlas{data: cvalue} + return &FontAtlas{CData: cvalue} } type FontAtlasCustomRect struct { - data *C.ImFontAtlasCustomRect + CData *C.ImFontAtlasCustomRect } func (self *FontAtlasCustomRect) handle() (result *C.ImFontAtlasCustomRect, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self FontAtlasCustomRect) c() (C.ImFontAtlasCustomRect, func()) { @@ -248,15 +248,15 @@ func (self FontAtlasCustomRect) c() (C.ImFontAtlasCustomRect, func()) { } func newFontAtlasCustomRectFromC(cvalue *C.ImFontAtlasCustomRect) *FontAtlasCustomRect { - return &FontAtlasCustomRect{data: cvalue} + return &FontAtlasCustomRect{CData: cvalue} } type FontBuilderIO struct { - data *C.ImFontBuilderIO + CData *C.ImFontBuilderIO } func (self *FontBuilderIO) handle() (result *C.ImFontBuilderIO, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self FontBuilderIO) c() (C.ImFontBuilderIO, func()) { @@ -265,15 +265,15 @@ func (self FontBuilderIO) c() (C.ImFontBuilderIO, func()) { } func newFontBuilderIOFromC(cvalue *C.ImFontBuilderIO) *FontBuilderIO { - return &FontBuilderIO{data: cvalue} + return &FontBuilderIO{CData: cvalue} } type FontConfig struct { - data *C.ImFontConfig + CData *C.ImFontConfig } func (self *FontConfig) handle() (result *C.ImFontConfig, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self FontConfig) c() (C.ImFontConfig, func()) { @@ -282,15 +282,15 @@ func (self FontConfig) c() (C.ImFontConfig, func()) { } func newFontConfigFromC(cvalue *C.ImFontConfig) *FontConfig { - return &FontConfig{data: cvalue} + return &FontConfig{CData: cvalue} } type FontGlyph struct { - data *C.ImFontGlyph + CData *C.ImFontGlyph } func (self *FontGlyph) handle() (result *C.ImFontGlyph, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self FontGlyph) c() (C.ImFontGlyph, func()) { @@ -299,15 +299,15 @@ func (self FontGlyph) c() (C.ImFontGlyph, func()) { } func newFontGlyphFromC(cvalue *C.ImFontGlyph) *FontGlyph { - return &FontGlyph{data: cvalue} + return &FontGlyph{CData: cvalue} } type FontGlyphRangesBuilder struct { - data *C.ImFontGlyphRangesBuilder + CData *C.ImFontGlyphRangesBuilder } func (self *FontGlyphRangesBuilder) handle() (result *C.ImFontGlyphRangesBuilder, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self FontGlyphRangesBuilder) c() (C.ImFontGlyphRangesBuilder, func()) { @@ -316,15 +316,15 @@ func (self FontGlyphRangesBuilder) c() (C.ImFontGlyphRangesBuilder, func()) { } func newFontGlyphRangesBuilderFromC(cvalue *C.ImFontGlyphRangesBuilder) *FontGlyphRangesBuilder { - return &FontGlyphRangesBuilder{data: cvalue} + return &FontGlyphRangesBuilder{CData: cvalue} } type ColorMod struct { - data *C.ImGuiColorMod + CData *C.ImGuiColorMod } func (self *ColorMod) handle() (result *C.ImGuiColorMod, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self ColorMod) c() (C.ImGuiColorMod, func()) { @@ -333,15 +333,15 @@ func (self ColorMod) c() (C.ImGuiColorMod, func()) { } func newColorModFromC(cvalue *C.ImGuiColorMod) *ColorMod { - return &ColorMod{data: cvalue} + return &ColorMod{CData: cvalue} } type ComboPreviewData struct { - data *C.ImGuiComboPreviewData + CData *C.ImGuiComboPreviewData } func (self *ComboPreviewData) handle() (result *C.ImGuiComboPreviewData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self ComboPreviewData) c() (C.ImGuiComboPreviewData, func()) { @@ -350,15 +350,15 @@ func (self ComboPreviewData) c() (C.ImGuiComboPreviewData, func()) { } func newComboPreviewDataFromC(cvalue *C.ImGuiComboPreviewData) *ComboPreviewData { - return &ComboPreviewData{data: cvalue} + return &ComboPreviewData{CData: cvalue} } type Context struct { - data *C.ImGuiContext + CData *C.ImGuiContext } func (self *Context) handle() (result *C.ImGuiContext, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self Context) c() (C.ImGuiContext, func()) { @@ -367,15 +367,15 @@ func (self Context) c() (C.ImGuiContext, func()) { } func newContextFromC(cvalue *C.ImGuiContext) *Context { - return &Context{data: cvalue} + return &Context{CData: cvalue} } type ContextHook struct { - data *C.ImGuiContextHook + CData *C.ImGuiContextHook } func (self *ContextHook) handle() (result *C.ImGuiContextHook, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self ContextHook) c() (C.ImGuiContextHook, func()) { @@ -384,15 +384,15 @@ func (self ContextHook) c() (C.ImGuiContextHook, func()) { } func newContextHookFromC(cvalue *C.ImGuiContextHook) *ContextHook { - return &ContextHook{data: cvalue} + return &ContextHook{CData: cvalue} } type DataTypeInfo struct { - data *C.ImGuiDataTypeInfo + CData *C.ImGuiDataTypeInfo } func (self *DataTypeInfo) handle() (result *C.ImGuiDataTypeInfo, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self DataTypeInfo) c() (C.ImGuiDataTypeInfo, func()) { @@ -401,15 +401,15 @@ func (self DataTypeInfo) c() (C.ImGuiDataTypeInfo, func()) { } func newDataTypeInfoFromC(cvalue *C.ImGuiDataTypeInfo) *DataTypeInfo { - return &DataTypeInfo{data: cvalue} + return &DataTypeInfo{CData: cvalue} } type DataTypeTempStorage struct { - data *C.ImGuiDataTypeTempStorage + CData *C.ImGuiDataTypeTempStorage } func (self *DataTypeTempStorage) handle() (result *C.ImGuiDataTypeTempStorage, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self DataTypeTempStorage) c() (C.ImGuiDataTypeTempStorage, func()) { @@ -418,15 +418,15 @@ func (self DataTypeTempStorage) c() (C.ImGuiDataTypeTempStorage, func()) { } func newDataTypeTempStorageFromC(cvalue *C.ImGuiDataTypeTempStorage) *DataTypeTempStorage { - return &DataTypeTempStorage{data: cvalue} + return &DataTypeTempStorage{CData: cvalue} } type DataVarInfo struct { - data *C.ImGuiDataVarInfo + CData *C.ImGuiDataVarInfo } func (self *DataVarInfo) handle() (result *C.ImGuiDataVarInfo, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self DataVarInfo) c() (C.ImGuiDataVarInfo, func()) { @@ -435,15 +435,15 @@ func (self DataVarInfo) c() (C.ImGuiDataVarInfo, func()) { } func newDataVarInfoFromC(cvalue *C.ImGuiDataVarInfo) *DataVarInfo { - return &DataVarInfo{data: cvalue} + return &DataVarInfo{CData: cvalue} } type DockContext struct { - data *C.ImGuiDockContext + CData *C.ImGuiDockContext } func (self *DockContext) handle() (result *C.ImGuiDockContext, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self DockContext) c() (C.ImGuiDockContext, func()) { @@ -452,15 +452,15 @@ func (self DockContext) c() (C.ImGuiDockContext, func()) { } func newDockContextFromC(cvalue *C.ImGuiDockContext) *DockContext { - return &DockContext{data: cvalue} + return &DockContext{CData: cvalue} } type DockNode struct { - data *C.ImGuiDockNode + CData *C.ImGuiDockNode } func (self *DockNode) handle() (result *C.ImGuiDockNode, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self DockNode) c() (C.ImGuiDockNode, func()) { @@ -469,39 +469,39 @@ func (self DockNode) c() (C.ImGuiDockNode, func()) { } func newDockNodeFromC(cvalue *C.ImGuiDockNode) *DockNode { - return &DockNode{data: cvalue} + return &DockNode{CData: cvalue} } type DockNodeSettings struct { - data *C.ImGuiDockNodeSettings + CData *C.ImGuiDockNodeSettings } func (self *DockNodeSettings) handle() (result *C.ImGuiDockNodeSettings, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func newDockNodeSettingsFromC(cvalue *C.ImGuiDockNodeSettings) *DockNodeSettings { - return &DockNodeSettings{data: cvalue} + return &DockNodeSettings{CData: cvalue} } type DockRequest struct { - data *C.ImGuiDockRequest + CData *C.ImGuiDockRequest } func (self *DockRequest) handle() (result *C.ImGuiDockRequest, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func newDockRequestFromC(cvalue *C.ImGuiDockRequest) *DockRequest { - return &DockRequest{data: cvalue} + return &DockRequest{CData: cvalue} } type GroupData struct { - data *C.ImGuiGroupData + CData *C.ImGuiGroupData } func (self *GroupData) handle() (result *C.ImGuiGroupData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self GroupData) c() (C.ImGuiGroupData, func()) { @@ -510,7 +510,7 @@ func (self GroupData) c() (C.ImGuiGroupData, func()) { } func newGroupDataFromC(cvalue *C.ImGuiGroupData) *GroupData { - return &GroupData{data: cvalue} + return &GroupData{CData: cvalue} } type ID uint32 @@ -530,11 +530,11 @@ func newIDFromC(cvalue *C.ImGuiID) *ID { } type IO struct { - data *C.ImGuiIO + CData *C.ImGuiIO } func (self *IO) handle() (result *C.ImGuiIO, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self IO) c() (C.ImGuiIO, func()) { @@ -543,15 +543,15 @@ func (self IO) c() (C.ImGuiIO, func()) { } func newIOFromC(cvalue *C.ImGuiIO) *IO { - return &IO{data: cvalue} + return &IO{CData: cvalue} } type InputEvent struct { - data *C.ImGuiInputEvent + CData *C.ImGuiInputEvent } func (self *InputEvent) handle() (result *C.ImGuiInputEvent, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self InputEvent) c() (C.ImGuiInputEvent, func()) { @@ -560,15 +560,15 @@ func (self InputEvent) c() (C.ImGuiInputEvent, func()) { } func newInputEventFromC(cvalue *C.ImGuiInputEvent) *InputEvent { - return &InputEvent{data: cvalue} + return &InputEvent{CData: cvalue} } type InputEventAppFocused struct { - data *C.ImGuiInputEventAppFocused + CData *C.ImGuiInputEventAppFocused } func (self *InputEventAppFocused) handle() (result *C.ImGuiInputEventAppFocused, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self InputEventAppFocused) c() (C.ImGuiInputEventAppFocused, func()) { @@ -577,15 +577,15 @@ func (self InputEventAppFocused) c() (C.ImGuiInputEventAppFocused, func()) { } func newInputEventAppFocusedFromC(cvalue *C.ImGuiInputEventAppFocused) *InputEventAppFocused { - return &InputEventAppFocused{data: cvalue} + return &InputEventAppFocused{CData: cvalue} } type InputEventKey struct { - data *C.ImGuiInputEventKey + CData *C.ImGuiInputEventKey } func (self *InputEventKey) handle() (result *C.ImGuiInputEventKey, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self InputEventKey) c() (C.ImGuiInputEventKey, func()) { @@ -594,15 +594,15 @@ func (self InputEventKey) c() (C.ImGuiInputEventKey, func()) { } func newInputEventKeyFromC(cvalue *C.ImGuiInputEventKey) *InputEventKey { - return &InputEventKey{data: cvalue} + return &InputEventKey{CData: cvalue} } type InputEventMouseButton struct { - data *C.ImGuiInputEventMouseButton + CData *C.ImGuiInputEventMouseButton } func (self *InputEventMouseButton) handle() (result *C.ImGuiInputEventMouseButton, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self InputEventMouseButton) c() (C.ImGuiInputEventMouseButton, func()) { @@ -611,15 +611,15 @@ func (self InputEventMouseButton) c() (C.ImGuiInputEventMouseButton, func()) { } func newInputEventMouseButtonFromC(cvalue *C.ImGuiInputEventMouseButton) *InputEventMouseButton { - return &InputEventMouseButton{data: cvalue} + return &InputEventMouseButton{CData: cvalue} } type InputEventMousePos struct { - data *C.ImGuiInputEventMousePos + CData *C.ImGuiInputEventMousePos } func (self *InputEventMousePos) handle() (result *C.ImGuiInputEventMousePos, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self InputEventMousePos) c() (C.ImGuiInputEventMousePos, func()) { @@ -628,15 +628,15 @@ func (self InputEventMousePos) c() (C.ImGuiInputEventMousePos, func()) { } func newInputEventMousePosFromC(cvalue *C.ImGuiInputEventMousePos) *InputEventMousePos { - return &InputEventMousePos{data: cvalue} + return &InputEventMousePos{CData: cvalue} } type InputEventMouseViewport struct { - data *C.ImGuiInputEventMouseViewport + CData *C.ImGuiInputEventMouseViewport } func (self *InputEventMouseViewport) handle() (result *C.ImGuiInputEventMouseViewport, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self InputEventMouseViewport) c() (C.ImGuiInputEventMouseViewport, func()) { @@ -645,15 +645,15 @@ func (self InputEventMouseViewport) c() (C.ImGuiInputEventMouseViewport, func()) } func newInputEventMouseViewportFromC(cvalue *C.ImGuiInputEventMouseViewport) *InputEventMouseViewport { - return &InputEventMouseViewport{data: cvalue} + return &InputEventMouseViewport{CData: cvalue} } type InputEventMouseWheel struct { - data *C.ImGuiInputEventMouseWheel + CData *C.ImGuiInputEventMouseWheel } func (self *InputEventMouseWheel) handle() (result *C.ImGuiInputEventMouseWheel, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self InputEventMouseWheel) c() (C.ImGuiInputEventMouseWheel, func()) { @@ -662,15 +662,15 @@ func (self InputEventMouseWheel) c() (C.ImGuiInputEventMouseWheel, func()) { } func newInputEventMouseWheelFromC(cvalue *C.ImGuiInputEventMouseWheel) *InputEventMouseWheel { - return &InputEventMouseWheel{data: cvalue} + return &InputEventMouseWheel{CData: cvalue} } type InputEventText struct { - data *C.ImGuiInputEventText + CData *C.ImGuiInputEventText } func (self *InputEventText) handle() (result *C.ImGuiInputEventText, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self InputEventText) c() (C.ImGuiInputEventText, func()) { @@ -679,15 +679,15 @@ func (self InputEventText) c() (C.ImGuiInputEventText, func()) { } func newInputEventTextFromC(cvalue *C.ImGuiInputEventText) *InputEventText { - return &InputEventText{data: cvalue} + return &InputEventText{CData: cvalue} } type InputTextCallbackData struct { - data *C.ImGuiInputTextCallbackData + CData *C.ImGuiInputTextCallbackData } func (self *InputTextCallbackData) handle() (result *C.ImGuiInputTextCallbackData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self InputTextCallbackData) c() (C.ImGuiInputTextCallbackData, func()) { @@ -696,27 +696,27 @@ func (self InputTextCallbackData) c() (C.ImGuiInputTextCallbackData, func()) { } func newInputTextCallbackDataFromC(cvalue *C.ImGuiInputTextCallbackData) *InputTextCallbackData { - return &InputTextCallbackData{data: cvalue} + return &InputTextCallbackData{CData: cvalue} } type InputTextDeactivateData struct { - data *C.ImGuiInputTextDeactivateData + CData *C.ImGuiInputTextDeactivateData } func (self *InputTextDeactivateData) handle() (result *C.ImGuiInputTextDeactivateData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func newInputTextDeactivateDataFromC(cvalue *C.ImGuiInputTextDeactivateData) *InputTextDeactivateData { - return &InputTextDeactivateData{data: cvalue} + return &InputTextDeactivateData{CData: cvalue} } type InputTextDeactivatedState struct { - data *C.ImGuiInputTextDeactivatedState + CData *C.ImGuiInputTextDeactivatedState } func (self *InputTextDeactivatedState) handle() (result *C.ImGuiInputTextDeactivatedState, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self InputTextDeactivatedState) c() (C.ImGuiInputTextDeactivatedState, func()) { @@ -725,15 +725,15 @@ func (self InputTextDeactivatedState) c() (C.ImGuiInputTextDeactivatedState, fun } func newInputTextDeactivatedStateFromC(cvalue *C.ImGuiInputTextDeactivatedState) *InputTextDeactivatedState { - return &InputTextDeactivatedState{data: cvalue} + return &InputTextDeactivatedState{CData: cvalue} } type InputTextState struct { - data *C.ImGuiInputTextState + CData *C.ImGuiInputTextState } func (self *InputTextState) handle() (result *C.ImGuiInputTextState, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self InputTextState) c() (C.ImGuiInputTextState, func()) { @@ -742,7 +742,7 @@ func (self InputTextState) c() (C.ImGuiInputTextState, func()) { } func newInputTextStateFromC(cvalue *C.ImGuiInputTextState) *InputTextState { - return &InputTextState{data: cvalue} + return &InputTextState{CData: cvalue} } type KeyChord int32 @@ -762,11 +762,11 @@ func newKeyChordFromC(cvalue *C.ImGuiKeyChord) *KeyChord { } type KeyData struct { - data *C.ImGuiKeyData + CData *C.ImGuiKeyData } func (self *KeyData) handle() (result *C.ImGuiKeyData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self KeyData) c() (C.ImGuiKeyData, func()) { @@ -775,15 +775,15 @@ func (self KeyData) c() (C.ImGuiKeyData, func()) { } func newKeyDataFromC(cvalue *C.ImGuiKeyData) *KeyData { - return &KeyData{data: cvalue} + return &KeyData{CData: cvalue} } type KeyOwnerData struct { - data *C.ImGuiKeyOwnerData + CData *C.ImGuiKeyOwnerData } func (self *KeyOwnerData) handle() (result *C.ImGuiKeyOwnerData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self KeyOwnerData) c() (C.ImGuiKeyOwnerData, func()) { @@ -792,15 +792,15 @@ func (self KeyOwnerData) c() (C.ImGuiKeyOwnerData, func()) { } func newKeyOwnerDataFromC(cvalue *C.ImGuiKeyOwnerData) *KeyOwnerData { - return &KeyOwnerData{data: cvalue} + return &KeyOwnerData{CData: cvalue} } type KeyRoutingData struct { - data *C.ImGuiKeyRoutingData + CData *C.ImGuiKeyRoutingData } func (self *KeyRoutingData) handle() (result *C.ImGuiKeyRoutingData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self KeyRoutingData) c() (C.ImGuiKeyRoutingData, func()) { @@ -809,15 +809,15 @@ func (self KeyRoutingData) c() (C.ImGuiKeyRoutingData, func()) { } func newKeyRoutingDataFromC(cvalue *C.ImGuiKeyRoutingData) *KeyRoutingData { - return &KeyRoutingData{data: cvalue} + return &KeyRoutingData{CData: cvalue} } type KeyRoutingTable struct { - data *C.ImGuiKeyRoutingTable + CData *C.ImGuiKeyRoutingTable } func (self *KeyRoutingTable) handle() (result *C.ImGuiKeyRoutingTable, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self KeyRoutingTable) c() (C.ImGuiKeyRoutingTable, func()) { @@ -826,15 +826,15 @@ func (self KeyRoutingTable) c() (C.ImGuiKeyRoutingTable, func()) { } func newKeyRoutingTableFromC(cvalue *C.ImGuiKeyRoutingTable) *KeyRoutingTable { - return &KeyRoutingTable{data: cvalue} + return &KeyRoutingTable{CData: cvalue} } type LastItemData struct { - data *C.ImGuiLastItemData + CData *C.ImGuiLastItemData } func (self *LastItemData) handle() (result *C.ImGuiLastItemData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self LastItemData) c() (C.ImGuiLastItemData, func()) { @@ -843,15 +843,15 @@ func (self LastItemData) c() (C.ImGuiLastItemData, func()) { } func newLastItemDataFromC(cvalue *C.ImGuiLastItemData) *LastItemData { - return &LastItemData{data: cvalue} + return &LastItemData{CData: cvalue} } type ListClipper struct { - data *C.ImGuiListClipper + CData *C.ImGuiListClipper } func (self *ListClipper) handle() (result *C.ImGuiListClipper, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self ListClipper) c() (C.ImGuiListClipper, func()) { @@ -860,15 +860,15 @@ func (self ListClipper) c() (C.ImGuiListClipper, func()) { } func newListClipperFromC(cvalue *C.ImGuiListClipper) *ListClipper { - return &ListClipper{data: cvalue} + return &ListClipper{CData: cvalue} } type ListClipperData struct { - data *C.ImGuiListClipperData + CData *C.ImGuiListClipperData } func (self *ListClipperData) handle() (result *C.ImGuiListClipperData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self ListClipperData) c() (C.ImGuiListClipperData, func()) { @@ -877,15 +877,15 @@ func (self ListClipperData) c() (C.ImGuiListClipperData, func()) { } func newListClipperDataFromC(cvalue *C.ImGuiListClipperData) *ListClipperData { - return &ListClipperData{data: cvalue} + return &ListClipperData{CData: cvalue} } type ListClipperRange struct { - data *C.ImGuiListClipperRange + CData *C.ImGuiListClipperRange } func (self *ListClipperRange) handle() (result *C.ImGuiListClipperRange, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self ListClipperRange) c() (C.ImGuiListClipperRange, func()) { @@ -894,15 +894,15 @@ func (self ListClipperRange) c() (C.ImGuiListClipperRange, func()) { } func newListClipperRangeFromC(cvalue *C.ImGuiListClipperRange) *ListClipperRange { - return &ListClipperRange{data: cvalue} + return &ListClipperRange{CData: cvalue} } type LocEntry struct { - data *C.ImGuiLocEntry + CData *C.ImGuiLocEntry } func (self *LocEntry) handle() (result *C.ImGuiLocEntry, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self LocEntry) c() (C.ImGuiLocEntry, func()) { @@ -911,15 +911,15 @@ func (self LocEntry) c() (C.ImGuiLocEntry, func()) { } func newLocEntryFromC(cvalue *C.ImGuiLocEntry) *LocEntry { - return &LocEntry{data: cvalue} + return &LocEntry{CData: cvalue} } type MenuColumns struct { - data *C.ImGuiMenuColumns + CData *C.ImGuiMenuColumns } func (self *MenuColumns) handle() (result *C.ImGuiMenuColumns, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self MenuColumns) c() (C.ImGuiMenuColumns, func()) { @@ -928,15 +928,15 @@ func (self MenuColumns) c() (C.ImGuiMenuColumns, func()) { } func newMenuColumnsFromC(cvalue *C.ImGuiMenuColumns) *MenuColumns { - return &MenuColumns{data: cvalue} + return &MenuColumns{CData: cvalue} } type MetricsConfig struct { - data *C.ImGuiMetricsConfig + CData *C.ImGuiMetricsConfig } func (self *MetricsConfig) handle() (result *C.ImGuiMetricsConfig, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self MetricsConfig) c() (C.ImGuiMetricsConfig, func()) { @@ -945,15 +945,15 @@ func (self MetricsConfig) c() (C.ImGuiMetricsConfig, func()) { } func newMetricsConfigFromC(cvalue *C.ImGuiMetricsConfig) *MetricsConfig { - return &MetricsConfig{data: cvalue} + return &MetricsConfig{CData: cvalue} } type NavItemData struct { - data *C.ImGuiNavItemData + CData *C.ImGuiNavItemData } func (self *NavItemData) handle() (result *C.ImGuiNavItemData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self NavItemData) c() (C.ImGuiNavItemData, func()) { @@ -962,15 +962,15 @@ func (self NavItemData) c() (C.ImGuiNavItemData, func()) { } func newNavItemDataFromC(cvalue *C.ImGuiNavItemData) *NavItemData { - return &NavItemData{data: cvalue} + return &NavItemData{CData: cvalue} } type NavTreeNodeData struct { - data *C.ImGuiNavTreeNodeData + CData *C.ImGuiNavTreeNodeData } func (self *NavTreeNodeData) handle() (result *C.ImGuiNavTreeNodeData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self NavTreeNodeData) c() (C.ImGuiNavTreeNodeData, func()) { @@ -979,15 +979,15 @@ func (self NavTreeNodeData) c() (C.ImGuiNavTreeNodeData, func()) { } func newNavTreeNodeDataFromC(cvalue *C.ImGuiNavTreeNodeData) *NavTreeNodeData { - return &NavTreeNodeData{data: cvalue} + return &NavTreeNodeData{CData: cvalue} } type NextItemData struct { - data *C.ImGuiNextItemData + CData *C.ImGuiNextItemData } func (self *NextItemData) handle() (result *C.ImGuiNextItemData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self NextItemData) c() (C.ImGuiNextItemData, func()) { @@ -996,15 +996,15 @@ func (self NextItemData) c() (C.ImGuiNextItemData, func()) { } func newNextItemDataFromC(cvalue *C.ImGuiNextItemData) *NextItemData { - return &NextItemData{data: cvalue} + return &NextItemData{CData: cvalue} } type NextWindowData struct { - data *C.ImGuiNextWindowData + CData *C.ImGuiNextWindowData } func (self *NextWindowData) handle() (result *C.ImGuiNextWindowData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self NextWindowData) c() (C.ImGuiNextWindowData, func()) { @@ -1013,15 +1013,15 @@ func (self NextWindowData) c() (C.ImGuiNextWindowData, func()) { } func newNextWindowDataFromC(cvalue *C.ImGuiNextWindowData) *NextWindowData { - return &NextWindowData{data: cvalue} + return &NextWindowData{CData: cvalue} } type OldColumnData struct { - data *C.ImGuiOldColumnData + CData *C.ImGuiOldColumnData } func (self *OldColumnData) handle() (result *C.ImGuiOldColumnData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self OldColumnData) c() (C.ImGuiOldColumnData, func()) { @@ -1030,15 +1030,15 @@ func (self OldColumnData) c() (C.ImGuiOldColumnData, func()) { } func newOldColumnDataFromC(cvalue *C.ImGuiOldColumnData) *OldColumnData { - return &OldColumnData{data: cvalue} + return &OldColumnData{CData: cvalue} } type OldColumns struct { - data *C.ImGuiOldColumns + CData *C.ImGuiOldColumns } func (self *OldColumns) handle() (result *C.ImGuiOldColumns, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self OldColumns) c() (C.ImGuiOldColumns, func()) { @@ -1047,15 +1047,15 @@ func (self OldColumns) c() (C.ImGuiOldColumns, func()) { } func newOldColumnsFromC(cvalue *C.ImGuiOldColumns) *OldColumns { - return &OldColumns{data: cvalue} + return &OldColumns{CData: cvalue} } type OnceUponAFrame struct { - data *C.ImGuiOnceUponAFrame + CData *C.ImGuiOnceUponAFrame } func (self *OnceUponAFrame) handle() (result *C.ImGuiOnceUponAFrame, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self OnceUponAFrame) c() (C.ImGuiOnceUponAFrame, func()) { @@ -1064,15 +1064,15 @@ func (self OnceUponAFrame) c() (C.ImGuiOnceUponAFrame, func()) { } func newOnceUponAFrameFromC(cvalue *C.ImGuiOnceUponAFrame) *OnceUponAFrame { - return &OnceUponAFrame{data: cvalue} + return &OnceUponAFrame{CData: cvalue} } type Payload struct { - data *C.ImGuiPayload + CData *C.ImGuiPayload } func (self *Payload) handle() (result *C.ImGuiPayload, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self Payload) c() (C.ImGuiPayload, func()) { @@ -1081,15 +1081,15 @@ func (self Payload) c() (C.ImGuiPayload, func()) { } func newPayloadFromC(cvalue *C.ImGuiPayload) *Payload { - return &Payload{data: cvalue} + return &Payload{CData: cvalue} } type PlatformIO struct { - data *C.ImGuiPlatformIO + CData *C.ImGuiPlatformIO } func (self *PlatformIO) handle() (result *C.ImGuiPlatformIO, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PlatformIO) c() (C.ImGuiPlatformIO, func()) { @@ -1098,15 +1098,15 @@ func (self PlatformIO) c() (C.ImGuiPlatformIO, func()) { } func newPlatformIOFromC(cvalue *C.ImGuiPlatformIO) *PlatformIO { - return &PlatformIO{data: cvalue} + return &PlatformIO{CData: cvalue} } type PlatformImeData struct { - data *C.ImGuiPlatformImeData + CData *C.ImGuiPlatformImeData } func (self *PlatformImeData) handle() (result *C.ImGuiPlatformImeData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PlatformImeData) c() (C.ImGuiPlatformImeData, func()) { @@ -1115,15 +1115,15 @@ func (self PlatformImeData) c() (C.ImGuiPlatformImeData, func()) { } func newPlatformImeDataFromC(cvalue *C.ImGuiPlatformImeData) *PlatformImeData { - return &PlatformImeData{data: cvalue} + return &PlatformImeData{CData: cvalue} } type PlatformMonitor struct { - data *C.ImGuiPlatformMonitor + CData *C.ImGuiPlatformMonitor } func (self *PlatformMonitor) handle() (result *C.ImGuiPlatformMonitor, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PlatformMonitor) c() (C.ImGuiPlatformMonitor, func()) { @@ -1132,15 +1132,15 @@ func (self PlatformMonitor) c() (C.ImGuiPlatformMonitor, func()) { } func newPlatformMonitorFromC(cvalue *C.ImGuiPlatformMonitor) *PlatformMonitor { - return &PlatformMonitor{data: cvalue} + return &PlatformMonitor{CData: cvalue} } type PopupData struct { - data *C.ImGuiPopupData + CData *C.ImGuiPopupData } func (self *PopupData) handle() (result *C.ImGuiPopupData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PopupData) c() (C.ImGuiPopupData, func()) { @@ -1149,15 +1149,15 @@ func (self PopupData) c() (C.ImGuiPopupData, func()) { } func newPopupDataFromC(cvalue *C.ImGuiPopupData) *PopupData { - return &PopupData{data: cvalue} + return &PopupData{CData: cvalue} } type PtrOrIndex struct { - data *C.ImGuiPtrOrIndex + CData *C.ImGuiPtrOrIndex } func (self *PtrOrIndex) handle() (result *C.ImGuiPtrOrIndex, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PtrOrIndex) c() (C.ImGuiPtrOrIndex, func()) { @@ -1166,15 +1166,15 @@ func (self PtrOrIndex) c() (C.ImGuiPtrOrIndex, func()) { } func newPtrOrIndexFromC(cvalue *C.ImGuiPtrOrIndex) *PtrOrIndex { - return &PtrOrIndex{data: cvalue} + return &PtrOrIndex{CData: cvalue} } type SettingsHandler struct { - data *C.ImGuiSettingsHandler + CData *C.ImGuiSettingsHandler } func (self *SettingsHandler) handle() (result *C.ImGuiSettingsHandler, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self SettingsHandler) c() (C.ImGuiSettingsHandler, func()) { @@ -1183,15 +1183,15 @@ func (self SettingsHandler) c() (C.ImGuiSettingsHandler, func()) { } func newSettingsHandlerFromC(cvalue *C.ImGuiSettingsHandler) *SettingsHandler { - return &SettingsHandler{data: cvalue} + return &SettingsHandler{CData: cvalue} } type ShrinkWidthItem struct { - data *C.ImGuiShrinkWidthItem + CData *C.ImGuiShrinkWidthItem } func (self *ShrinkWidthItem) handle() (result *C.ImGuiShrinkWidthItem, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self ShrinkWidthItem) c() (C.ImGuiShrinkWidthItem, func()) { @@ -1200,15 +1200,15 @@ func (self ShrinkWidthItem) c() (C.ImGuiShrinkWidthItem, func()) { } func newShrinkWidthItemFromC(cvalue *C.ImGuiShrinkWidthItem) *ShrinkWidthItem { - return &ShrinkWidthItem{data: cvalue} + return &ShrinkWidthItem{CData: cvalue} } type SizeCallbackData struct { - data *C.ImGuiSizeCallbackData + CData *C.ImGuiSizeCallbackData } func (self *SizeCallbackData) handle() (result *C.ImGuiSizeCallbackData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self SizeCallbackData) c() (C.ImGuiSizeCallbackData, func()) { @@ -1217,15 +1217,15 @@ func (self SizeCallbackData) c() (C.ImGuiSizeCallbackData, func()) { } func newSizeCallbackDataFromC(cvalue *C.ImGuiSizeCallbackData) *SizeCallbackData { - return &SizeCallbackData{data: cvalue} + return &SizeCallbackData{CData: cvalue} } type StackLevelInfo struct { - data *C.ImGuiStackLevelInfo + CData *C.ImGuiStackLevelInfo } func (self *StackLevelInfo) handle() (result *C.ImGuiStackLevelInfo, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self StackLevelInfo) c() (C.ImGuiStackLevelInfo, func()) { @@ -1234,15 +1234,15 @@ func (self StackLevelInfo) c() (C.ImGuiStackLevelInfo, func()) { } func newStackLevelInfoFromC(cvalue *C.ImGuiStackLevelInfo) *StackLevelInfo { - return &StackLevelInfo{data: cvalue} + return &StackLevelInfo{CData: cvalue} } type StackSizes struct { - data *C.ImGuiStackSizes + CData *C.ImGuiStackSizes } func (self *StackSizes) handle() (result *C.ImGuiStackSizes, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self StackSizes) c() (C.ImGuiStackSizes, func()) { @@ -1251,15 +1251,15 @@ func (self StackSizes) c() (C.ImGuiStackSizes, func()) { } func newStackSizesFromC(cvalue *C.ImGuiStackSizes) *StackSizes { - return &StackSizes{data: cvalue} + return &StackSizes{CData: cvalue} } type StackTool struct { - data *C.ImGuiStackTool + CData *C.ImGuiStackTool } func (self *StackTool) handle() (result *C.ImGuiStackTool, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self StackTool) c() (C.ImGuiStackTool, func()) { @@ -1268,15 +1268,15 @@ func (self StackTool) c() (C.ImGuiStackTool, func()) { } func newStackToolFromC(cvalue *C.ImGuiStackTool) *StackTool { - return &StackTool{data: cvalue} + return &StackTool{CData: cvalue} } type Storage struct { - data *C.ImGuiStorage + CData *C.ImGuiStorage } func (self *Storage) handle() (result *C.ImGuiStorage, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self Storage) c() (C.ImGuiStorage, func()) { @@ -1285,15 +1285,15 @@ func (self Storage) c() (C.ImGuiStorage, func()) { } func newStorageFromC(cvalue *C.ImGuiStorage) *Storage { - return &Storage{data: cvalue} + return &Storage{CData: cvalue} } type StoragePair struct { - data *C.ImGuiStoragePair + CData *C.ImGuiStoragePair } func (self *StoragePair) handle() (result *C.ImGuiStoragePair, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self StoragePair) c() (C.ImGuiStoragePair, func()) { @@ -1302,15 +1302,15 @@ func (self StoragePair) c() (C.ImGuiStoragePair, func()) { } func newStoragePairFromC(cvalue *C.ImGuiStoragePair) *StoragePair { - return &StoragePair{data: cvalue} + return &StoragePair{CData: cvalue} } type Style struct { - data *C.ImGuiStyle + CData *C.ImGuiStyle } func (self *Style) handle() (result *C.ImGuiStyle, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self Style) c() (C.ImGuiStyle, func()) { @@ -1319,15 +1319,15 @@ func (self Style) c() (C.ImGuiStyle, func()) { } func newStyleFromC(cvalue *C.ImGuiStyle) *Style { - return &Style{data: cvalue} + return &Style{CData: cvalue} } type StyleMod struct { - data *C.ImGuiStyleMod + CData *C.ImGuiStyleMod } func (self *StyleMod) handle() (result *C.ImGuiStyleMod, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self StyleMod) c() (C.ImGuiStyleMod, func()) { @@ -1336,15 +1336,15 @@ func (self StyleMod) c() (C.ImGuiStyleMod, func()) { } func newStyleModFromC(cvalue *C.ImGuiStyleMod) *StyleMod { - return &StyleMod{data: cvalue} + return &StyleMod{CData: cvalue} } type TabBar struct { - data *C.ImGuiTabBar + CData *C.ImGuiTabBar } func (self *TabBar) handle() (result *C.ImGuiTabBar, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self TabBar) c() (C.ImGuiTabBar, func()) { @@ -1353,15 +1353,15 @@ func (self TabBar) c() (C.ImGuiTabBar, func()) { } func newTabBarFromC(cvalue *C.ImGuiTabBar) *TabBar { - return &TabBar{data: cvalue} + return &TabBar{CData: cvalue} } type TabItem struct { - data *C.ImGuiTabItem + CData *C.ImGuiTabItem } func (self *TabItem) handle() (result *C.ImGuiTabItem, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self TabItem) c() (C.ImGuiTabItem, func()) { @@ -1370,15 +1370,15 @@ func (self TabItem) c() (C.ImGuiTabItem, func()) { } func newTabItemFromC(cvalue *C.ImGuiTabItem) *TabItem { - return &TabItem{data: cvalue} + return &TabItem{CData: cvalue} } type Table struct { - data *C.ImGuiTable + CData *C.ImGuiTable } func (self *Table) handle() (result *C.ImGuiTable, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self Table) c() (C.ImGuiTable, func()) { @@ -1387,15 +1387,15 @@ func (self Table) c() (C.ImGuiTable, func()) { } func newTableFromC(cvalue *C.ImGuiTable) *Table { - return &Table{data: cvalue} + return &Table{CData: cvalue} } type TableCellData struct { - data *C.ImGuiTableCellData + CData *C.ImGuiTableCellData } func (self *TableCellData) handle() (result *C.ImGuiTableCellData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self TableCellData) c() (C.ImGuiTableCellData, func()) { @@ -1404,15 +1404,15 @@ func (self TableCellData) c() (C.ImGuiTableCellData, func()) { } func newTableCellDataFromC(cvalue *C.ImGuiTableCellData) *TableCellData { - return &TableCellData{data: cvalue} + return &TableCellData{CData: cvalue} } type TableColumn struct { - data *C.ImGuiTableColumn + CData *C.ImGuiTableColumn } func (self *TableColumn) handle() (result *C.ImGuiTableColumn, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self TableColumn) c() (C.ImGuiTableColumn, func()) { @@ -1421,15 +1421,15 @@ func (self TableColumn) c() (C.ImGuiTableColumn, func()) { } func newTableColumnFromC(cvalue *C.ImGuiTableColumn) *TableColumn { - return &TableColumn{data: cvalue} + return &TableColumn{CData: cvalue} } type TableColumnSettings struct { - data *C.ImGuiTableColumnSettings + CData *C.ImGuiTableColumnSettings } func (self *TableColumnSettings) handle() (result *C.ImGuiTableColumnSettings, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self TableColumnSettings) c() (C.ImGuiTableColumnSettings, func()) { @@ -1438,15 +1438,15 @@ func (self TableColumnSettings) c() (C.ImGuiTableColumnSettings, func()) { } func newTableColumnSettingsFromC(cvalue *C.ImGuiTableColumnSettings) *TableColumnSettings { - return &TableColumnSettings{data: cvalue} + return &TableColumnSettings{CData: cvalue} } type TableColumnSortSpecs struct { - data *C.ImGuiTableColumnSortSpecs + CData *C.ImGuiTableColumnSortSpecs } func (self *TableColumnSortSpecs) handle() (result *C.ImGuiTableColumnSortSpecs, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self TableColumnSortSpecs) c() (C.ImGuiTableColumnSortSpecs, func()) { @@ -1455,19 +1455,19 @@ func (self TableColumnSortSpecs) c() (C.ImGuiTableColumnSortSpecs, func()) { } func newTableColumnSortSpecsFromC(cvalue *C.ImGuiTableColumnSortSpecs) *TableColumnSortSpecs { - return &TableColumnSortSpecs{data: cvalue} + return &TableColumnSortSpecs{CData: cvalue} } type TableColumnsSettings struct { - data *C.ImGuiTableColumnsSettings + CData *C.ImGuiTableColumnsSettings } func (self *TableColumnsSettings) handle() (result *C.ImGuiTableColumnsSettings, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func newTableColumnsSettingsFromC(cvalue *C.ImGuiTableColumnsSettings) *TableColumnsSettings { - return &TableColumnsSettings{data: cvalue} + return &TableColumnsSettings{CData: cvalue} } type TableDrawChannelIdx uint16 @@ -1487,11 +1487,11 @@ func newTableDrawChannelIdxFromC(cvalue *C.ImGuiTableDrawChannelIdx) *TableDrawC } type TableInstanceData struct { - data *C.ImGuiTableInstanceData + CData *C.ImGuiTableInstanceData } func (self *TableInstanceData) handle() (result *C.ImGuiTableInstanceData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self TableInstanceData) c() (C.ImGuiTableInstanceData, func()) { @@ -1500,15 +1500,15 @@ func (self TableInstanceData) c() (C.ImGuiTableInstanceData, func()) { } func newTableInstanceDataFromC(cvalue *C.ImGuiTableInstanceData) *TableInstanceData { - return &TableInstanceData{data: cvalue} + return &TableInstanceData{CData: cvalue} } type TableSettings struct { - data *C.ImGuiTableSettings + CData *C.ImGuiTableSettings } func (self *TableSettings) handle() (result *C.ImGuiTableSettings, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self TableSettings) c() (C.ImGuiTableSettings, func()) { @@ -1517,15 +1517,15 @@ func (self TableSettings) c() (C.ImGuiTableSettings, func()) { } func newTableSettingsFromC(cvalue *C.ImGuiTableSettings) *TableSettings { - return &TableSettings{data: cvalue} + return &TableSettings{CData: cvalue} } type TableSortSpecs struct { - data *C.ImGuiTableSortSpecs + CData *C.ImGuiTableSortSpecs } func (self *TableSortSpecs) handle() (result *C.ImGuiTableSortSpecs, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self TableSortSpecs) c() (C.ImGuiTableSortSpecs, func()) { @@ -1534,15 +1534,15 @@ func (self TableSortSpecs) c() (C.ImGuiTableSortSpecs, func()) { } func newTableSortSpecsFromC(cvalue *C.ImGuiTableSortSpecs) *TableSortSpecs { - return &TableSortSpecs{data: cvalue} + return &TableSortSpecs{CData: cvalue} } type TableTempData struct { - data *C.ImGuiTableTempData + CData *C.ImGuiTableTempData } func (self *TableTempData) handle() (result *C.ImGuiTableTempData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self TableTempData) c() (C.ImGuiTableTempData, func()) { @@ -1551,15 +1551,15 @@ func (self TableTempData) c() (C.ImGuiTableTempData, func()) { } func newTableTempDataFromC(cvalue *C.ImGuiTableTempData) *TableTempData { - return &TableTempData{data: cvalue} + return &TableTempData{CData: cvalue} } type TextBuffer struct { - data *C.ImGuiTextBuffer + CData *C.ImGuiTextBuffer } func (self *TextBuffer) handle() (result *C.ImGuiTextBuffer, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self TextBuffer) c() (C.ImGuiTextBuffer, func()) { @@ -1568,15 +1568,15 @@ func (self TextBuffer) c() (C.ImGuiTextBuffer, func()) { } func newTextBufferFromC(cvalue *C.ImGuiTextBuffer) *TextBuffer { - return &TextBuffer{data: cvalue} + return &TextBuffer{CData: cvalue} } type TextFilter struct { - data *C.ImGuiTextFilter + CData *C.ImGuiTextFilter } func (self *TextFilter) handle() (result *C.ImGuiTextFilter, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self TextFilter) c() (C.ImGuiTextFilter, func()) { @@ -1585,15 +1585,15 @@ func (self TextFilter) c() (C.ImGuiTextFilter, func()) { } func newTextFilterFromC(cvalue *C.ImGuiTextFilter) *TextFilter { - return &TextFilter{data: cvalue} + return &TextFilter{CData: cvalue} } type TextIndex struct { - data *C.ImGuiTextIndex + CData *C.ImGuiTextIndex } func (self *TextIndex) handle() (result *C.ImGuiTextIndex, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self TextIndex) c() (C.ImGuiTextIndex, func()) { @@ -1602,15 +1602,15 @@ func (self TextIndex) c() (C.ImGuiTextIndex, func()) { } func newTextIndexFromC(cvalue *C.ImGuiTextIndex) *TextIndex { - return &TextIndex{data: cvalue} + return &TextIndex{CData: cvalue} } type TextRange struct { - data *C.ImGuiTextRange + CData *C.ImGuiTextRange } func (self *TextRange) handle() (result *C.ImGuiTextRange, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self TextRange) c() (C.ImGuiTextRange, func()) { @@ -1619,15 +1619,15 @@ func (self TextRange) c() (C.ImGuiTextRange, func()) { } func newTextRangeFromC(cvalue *C.ImGuiTextRange) *TextRange { - return &TextRange{data: cvalue} + return &TextRange{CData: cvalue} } type TypingSelectRequest struct { - data *C.ImGuiTypingSelectRequest + CData *C.ImGuiTypingSelectRequest } func (self *TypingSelectRequest) handle() (result *C.ImGuiTypingSelectRequest, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self TypingSelectRequest) c() (C.ImGuiTypingSelectRequest, func()) { @@ -1636,15 +1636,15 @@ func (self TypingSelectRequest) c() (C.ImGuiTypingSelectRequest, func()) { } func newTypingSelectRequestFromC(cvalue *C.ImGuiTypingSelectRequest) *TypingSelectRequest { - return &TypingSelectRequest{data: cvalue} + return &TypingSelectRequest{CData: cvalue} } type TypingSelectState struct { - data *C.ImGuiTypingSelectState + CData *C.ImGuiTypingSelectState } func (self *TypingSelectState) handle() (result *C.ImGuiTypingSelectState, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self TypingSelectState) c() (C.ImGuiTypingSelectState, func()) { @@ -1653,15 +1653,15 @@ func (self TypingSelectState) c() (C.ImGuiTypingSelectState, func()) { } func newTypingSelectStateFromC(cvalue *C.ImGuiTypingSelectState) *TypingSelectState { - return &TypingSelectState{data: cvalue} + return &TypingSelectState{CData: cvalue} } type Viewport struct { - data *C.ImGuiViewport + CData *C.ImGuiViewport } func (self *Viewport) handle() (result *C.ImGuiViewport, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self Viewport) c() (C.ImGuiViewport, func()) { @@ -1670,15 +1670,15 @@ func (self Viewport) c() (C.ImGuiViewport, func()) { } func newViewportFromC(cvalue *C.ImGuiViewport) *Viewport { - return &Viewport{data: cvalue} + return &Viewport{CData: cvalue} } type ViewportP struct { - data *C.ImGuiViewportP + CData *C.ImGuiViewportP } func (self *ViewportP) handle() (result *C.ImGuiViewportP, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self ViewportP) c() (C.ImGuiViewportP, func()) { @@ -1687,15 +1687,15 @@ func (self ViewportP) c() (C.ImGuiViewportP, func()) { } func newViewportPFromC(cvalue *C.ImGuiViewportP) *ViewportP { - return &ViewportP{data: cvalue} + return &ViewportP{CData: cvalue} } type Window struct { - data *C.ImGuiWindow + CData *C.ImGuiWindow } func (self *Window) handle() (result *C.ImGuiWindow, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self Window) c() (C.ImGuiWindow, func()) { @@ -1704,15 +1704,15 @@ func (self Window) c() (C.ImGuiWindow, func()) { } func newWindowFromC(cvalue *C.ImGuiWindow) *Window { - return &Window{data: cvalue} + return &Window{CData: cvalue} } type WindowClass struct { - data *C.ImGuiWindowClass + CData *C.ImGuiWindowClass } func (self *WindowClass) handle() (result *C.ImGuiWindowClass, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self WindowClass) c() (C.ImGuiWindowClass, func()) { @@ -1721,15 +1721,15 @@ func (self WindowClass) c() (C.ImGuiWindowClass, func()) { } func newWindowClassFromC(cvalue *C.ImGuiWindowClass) *WindowClass { - return &WindowClass{data: cvalue} + return &WindowClass{CData: cvalue} } type WindowDockStyle struct { - data *C.ImGuiWindowDockStyle + CData *C.ImGuiWindowDockStyle } func (self *WindowDockStyle) handle() (result *C.ImGuiWindowDockStyle, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self WindowDockStyle) c() (C.ImGuiWindowDockStyle, func()) { @@ -1738,15 +1738,15 @@ func (self WindowDockStyle) c() (C.ImGuiWindowDockStyle, func()) { } func newWindowDockStyleFromC(cvalue *C.ImGuiWindowDockStyle) *WindowDockStyle { - return &WindowDockStyle{data: cvalue} + return &WindowDockStyle{CData: cvalue} } type WindowSettings struct { - data *C.ImGuiWindowSettings + CData *C.ImGuiWindowSettings } func (self *WindowSettings) handle() (result *C.ImGuiWindowSettings, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self WindowSettings) c() (C.ImGuiWindowSettings, func()) { @@ -1755,15 +1755,15 @@ func (self WindowSettings) c() (C.ImGuiWindowSettings, func()) { } func newWindowSettingsFromC(cvalue *C.ImGuiWindowSettings) *WindowSettings { - return &WindowSettings{data: cvalue} + return &WindowSettings{CData: cvalue} } type WindowStackData struct { - data *C.ImGuiWindowStackData + CData *C.ImGuiWindowStackData } func (self *WindowStackData) handle() (result *C.ImGuiWindowStackData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self WindowStackData) c() (C.ImGuiWindowStackData, func()) { @@ -1772,15 +1772,15 @@ func (self WindowStackData) c() (C.ImGuiWindowStackData, func()) { } func newWindowStackDataFromC(cvalue *C.ImGuiWindowStackData) *WindowStackData { - return &WindowStackData{data: cvalue} + return &WindowStackData{CData: cvalue} } type WindowTempData struct { - data *C.ImGuiWindowTempData + CData *C.ImGuiWindowTempData } func (self *WindowTempData) handle() (result *C.ImGuiWindowTempData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self WindowTempData) c() (C.ImGuiWindowTempData, func()) { @@ -1789,7 +1789,7 @@ func (self WindowTempData) c() (C.ImGuiWindowTempData, func()) { } func newWindowTempDataFromC(cvalue *C.ImGuiWindowTempData) *WindowTempData { - return &WindowTempData{data: cvalue} + return &WindowTempData{CData: cvalue} } type PoolIdx int32 @@ -1829,11 +1829,11 @@ func newTextureIDFromC(cvalue *C.ImTextureID) *TextureID { } type Vec1 struct { - data *C.ImVec1 + CData *C.ImVec1 } func (self *Vec1) handle() (result *C.ImVec1, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self Vec1) c() (C.ImVec1, func()) { @@ -1842,7 +1842,7 @@ func (self Vec1) c() (C.ImVec1, func()) { } func newVec1FromC(cvalue *C.ImVec1) *Vec1 { - return &Vec1{data: cvalue} + return &Vec1{CData: cvalue} } type Wchar32 uint32 @@ -1862,11 +1862,11 @@ func newWchar32FromC(cvalue *C.ImWchar32) *Wchar32 { } type STBTexteditState struct { - data *C.STB_TexteditState + CData *C.STB_TexteditState } func (self *STBTexteditState) handle() (result *C.STB_TexteditState, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self STBTexteditState) c() (C.STB_TexteditState, func()) { @@ -1875,15 +1875,15 @@ func (self STBTexteditState) c() (C.STB_TexteditState, func()) { } func newSTBTexteditStateFromC(cvalue *C.STB_TexteditState) *STBTexteditState { - return &STBTexteditState{data: cvalue} + return &STBTexteditState{CData: cvalue} } type StbTexteditRow struct { - data *C.StbTexteditRow + CData *C.StbTexteditRow } func (self *StbTexteditRow) handle() (result *C.StbTexteditRow, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self StbTexteditRow) c() (C.StbTexteditRow, func()) { @@ -1892,15 +1892,15 @@ func (self StbTexteditRow) c() (C.StbTexteditRow, func()) { } func newStbTexteditRowFromC(cvalue *C.StbTexteditRow) *StbTexteditRow { - return &StbTexteditRow{data: cvalue} + return &StbTexteditRow{CData: cvalue} } type StbUndoRecord struct { - data *C.StbUndoRecord + CData *C.StbUndoRecord } func (self *StbUndoRecord) handle() (result *C.StbUndoRecord, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self StbUndoRecord) c() (C.StbUndoRecord, func()) { @@ -1909,15 +1909,15 @@ func (self StbUndoRecord) c() (C.StbUndoRecord, func()) { } func newStbUndoRecordFromC(cvalue *C.StbUndoRecord) *StbUndoRecord { - return &StbUndoRecord{data: cvalue} + return &StbUndoRecord{CData: cvalue} } type StbUndoState struct { - data *C.StbUndoState + CData *C.StbUndoState } func (self *StbUndoState) handle() (result *C.StbUndoState, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self StbUndoState) c() (C.StbUndoState, func()) { @@ -1926,5 +1926,5 @@ func (self StbUndoState) c() (C.StbUndoState, func()) { } func newStbUndoStateFromC(cvalue *C.StbUndoState) *StbUndoState { - return &StbUndoState{data: cvalue} + return &StbUndoState{CData: cvalue} } diff --git a/cimmarkdown_typedefs.go b/cimmarkdown_typedefs.go index 0d8fa6894..6756656cb 100644 --- a/cimmarkdown_typedefs.go +++ b/cimmarkdown_typedefs.go @@ -10,11 +10,11 @@ package imgui import "C" type Emphasis struct { - data *C.Emphasis + CData *C.Emphasis } func (self *Emphasis) handle() (result *C.Emphasis, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self Emphasis) c() (C.Emphasis, func()) { @@ -23,15 +23,15 @@ func (self Emphasis) c() (C.Emphasis, func()) { } func newEmphasisFromC(cvalue *C.Emphasis) *Emphasis { - return &Emphasis{data: cvalue} + return &Emphasis{CData: cvalue} } type Line struct { - data *C.Line + CData *C.Line } func (self *Line) handle() (result *C.Line, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self Line) c() (C.Line, func()) { @@ -40,15 +40,15 @@ func (self Line) c() (C.Line, func()) { } func newLineFromC(cvalue *C.Line) *Line { - return &Line{data: cvalue} + return &Line{CData: cvalue} } type Link struct { - data *C.Link + CData *C.Link } func (self *Link) handle() (result *C.Link, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self Link) c() (C.Link, func()) { @@ -57,15 +57,15 @@ func (self Link) c() (C.Link, func()) { } func newLinkFromC(cvalue *C.Link) *Link { - return &Link{data: cvalue} + return &Link{CData: cvalue} } type MarkdownConfig struct { - data *C.MarkdownConfig + CData *C.MarkdownConfig } func (self *MarkdownConfig) handle() (result *C.MarkdownConfig, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self MarkdownConfig) c() (C.MarkdownConfig, func()) { @@ -74,15 +74,15 @@ func (self MarkdownConfig) c() (C.MarkdownConfig, func()) { } func newMarkdownConfigFromC(cvalue *C.MarkdownConfig) *MarkdownConfig { - return &MarkdownConfig{data: cvalue} + return &MarkdownConfig{CData: cvalue} } type MarkdownFormatInfo struct { - data *C.MarkdownFormatInfo + CData *C.MarkdownFormatInfo } func (self *MarkdownFormatInfo) handle() (result *C.MarkdownFormatInfo, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self MarkdownFormatInfo) c() (C.MarkdownFormatInfo, func()) { @@ -91,15 +91,15 @@ func (self MarkdownFormatInfo) c() (C.MarkdownFormatInfo, func()) { } func newMarkdownFormatInfoFromC(cvalue *C.MarkdownFormatInfo) *MarkdownFormatInfo { - return &MarkdownFormatInfo{data: cvalue} + return &MarkdownFormatInfo{CData: cvalue} } type MarkdownHeadingFormat struct { - data *C.MarkdownHeadingFormat + CData *C.MarkdownHeadingFormat } func (self *MarkdownHeadingFormat) handle() (result *C.MarkdownHeadingFormat, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self MarkdownHeadingFormat) c() (C.MarkdownHeadingFormat, func()) { @@ -108,15 +108,15 @@ func (self MarkdownHeadingFormat) c() (C.MarkdownHeadingFormat, func()) { } func newMarkdownHeadingFormatFromC(cvalue *C.MarkdownHeadingFormat) *MarkdownHeadingFormat { - return &MarkdownHeadingFormat{data: cvalue} + return &MarkdownHeadingFormat{CData: cvalue} } type MarkdownImageData struct { - data *C.MarkdownImageData + CData *C.MarkdownImageData } func (self *MarkdownImageData) handle() (result *C.MarkdownImageData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self MarkdownImageData) c() (C.MarkdownImageData, func()) { @@ -125,15 +125,15 @@ func (self MarkdownImageData) c() (C.MarkdownImageData, func()) { } func newMarkdownImageDataFromC(cvalue *C.MarkdownImageData) *MarkdownImageData { - return &MarkdownImageData{data: cvalue} + return &MarkdownImageData{CData: cvalue} } type MarkdownLinkCallbackData struct { - data *C.MarkdownLinkCallbackData + CData *C.MarkdownLinkCallbackData } func (self *MarkdownLinkCallbackData) handle() (result *C.MarkdownLinkCallbackData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self MarkdownLinkCallbackData) c() (C.MarkdownLinkCallbackData, func()) { @@ -142,15 +142,15 @@ func (self MarkdownLinkCallbackData) c() (C.MarkdownLinkCallbackData, func()) { } func newMarkdownLinkCallbackDataFromC(cvalue *C.MarkdownLinkCallbackData) *MarkdownLinkCallbackData { - return &MarkdownLinkCallbackData{data: cvalue} + return &MarkdownLinkCallbackData{CData: cvalue} } type MarkdownTooltipCallbackData struct { - data *C.MarkdownTooltipCallbackData + CData *C.MarkdownTooltipCallbackData } func (self *MarkdownTooltipCallbackData) handle() (result *C.MarkdownTooltipCallbackData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self MarkdownTooltipCallbackData) c() (C.MarkdownTooltipCallbackData, func()) { @@ -159,15 +159,15 @@ func (self MarkdownTooltipCallbackData) c() (C.MarkdownTooltipCallbackData, func } func newMarkdownTooltipCallbackDataFromC(cvalue *C.MarkdownTooltipCallbackData) *MarkdownTooltipCallbackData { - return &MarkdownTooltipCallbackData{data: cvalue} + return &MarkdownTooltipCallbackData{CData: cvalue} } type TextBlock struct { - data *C.TextBlock + CData *C.TextBlock } func (self *TextBlock) handle() (result *C.TextBlock, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self TextBlock) c() (C.TextBlock, func()) { @@ -176,15 +176,15 @@ func (self TextBlock) c() (C.TextBlock, func()) { } func newTextBlockFromC(cvalue *C.TextBlock) *TextBlock { - return &TextBlock{data: cvalue} + return &TextBlock{CData: cvalue} } type TextRegion struct { - data *C.TextRegion + CData *C.TextRegion } func (self *TextRegion) handle() (result *C.TextRegion, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self TextRegion) c() (C.TextRegion, func()) { @@ -193,5 +193,5 @@ func (self TextRegion) c() (C.TextRegion, func()) { } func newTextRegionFromC(cvalue *C.TextRegion) *TextRegion { - return &TextRegion{data: cvalue} + return &TextRegion{CData: cvalue} } diff --git a/cimnodes_typedefs.go b/cimnodes_typedefs.go index 946eb63a3..9f4539922 100644 --- a/cimnodes_typedefs.go +++ b/cimnodes_typedefs.go @@ -11,11 +11,11 @@ import "C" import "unsafe" type EmulateThreeButtonMouse struct { - data *C.EmulateThreeButtonMouse + CData *C.EmulateThreeButtonMouse } func (self *EmulateThreeButtonMouse) handle() (result *C.EmulateThreeButtonMouse, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self EmulateThreeButtonMouse) c() (C.EmulateThreeButtonMouse, func()) { @@ -24,39 +24,39 @@ func (self EmulateThreeButtonMouse) c() (C.EmulateThreeButtonMouse, func()) { } func newEmulateThreeButtonMouseFromC(cvalue *C.EmulateThreeButtonMouse) *EmulateThreeButtonMouse { - return &EmulateThreeButtonMouse{data: cvalue} + return &EmulateThreeButtonMouse{CData: cvalue} } type NodesContext struct { - data *C.ImNodesContext + CData *C.ImNodesContext } func (self *NodesContext) handle() (result *C.ImNodesContext, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func newNodesContextFromC(cvalue *C.ImNodesContext) *NodesContext { - return &NodesContext{data: cvalue} + return &NodesContext{CData: cvalue} } type NodesEditorContext struct { - data *C.ImNodesEditorContext + CData *C.ImNodesEditorContext } func (self *NodesEditorContext) handle() (result *C.ImNodesEditorContext, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func newNodesEditorContextFromC(cvalue *C.ImNodesEditorContext) *NodesEditorContext { - return &NodesEditorContext{data: cvalue} + return &NodesEditorContext{CData: cvalue} } type NodesIO struct { - data *C.ImNodesIO + CData *C.ImNodesIO } func (self *NodesIO) handle() (result *C.ImNodesIO, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self NodesIO) c() (C.ImNodesIO, func()) { @@ -65,7 +65,7 @@ func (self NodesIO) c() (C.ImNodesIO, func()) { } func newNodesIOFromC(cvalue *C.ImNodesIO) *NodesIO { - return &NodesIO{data: cvalue} + return &NodesIO{CData: cvalue} } type NodesMiniMapNodeHoveringCallbackUserData struct { @@ -89,11 +89,11 @@ func newNodesMiniMapNodeHoveringCallbackUserDataFromC(cvalue *C.ImNodesMiniMapNo } type NodesStyle struct { - data *C.ImNodesStyle + CData *C.ImNodesStyle } func (self *NodesStyle) handle() (result *C.ImNodesStyle, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self NodesStyle) c() (C.ImNodesStyle, func()) { @@ -102,15 +102,15 @@ func (self NodesStyle) c() (C.ImNodesStyle, func()) { } func newNodesStyleFromC(cvalue *C.ImNodesStyle) *NodesStyle { - return &NodesStyle{data: cvalue} + return &NodesStyle{CData: cvalue} } type LinkDetachWithModifierClick struct { - data *C.LinkDetachWithModifierClick + CData *C.LinkDetachWithModifierClick } func (self *LinkDetachWithModifierClick) handle() (result *C.LinkDetachWithModifierClick, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self LinkDetachWithModifierClick) c() (C.LinkDetachWithModifierClick, func()) { @@ -119,15 +119,15 @@ func (self LinkDetachWithModifierClick) c() (C.LinkDetachWithModifierClick, func } func newLinkDetachWithModifierClickFromC(cvalue *C.LinkDetachWithModifierClick) *LinkDetachWithModifierClick { - return &LinkDetachWithModifierClick{data: cvalue} + return &LinkDetachWithModifierClick{CData: cvalue} } type MultipleSelectModifier struct { - data *C.MultipleSelectModifier + CData *C.MultipleSelectModifier } func (self *MultipleSelectModifier) handle() (result *C.MultipleSelectModifier, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self MultipleSelectModifier) c() (C.MultipleSelectModifier, func()) { @@ -136,5 +136,5 @@ func (self MultipleSelectModifier) c() (C.MultipleSelectModifier, func()) { } func newMultipleSelectModifierFromC(cvalue *C.MultipleSelectModifier) *MultipleSelectModifier { - return &MultipleSelectModifier{data: cvalue} + return &MultipleSelectModifier{CData: cvalue} } diff --git a/cimplot_typedefs.go b/cimplot_typedefs.go index 780f88081..89acb037d 100644 --- a/cimplot_typedefs.go +++ b/cimplot_typedefs.go @@ -10,11 +10,11 @@ package imgui import "C" type FormatterTimeData struct { - data *C.Formatter_Time_Data + CData *C.Formatter_Time_Data } func (self *FormatterTimeData) handle() (result *C.Formatter_Time_Data, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self FormatterTimeData) c() (C.Formatter_Time_Data, func()) { @@ -23,15 +23,15 @@ func (self FormatterTimeData) c() (C.Formatter_Time_Data, func()) { } func newFormatterTimeDataFromC(cvalue *C.Formatter_Time_Data) *FormatterTimeData { - return &FormatterTimeData{data: cvalue} + return &FormatterTimeData{CData: cvalue} } type PlotAlignmentData struct { - data *C.ImPlotAlignmentData + CData *C.ImPlotAlignmentData } func (self *PlotAlignmentData) handle() (result *C.ImPlotAlignmentData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PlotAlignmentData) c() (C.ImPlotAlignmentData, func()) { @@ -40,15 +40,15 @@ func (self PlotAlignmentData) c() (C.ImPlotAlignmentData, func()) { } func newPlotAlignmentDataFromC(cvalue *C.ImPlotAlignmentData) *PlotAlignmentData { - return &PlotAlignmentData{data: cvalue} + return &PlotAlignmentData{CData: cvalue} } type PlotAnnotation struct { - data *C.ImPlotAnnotation + CData *C.ImPlotAnnotation } func (self *PlotAnnotation) handle() (result *C.ImPlotAnnotation, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PlotAnnotation) c() (C.ImPlotAnnotation, func()) { @@ -57,15 +57,15 @@ func (self PlotAnnotation) c() (C.ImPlotAnnotation, func()) { } func newPlotAnnotationFromC(cvalue *C.ImPlotAnnotation) *PlotAnnotation { - return &PlotAnnotation{data: cvalue} + return &PlotAnnotation{CData: cvalue} } type PlotAnnotationCollection struct { - data *C.ImPlotAnnotationCollection + CData *C.ImPlotAnnotationCollection } func (self *PlotAnnotationCollection) handle() (result *C.ImPlotAnnotationCollection, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PlotAnnotationCollection) c() (C.ImPlotAnnotationCollection, func()) { @@ -74,15 +74,15 @@ func (self PlotAnnotationCollection) c() (C.ImPlotAnnotationCollection, func()) } func newPlotAnnotationCollectionFromC(cvalue *C.ImPlotAnnotationCollection) *PlotAnnotationCollection { - return &PlotAnnotationCollection{data: cvalue} + return &PlotAnnotationCollection{CData: cvalue} } type PlotAxis struct { - data *C.ImPlotAxis + CData *C.ImPlotAxis } func (self *PlotAxis) handle() (result *C.ImPlotAxis, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PlotAxis) c() (C.ImPlotAxis, func()) { @@ -91,27 +91,27 @@ func (self PlotAxis) c() (C.ImPlotAxis, func()) { } func newPlotAxisFromC(cvalue *C.ImPlotAxis) *PlotAxis { - return &PlotAxis{data: cvalue} + return &PlotAxis{CData: cvalue} } type PlotAxisColor struct { - data *C.ImPlotAxisColor + CData *C.ImPlotAxisColor } func (self *PlotAxisColor) handle() (result *C.ImPlotAxisColor, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func newPlotAxisColorFromC(cvalue *C.ImPlotAxisColor) *PlotAxisColor { - return &PlotAxisColor{data: cvalue} + return &PlotAxisColor{CData: cvalue} } type PlotColormapData struct { - data *C.ImPlotColormapData + CData *C.ImPlotColormapData } func (self *PlotColormapData) handle() (result *C.ImPlotColormapData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PlotColormapData) c() (C.ImPlotColormapData, func()) { @@ -120,15 +120,15 @@ func (self PlotColormapData) c() (C.ImPlotColormapData, func()) { } func newPlotColormapDataFromC(cvalue *C.ImPlotColormapData) *PlotColormapData { - return &PlotColormapData{data: cvalue} + return &PlotColormapData{CData: cvalue} } type PlotContext struct { - data *C.ImPlotContext + CData *C.ImPlotContext } func (self *PlotContext) handle() (result *C.ImPlotContext, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PlotContext) c() (C.ImPlotContext, func()) { @@ -137,15 +137,15 @@ func (self PlotContext) c() (C.ImPlotContext, func()) { } func newPlotContextFromC(cvalue *C.ImPlotContext) *PlotContext { - return &PlotContext{data: cvalue} + return &PlotContext{CData: cvalue} } type PlotDateTimeSpec struct { - data *C.ImPlotDateTimeSpec + CData *C.ImPlotDateTimeSpec } func (self *PlotDateTimeSpec) handle() (result *C.ImPlotDateTimeSpec, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PlotDateTimeSpec) c() (C.ImPlotDateTimeSpec, func()) { @@ -154,15 +154,15 @@ func (self PlotDateTimeSpec) c() (C.ImPlotDateTimeSpec, func()) { } func newPlotDateTimeSpecFromC(cvalue *C.ImPlotDateTimeSpec) *PlotDateTimeSpec { - return &PlotDateTimeSpec{data: cvalue} + return &PlotDateTimeSpec{CData: cvalue} } type PlotInputMap struct { - data *C.ImPlotInputMap + CData *C.ImPlotInputMap } func (self *PlotInputMap) handle() (result *C.ImPlotInputMap, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PlotInputMap) c() (C.ImPlotInputMap, func()) { @@ -171,15 +171,15 @@ func (self PlotInputMap) c() (C.ImPlotInputMap, func()) { } func newPlotInputMapFromC(cvalue *C.ImPlotInputMap) *PlotInputMap { - return &PlotInputMap{data: cvalue} + return &PlotInputMap{CData: cvalue} } type PlotItem struct { - data *C.ImPlotItem + CData *C.ImPlotItem } func (self *PlotItem) handle() (result *C.ImPlotItem, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PlotItem) c() (C.ImPlotItem, func()) { @@ -188,15 +188,15 @@ func (self PlotItem) c() (C.ImPlotItem, func()) { } func newPlotItemFromC(cvalue *C.ImPlotItem) *PlotItem { - return &PlotItem{data: cvalue} + return &PlotItem{CData: cvalue} } type PlotItemGroup struct { - data *C.ImPlotItemGroup + CData *C.ImPlotItemGroup } func (self *PlotItemGroup) handle() (result *C.ImPlotItemGroup, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PlotItemGroup) c() (C.ImPlotItemGroup, func()) { @@ -205,15 +205,15 @@ func (self PlotItemGroup) c() (C.ImPlotItemGroup, func()) { } func newPlotItemGroupFromC(cvalue *C.ImPlotItemGroup) *PlotItemGroup { - return &PlotItemGroup{data: cvalue} + return &PlotItemGroup{CData: cvalue} } type PlotLegend struct { - data *C.ImPlotLegend + CData *C.ImPlotLegend } func (self *PlotLegend) handle() (result *C.ImPlotLegend, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PlotLegend) c() (C.ImPlotLegend, func()) { @@ -222,15 +222,15 @@ func (self PlotLegend) c() (C.ImPlotLegend, func()) { } func newPlotLegendFromC(cvalue *C.ImPlotLegend) *PlotLegend { - return &PlotLegend{data: cvalue} + return &PlotLegend{CData: cvalue} } type PlotNextItemData struct { - data *C.ImPlotNextItemData + CData *C.ImPlotNextItemData } func (self *PlotNextItemData) handle() (result *C.ImPlotNextItemData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PlotNextItemData) c() (C.ImPlotNextItemData, func()) { @@ -239,15 +239,15 @@ func (self PlotNextItemData) c() (C.ImPlotNextItemData, func()) { } func newPlotNextItemDataFromC(cvalue *C.ImPlotNextItemData) *PlotNextItemData { - return &PlotNextItemData{data: cvalue} + return &PlotNextItemData{CData: cvalue} } type PlotNextPlotData struct { - data *C.ImPlotNextPlotData + CData *C.ImPlotNextPlotData } func (self *PlotNextPlotData) handle() (result *C.ImPlotNextPlotData, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PlotNextPlotData) c() (C.ImPlotNextPlotData, func()) { @@ -256,15 +256,15 @@ func (self PlotNextPlotData) c() (C.ImPlotNextPlotData, func()) { } func newPlotNextPlotDataFromC(cvalue *C.ImPlotNextPlotData) *PlotNextPlotData { - return &PlotNextPlotData{data: cvalue} + return &PlotNextPlotData{CData: cvalue} } type PlotPlot struct { - data *C.ImPlotPlot + CData *C.ImPlotPlot } func (self *PlotPlot) handle() (result *C.ImPlotPlot, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PlotPlot) c() (C.ImPlotPlot, func()) { @@ -273,15 +273,15 @@ func (self PlotPlot) c() (C.ImPlotPlot, func()) { } func newPlotPlotFromC(cvalue *C.ImPlotPlot) *PlotPlot { - return &PlotPlot{data: cvalue} + return &PlotPlot{CData: cvalue} } type PlotPointError struct { - data *C.ImPlotPointError + CData *C.ImPlotPointError } func (self *PlotPointError) handle() (result *C.ImPlotPointError, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PlotPointError) c() (C.ImPlotPointError, func()) { @@ -290,15 +290,15 @@ func (self PlotPointError) c() (C.ImPlotPointError, func()) { } func newPlotPointErrorFromC(cvalue *C.ImPlotPointError) *PlotPointError { - return &PlotPointError{data: cvalue} + return &PlotPointError{CData: cvalue} } type PlotRange struct { - data *C.ImPlotRange + CData *C.ImPlotRange } func (self *PlotRange) handle() (result *C.ImPlotRange, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PlotRange) c() (C.ImPlotRange, func()) { @@ -307,15 +307,15 @@ func (self PlotRange) c() (C.ImPlotRange, func()) { } func newPlotRangeFromC(cvalue *C.ImPlotRange) *PlotRange { - return &PlotRange{data: cvalue} + return &PlotRange{CData: cvalue} } type PlotRect struct { - data *C.ImPlotRect + CData *C.ImPlotRect } func (self *PlotRect) handle() (result *C.ImPlotRect, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PlotRect) c() (C.ImPlotRect, func()) { @@ -324,15 +324,15 @@ func (self PlotRect) c() (C.ImPlotRect, func()) { } func newPlotRectFromC(cvalue *C.ImPlotRect) *PlotRect { - return &PlotRect{data: cvalue} + return &PlotRect{CData: cvalue} } type PlotStyle struct { - data *C.ImPlotStyle + CData *C.ImPlotStyle } func (self *PlotStyle) handle() (result *C.ImPlotStyle, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PlotStyle) c() (C.ImPlotStyle, func()) { @@ -341,15 +341,15 @@ func (self PlotStyle) c() (C.ImPlotStyle, func()) { } func newPlotStyleFromC(cvalue *C.ImPlotStyle) *PlotStyle { - return &PlotStyle{data: cvalue} + return &PlotStyle{CData: cvalue} } type PlotSubplot struct { - data *C.ImPlotSubplot + CData *C.ImPlotSubplot } func (self *PlotSubplot) handle() (result *C.ImPlotSubplot, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PlotSubplot) c() (C.ImPlotSubplot, func()) { @@ -358,15 +358,15 @@ func (self PlotSubplot) c() (C.ImPlotSubplot, func()) { } func newPlotSubplotFromC(cvalue *C.ImPlotSubplot) *PlotSubplot { - return &PlotSubplot{data: cvalue} + return &PlotSubplot{CData: cvalue} } type PlotTag struct { - data *C.ImPlotTag + CData *C.ImPlotTag } func (self *PlotTag) handle() (result *C.ImPlotTag, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PlotTag) c() (C.ImPlotTag, func()) { @@ -375,15 +375,15 @@ func (self PlotTag) c() (C.ImPlotTag, func()) { } func newPlotTagFromC(cvalue *C.ImPlotTag) *PlotTag { - return &PlotTag{data: cvalue} + return &PlotTag{CData: cvalue} } type PlotTagCollection struct { - data *C.ImPlotTagCollection + CData *C.ImPlotTagCollection } func (self *PlotTagCollection) handle() (result *C.ImPlotTagCollection, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PlotTagCollection) c() (C.ImPlotTagCollection, func()) { @@ -392,15 +392,15 @@ func (self PlotTagCollection) c() (C.ImPlotTagCollection, func()) { } func newPlotTagCollectionFromC(cvalue *C.ImPlotTagCollection) *PlotTagCollection { - return &PlotTagCollection{data: cvalue} + return &PlotTagCollection{CData: cvalue} } type PlotTick struct { - data *C.ImPlotTick + CData *C.ImPlotTick } func (self *PlotTick) handle() (result *C.ImPlotTick, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PlotTick) c() (C.ImPlotTick, func()) { @@ -409,15 +409,15 @@ func (self PlotTick) c() (C.ImPlotTick, func()) { } func newPlotTickFromC(cvalue *C.ImPlotTick) *PlotTick { - return &PlotTick{data: cvalue} + return &PlotTick{CData: cvalue} } type PlotTicker struct { - data *C.ImPlotTicker + CData *C.ImPlotTicker } func (self *PlotTicker) handle() (result *C.ImPlotTicker, fin func()) { - return self.data, func() {} + return self.CData, func() {} } func (self PlotTicker) c() (C.ImPlotTicker, func()) { @@ -426,5 +426,5 @@ func (self PlotTicker) c() (C.ImPlotTicker, func()) { } func newPlotTickerFromC(cvalue *C.ImPlotTicker) *PlotTicker { - return &PlotTicker{data: cvalue} + return &PlotTicker{CData: cvalue} } From 6feb3d0420de86573ca745879284fe209f9b7be7 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Fri, 1 Dec 2023 10:26:18 +0100 Subject: [PATCH 48/68] fix test --- cimgui_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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") } From 6a2c655f234e250eb0b0725344d2dce1cc1edb31 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Wed, 20 Dec 2023 10:20:57 +0100 Subject: [PATCH 49/68] sdl: fix windows --- sdl_backend.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdl_backend.go b/sdl_backend.go index f0ed319ee..4106fd8d7 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 -lSDL2main -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 From d668d35f0a29742f38370f32babf412990793e88 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Wed, 20 Dec 2023 10:34:09 +0100 Subject: [PATCH 50/68] texture: fix build error --- texture.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/texture.go b/texture.go index e3057e494..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.Data == nil { + if texID.Data == 0 { return nil } From 260c729212bac7b44ece1e12e8f5dc735d835256 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Thu, 21 Dec 2023 14:23:06 +0100 Subject: [PATCH 51/68] fix sdl args --- sdl_backend.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdl_backend.go b/sdl_backend.go index 4106fd8d7..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 -l:libSDL2.a -lSDL2main -lgdi32 -lopengl32 -limm32 -mwindows -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid +// #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 From 2a4ea03172d6f8047f297cf54af726179f2817cc Mon Sep 17 00:00:00 2001 From: gucio321 Date: Sat, 6 Jan 2024 12:19:00 +0100 Subject: [PATCH 52/68] codegen: change type of void* arguments to uintptr_t currently it applies to cimgui functions and typedefs. What is missing is the struct_accessor that will be reworked in the next commit. Rason for that is https://github.com/golang/go/issues/64467 --- cmd/codegen/arguments_wrapper.go | 4 ++-- cmd/codegen/gencpp.go | 8 ++++++++ cmd/codegen/gengo_typedefs.go | 4 ++++ cmd/codegen/return_wrapper.go | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/cmd/codegen/arguments_wrapper.go b/cmd/codegen/arguments_wrapper.go index a52c14ab6..af1f92f93 100644 --- a/cmd/codegen/arguments_wrapper.go +++ b/cmd/codegen/arguments_wrapper.go @@ -100,8 +100,8 @@ func getArgWrapper( "ImWchar*": simpleW("(*Wchar)", "(*C.ImWchar)"), "const ImWchar*": simpleW("(*Wchar)", "(*C.ImWchar)"), "ImWchar16": simpleW("uint16", "C.ImWchar16"), - "void*": simpleW("uintptr", "unsafe.Pointer"), - "const void*": simpleW("uintptr", "unsafe.Pointer"), + "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"), diff --git a/cmd/codegen/gencpp.go b/cmd/codegen/gencpp.go index ba262318d..263a86e8c 100644 --- a/cmd/codegen/gencpp.go +++ b/cmd/codegen/gencpp.go @@ -109,6 +109,7 @@ extern "C" { // Remove text_end arg f.Args = strings.Replace(f.Args, ",const char* text_end_", "", 1) // sometimes happens in cimmarkdown f.Args = strings.Replace(f.Args, ",const char* text_end", "", 1) + f.Ret = ReplaceAll(f.Ret, "void*", "uintptr_t") var argsT []ArgDef var actualCallArgs []CIdentifier @@ -121,6 +122,13 @@ extern "C" { case a.Name == "text_end", a.Name == "text_end_": 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*"): + a.Type = ReplaceAll(a.Type, "void*", "uintptr_t") + fallthrough default: argsT = append(argsT, a) actualCallArgs = append(actualCallArgs, a.Name) diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index 6bd84c0e3..347b3a5f0 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -67,6 +67,10 @@ import "unsafe" var knownArgType, knownPtrArgType ArgumentWrapperData var argTypeErr, ptrArgTypeErr, returnTypeErr, ptrReturnTypeErr error + if typedefs.data[k] == "void*" { + typedefs.data[k] = "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) diff --git a/cmd/codegen/return_wrapper.go b/cmd/codegen/return_wrapper.go index c5b518cc7..637cf67a8 100644 --- a/cmd/codegen/return_wrapper.go +++ b/cmd/codegen/return_wrapper.go @@ -56,7 +56,7 @@ func getReturnWrapper( "ImPlotPoint": wrappableR("PlotPoint"), "ImRect": wrappableR("Rect"), "ImPlotTime": wrappableR("PlotTime"), - "void*": simpleR("uintptr"), + "uintptr_t": simpleR("uintptr"), "size_t": simpleR("uint64"), } From 45709b46f8b87d0110472ade5787b4db6ec43245 Mon Sep 17 00:00:00 2001 From: gucio321 Date: Thu, 1 Feb 2024 11:59:17 +0100 Subject: [PATCH 53/68] codegen: add comments --- cmd/codegen/gencpp.go | 39 +++++++++++++++++++++++++++++---------- cmd/codegen/helpers.go | 4 ++-- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/cmd/codegen/gencpp.go b/cmd/codegen/gencpp.go index 263a86e8c..71789e549 100644 --- a/cmd/codegen/gencpp.go +++ b/cmd/codegen/gencpp.go @@ -50,7 +50,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 @@ -60,12 +60,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") || @@ -76,14 +76,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 } @@ -91,6 +90,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])) { @@ -109,7 +110,9 @@ extern "C" { // Remove text_end arg f.Args = strings.Replace(f.Args, ",const char* text_end_", "", 1) // sometimes happens in cimmarkdown f.Args = strings.Replace(f.Args, ",const char* text_end", "", 1) - f.Ret = ReplaceAll(f.Ret, "void*", "uintptr_t") + if f.Ret == "void*" { + f.Ret = "uintptr_t" + } var argsT []ArgDef var actualCallArgs []CIdentifier @@ -126,17 +129,33 @@ extern "C" { // 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*"): - a.Type = ReplaceAll(a.Type, "void*", "uintptr_t") - fallthrough + //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))) + f.AllCallArgs = Join(actualCallArgs, ",") + a.Type = "uintptr_t" + f.Args = Replace(f.Args, fmt.Sprintf("void* %s", a.Name), fmt.Sprintf("uintptr_t %s", a.Name), 1) + fmt.Println(a) + fmt.Println(f.Args) + fmt.Println(actualCallArgs) + fmt.Println(f.AllCallArgs) + fmt.Println(f.InvocationStmt) + argsT = append(argsT, a) default: argsT = append(argsT, a) actualCallArgs = append(actualCallArgs, a.Name) } } + f.AllCallArgs = "(" + TrimSuffix(f.AllCallArgs, ",") + ")" f.ArgsT = argsT + //f.Args = "(" + //for _, a := range argsT { + // f.Args += fmt.Sprintf("%s %s,", a.Type, a.Name) + //} + //f.Args = TrimSuffix(f.Args, ",") + //f.Args += ")" // Generate shotter function which omits the default args // Skip functions as function pointer arg diff --git a/cmd/codegen/helpers.go b/cmd/codegen/helpers.go index 156d3024f..67ac26c1b 100644 --- a/cmd/codegen/helpers.go +++ b/cmd/codegen/helpers.go @@ -21,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 { From 57676e1d7105fcce19a9b9df863af21e642fb831 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Wed, 14 Feb 2024 19:30:11 +0100 Subject: [PATCH 54/68] gencpp: fix bug when some wrappers were not generated --- cmd/codegen/gencpp.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/codegen/gencpp.go b/cmd/codegen/gencpp.go index 8c7449203..7cfe8f819 100644 --- a/cmd/codegen/gencpp.go +++ b/cmd/codegen/gencpp.go @@ -154,7 +154,6 @@ extern "C" { // 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))) - f.AllCallArgs = Join(actualCallArgs, ",") a.Type = "uintptr_t" f.Args = Replace(f.Args, fmt.Sprintf("void* %s", a.Name), fmt.Sprintf("uintptr_t %s", a.Name), 1) argsT = append(argsT, a) @@ -165,8 +164,8 @@ extern "C" { } f.AllCallArgs = "(" + TrimSuffix(f.AllCallArgs, ",") + ")" - f.ArgsT = argsT + //f.Args = "(" //for _, a := range argsT { // f.Args += fmt.Sprintf("%s %s,", a.Type, a.Name) @@ -174,7 +173,7 @@ extern "C" { //f.Args = TrimSuffix(f.Args, ",") //f.Args += ")" - // Generate shotter function which omits the default args + // Generate shorter function which omits the default args // Skip functions as function pointer arg shouldSkip = false for _, a := range f.ArgsT { @@ -347,6 +346,7 @@ extern "C" { // cppSb.WriteString(fmt.Sprintf("// %#v\n", f)) + // if needed, write extra stuff to cpp headers if string(f.AllCallArgs) == actualCallArgsStr { cWrapperFuncName = f.FuncName } else if f.Constructor { From 2d88787974923bb67d1fe654949b9ad5869e5ef1 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Wed, 14 Feb 2024 19:30:26 +0100 Subject: [PATCH 55/68] codegen: regenerate code --- cimgui_funcs.go | 34 +++++++++++++++--------------- cimgui_wrapper.cpp | 50 +++++++++++++++++++++++++++++++++++---------- cimgui_wrapper.h | 28 +++++++++++++++++++++++++ cimplot_funcs.go | 18 ++++++++-------- cimplot_wrapper.cpp | 20 ++++++++++++++++-- cimplot_wrapper.h | 16 +++++++++++++++ 6 files changed, 127 insertions(+), 39 deletions(-) diff --git a/cimgui_funcs.go b/cimgui_funcs.go index 983602e8c..882a3136b 100644 --- a/cimgui_funcs.go +++ b/cimgui_funcs.go @@ -1460,7 +1460,7 @@ func (self *DataVarInfo) InternalVarPtr(parent uintptr) uintptr { defer func() { selfFin() }() - return uintptr(C.ImGuiDataVarInfo_GetVarPtr(selfArg, C.uintptr_t(parent))) + return uintptr(C.wrap_ImGuiDataVarInfo_GetVarPtr(selfArg, C.uintptr_t(parent))) } func InternalNewDockContext() *DockContext { @@ -2290,7 +2290,7 @@ func InternalNewPtrOrIndexInt(index int32) *PtrOrIndex { } func InternalNewPtrOrIndexPtr(ptr uintptr) *PtrOrIndex { - return newPtrOrIndexFromC(C.ImGuiPtrOrIndex_ImGuiPtrOrIndex_Ptr(C.uintptr_t(ptr))) + return newPtrOrIndexFromC(C.wrap_ImGuiPtrOrIndex_ImGuiPtrOrIndex_Ptr(C.uintptr_t(ptr))) } func (self *PtrOrIndex) Destroy() { @@ -2386,7 +2386,7 @@ func NewStoragePairPtr(_key ID, _val_p uintptr) *StoragePair { defer func() { _keyFin() }() - return newStoragePairFromC(C.ImGuiStoragePair_ImGuiStoragePair_Ptr(_keyArg, C.uintptr_t(_val_p))) + return newStoragePairFromC(C.wrap_ImGuiStoragePair_ImGuiStoragePair_Ptr(_keyArg, C.uintptr_t(_val_p))) } func (self *StoragePair) Destroy() { @@ -2524,7 +2524,7 @@ func (self *Storage) SetInt(key ID, val int32) { func (self *Storage) SetVoidPtr(key ID, val uintptr) { selfArg, selfFin := self.handle() keyArg, keyFin := key.c() - C.ImGuiStorage_SetVoidPtr(selfArg, keyArg, C.uintptr_t(val)) + C.wrap_ImGuiStorage_SetVoidPtr(selfArg, keyArg, C.uintptr_t(val)) selfFin() keyFin() @@ -3136,7 +3136,7 @@ func (self *Window) InternalIDPtr(ptr uintptr) ID { defer func() { selfFin() }() - return *newIDFromC(func() *C.ImGuiID { result := C.ImGuiWindow_GetID_Ptr(selfArg, C.uintptr_t(ptr)); return &result }()) + return *newIDFromC(func() *C.ImGuiID { result := C.wrap_ImGuiWindow_GetID_Ptr(selfArg, C.uintptr_t(ptr)); return &result }()) } // InternalIDStrV parameter default value hint: @@ -4454,15 +4454,15 @@ func InternalDataTypeApplyFromText(buf string, data_type DataType, p_data uintpt } func InternalDataTypeApplyOp(data_type DataType, op int32, output uintptr, arg_1 uintptr, arg_2 uintptr) { - C.igDataTypeApplyOp(C.ImGuiDataType(data_type), C.int(op), C.uintptr_t(output), C.uintptr_t(arg_1), C.uintptr_t(arg_2)) + 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 uintptr, p_min uintptr, p_max uintptr) bool { - return C.igDataTypeClamp(C.ImGuiDataType(data_type), C.uintptr_t(p_data), C.uintptr_t(p_min), C.uintptr_t(p_max)) == C.bool(true) + 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 uintptr, arg_2 uintptr) int32 { - return int32(C.igDataTypeCompare(C.ImGuiDataType(data_type), C.uintptr_t(arg_1), C.uintptr_t(arg_2))) + 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 uintptr, format string) int32 { @@ -4510,7 +4510,7 @@ func InternalDebugDrawLineExtentsV(col uint32) { func InternalDebugHookIdInfo(id ID, data_type DataType, data_id uintptr, data_id_end uintptr) { idArg, idFin := id.c() - C.igDebugHookIdInfo(idArg, C.ImGuiDataType(data_type), C.uintptr_t(data_id), C.uintptr_t(data_id_end)) + C.wrap_igDebugHookIdInfo(idArg, C.ImGuiDataType(data_type), C.uintptr_t(data_id), C.uintptr_t(data_id_end)) idFin() } @@ -5546,7 +5546,7 @@ func FindViewportByID(id ID) *Viewport { // 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.igFindViewportByPlatformHandle(C.uintptr_t(platform_handle))) + return newViewportFromC(C.wrap_igFindViewportByPlatformHandle(C.uintptr_t(platform_handle))) } func InternalFindWindowByID(id ID) *Window { @@ -5947,7 +5947,7 @@ func InternalIDWithSeedStr(str_id_begin string, str_id_end string, seed ID) ID { } func IDPtr(ptr_id uintptr) ID { - return *newIDFromC(func() *C.ImGuiID { result := C.igGetID_Ptr(C.uintptr_t(ptr_id)); return &result }()) + 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 @@ -6608,7 +6608,7 @@ func InternalImFontAtlasBuildInit(atlas *FontAtlas) { func InternalImFontAtlasBuildPackCustomRects(atlas *FontAtlas, stbrp_context_opaque uintptr) { atlasArg, atlasFin := atlas.handle() - C.igImFontAtlasBuildPackCustomRects(atlasArg, C.uintptr_t(stbrp_context_opaque)) + C.wrap_igImFontAtlasBuildPackCustomRects(atlasArg, C.uintptr_t(stbrp_context_opaque)) atlasFin() } @@ -8035,7 +8035,7 @@ func MemAlloc(size uint64) uintptr { } func MemFree(ptr uintptr) { - C.igMemFree(C.uintptr_t(ptr)) + C.wrap_igMemFree(C.uintptr_t(ptr)) } // InternalMenuItemExV parameter default value hint: @@ -8346,7 +8346,7 @@ func PushIDInt(int_id int32) { // push pointer into the ID stack (will hash pointer). func PushIDPtr(ptr_id uintptr) { - C.igPushID_Ptr(C.uintptr_t(ptr_id)) + C.wrap_igPushID_Ptr(C.uintptr_t(ptr_id)) } // push string into the ID stack (will hash string). @@ -8545,7 +8545,7 @@ func InternalRenderNavHighlightV(bb Rect, id ID, flags NavHighlightFlags) { // platform_render_arg: NULL // renderer_render_arg: NULL func RenderPlatformWindowsDefaultV(platform_render_arg uintptr, renderer_render_arg uintptr) { - C.igRenderPlatformWindowsDefault(C.uintptr_t(platform_render_arg), C.uintptr_t(renderer_render_arg)) + 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) { @@ -10387,7 +10387,7 @@ func InternalTempInputScalarV(bb Rect, id ID, label string, data_type DataType, labelFin() formatFin() }() - return C.igTempInputScalar(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) + 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 { @@ -10589,7 +10589,7 @@ func InternalTreePushOverrideID(id ID) { // " func TreePushPtr(ptr_id uintptr) { - C.igTreePush_Ptr(C.uintptr_t(ptr_id)) + 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. diff --git a/cimgui_wrapper.cpp b/cimgui_wrapper.cpp index bd91e029a..9b61a151f 100644 --- a/cimgui_wrapper.cpp +++ b/cimgui_wrapper.cpp @@ -4,6 +4,7 @@ #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); } @@ -12,45 +13,70 @@ void wrap_ImFontGlyphRangesBuilder_AddTextV(ImFontGlyphRangesBuilder* self,const 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 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); } +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)(uintptr_t user_data,int idx),void* 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); } 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)(uintptr_t user_data,int idx),void* 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); } +void wrap_igMemFree(uintptr_t ptr) { igMemFree((void*)(uintptr_t)ptr); } int wrap_igPlotEx(ImGuiPlotType plot_type,const char* label,float(*values_getter)(uintptr_t data,int idx),void* 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)(uintptr_t data,int idx),void* 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)(uintptr_t data,int idx),void* 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); } @@ -61,6 +87,8 @@ bool wrap_igTreeNodeEx_Ptr(const uintptr_t ptr_id,ImGuiTreeNodeFlags flags,const 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 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); } @@ -111,7 +139,7 @@ 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_ImGuiStorage_GetVoidPtrRef(ImGuiStorage* self,ImGuiID key) { return wrap_ImGuiStorage_GetVoidPtrRefV(self,key,NULL); } void wrap_ImGuiTextBuffer_Append(ImGuiTextBuffer* self,const char* str) { ImGuiTextBuffer_append(self,str,NULL); } 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); } @@ -174,8 +202,8 @@ bool wrap_igDragInt4(const char* label,int v[4]) { return igDragInt4(label,v,1.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,uintptr_t p_data) { return wrap_igDragScalarV(label,data_type,p_data,1.0f,NULL,NULL,NULL,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,NULL,NULL,NULL,0); } -void wrap_igErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback) { igErrorCheckEndFrameRecover(log_callback,NULL); } -void wrap_igErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback) { igErrorCheckEndWindowRecover(log_callback,NULL); } +void wrap_igErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback) { wrap_igErrorCheckEndFrameRecoverV(log_callback,NULL); } +void wrap_igErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback) { wrap_igErrorCheckEndWindowRecoverV(log_callback,NULL); } 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); } @@ -202,10 +230,10 @@ 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,uintptr_t p_data) { return wrap_igInputScalarV(label,data_type,p_data,NULL,NULL,NULL,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,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_igInputText(const char* label,char* buf,size_t buf_size) { return wrap_igInputTextV(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 wrap_igInputTextExV(label,hint,buf,buf_size,size_arg,flags,NULL,NULL); } +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,NULL,NULL); } +bool wrap_igInputTextWithHint(const char* label,const char* hint,char* buf,size_t buf_size) { return wrap_igInputTextWithHintV(label,hint,buf,buf_size,0,NULL,NULL); } 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); } @@ -250,7 +278,7 @@ void wrap_igRenderColorRectWithAlphaCheckerboard(ImDrawList* draw_list,ImVec2 p_ 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(NULL,NULL); } 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); } @@ -263,7 +291,7 @@ void wrap_igScrollToRectEx(ImVec2* pOut,ImGuiWindow* window,const ImRect rect) { 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); } +void wrap_igSetAllocatorFunctions(ImGuiMemAllocFunc alloc_func,ImGuiMemFreeFunc free_func) { wrap_igSetAllocatorFunctionsV(alloc_func,free_func,NULL); } 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); } @@ -274,7 +302,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,NULL,NULL); } 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); } @@ -319,7 +347,7 @@ 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,uintptr_t 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,NULL,NULL); } 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); } diff --git a/cimgui_wrapper.h b/cimgui_wrapper.h index ba0a0439b..59ffaab9f 100644 --- a/cimgui_wrapper.h +++ b/cimgui_wrapper.h @@ -9,6 +9,7 @@ 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); @@ -17,45 +18,70 @@ extern void wrap_ImFontGlyphRangesBuilder_AddTextV(ImFontGlyphRangesBuilder* sel 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 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)(uintptr_t user_data,int idx),void* 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 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)(uintptr_t user_data,int idx),void* 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 void wrap_igMemFree(uintptr_t ptr); extern int wrap_igPlotEx(ImGuiPlotType plot_type,const char* label,float(*values_getter)(uintptr_t data,int idx),void* 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)(uintptr_t data,int idx),void* 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)(uintptr_t data,int idx),void* 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); @@ -66,6 +92,8 @@ extern bool wrap_igTreeNodeEx_Ptr(const uintptr_t ptr_id,ImGuiTreeNodeFlags flag extern bool wrap_igTreeNodeEx_StrStr(const char* str_id,ImGuiTreeNodeFlags flags,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); diff --git a/cimplot_funcs.go b/cimplot_funcs.go index 83e5356fa..8dfacb8d0 100644 --- a/cimplot_funcs.go +++ b/cimplot_funcs.go @@ -1943,7 +1943,7 @@ func PlotFormatterDefault(value float64, buff string, size int32, data uintptr) defer func() { buffFin() }() - return int32(C.ImPlot_Formatter_Default(C.double(value), buffArg, C.int(size), C.uintptr_t(data))) + 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 uintptr) int32 { @@ -1952,7 +1952,7 @@ func PlotFormatterLogit(value float64, buff string, size int32, noname1 uintptr) defer func() { buffFin() }() - return int32(C.ImPlot_Formatter_Logit(C.double(value), buffArg, C.int(size), C.uintptr_t(noname1))) + 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 uintptr) int32 { @@ -1961,7 +1961,7 @@ func PlotFormatterTime(noname1 float64, buff string, size int32, data uintptr) i defer func() { buffFin() }() - return int32(C.ImPlot_Formatter_Time(C.double(noname1), buffArg, C.int(size), C.uintptr_t(data))) + return int32(C.wrap_ImPlot_Formatter_Time(C.double(noname1), buffArg, C.int(size), C.uintptr_t(data))) } func PlotGetAutoColor(idx PlotCol) Vec4 { @@ -9019,27 +9019,27 @@ func PlotTagYStr(y float64, col Vec4, fmt string) { } func PlotTransformForwardLog10(v float64, noname1 uintptr) float64 { - return float64(C.ImPlot_TransformForward_Log10(C.double(v), C.uintptr_t(noname1))) + return float64(C.wrap_ImPlot_TransformForward_Log10(C.double(v), C.uintptr_t(noname1))) } func PlotTransformForwardLogit(v float64, noname1 uintptr) float64 { - return float64(C.ImPlot_TransformForward_Logit(C.double(v), C.uintptr_t(noname1))) + return float64(C.wrap_ImPlot_TransformForward_Logit(C.double(v), C.uintptr_t(noname1))) } func PlotTransformForwardSymLog(v float64, noname1 uintptr) float64 { - return float64(C.ImPlot_TransformForward_SymLog(C.double(v), C.uintptr_t(noname1))) + return float64(C.wrap_ImPlot_TransformForward_SymLog(C.double(v), C.uintptr_t(noname1))) } func PlotTransformInverseLog10(v float64, noname1 uintptr) float64 { - return float64(C.ImPlot_TransformInverse_Log10(C.double(v), C.uintptr_t(noname1))) + return float64(C.wrap_ImPlot_TransformInverse_Log10(C.double(v), C.uintptr_t(noname1))) } func PlotTransformInverseLogit(v float64, noname1 uintptr) float64 { - return float64(C.ImPlot_TransformInverse_Logit(C.double(v), C.uintptr_t(noname1))) + return float64(C.wrap_ImPlot_TransformInverse_Logit(C.double(v), C.uintptr_t(noname1))) } func PlotTransformInverseSymLog(v float64, noname1 uintptr) float64 { - return float64(C.ImPlot_TransformInverse_SymLog(C.double(v), C.uintptr_t(noname1))) + return float64(C.wrap_ImPlot_TransformInverse_SymLog(C.double(v), C.uintptr_t(noname1))) } func (self *PlotAxis) SetMax(_max float64) bool { diff --git a/cimplot_wrapper.cpp b/cimplot_wrapper.cpp index 2ccfaeafc..2eef216c6 100644 --- a/cimplot_wrapper.cpp +++ b/cimplot_wrapper.cpp @@ -6,17 +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); } @@ -301,9 +317,9 @@ void wrap_ImPlot_SetNextMarkerStyle() { ImPlot_SetNextMarkerStyle(-1,-1,(ImVec4) 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_SetupAxisFormat_PlotFormatter(ImAxis axis,ImPlotFormatter formatter) { wrap_ImPlot_SetupAxisFormat_PlotFormatterV(axis,formatter,nullptr); } 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_SetupAxisScale_PlotTransform(ImAxis axis,ImPlotTransform forward,ImPlotTransform inverse) { wrap_ImPlot_SetupAxisScale_PlotTransformV(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_SetupLegend(ImPlotLocation location) { ImPlot_SetupLegend(location,0); } diff --git a/cimplot_wrapper.h b/cimplot_wrapper.h index 78bea0198..b4403183a 100644 --- a/cimplot_wrapper.h +++ b/cimplot_wrapper.h @@ -11,17 +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); From 53808fadd2dea4329bf59fe35cb88219511bfbc2 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Thu, 15 Feb 2024 21:51:43 +0100 Subject: [PATCH 56/68] codegen: fix typedefs generation with new void* rules --- cmd/codegen/gencpp.go | 4 ++ cmd/codegen/gengo_typedefs.go | 108 ++++++++++++++++++++++++++++++---- 2 files changed, 102 insertions(+), 10 deletions(-) diff --git a/cmd/codegen/gencpp.go b/cmd/codegen/gencpp.go index 7cfe8f819..780707c3c 100644 --- a/cmd/codegen/gencpp.go +++ b/cmd/codegen/gencpp.go @@ -273,6 +273,10 @@ extern "C" { v = "NULL" } + if v == "nullptr" { + v = "NULL" + } + if k == "text_end" || k == "text_end_" { v = "0" } diff --git a/cmd/codegen/gengo_typedefs.go b/cmd/codegen/gengo_typedefs.go index 347b3a5f0..f7fbcd3a7 100644 --- a/cmd/codegen/gengo_typedefs.go +++ b/cmd/codegen/gengo_typedefs.go @@ -19,12 +19,32 @@ func proceedTypedefs(prefix string, typedefs *Typedefs, structs []StructDef, enu `// #include // #include // #include "extra_types.h" -// #include "%s_wrapper.h" +// #include "%[1]s_wrapper.h" +// #include "%[1]s_typedefs.h" import "C" import "unsafe" `, prefix) - //callbacksCSb := &strings.Builder{} + + 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)) @@ -36,6 +56,7 @@ import "unsafe" 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 @@ -56,19 +77,19 @@ import "unsafe" continue } - if IsTemplateTypedef(typedefs.data[k]) { + if IsTemplateTypedef(typedef) { glg.Infof("typedef %s is a template. not implemented yet", k) continue } - isPtr := HasSuffix(typedefs.data[k], "*") + isPtr := HasSuffix(typedef, "*") var knownReturnType, knownPtrReturnType returnWrapper var knownArgType, knownPtrArgType ArgumentWrapperData var argTypeErr, ptrArgTypeErr, returnTypeErr, ptrReturnTypeErr error - if typedefs.data[k] == "void*" { - typedefs.data[k] = "uintptr_t" + if typedef == "void*" { + typedef = "uintptr_t" } // Let's say our pureType is of form short @@ -77,14 +98,14 @@ import "unsafe" // - *int16 -> short* (for handle()) // - short* -> *int16 (for newXXXFromC) knownReturnType, returnTypeErr = getReturnWrapper( - CIdentifier(typedefs.data[k]), + CIdentifier(typedef), map[CIdentifier]bool{}, map[GoIdentifier]bool{}, map[CIdentifier]string{}, ) knownPtrReturnType, ptrReturnTypeErr = getReturnWrapper( - CIdentifier(typedefs.data[k])+"*", + CIdentifier(typedef)+"*", map[CIdentifier]bool{}, map[GoIdentifier]bool{}, map[CIdentifier]string{}, @@ -93,7 +114,7 @@ import "unsafe" _, knownArgType, argTypeErr = getArgWrapper( &ArgDef{ Name: "self", - Type: CIdentifier(typedefs.data[k]), + Type: CIdentifier(typedef), }, false, false, map[CIdentifier]bool{}, @@ -104,7 +125,7 @@ import "unsafe" _, knownPtrArgType, ptrArgTypeErr = getArgWrapper( &ArgDef{ Name: "self", - Type: CIdentifier(typedefs.data[k]) + "*", + Type: CIdentifier(typedef) + "*", }, false, false, map[CIdentifier]bool{}, @@ -114,8 +135,61 @@ import "unsafe" // 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 @@ -198,10 +272,24 @@ func new%[1]sFromC(cvalue *C.%[6]s) *%[1]s { } } + 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 } From 1c4d9f527b8603cdaf2493ba02d5cfe443077105 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Thu, 15 Feb 2024 22:02:34 +0100 Subject: [PATCH 57/68] regenerate code --- cimgui_typedefs.cpp | 14 ++++++++++++ cimgui_typedefs.go | 16 ++++++-------- cimgui_typedefs.h | 16 ++++++++++++++ cimmarkdown_typedefs.cpp | 6 +++++ cimmarkdown_typedefs.go | 1 + cimmarkdown_typedefs.h | 15 +++++++++++++ cimnodes_typedefs.cpp | 14 ++++++++++++ cimnodes_typedefs.go | 16 ++++++-------- cimnodes_typedefs.h | 16 ++++++++++++++ cimplot_typedefs.cpp | 6 +++++ cimplot_typedefs.go | 1 + cimplot_typedefs.h | 15 +++++++++++++ cimplot_wrapper.cpp | 48 ++++++++++++++++++++-------------------- 13 files changed, 142 insertions(+), 42 deletions(-) create mode 100644 cimgui_typedefs.cpp create mode 100644 cimgui_typedefs.h create mode 100644 cimmarkdown_typedefs.cpp create mode 100644 cimmarkdown_typedefs.h create mode 100644 cimnodes_typedefs.cpp create mode 100644 cimnodes_typedefs.h create mode 100644 cimplot_typedefs.cpp create mode 100644 cimplot_typedefs.h 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 index 8e9f1b246..9b12bb672 100644 --- a/cimgui_typedefs.go +++ b/cimgui_typedefs.go @@ -7,6 +7,7 @@ package imgui // #include // #include "extra_types.h" // #include "cimgui_wrapper.h" +// #include "cimgui_typedefs.h" import "C" type BitArrayPtr struct { @@ -1811,20 +1812,17 @@ type TextureID struct { Data uintptr } -func (self *TextureID) handle() (*C.ImTextureID, func()) { - result, fn := self.c() - return &result, fn +func (self *TextureID) handle() (result *C.ImTextureID, fin func()) { + r, f := self.c() + return &r, f } -func (selfStruct *TextureID) c() (result C.ImTextureID, fin func()) { - self := selfStruct.Data - - return (C.ImTextureID)(C.uintptr_t(self)), func() {} +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 { - v := (C.uintptr_t)(*cvalue) - return &TextureID{Data: uintptr(v)} + return &TextureID{Data: (uintptr)(C.ImTextureID_toUintptr(*cvalue))} } type Vec1 struct { 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/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 index 6756656cb..c9c6be6a2 100644 --- a/cimmarkdown_typedefs.go +++ b/cimmarkdown_typedefs.go @@ -7,6 +7,7 @@ package imgui // #include // #include "extra_types.h" // #include "cimmarkdown_wrapper.h" +// #include "cimmarkdown_typedefs.h" import "C" type Emphasis struct { 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_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 index 87d743c3c..655cb844a 100644 --- a/cimnodes_typedefs.go +++ b/cimnodes_typedefs.go @@ -7,6 +7,7 @@ package imgui // #include // #include "extra_types.h" // #include "cimnodes_wrapper.h" +// #include "cimnodes_typedefs.h" import "C" type EmulateThreeButtonMouse struct { @@ -71,20 +72,17 @@ type NodesMiniMapNodeHoveringCallbackUserData struct { Data uintptr } -func (self *NodesMiniMapNodeHoveringCallbackUserData) handle() (*C.ImNodesMiniMapNodeHoveringCallbackUserData, func()) { - result, fn := self.c() - return &result, fn +func (self *NodesMiniMapNodeHoveringCallbackUserData) handle() (result *C.ImNodesMiniMapNodeHoveringCallbackUserData, fin func()) { + r, f := self.c() + return &r, f } -func (selfStruct *NodesMiniMapNodeHoveringCallbackUserData) c() (result C.ImNodesMiniMapNodeHoveringCallbackUserData, fin func()) { - self := selfStruct.Data - - return (C.ImNodesMiniMapNodeHoveringCallbackUserData)(C.uintptr_t(self)), func() {} +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 { - v := (C.uintptr_t)(*cvalue) - return &NodesMiniMapNodeHoveringCallbackUserData{Data: uintptr(v)} + return &NodesMiniMapNodeHoveringCallbackUserData{Data: (uintptr)(C.ImNodesMiniMapNodeHoveringCallbackUserData_toUintptr(*cvalue))} } type NodesStyle struct { 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/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 index 89acb037d..e096a1092 100644 --- a/cimplot_typedefs.go +++ b/cimplot_typedefs.go @@ -7,6 +7,7 @@ package imgui // #include // #include "extra_types.h" // #include "cimplot_wrapper.h" +// #include "cimplot_typedefs.h" import "C" type FormatterTimeData struct { 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 2eef216c6..0f94e7458 100644 --- a/cimplot_wrapper.cpp +++ b/cimplot_wrapper.cpp @@ -47,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,NULL,NULL); } +void wrap_ImPlot_BustColorCache() { ImPlot_BustColorCache(NULL); } 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,NULL,"",-1); } +void wrap_ImPlot_DestroyContext() { ImPlot_DestroyContext(NULL); } +bool wrap_ImPlot_DragLineX(int id,double* x,const ImVec4 col) { return ImPlot_DragLineX(id,x,col,1,0,NULL,NULL,NULL); } +bool wrap_ImPlot_DragLineY(int id,double* y,const ImVec4 col) { return ImPlot_DragLineY(id,y,col,1,0,NULL,NULL,NULL); } +bool wrap_ImPlot_DragPoint(int id,double* x,double* y,const ImVec4 col) { return ImPlot_DragPoint(id,x,y,col,4,0,NULL,NULL,NULL); } +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,NULL,NULL,NULL); } 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}); } @@ -67,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(NULL); } +void wrap_ImPlot_MapInputReverse() { ImPlot_MapInputReverse(NULL); } 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); } @@ -306,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,NULL); } 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); } @@ -316,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) { wrap_ImPlot_SetupAxisFormat_PlotFormatterV(axis,formatter,nullptr); } +void wrap_ImPlot_SetupAxis(ImAxis axis) { ImPlot_SetupAxis(axis,NULL,0); } +void wrap_ImPlot_SetupAxisFormat_PlotFormatter(ImAxis axis,ImPlotFormatter formatter) { wrap_ImPlot_SetupAxisFormat_PlotFormatterV(axis,formatter,NULL); } 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) { wrap_ImPlot_SetupAxisScale_PlotTransformV(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,NULL); } +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,NULL,false); } +void wrap_ImPlot_SetupAxisTicks_doublePtr(ImAxis axis,const double* values,int n_ticks) { ImPlot_SetupAxisTicks_doublePtr(axis,values,n_ticks,NULL,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,NULL,NULL); } +void wrap_ImPlot_ShowDemoWindow() { ImPlot_ShowDemoWindow(NULL); } +void wrap_ImPlot_ShowMetricsWindow() { ImPlot_ShowMetricsWindow(NULL); } +void wrap_ImPlot_ShowStyleEditor() { ImPlot_ShowStyleEditor(NULL); } +void wrap_ImPlot_StyleColorsAuto() { ImPlot_StyleColorsAuto(NULL); } +void wrap_ImPlot_StyleColorsClassic() { ImPlot_StyleColorsClassic(NULL); } +void wrap_ImPlot_StyleColorsDark() { ImPlot_StyleColorsDark(NULL); } +void wrap_ImPlot_StyleColorsLight() { ImPlot_StyleColorsLight(NULL); } 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); } From c513fe78379e64193c1509e1cdd8e0529c871940 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Fri, 16 Feb 2024 21:09:59 +0100 Subject: [PATCH 58/68] codegen: convert return type to unintptr --- cmd/codegen/gencpp.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/cmd/codegen/gencpp.go b/cmd/codegen/gencpp.go index 780707c3c..6192ef3e2 100644 --- a/cmd/codegen/gencpp.go +++ b/cmd/codegen/gencpp.go @@ -115,8 +115,9 @@ 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) - if f.Ret == "void*" { - f.Ret = "uintptr_t" + ret := f.Ret + if ret == "void*" { + ret = "uintptr_t" } var argsT []ArgDef @@ -301,7 +302,7 @@ extern "C" { Destructor: f.Destructor, StructSetter: false, StructGetter: false, - Ret: f.Ret, + Ret: ret, StName: f.StName, NonUDT: f.NonUDT, CWrapperFuncName: cWrapperFuncName + "V", @@ -329,7 +330,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, @@ -362,9 +363,12 @@ extern "C" { } else { headerSb.WriteString(fmt.Sprintf("extern %s %s%s;\n", f.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)) } } From 2fb2b55e627c6ee1920efd6d346a3826e9a15b6c Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Fri, 16 Feb 2024 21:10:08 +0100 Subject: [PATCH 59/68] suppress warning --- cimgui.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 229ff31672b897becd4bde895c09c8b6115ae463 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Fri, 16 Feb 2024 21:10:16 +0100 Subject: [PATCH 60/68] regenerte code --- cimgui_wrapper.cpp | 2 +- cimgui_wrapper.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cimgui_wrapper.cpp b/cimgui_wrapper.cpp index 9b61a151f..9b5414796 100644 --- a/cimgui_wrapper.cpp +++ b/cimgui_wrapper.cpp @@ -13,7 +13,7 @@ void wrap_ImFontGlyphRangesBuilder_AddTextV(ImFontGlyphRangesBuilder* self,const 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 ImGuiDataVarInfo_GetVarPtr(self,(void*)(uintptr_t)parent); } +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); } diff --git a/cimgui_wrapper.h b/cimgui_wrapper.h index 59ffaab9f..e2dcc7f07 100644 --- a/cimgui_wrapper.h +++ b/cimgui_wrapper.h @@ -18,7 +18,7 @@ extern void wrap_ImFontGlyphRangesBuilder_AddTextV(ImFontGlyphRangesBuilder* sel 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_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); From bc5a43554049e3b3bd486a6f5af7b7828c8c8a33 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Fri, 16 Feb 2024 21:36:21 +0100 Subject: [PATCH 61/68] typedefs: generate functions with callback arguments correctly --- cmd/codegen/gencpp.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/cmd/codegen/gencpp.go b/cmd/codegen/gencpp.go index 6192ef3e2..57b5eef86 100644 --- a/cmd/codegen/gencpp.go +++ b/cmd/codegen/gencpp.go @@ -156,7 +156,24 @@ extern "C" { 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" - f.Args = Replace(f.Args, fmt.Sprintf("void* %s", a.Name), fmt.Sprintf("uintptr_t %s", a.Name), 1) + // 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) From d43c3d93a66b87477cf20a0d8f66f37ba7226a42 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Fri, 16 Feb 2024 21:36:33 +0100 Subject: [PATCH 62/68] regenerate code --- cimgui_wrapper.cpp | 10 +++++----- cimgui_wrapper.h | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cimgui_wrapper.cpp b/cimgui_wrapper.cpp index 9b5414796..1b7e55115 100644 --- a/cimgui_wrapper.cpp +++ b/cimgui_wrapper.cpp @@ -24,7 +24,7 @@ bool wrap_ImGuiTextFilter_PassFilterV(ImGuiTextFilter* self,const char* text,con 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)(uintptr_t user_data,int idx),void* 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_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); } @@ -54,13 +54,13 @@ bool wrap_igInputTextExV(const char* label,const char* hint,char* buf,int buf_si 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)(uintptr_t user_data,int idx),void* 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); } +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); } void wrap_igMemFree(uintptr_t ptr) { igMemFree((void*)(uintptr_t)ptr); } -int wrap_igPlotEx(ImGuiPlotType plot_type,const char* label,float(*values_getter)(uintptr_t data,int idx),void* 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)(uintptr_t data,int idx),void* 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)(uintptr_t data,int idx),void* 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); } +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); } diff --git a/cimgui_wrapper.h b/cimgui_wrapper.h index e2dcc7f07..b8f40d776 100644 --- a/cimgui_wrapper.h +++ b/cimgui_wrapper.h @@ -29,7 +29,7 @@ extern bool wrap_ImGuiTextFilter_PassFilterV(ImGuiTextFilter* self,const char* t 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)(uintptr_t user_data,int idx),void* user_data,int items_count,int popup_max_height_in_items); +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); @@ -59,13 +59,13 @@ extern bool wrap_igInputTextExV(const char* label,const char* hint,char* buf,int 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)(uintptr_t user_data,int idx),void* user_data,int items_count,int height_in_items); +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 void wrap_igMemFree(uintptr_t ptr); -extern int wrap_igPlotEx(ImGuiPlotType plot_type,const char* label,float(*values_getter)(uintptr_t data,int idx),void* 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)(uintptr_t data,int idx),void* 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)(uintptr_t data,int idx),void* data,int values_count,int values_offset,const char* overlay_text,float scale_min,float scale_max,ImVec2 graph_size); +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); From 942ee405c6c8fbc3fc7ed99a350b44cddb99ed7c Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sat, 17 Feb 2024 10:09:24 +0100 Subject: [PATCH 63/68] codegen: generate functions with void* return type correctly (sometimes this fact was skipped) --- cmd/codegen/gencpp.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/codegen/gencpp.go b/cmd/codegen/gencpp.go index 57b5eef86..80b872c9d 100644 --- a/cmd/codegen/gencpp.go +++ b/cmd/codegen/gencpp.go @@ -369,7 +369,7 @@ extern "C" { // cppSb.WriteString(fmt.Sprintf("// %#v\n", f)) // if needed, write extra stuff to cpp headers - if string(f.AllCallArgs) == actualCallArgsStr { + 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)) From 2fad3e7bfd00fbb998951c4ed6ccc0090d7c4c56 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sat, 17 Feb 2024 10:10:20 +0100 Subject: [PATCH 64/68] codegen: fix header generation for void* return type --- cimgui_funcs.go | 6 +++--- cimgui_wrapper.cpp | 5 ++++- cimgui_wrapper.h | 3 +++ cmd/codegen/gencpp.go | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/cimgui_funcs.go b/cimgui_funcs.go index 882a3136b..5db392bbe 100644 --- a/cimgui_funcs.go +++ b/cimgui_funcs.go @@ -2484,7 +2484,7 @@ func (self *Storage) VoidPtr(key ID) uintptr { selfFin() keyFin() }() - return uintptr(C.ImGuiStorage_GetVoidPtr(selfArg, keyArg)) + return uintptr(C.wrap_ImGuiStorage_GetVoidPtr(selfArg, keyArg)) } func (self *Storage) SetAllInt(val int32) { @@ -6558,7 +6558,7 @@ func InternalImFileLoadToMemoryV(filename string, mode string, out_file_size *ui filenameFin() modeFin() }() - return uintptr(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() @@ -8031,7 +8031,7 @@ func InternalMarkItemEdited(id ID) { } func MemAlloc(size uint64) uintptr { - return uintptr(C.igMemAlloc(C.xulong(size))) + return uintptr(C.wrap_igMemAlloc(C.xulong(size))) } func MemFree(ptr uintptr) { diff --git a/cimgui_wrapper.cpp b/cimgui_wrapper.cpp index 1b7e55115..dc1c7d9b1 100644 --- a/cimgui_wrapper.cpp +++ b/cimgui_wrapper.cpp @@ -17,6 +17,7 @@ uintptr_t wrap_ImGuiDataVarInfo_GetVarPtr(ImGuiDataVarInfo* self,uintptr_t paren 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); } @@ -40,6 +41,7 @@ void wrap_igErrorCheckEndWindowRecoverV(ImGuiErrorLogCallback log_callback,uintp 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); } @@ -57,6 +59,7 @@ 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); } @@ -211,7 +214,7 @@ 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); } -uintptr_t wrap_igImFileLoadToMemory(const char* filename,const char* mode) { return igImFileLoadToMemory(filename,mode,NULL,0); } +uintptr_t wrap_igImFileLoadToMemory(const char* filename,const char* mode) { return wrap_igImFileLoadToMemoryV(filename,mode,NULL,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); } diff --git a/cimgui_wrapper.h b/cimgui_wrapper.h index b8f40d776..c395efb3c 100644 --- a/cimgui_wrapper.h +++ b/cimgui_wrapper.h @@ -22,6 +22,7 @@ extern void* wrap_ImGuiDataVarInfo_GetVarPtr(ImGuiDataVarInfo* self,uintptr_t pa 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 void* 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); @@ -45,6 +46,7 @@ extern void wrap_igErrorCheckEndWindowRecoverV(ImGuiErrorLogCallback log_callbac 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 void* 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); @@ -62,6 +64,7 @@ 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 void* 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); diff --git a/cmd/codegen/gencpp.go b/cmd/codegen/gencpp.go index 80b872c9d..c4c28b7ee 100644 --- a/cmd/codegen/gencpp.go +++ b/cmd/codegen/gencpp.go @@ -378,7 +378,7 @@ 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)) switch f.Ret { case "void": From 7b9ba2a1692392b34a6992e4354d890fcbc7b960 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sat, 17 Feb 2024 10:10:28 +0100 Subject: [PATCH 65/68] regenerate code --- cimgui_wrapper.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cimgui_wrapper.h b/cimgui_wrapper.h index c395efb3c..aae8cdfa0 100644 --- a/cimgui_wrapper.h +++ b/cimgui_wrapper.h @@ -18,11 +18,11 @@ extern void wrap_ImFontGlyphRangesBuilder_AddTextV(ImFontGlyphRangesBuilder* sel 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 void* wrap_ImGuiDataVarInfo_GetVarPtr(ImGuiDataVarInfo* self,uintptr_t parent); +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 void* wrap_ImGuiStorage_GetVoidPtr(ImGuiStorage* self,ImGuiID key); +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); @@ -46,7 +46,7 @@ extern void wrap_igErrorCheckEndWindowRecoverV(ImGuiErrorLogCallback log_callbac 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 void* wrap_igImFileLoadToMemoryV(const char* filename,const char* mode,size_t* out_file_size,int padding_bytes); +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); @@ -64,7 +64,7 @@ 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 void* wrap_igMemAlloc(size_t size); +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); From 6f29f8d70ba7824a4dbe6143667f43cf929b1cd5 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sat, 17 Feb 2024 10:27:31 +0100 Subject: [PATCH 66/68] codegen: replace NULL with 0 0 is more appropiate null value for uintptr_t --- cmd/codegen/gencpp.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/codegen/gencpp.go b/cmd/codegen/gencpp.go index c4c28b7ee..2d90a9cbe 100644 --- a/cmd/codegen/gencpp.go +++ b/cmd/codegen/gencpp.go @@ -291,8 +291,8 @@ extern "C" { v = "NULL" } - if v == "nullptr" { - v = "NULL" + if v == "nullptr" || v == "NULL" { + v = "0" } if k == "text_end" || k == "text_end_" { From 87cdde196b817979107ab13023130d26d7de1f83 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sat, 17 Feb 2024 10:31:41 +0100 Subject: [PATCH 67/68] Regenerate code --- cimgui_wrapper.cpp | 136 +++++++++++++++++++++---------------------- cimnodes_wrapper.cpp | 22 +++---- cimplot_wrapper.cpp | 48 +++++++-------- 3 files changed, 103 insertions(+), 103 deletions(-) diff --git a/cimgui_wrapper.cpp b/cimgui_wrapper.cpp index dc1c7d9b1..cf503cf6a 100644 --- a/cimgui_wrapper.cpp +++ b/cimgui_wrapper.cpp @@ -111,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); } @@ -122,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,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,NULL,NULL); } -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,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); } @@ -142,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 wrap_ImGuiStorage_GetVoidPtrRefV(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); } @@ -161,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}); } @@ -179,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,uintptr_t p_data) { return wrap_igDragScalarV(label,data_type,p_data,1.0f,NULL,NULL,NULL,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,NULL,NULL,NULL,0); } -void wrap_igErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback) { wrap_igErrorCheckEndFrameRecoverV(log_callback,NULL); } -void wrap_igErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback) { wrap_igErrorCheckEndWindowRecoverV(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); } @@ -214,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); } -uintptr_t wrap_igImFileLoadToMemory(const char* filename,const char* mode) { return wrap_igImFileLoadToMemoryV(filename,mode,NULL,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); } @@ -231,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,uintptr_t p_data) { return wrap_igInputScalarV(label,data_type,p_data,NULL,NULL,NULL,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,NULL,NULL,NULL,0); } -bool wrap_igInputText(const char* label,char* buf,size_t buf_size) { return wrap_igInputTextV(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 wrap_igInputTextExV(label,hint,buf,buf_size,size_arg,flags,NULL,NULL); } -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,NULL,NULL); } -bool wrap_igInputTextWithHint(const char* label,const char* hint,char* buf,size_t buf_size) { return wrap_igInputTextWithHintV(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); } @@ -248,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); } @@ -261,40 +261,40 @@ 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() { wrap_igRenderPlatformWindowsDefaultV(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) { wrap_igSetAllocatorFunctionsV(alloc_func,free_func,NULL); } +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); } @@ -305,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) { wrap_igSetNextWindowSizeConstraintsV(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); } @@ -321,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); } @@ -336,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,uintptr_t p_data,uintptr_t p_min,uintptr_t p_max) { return wrap_igSliderScalarV(label,data_type,p_data,p_min,p_max,NULL,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,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); } @@ -350,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,uintptr_t p_data,const char* format) { return wrap_igTempInputScalarV(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,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,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/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_wrapper.cpp b/cimplot_wrapper.cpp index 0f94e7458..fd652872e 100644 --- a/cimplot_wrapper.cpp +++ b/cimplot_wrapper.cpp @@ -47,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,NULL,NULL); } -void wrap_ImPlot_BustColorCache() { ImPlot_BustColorCache(NULL); } +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,NULL,"",-1); } -void wrap_ImPlot_DestroyContext() { ImPlot_DestroyContext(NULL); } -bool wrap_ImPlot_DragLineX(int id,double* x,const ImVec4 col) { return ImPlot_DragLineX(id,x,col,1,0,NULL,NULL,NULL); } -bool wrap_ImPlot_DragLineY(int id,double* y,const ImVec4 col) { return ImPlot_DragLineY(id,y,col,1,0,NULL,NULL,NULL); } -bool wrap_ImPlot_DragPoint(int id,double* x,double* y,const ImVec4 col) { return ImPlot_DragPoint(id,x,y,col,4,0,NULL,NULL,NULL); } -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,NULL,NULL,NULL); } +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}); } @@ -67,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(NULL); } -void wrap_ImPlot_MapInputReverse() { ImPlot_MapInputReverse(NULL); } +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); } @@ -306,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,NULL); } +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); } @@ -316,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,NULL,0); } -void wrap_ImPlot_SetupAxisFormat_PlotFormatter(ImAxis axis,ImPlotFormatter formatter) { wrap_ImPlot_SetupAxisFormat_PlotFormatterV(axis,formatter,NULL); } +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) { wrap_ImPlot_SetupAxisScale_PlotTransformV(axis,forward,inverse,NULL); } -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,NULL,false); } -void wrap_ImPlot_SetupAxisTicks_doublePtr(ImAxis axis,const double* values,int n_ticks) { ImPlot_SetupAxisTicks_doublePtr(axis,values,n_ticks,NULL,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,NULL,NULL); } -void wrap_ImPlot_ShowDemoWindow() { ImPlot_ShowDemoWindow(NULL); } -void wrap_ImPlot_ShowMetricsWindow() { ImPlot_ShowMetricsWindow(NULL); } -void wrap_ImPlot_ShowStyleEditor() { ImPlot_ShowStyleEditor(NULL); } -void wrap_ImPlot_StyleColorsAuto() { ImPlot_StyleColorsAuto(NULL); } -void wrap_ImPlot_StyleColorsClassic() { ImPlot_StyleColorsClassic(NULL); } -void wrap_ImPlot_StyleColorsDark() { ImPlot_StyleColorsDark(NULL); } -void wrap_ImPlot_StyleColorsLight() { ImPlot_StyleColorsLight(NULL); } +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); } From 76e8b9c0752edf27f24696c03cf3c3b422834c35 Mon Sep 17 00:00:00 2001 From: gucio321 <73652197+gucio321@users.noreply.github.com> Date: Sat, 17 Feb 2024 10:40:58 +0100 Subject: [PATCH 68/68] codegen: remove gengo_structs.go this file is deprecated and was replaced by gengo_typedefs.go --- cmd/codegen/gengo_structs.go | 249 ----------------------------------- 1 file changed, 249 deletions(-) delete mode 100644 cmd/codegen/gengo_structs.go diff --git a/cmd/codegen/gengo_structs.go b/cmd/codegen/gengo_structs.go deleted file mode 100644 index ab1a42c3e..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, refTypedefs map[CIdentifier]string) []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, refTypedefs, &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, refTypedefs map[CIdentifier]string, 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, refTypedefs, - ) - - fromC, fromCErr := getReturnWrapper( - field.Type, - structs, enums, refTypedefs, - ) - - 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) -}