{"id":14990786,"url":"https://github.com/batiati/iupforzig","last_synced_at":"2025-04-12T03:24:37.320Z","repository":{"id":47368964,"uuid":"378521227","full_name":"batiati/IUPforZig","owner":"batiati","description":"IUP (Portable User Interface Toolkit) bindings for the Zig language.","archived":false,"fork":false,"pushed_at":"2024-01-12T21:15:21.000Z","size":3719,"stargazers_count":120,"open_issues_count":2,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-10T05:59:13.195Z","etag":null,"topics":["gui","iup","iup-gui-library","iup-toolkit","multiplatform","zig","zig-package","ziglang"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/batiati.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-19T23:19:14.000Z","updated_at":"2025-03-25T23:27:17.000Z","dependencies_parsed_at":"2024-01-13T03:37:51.667Z","dependency_job_id":null,"html_url":"https://github.com/batiati/IUPforZig","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/batiati%2FIUPforZig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/batiati%2FIUPforZig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/batiati%2FIUPforZig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/batiati%2FIUPforZig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/batiati","download_url":"https://codeload.github.com/batiati/IUPforZig/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248511087,"owners_count":21116349,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gui","iup","iup-gui-library","iup-toolkit","multiplatform","zig","zig-package","ziglang"],"created_at":"2024-09-24T14:20:50.588Z","updated_at":"2025-04-12T03:24:37.283Z","avatar_url":"https://github.com/batiati.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IUP for Zig\n[![Lines of code](https://img.shields.io/tokei/lines/github/batiati/IUPforZig)]()\n[![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/batiati/IUPforZig)]()\n[![made with Zig](https://img.shields.io/badge/made%20with%20%E2%9D%A4%20-Zig-orange)]()\n[![made with Zig](https://img.shields.io/badge/unlicensed-public%20domain-brightgreen)]()\n\nA [Zig language](https://ziglang.org/) idiomatic and type-checked bindings for [IUP Portable User Interface Toolkit](https://tecgraf.puc-rio.br/iup/)\n\n## Examples\n\n- [Simple notepad (in progress)](docs/simple_notepad.md)\n- [7GUIs](src/7gui/ReadMe.md)\n- [Button](docs/button.md)\n- [Image](docs/image.md)\n- [List](docs/list.md)\n- [Tree](docs/tree.md)\n- [MDI](docs/mdi.md)\n- [Gauge](docs/gauge.md)\n- [Tabs](docs/tabs.md)\n\n![Simple Notepad Windows](docs/SimpleNotepadWindows.gif)\n\n![Simple Notepad Ubuntu](docs/SimpleNotepadUbuntu.gif)\n\n## First look\n\nA simple hello world example looks like this:\n\n```Zig\nconst iup = @import(\"iup.zig\");\n\npub fn main() !void {\n    try iup.MainLoop.open();\n    defer iup.MainLoop.close();\n\n    var main_dialog = try (iup.Dialog.init()\n        .setTitle(\"Hello World\")\n        .setChildren(\n        .{\n            iup.VBox.init()\n                .setMargin(10, 10)\n                .setGap(10)\n                .setAlignment(.ACenter)\n                .setChildren(\n                .{\n                    iup.Label.init()\n                        .setTitle(\"Hello World from IUPforZig\"),\n                    iup.Button.init()\n                        .setTitle(\"OK\")\n                        .setActionCallback(exit),\n                },\n            ),\n        },\n    ).unwrap());\n    defer main_dialog.deinit();\n\n    try main_dialog.showXY(.Center, .Center);\n    try iup.MainLoop.beginLoop();\n}\n\nfn exit(button: *iup.Button) !void {\n    iup.MainLoop.exitLoop();\n}\n```\n\nResulting in this:\n\n![Hello World Windows](docs/HelloWorldWindows.jpg)\n\n![Hello World Ubuntu](docs/HelloWorldUbuntu.jpg)\n\n## IUP Metadata\n\nThis project contains source-code automatically generated by [The IUP Metadata Project](https://github.com/batiati/IUPMetadata).\n\nMost of the hard/repetitive work was done by code-gen tool, however, the API guidelines and all the interop code belongs here on this project.\n\n## API\n\nZig does not require any special treatment to use C libraries, so to use IUP in Zig, it is as simple as adding `@cInclude(\"iup.h\") ` in your source code, no need for special bindings!\n\nThis project attempts to create Zig bindings for IUP Toolkit with idiomatic and type-checked API, where none of the original IUP's declarations are exposed in the public interface, only names and concepts are kept as close as possible.\n\n## Comparison:\n\n1. IUP [simple example](https://tecgraf.puc-rio.br/iup/examples/tutorial/example3_1.c) in C:\n\n```C\n#include \u003cstdlib.h\u003e\n#include \u003ciup.h\u003e\n\nint main(int argc, char **argv)\n{\n  Ihandle *dlg, *multitext, *vbox;\n\n  IupOpen(\u0026argc, \u0026argv);\n\n  multitext = IupText(NULL);\n  vbox = IupVbox(\n    multitext,\n    NULL);\n  IupSetAttribute(multitext, \"MULTILINE\", \"YES\");\n  IupSetAttribute(multitext, \"EXPAND\", \"YES\");\n\n  dlg = IupDialog(vbox);\n  IupSetAttribute(dlg, \"TITLE\", \"Simple Notepad\");\n  IupSetAttribute(dlg, \"SIZE\", \"QUARTERxQUARTER\");\n\n  IupShowXY(dlg, IUP_CENTER, IUP_CENTER);\n  IupSetAttribute(dlg, \"USERSIZE\", NULL);\n\n  IupMainLoop();\n\n  IupClose();\n  return EXIT_SUCCESS;\n}\n``` \n\n2. Equivalent example in Zig:\n\n```zig\nconst iup = @import(\"iup.zig\");\n\npub fn main() !void {\n    try iup.MainLoop.open();\n    defer iup.MainLoop.close();\n\n    var main_dialog = try (iup.Dialog.init()\n        .setTitle(\"Simple Notepad\")\n        .setSize(.Quarter, .Quarter)\n        .setChildren(\n        .{\n            iup.VBox.init()\n                .setChildren(\n                .{\n                    iup.Text.init()\n                        .setMultiline(true)\n                        .setExpand(.Yes),\n                },\n            ),\n        },\n    ).unwrap());\n    defer main_dialog.deinit();\n\n    try main_dialog.showXY(.Center, .Center);\n    try iup.MainLoop.beginLoop();\n}\n```\n\n## How to build\n\n1. Download [Zig](https://ziglang.org/download/);\n\n2. Install IUP shared libraries and run:\n\n\u003e NOTE: [curl](https://curl.se/) is needed to download IUP binaries.\n\n**Linux**\n```bash\n./install_iup.sh\nzig build run\n```\n\n**Windows**\n```cmd\n.\\install_iup.bat\nzig build run\n```\n\n\u003eFor more information, please visit IUP's download page for your platform:\n\u003ehttps://sourceforge.net/projects/iup/files/3.30/\n\n\u003eDependencies for `libim` and `libcd` may be required:\n\u003ehttps://sourceforge.net/projects/imtoolkit/files/3.15/\n\u003ehttps://sourceforge.net/projects/canvasdraw/files/5.14/\n\n## Pending work\n\n- [X] Support for collections and indexed attributes (list items for example)\n\n- [ ] Complete the [Simple Notepad](https://github.com/batiati/IUPforZig/blob/master/src/example.zig) example.\n\n- [X] Support Linux and Windows (using shared libs)\n\n- [ ] Investigate how to build IUP from C sources in Zig.\n\n- [ ] More tests, and sanitize failing tests.\n\n- [ ] Additional controls (image library, matrix, GLCanvas, scintilla, plot, etc)\n\nFeel free to place any comments/issues/PRs, it will be very nice to receive any feedback 🚀.\n\n## Prior Art\n\nSome great projects that served as inspiration.\n\n- [Common Lisp CFFI bindings](https://github.com/lispnik/iup)\n\n- [Iup4D is a D binding library](https://github.com/Heromyth/Iup4D)\n\n- [IUP Rust](https://github.com/dcampbell24/iup-rust)\n\n## License\n\n* This project is a free and unencumbered software released into the public domain. Plese visit [unlicense.org](https://unlicense.org/) for more details.\n\n* IUP is a [Tecgraf](http://www.tecgraf.puc-rio.br)/[PUC-Rio](http://www.puc-rio.br) project licensed under the terms of the [MIT license](http://www.opensource.org/licenses/mit-license.html). Please visit https://www.tecgraf.puc-rio.br/iup/ for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbatiati%2Fiupforzig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbatiati%2Fiupforzig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbatiati%2Fiupforzig/lists"}