{"id":26800622,"url":"https://github.com/ktsu-dev/imguiwidgets","last_synced_at":"2025-06-12T07:37:25.903Z","repository":{"id":217232372,"uuid":"743345688","full_name":"ktsu-dev/ImGuiWidgets","owner":"ktsu-dev","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-18T23:07:40.000Z","size":851,"stargazers_count":1,"open_issues_count":5,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-19T00:21:10.539Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ktsu-dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-01-15T02:51:47.000Z","updated_at":"2025-05-18T23:07:43.000Z","dependencies_parsed_at":"2024-01-15T06:11:07.006Z","dependency_job_id":"f27289f5-c0cd-4c98-b9f0-e8474af5534a","html_url":"https://github.com/ktsu-dev/ImGuiWidgets","commit_stats":null,"previous_names":["ktsu-io/imguiwidgets","ktsu-dev/imguiwidgets"],"tags_count":180,"template":false,"template_full_name":null,"purl":"pkg:github/ktsu-dev/ImGuiWidgets","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ktsu-dev%2FImGuiWidgets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ktsu-dev%2FImGuiWidgets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ktsu-dev%2FImGuiWidgets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ktsu-dev%2FImGuiWidgets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ktsu-dev","download_url":"https://codeload.github.com/ktsu-dev/ImGuiWidgets/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ktsu-dev%2FImGuiWidgets/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259421272,"owners_count":22854774,"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":[],"created_at":"2025-03-29T20:18:12.178Z","updated_at":"2025-06-12T07:37:25.897Z","avatar_url":"https://github.com/ktsu-dev.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ktsu.ImGuiWidgets\n\nImGuiWidgets is a library of custom widgets using ImGui.NET. This library provides a variety of widgets and utilities to enhance your ImGui-based applications.\n\n## Features\n\n- **Knobs**: Ported to .NET from [ImGui-works/ImGui-knobs-dial-gauge-meter](https://github.com/imgui-works/imgui-knobs-dial-gauge-meter)\n- **Resizable Layout Dividers**: Draggable layout dividers for resizable layouts\n- **TabPanel**: Tabbed interface with closable, reorderable tabs and dirty indicator support\n- **Icons**: Customizable icons with various alignment options and event delegates\n- **Grid**: Flexible grid layout for displaying items\n- **Color Indicator**: An indicator that displays a color when enabled\n- **Image**: An image widget with alignment options\n- **Text**: A text widget with alignment options\n- **Tree**: A tree widget for displaying hierarchical data\n- **Scoped Id**: A utility class for creating scoped IDs\n- **SearchBox**: A powerful search box with support for various filter types (Glob, Regex, Fuzzy) and matching options\n\n## Installation\n\nTo install ImGuiWidgets, you can add the library to your .NET project using the following command:\n\n```bash\ndotnet add package ktsu.ImGuiWidgets\n```\n\n## Usage\n\nTo use ImGuiWidgets, you need to include the `ktsu.ImGuiWidgets` namespace in your code:\n\n```csharp\nusing ktsu.ImGuiWidgets;\n```\n\nThen, you can start using the widgets provided by ImGuiWidgets in your ImGui-based applications.\n\n## Examples\n\nHere are some examples of using ImGuiWidgets:\n\n### Knobs\n\nKnobs are useful for creating dial-like controls:\n\n```csharp\nfloat value = 0.5f;\nfloat minValue = 0.0f;\n\nImGuiWidgets.Knob(\"Knob\", ref value, minValue);\n```\n\n### SearchBox\n\nThe SearchBox widget provides a powerful search interface with multiple filter type options:\n\n```csharp\n// Static fields to maintain filter state between renders\nprivate static string searchTerm = string.Empty;\nprivate static TextFilterType filterType = TextFilterType.Glob;\nprivate static TextFilterMatchOptions matchOptions = TextFilterMatchOptions.ByWholeString;\n\n// List of items to search\nvar items = new List\u003cstring\u003e { \"Apple\", \"Banana\", \"Cherry\", \"Date\", \"Elderberry\" };\n\n// Basic search box with right-click context menu for filter options\nImGuiWidgets.SearchBox(\"##BasicSearch\", ref searchTerm, ref filterType, ref matchOptions);\n\n// Display results\nif (!string.IsNullOrEmpty(searchTerm))\n{\n    ImGui.TextUnformatted($\"Search results for: {searchTerm}\");\n}\n\n// Search box that returns filtered results directly\nvar filteredResults = ImGuiWidgets.SearchBox(\n    \"##FilteredSearch\",\n    ref searchTerm,\n    items,                  // Collection to filter\n    item =\u003e item,           // Selector function to extract string from each item\n    ref filterType,\n    ref matchOptions).ToList();\n\n// Ranked search box for fuzzy matching and ranked results\nvar rankedResults = ImGuiWidgets.SearchBoxRanked(\n    \"##RankedSearch\", \n    ref searchTerm, \n    items, \n    item =\u003e item).ToList();\n```\n\n### TabPanel\n\nTabPanel creates a tabbed interface with support for closable tabs, reordering, and dirty state indication:\n\n```csharp\n// Create a tab panel with closable and reorderable tabs\nvar tabPanel = new ImGuiWidgets.TabPanel(\"MyTabPanel\", true, true);\n\n// Add tabs with explicit IDs (recommended for stability when tabs are reordered)\nstring tab1Id = tabPanel.AddTab(\"tab1\", \"First Tab\", RenderTab1Content);\nstring tab2Id = tabPanel.AddTab(\"tab2\", \"Second Tab\", RenderTab2Content);\nstring tab3Id = tabPanel.AddTab(\"tab3\", \"Third Tab\", RenderTab3Content);\n\n// Draw the tab panel in your render loop\ntabPanel.Draw();\n\n// Methods to render tab content\nvoid RenderTab1Content()\n{\n    ImGui.Text(\"Tab 1 Content\");\n    \n    // Mark tab as dirty when content changes\n    if (ImGui.Button(\"Edit\"))\n    {\n        tabPanel.MarkTabDirty(tab1Id);\n    }\n    \n    // Mark tab as clean when content is saved\n    if (ImGui.Button(\"Save\"))\n    {\n        tabPanel.MarkTabClean(tab1Id);\n    }\n}\n\nvoid RenderTab2Content()\n{\n    ImGui.Text(\"Tab 2 Content\");\n}\n\nvoid RenderTab3Content()\n{\n    ImGui.Text(\"Tab 3 Content\");\n}\n```\n\n### Icons\n\nIcons can be used to display images with various alignment options and event delegates:\n\n```csharp\nfloat iconWidthEms = 7.5f;\nfloat iconWidthPx = ImGuiApp.EmsToPx(iconWidthEms);\n\nuint textureId = ImGuiApp.GetOrLoadTexture(\"icon.png\");\n\nImGuiWidgets.Icon(\"Click Me\", textureId, iconWidthPx, Color.White.Value, ImGuiWidgets.IconAlignment.Vertical, new ImGuiWidgets.IconDelegates()\n{\n\tOnClick = () =\u003e MessageOK.Open(\"Click\", \"You clicked\")\n});\n\nImGui.SameLine();\nImGuiWidgets.Icon(\"Double Click Me\", textureId, iconWidthPx, Color.White.Value, ImGuiWidgets.IconAlignment.Vertical, new ImGuiWidgets.IconDelegates()\n{\n\tOnDoubleClick = () =\u003e MessageOK.Open(\"Double Click\", \"You clicked twice\")\n});\n\nImGui.SameLine();\nImGuiWidgets.Icon(\"Right Click Me\", textureId, iconWidthPx, Color.White.Value, ImGuiWidgets.IconAlignment.Vertical, new ImGuiWidgets.IconDelegates()\n{\n\tOnContextMenu = () =\u003e\n\t{\n\t\tImGui.MenuItem(\"Context Menu Item 1\");\n\t\tImGui.MenuItem(\"Context Menu Item 2\");\n\t\tImGui.MenuItem(\"Context Menu Item 3\");\n\t},\n});\n```\n\n### Grid\n\nThe grid layout allows you to display items in a flexible grid:\n\n```csharp\nfloat iconSizeEms = 7.5f;\nfloat iconSizePx = ImGuiApp.EmsToPx(iconSizeEms);\n\nuint textureId = ImGuiApp.GetOrLoadTexture(\"icon.png\");\n\nImGuiWidgets.Grid(items, i =\u003e ImGuiWidgets.CalcIconSize(i, iconSizePx), (item, cellSize, itemSize) =\u003e\n{\n\tImGuiWidgets.Icon(item, textureId, iconSizePx, Color.White.Value);\n});\n```\n\n### Color Indicator\n\nThe color indicator widget displays a color when enabled:\n\n```csharp\nbool enabled = true;\nColor color = Color.Red;\n\nImGuiWidgets.ColorIndicator(\"Color Indicator\", enabled, color);\n```\n\n### Image\n\nThe image widget allows you to display images with alignment options:\n\n```csharp\nuint textureId = ImGuiApp.GetOrLoadTexture(\"image.png\");\n\nImGuiWidgets.Image(textureId, new Vector2(100, 100));\n```\n\n### Text\n\nThe text widget allows you to display text with alignment options:\n\n```csharp\nImGuiWidgets.Text(\"Hello, ImGuiWidgets!\");\nImGuiWidgets.TextCentered(\"Hello, ImGuiWidgets!\");\nImGuiWidgets.TextCenteredWithin(\"Hello, ImGuiWidgets!\", new Vector2(100, 100));\n```\n\n### Tree\n\nThe tree widget allows you to display hierarchical data:\n\n```csharp\nusing (var tree = new ImGuiWidgets.Tree())\n{\n\tfor (int i = 0; i \u003c 5; i++)\n\t{\n\t\tusing (tree.Child)\n\t\t{\n\t\t\tImGui.Button($\"Hello, Child {i}!\");\n\t\t\tusing (var subtree = new ImGuiWidgets.Tree())\n\t\t\t{\n\t\t\t\tusing (subtree.Child)\n\t\t\t\t{\n\t\t\t\t\tImGui.Button($\"Hello, Grandchild!\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n```\n\n### Scoped Id\n\nThe scoped ID utility class helps in creating scoped IDs for ImGui elements and ensuring they get popped appropriatley:\n\n```csharp\nusing (new ImGuiWidgets.ScopedId())\n{\n    ImGui.Button(\"Hello, Scoped ID!\");\n}\n```\n\n## Contributing\n\nContributions are welcome! For feature requests, bug reports, or questions, please open an issue on the GitHub repository. If you would like to contribute code, please open a pull request with your changes.\n\n## Acknowledgements\n\nImGuiWidgets is inspired by the following projects:\n\n- [ocornut/ImGui](https://github.com/ocornut/imgui)\n- [ImGui.NET](https://github.com/ImGuiNET/ImGui.NET)\n- [ImGui-works/ImGui-knobs-dial-gauge-meter](https://github.com/imgui-works/imgui-knobs-dial-gauge-meter)\n\n## License\n\nImGuiWidgets is licensed under the MIT License. See [LICENSE](LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fktsu-dev%2Fimguiwidgets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fktsu-dev%2Fimguiwidgets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fktsu-dev%2Fimguiwidgets/lists"}