1 // Generated on 2025-06-28 2 /++ 3 D wrapper for cimgui (Dear ImGui). 4 Provides bindings for Dear ImGui immediate mode GUI library. 5 6 Features: 7 - Full ImGui API coverage 8 - @trusted wrapper functions 9 - Preserves ImGui naming conventions 10 - Handles memory management 11 +/ 12 module imgui.cimgui; 13 public import imgui.c.dcimgui; 14 15 pure @nogc nothrow: 16 17 // Callback function types 18 extern(C) alias ImGuiGetterCallback = const(char)* function(void*, int); 19 extern(C) alias ImGuiOld_callbackCallback = bool function(void*, int, const(char)**); 20 extern(C) alias ImGuiValues_getterCallback = float function(void*, int); 21 22 // D-friendly wrappers 23 /++ 24 Context creation and access 25 - Each context create its own ImFontAtlas by default. You may instance one yourself and pass it to CreateContext() to share a font atlas between contexts. 26 - DLL users: heaps and globals are not shared across DLL boundaries! You will need to call SetCurrentContext() + SetAllocatorFunctions() 27 for each static/DLL boundary you are calling from. Read "Context and Memory Allocators" section of imgui.cpp for details. 28 +/ 29 ImGuiContext* CreateContext(scope ImFontAtlas* shared_font_atlas) @trusted 30 { 31 return igCreateContext(shared_font_atlas); 32 } 33 34 void DestroyContext(scope ImGuiContext* ctx) @trusted 35 { 36 igDestroyContext(ctx); 37 } 38 39 ImGuiContext* GetCurrentContext() @trusted 40 { 41 return igGetCurrentContext(); 42 } 43 44 void SetCurrentContext(scope ImGuiContext* ctx) @trusted 45 { 46 igSetCurrentContext(ctx); 47 } 48 49 /++ 50 Main 51 +/ 52 ImGuiIO* GetIO() @trusted 53 { 54 return igGetIO(); 55 } 56 57 ImGuiPlatformIO* GetPlatformIO() @trusted 58 { 59 return igGetPlatformIO(); 60 } 61 62 ImGuiStyle* GetStyle() @trusted 63 { 64 return igGetStyle(); 65 } 66 67 void NewFrame() @trusted 68 { 69 igNewFrame(); 70 } 71 72 void EndFrame() @trusted 73 { 74 igEndFrame(); 75 } 76 77 void Render() @trusted 78 { 79 igRender(); 80 } 81 82 ImDrawData* GetDrawData() @trusted 83 { 84 return igGetDrawData(); 85 } 86 87 /++ 88 Demo, Debug, Information 89 +/ 90 void ShowDemoWindow(scope bool* p_open) @trusted 91 { 92 igShowDemoWindow(p_open); 93 } 94 95 void ShowMetricsWindow(scope bool* p_open) @trusted 96 { 97 igShowMetricsWindow(p_open); 98 } 99 100 void ShowDebugLogWindow(scope bool* p_open) @trusted 101 { 102 igShowDebugLogWindow(p_open); 103 } 104 105 void ShowIDStackToolWindow() @trusted 106 { 107 igShowIDStackToolWindow(); 108 } 109 110 void ShowIDStackToolWindowEx(scope bool* p_open) @trusted 111 { 112 igShowIDStackToolWindowEx(p_open); 113 } 114 115 void ShowAboutWindow(scope bool* p_open) @trusted 116 { 117 igShowAboutWindow(p_open); 118 } 119 120 void ShowStyleEditor(scope ImGuiStyle* ref_) @trusted 121 { 122 igShowStyleEditor(ref_); 123 } 124 125 bool ShowStyleSelector(scope const(char)* label) @trusted 126 { 127 return igShowStyleSelector(label); 128 } 129 130 void ShowFontSelector(scope const(char)* label) @trusted 131 { 132 igShowFontSelector(label); 133 } 134 135 void ShowUserGuide() @trusted 136 { 137 igShowUserGuide(); 138 } 139 140 const(char)* GetVersion() @trusted 141 { 142 return igGetVersion(); 143 } 144 145 /++ 146 Styles 147 +/ 148 void StyleColorsDark(scope ImGuiStyle* dst) @trusted 149 { 150 igStyleColorsDark(dst); 151 } 152 153 void StyleColorsLight(scope ImGuiStyle* dst) @trusted 154 { 155 igStyleColorsLight(dst); 156 } 157 158 void StyleColorsClassic(scope ImGuiStyle* dst) @trusted 159 { 160 igStyleColorsClassic(dst); 161 } 162 163 /++ 164 Windows 165 - Begin() = push window to the stack and start appending to it. End() = pop window from the stack. 166 - Passing 'bool* p_open != NULL' shows a window-closing widget in the upper-right corner of the window, 167 which clicking will set the boolean to false when clicked. 168 - You may append multiple times to the same window during the same frame by calling Begin()/End() pairs multiple times. 169 Some information such as 'flags' or 'p_open' will only be considered by the first call to Begin(). 170 - Begin() return false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting 171 anything to the window. Always call a matching End() for each Begin() call, regardless of its return value! 172 [Important: due to legacy reason, Begin/End and BeginChild/EndChild are inconsistent with all other functions 173 such as BeginMenu/EndMenu, BeginPopup/EndPopup, etc. where the EndXXX call should only be called if the corresponding 174 BeginXXX function returned true. Begin and BeginChild are the only odd ones out. Will be fixed in a future update.] 175 - Note that the bottom of window stack always contains a window called "Debug". 176 +/ 177 bool Begin(scope const(char)* name, scope bool* p_open, ImGuiWindowFlags flags) @trusted 178 { 179 return igBegin(name, p_open, flags); 180 } 181 182 void End() @trusted 183 { 184 igEnd(); 185 } 186 187 /++ 188 Child Windows 189 - Use child windows to begin into a self-contained independent scrolling/clipping regions within a host window. Child windows can embed their own child. 190 - Before 1.90 (November 2023), the "ImGuiChildFlags child_flags = 0" parameter was "bool border = false". 191 This API is backward compatible with old code, as we guarantee that ImGuiChildFlags_Borders == true. 192 Consider updating your old code: 193 BeginChild("Name", size, false) -> Begin("Name", size, 0); or Begin("Name", size, ImGuiChildFlags_None); 194 BeginChild("Name", size, true) -> Begin("Name", size, ImGuiChildFlags_Borders); 195 - Manual sizing (each axis can use a different setting e.g. ImVec2(0.0f, 400.0f)): 196 == 0.0f: use remaining parent window size for this axis. 197 > 0.0f: use specified size for this axis. 198 199 < 200 0.0f: right/bottom-align to specified distance from available content boundaries. 201 - Specifying ImGuiChildFlags_AutoResizeX or ImGuiChildFlags_AutoResizeY makes the sizing automatic based on child contents. 202 Combining both ImGuiChildFlags_AutoResizeX _and_ ImGuiChildFlags_AutoResizeY defeats purpose of a scrolling region and is NOT recommended. 203 - BeginChild() returns false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting 204 anything to the window. Always call a matching EndChild() for each BeginChild() call, regardless of its return value. 205 [Important: due to legacy reason, Begin/End and BeginChild/EndChild are inconsistent with all other functions 206 such as BeginMenu/EndMenu, BeginPopup/EndPopup, etc. where the EndXXX call should only be called if the corresponding 207 BeginXXX function returned true. Begin and BeginChild are the only odd ones out. Will be fixed in a future update.] 208 +/ 209 bool BeginChild(scope const(char)* str_id, ImVec2 size, ImGuiChildFlags child_flags, ImGuiWindowFlags window_flags) @trusted 210 { 211 return igBeginChild(str_id, size, child_flags, window_flags); 212 } 213 214 bool BeginChildID(ImGuiID id, ImVec2 size, ImGuiChildFlags child_flags, ImGuiWindowFlags window_flags) @trusted 215 { 216 return igBeginChildID(id, size, child_flags, window_flags); 217 } 218 219 void EndChild() @trusted 220 { 221 igEndChild(); 222 } 223 224 /++ 225 Windows Utilities 226 - 'current window' = the window we are appending into while inside a Begin()/End() block. 'next window' = next window we will Begin() into. 227 +/ 228 bool IsWindowAppearing() @trusted 229 { 230 return igIsWindowAppearing(); 231 } 232 233 bool IsWindowCollapsed() @trusted 234 { 235 return igIsWindowCollapsed(); 236 } 237 238 bool IsWindowFocused(ImGuiFocusedFlags flags) @trusted 239 { 240 return igIsWindowFocused(flags); 241 } 242 243 bool IsWindowHovered(ImGuiHoveredFlags flags) @trusted 244 { 245 return igIsWindowHovered(flags); 246 } 247 248 ImDrawList* GetWindowDrawList() @trusted 249 { 250 return igGetWindowDrawList(); 251 } 252 253 ImVec2 GetWindowPos() @trusted 254 { 255 return igGetWindowPos(); 256 } 257 258 ImVec2 GetWindowSize() @trusted 259 { 260 return igGetWindowSize(); 261 } 262 263 float GetWindowWidth() @trusted 264 { 265 return igGetWindowWidth(); 266 } 267 268 float GetWindowHeight() @trusted 269 { 270 return igGetWindowHeight(); 271 } 272 273 /++ 274 Window manipulation 275 - Prefer using SetNextXXX functions (before Begin) rather that SetXXX functions (after Begin). 276 +/ 277 void SetNextWindowPos(ImVec2 pos, ImGuiCond cond) @trusted 278 { 279 igSetNextWindowPos(pos, cond); 280 } 281 282 void SetNextWindowPosEx(ImVec2 pos, ImGuiCond cond, ImVec2 pivot) @trusted 283 { 284 igSetNextWindowPosEx(pos, cond, pivot); 285 } 286 287 void SetNextWindowSize(ImVec2 size, ImGuiCond cond) @trusted 288 { 289 igSetNextWindowSize(size, cond); 290 } 291 292 void SetNextWindowSizeConstraints(ImVec2 size_min, ImVec2 size_max, ImGuiSizeCallback custom_callback, scope void* custom_callback_data) @trusted 293 { 294 igSetNextWindowSizeConstraints(size_min, size_max, custom_callback, custom_callback_data); 295 } 296 297 void SetNextWindowContentSize(ImVec2 size) @trusted 298 { 299 igSetNextWindowContentSize(size); 300 } 301 302 void SetNextWindowCollapsed(bool collapsed, ImGuiCond cond) @trusted 303 { 304 igSetNextWindowCollapsed(collapsed, cond); 305 } 306 307 void SetNextWindowFocus() @trusted 308 { 309 igSetNextWindowFocus(); 310 } 311 312 void SetNextWindowScroll(ImVec2 scroll) @trusted 313 { 314 igSetNextWindowScroll(scroll); 315 } 316 317 void SetNextWindowBgAlpha(float alpha) @trusted 318 { 319 igSetNextWindowBgAlpha(alpha); 320 } 321 322 void SetWindowPos(ImVec2 pos, ImGuiCond cond) @trusted 323 { 324 igSetWindowPos(pos, cond); 325 } 326 327 void SetWindowSize(ImVec2 size, ImGuiCond cond) @trusted 328 { 329 igSetWindowSize(size, cond); 330 } 331 332 void SetWindowCollapsed(bool collapsed, ImGuiCond cond) @trusted 333 { 334 igSetWindowCollapsed(collapsed, cond); 335 } 336 337 void SetWindowFocus() @trusted 338 { 339 igSetWindowFocus(); 340 } 341 342 void SetWindowPosStr(scope const(char)* name, ImVec2 pos, ImGuiCond cond) @trusted 343 { 344 igSetWindowPosStr(name, pos, cond); 345 } 346 347 void SetWindowSizeStr(scope const(char)* name, ImVec2 size, ImGuiCond cond) @trusted 348 { 349 igSetWindowSizeStr(name, size, cond); 350 } 351 352 void SetWindowCollapsedStr(scope const(char)* name, bool collapsed, ImGuiCond cond) @trusted 353 { 354 igSetWindowCollapsedStr(name, collapsed, cond); 355 } 356 357 void SetWindowFocusStr(scope const(char)* name) @trusted 358 { 359 igSetWindowFocusStr(name); 360 } 361 362 /++ 363 Windows Scrolling 364 - Any change of Scroll will be applied at the beginning of next frame in the first call to Begin(). 365 - You may instead use SetNextWindowScroll() prior to calling Begin() to avoid this delay, as an alternative to using SetScrollX()/SetScrollY(). 366 +/ 367 float GetScrollX() @trusted 368 { 369 return igGetScrollX(); 370 } 371 372 float GetScrollY() @trusted 373 { 374 return igGetScrollY(); 375 } 376 377 void SetScrollX(float scroll_x) @trusted 378 { 379 igSetScrollX(scroll_x); 380 } 381 382 void SetScrollY(float scroll_y) @trusted 383 { 384 igSetScrollY(scroll_y); 385 } 386 387 float GetScrollMaxX() @trusted 388 { 389 return igGetScrollMaxX(); 390 } 391 392 float GetScrollMaxY() @trusted 393 { 394 return igGetScrollMaxY(); 395 } 396 397 void SetScrollHereX(float center_x_ratio) @trusted 398 { 399 igSetScrollHereX(center_x_ratio); 400 } 401 402 void SetScrollHereY(float center_y_ratio) @trusted 403 { 404 igSetScrollHereY(center_y_ratio); 405 } 406 407 void SetScrollFromPosX(float local_x, float center_x_ratio) @trusted 408 { 409 igSetScrollFromPosX(local_x, center_x_ratio); 410 } 411 412 void SetScrollFromPosY(float local_y, float center_y_ratio) @trusted 413 { 414 igSetScrollFromPosY(local_y, center_y_ratio); 415 } 416 417 /++ 418 Parameters stacks (font) 419 - PushFont(font, 0.0f) // Change font and keep current size 420 - PushFont(NULL, 20.0f) // Keep font and change current size 421 - PushFont(font, 20.0f) // Change font and set size to 20.0f 422 - PushFont(font, style.FontSizeBase * 2.0f) // Change font and set size to be twice bigger than current size. 423 - PushFont(font, font->LegacySize) // Change font and set size to size passed to AddFontXXX() function. Same as pre-1.92 behavior. 424 *IMPORTANT* before 1.92, fonts had a single size. They can now be dynamically be adjusted. 425 - In 1.92 we have REMOVED the single parameter version of PushFont() because it seems like the easiest way to provide an error-proof transition. 426 - PushFont(font) before 1.92 = PushFont(font, font->LegacySize) after 1.92 // Use default font size as passed to AddFontXXX() function. 427 *IMPORTANT* global scale factors are applied over the provided size. 428 - Global scale factors are: 'style.FontScaleMain', 'style.FontScaleDpi' and maybe more. 429 - If you want to apply a factor to the _current_ font size: 430 - CORRECT: PushFont(NULL, style.FontSizeBase) // use current unscaled size == does nothing 431 - CORRECT: PushFont(NULL, style.FontSizeBase * 2.0f) // use current unscaled size x2 == make text twice bigger 432 - INCORRECT: PushFont(NULL, GetFontSize()) // INCORRECT! using size after global factors already applied == GLOBAL SCALING FACTORS WILL APPLY TWICE! 433 - INCORRECT: PushFont(NULL, GetFontSize() * 2.0f) // INCORRECT! using size after global factors already applied == GLOBAL SCALING FACTORS WILL APPLY TWICE! 434 +/ 435 void PushFontFloat(scope ImFont* font, float font_size_base_unscaled) @trusted 436 { 437 igPushFontFloat(font, font_size_base_unscaled); 438 } 439 440 void PopFont() @trusted 441 { 442 igPopFont(); 443 } 444 445 ImFont* GetFont() @trusted 446 { 447 return igGetFont(); 448 } 449 450 float GetFontSize() @trusted 451 { 452 return igGetFontSize(); 453 } 454 455 ImFontBaked* GetFontBaked() @trusted 456 { 457 return igGetFontBaked(); 458 } 459 460 /++ 461 Parameters stacks (shared) 462 +/ 463 void PushStyleColor(ImGuiCol idx, ImU32 col) @trusted 464 { 465 igPushStyleColor(idx, col); 466 } 467 468 void PushStyleColorImVec4(ImGuiCol idx, ImVec4 col) @trusted 469 { 470 igPushStyleColorImVec4(idx, col); 471 } 472 473 void PopStyleColor() @trusted 474 { 475 igPopStyleColor(); 476 } 477 478 void PopStyleColorEx(int count) @trusted 479 { 480 igPopStyleColorEx(count); 481 } 482 483 void PushStyleVar(ImGuiStyleVar idx, float val) @trusted 484 { 485 igPushStyleVar(idx, val); 486 } 487 488 void PushStyleVarImVec2(ImGuiStyleVar idx, ImVec2 val) @trusted 489 { 490 igPushStyleVarImVec2(idx, val); 491 } 492 493 void PushStyleVarX(ImGuiStyleVar idx, float val_x) @trusted 494 { 495 igPushStyleVarX(idx, val_x); 496 } 497 498 void PushStyleVarY(ImGuiStyleVar idx, float val_y) @trusted 499 { 500 igPushStyleVarY(idx, val_y); 501 } 502 503 void PopStyleVar() @trusted 504 { 505 igPopStyleVar(); 506 } 507 508 void PopStyleVarEx(int count) @trusted 509 { 510 igPopStyleVarEx(count); 511 } 512 513 void PushItemFlag(ImGuiItemFlags option, bool enabled) @trusted 514 { 515 igPushItemFlag(option, enabled); 516 } 517 518 void PopItemFlag() @trusted 519 { 520 igPopItemFlag(); 521 } 522 523 /++ 524 Parameters stacks (current window) 525 +/ 526 void PushItemWidth(float item_width) @trusted 527 { 528 igPushItemWidth(item_width); 529 } 530 531 void PopItemWidth() @trusted 532 { 533 igPopItemWidth(); 534 } 535 536 void SetNextItemWidth(float item_width) @trusted 537 { 538 igSetNextItemWidth(item_width); 539 } 540 541 float CalcItemWidth() @trusted 542 { 543 return igCalcItemWidth(); 544 } 545 546 void PushTextWrapPos(float wrap_local_pos_x) @trusted 547 { 548 igPushTextWrapPos(wrap_local_pos_x); 549 } 550 551 void PopTextWrapPos() @trusted 552 { 553 igPopTextWrapPos(); 554 } 555 556 /++ 557 Style read access 558 - Use the ShowStyleEditor() function to interactively see/edit the colors. 559 +/ 560 ImVec2 GetFontTexUvWhitePixel() @trusted 561 { 562 return igGetFontTexUvWhitePixel(); 563 } 564 565 ImU32 GetColorU32(ImGuiCol idx) @trusted 566 { 567 return igGetColorU32(idx); 568 } 569 570 ImU32 GetColorU32Ex(ImGuiCol idx, float alpha_mul) @trusted 571 { 572 return igGetColorU32Ex(idx, alpha_mul); 573 } 574 575 ImU32 GetColorU32ImVec4(ImVec4 col) @trusted 576 { 577 return igGetColorU32ImVec4(col); 578 } 579 580 ImU32 GetColorU32ImU32(ImU32 col) @trusted 581 { 582 return igGetColorU32ImU32(col); 583 } 584 585 ImU32 GetColorU32ImU32Ex(ImU32 col, float alpha_mul) @trusted 586 { 587 return igGetColorU32ImU32Ex(col, alpha_mul); 588 } 589 590 scope const(ImVec4)* GetStyleColorVec4(ImGuiCol idx) @trusted 591 { 592 return igGetStyleColorVec4(idx); 593 } 594 595 /++ 596 Layout cursor positioning 597 - By "cursor" we mean the current output position. 598 - The typical widget behavior is to output themselves at the current cursor position, then move the cursor one line down. 599 - You can call SameLine() between widgets to undo the last carriage return and output at the right of the preceding widget. 600 - YOU CAN DO 99% OF WHAT YOU NEED WITH ONLY GetCursorScreenPos() and GetContentRegionAvail(). 601 - Attention! We currently have inconsistencies between window-local and absolute positions we will aim to fix with future API: 602 - Absolute coordinate: GetCursorScreenPos(), SetCursorScreenPos(), all ImDrawList:: functions. -> this is the preferred way forward. 603 - Window-local coordinates: SameLine(offset), GetCursorPos(), SetCursorPos(), GetCursorStartPos(), PushTextWrapPos() 604 - Window-local coordinates: GetContentRegionMax(), GetWindowContentRegionMin(), GetWindowContentRegionMax() --> all obsoleted. YOU DON'T NEED THEM. 605 - GetCursorScreenPos() = GetCursorPos() + GetWindowPos(). GetWindowPos() is almost only ever useful to convert from window-local to absolute coordinates. Try not to use it. 606 +/ 607 ImVec2 GetCursorScreenPos() @trusted 608 { 609 return igGetCursorScreenPos(); 610 } 611 612 void SetCursorScreenPos(ImVec2 pos) @trusted 613 { 614 igSetCursorScreenPos(pos); 615 } 616 617 ImVec2 GetContentRegionAvail() @trusted 618 { 619 return igGetContentRegionAvail(); 620 } 621 622 ImVec2 GetCursorPos() @trusted 623 { 624 return igGetCursorPos(); 625 } 626 627 float GetCursorPosX() @trusted 628 { 629 return igGetCursorPosX(); 630 } 631 632 float GetCursorPosY() @trusted 633 { 634 return igGetCursorPosY(); 635 } 636 637 void SetCursorPos(ImVec2 local_pos) @trusted 638 { 639 igSetCursorPos(local_pos); 640 } 641 642 void SetCursorPosX(float local_x) @trusted 643 { 644 igSetCursorPosX(local_x); 645 } 646 647 void SetCursorPosY(float local_y) @trusted 648 { 649 igSetCursorPosY(local_y); 650 } 651 652 ImVec2 GetCursorStartPos() @trusted 653 { 654 return igGetCursorStartPos(); 655 } 656 657 /++ 658 Other layout functions 659 +/ 660 void Separator() @trusted 661 { 662 igSeparator(); 663 } 664 665 void SameLine() @trusted 666 { 667 igSameLine(); 668 } 669 670 void SameLineEx(float offset_from_start_x, float spacing) @trusted 671 { 672 igSameLineEx(offset_from_start_x, spacing); 673 } 674 675 void NewLine() @trusted 676 { 677 igNewLine(); 678 } 679 680 void Spacing() @trusted 681 { 682 igSpacing(); 683 } 684 685 void Dummy(ImVec2 size) @trusted 686 { 687 igDummy(size); 688 } 689 690 void Indent() @trusted 691 { 692 igIndent(); 693 } 694 695 void IndentEx(float indent_w) @trusted 696 { 697 igIndentEx(indent_w); 698 } 699 700 void Unindent() @trusted 701 { 702 igUnindent(); 703 } 704 705 void UnindentEx(float indent_w) @trusted 706 { 707 igUnindentEx(indent_w); 708 } 709 710 void BeginGroup() @trusted 711 { 712 igBeginGroup(); 713 } 714 715 void EndGroup() @trusted 716 { 717 igEndGroup(); 718 } 719 720 void AlignTextToFramePadding() @trusted 721 { 722 igAlignTextToFramePadding(); 723 } 724 725 float GetTextLineHeight() @trusted 726 { 727 return igGetTextLineHeight(); 728 } 729 730 float GetTextLineHeightWithSpacing() @trusted 731 { 732 return igGetTextLineHeightWithSpacing(); 733 } 734 735 float GetFrameHeight() @trusted 736 { 737 return igGetFrameHeight(); 738 } 739 740 float GetFrameHeightWithSpacing() @trusted 741 { 742 return igGetFrameHeightWithSpacing(); 743 } 744 745 /++ 746 ID stack/scopes 747 Read the FAQ (docs/FAQ.md or http://dearimgui.com/faq) for more details about how ID are handled in dear imgui. 748 - Those questions are answered and impacted by understanding of the ID stack system: 749 - "Q: Why is my widget not reacting when I click on it?" 750 - "Q: How can I have widgets with an empty label?" 751 - "Q: How can I have multiple widgets with the same label?" 752 - Short version: ID are hashes of the entire ID stack. If you are creating widgets in a loop you most likely 753 want to push a unique identifier (e.g. object pointer, loop index) to uniquely differentiate them. 754 - You can also use the "Label##foobar" syntax within widget label to distinguish them from each others. 755 - In this header file we use the "label"/"name" terminology to denote a string that will be displayed + used as an ID, 756 whereas "str_id" denote a string that is only used as an ID and not normally displayed. 757 +/ 758 void PushID(scope const(char)* str_id) @trusted 759 { 760 igPushID(str_id); 761 } 762 763 void PushIDStr(scope const(char)* str_id_begin, scope const(char)* str_id_end) @trusted 764 { 765 igPushIDStr(str_id_begin, str_id_end); 766 } 767 768 void PushIDPtr(scope const void* ptr_id) @trusted 769 { 770 igPushIDPtr(ptr_id); 771 } 772 773 void PushIDInt(int int_id) @trusted 774 { 775 igPushIDInt(int_id); 776 } 777 778 void PopID() @trusted 779 { 780 igPopID(); 781 } 782 783 ImGuiID GetID(scope const(char)* str_id) @trusted 784 { 785 return igGetID(str_id); 786 } 787 788 ImGuiID GetIDStr(scope const(char)* str_id_begin, scope const(char)* str_id_end) @trusted 789 { 790 return igGetIDStr(str_id_begin, str_id_end); 791 } 792 793 ImGuiID GetIDPtr(scope const void* ptr_id) @trusted 794 { 795 return igGetIDPtr(ptr_id); 796 } 797 798 ImGuiID GetIDInt(int int_id) @trusted 799 { 800 return igGetIDInt(int_id); 801 } 802 803 /++ 804 Widgets: Text 805 +/ 806 void TextUnformatted(scope const(char)* text) @trusted 807 { 808 igTextUnformatted(text); 809 } 810 811 void TextUnformattedEx(scope const(char)* text, scope const(char)* text_end) @trusted 812 { 813 igTextUnformattedEx(text, text_end); 814 } 815 816 alias Text = igText; 817 818 alias TextV = igTextV; 819 820 alias TextColored = igTextColored; 821 822 alias TextColoredV = igTextColoredV; 823 824 alias TextDisabled = igTextDisabled; 825 826 alias TextDisabledV = igTextDisabledV; 827 828 alias TextWrapped = igTextWrapped; 829 830 alias TextWrappedV = igTextWrappedV; 831 832 void LabelText(scope const(char)* label, scope const(char)* fmt) @trusted 833 { 834 igLabelText(label, fmt); 835 } 836 837 alias LabelTextV = igLabelTextV; 838 839 void BulletText(scope const(char)* fmt) @trusted 840 { 841 igBulletText(fmt); 842 } 843 844 alias BulletTextV = igBulletTextV; 845 846 void SeparatorText(scope const(char)* label) @trusted 847 { 848 igSeparatorText(label); 849 } 850 851 /++ 852 Widgets: Main 853 - Most widgets return true when the value has been changed or when pressed/selected 854 - You may also use one of the many IsItemXXX functions (e.g. IsItemActive, IsItemHovered, etc.) to query widget state. 855 +/ 856 bool Button(scope const(char)* label) @trusted 857 { 858 return igButton(label); 859 } 860 861 bool ButtonEx(scope const(char)* label, ImVec2 size) @trusted 862 { 863 return igButtonEx(label, size); 864 } 865 866 bool SmallButton(scope const(char)* label) @trusted 867 { 868 return igSmallButton(label); 869 } 870 871 bool InvisibleButton(scope const(char)* str_id, ImVec2 size, ImGuiButtonFlags flags) @trusted 872 { 873 return igInvisibleButton(str_id, size, flags); 874 } 875 876 bool ArrowButton(scope const(char)* str_id, ImGuiDir dir) @trusted 877 { 878 return igArrowButton(str_id, dir); 879 } 880 881 bool Checkbox(scope const(char)* label, scope bool* v) @trusted 882 { 883 return igCheckbox(label, v); 884 } 885 886 bool CheckboxFlagsIntPtr(scope const(char)* label, scope int* flags, int flags_value) @trusted 887 { 888 return igCheckboxFlagsIntPtr(label, flags, flags_value); 889 } 890 891 bool CheckboxFlagsUintPtr(scope const(char)* label, scope uint* flags, uint flags_value) @trusted 892 { 893 return igCheckboxFlagsUintPtr(label, flags, flags_value); 894 } 895 896 bool RadioButton(scope const(char)* label, bool active) @trusted 897 { 898 return igRadioButton(label, active); 899 } 900 901 bool RadioButtonIntPtr(scope const(char)* label, scope int* v, int v_button) @trusted 902 { 903 return igRadioButtonIntPtr(label, v, v_button); 904 } 905 906 void ProgressBar(float fraction, ImVec2 size_arg, scope const(char)* overlay) @trusted 907 { 908 igProgressBar(fraction, size_arg, overlay); 909 } 910 911 void Bullet() @trusted 912 { 913 igBullet(); 914 } 915 916 bool TextLink(scope const(char)* label) @trusted 917 { 918 return igTextLink(label); 919 } 920 921 bool TextLinkOpenURL(scope const(char)* label) @trusted 922 { 923 return igTextLinkOpenURL(label); 924 } 925 926 bool TextLinkOpenURLEx(scope const(char)* label, scope const(char)* url) @trusted 927 { 928 return igTextLinkOpenURLEx(label, url); 929 } 930 931 /++ 932 Widgets: Images 933 - Read about ImTextureID/ImTextureRef here: https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples 934 - 'uv0' and 'uv1' are texture coordinates. Read about them from the same link above. 935 - Image() pads adds style.ImageBorderSize on each side, ImageButton() adds style.FramePadding on each side. 936 - ImageButton() draws a background based on regular Button() color + optionally an inner background if specified. 937 - An obsolete version of Image(), before 1.91.9 (March 2025), had a 'tint_col' parameter which is now supported by the ImageWithBg() function. 938 +/ 939 void Image(ImTextureRef tex_ref, ImVec2 image_size) @trusted 940 { 941 igImage(tex_ref, image_size); 942 } 943 944 void ImageEx(ImTextureRef tex_ref, ImVec2 image_size, ImVec2 uv0, ImVec2 uv1) @trusted 945 { 946 igImageEx(tex_ref, image_size, uv0, uv1); 947 } 948 949 void ImageWithBg(ImTextureRef tex_ref, ImVec2 image_size) @trusted 950 { 951 igImageWithBg(tex_ref, image_size); 952 } 953 954 void ImageWithBgEx(ImTextureRef tex_ref, ImVec2 image_size, ImVec2 uv0, ImVec2 uv1, ImVec4 bg_col, ImVec4 tint_col) @trusted 955 { 956 igImageWithBgEx(tex_ref, image_size, uv0, uv1, bg_col, tint_col); 957 } 958 959 bool ImageButton(scope const(char)* str_id, ImTextureRef tex_ref, ImVec2 image_size) @trusted 960 { 961 return igImageButton(str_id, tex_ref, image_size); 962 } 963 964 bool ImageButtonEx(scope const(char)* str_id, ImTextureRef tex_ref, ImVec2 image_size, ImVec2 uv0, ImVec2 uv1, ImVec4 bg_col, ImVec4 tint_col) @trusted 965 { 966 return igImageButtonEx(str_id, tex_ref, image_size, uv0, uv1, bg_col, tint_col); 967 } 968 969 /++ 970 Widgets: Combo Box (Dropdown) 971 - The BeginCombo()/EndCombo() api allows you to manage your contents and selection state however you want it, by creating e.g. Selectable() items. 972 - The old Combo() api are helpers over BeginCombo()/EndCombo() which are kept available for convenience purpose. This is analogous to how ListBox are created. 973 +/ 974 bool BeginCombo(scope const(char)* label, scope const(char)* preview_value, ImGuiComboFlags flags) @trusted 975 { 976 return igBeginCombo(label, preview_value, flags); 977 } 978 979 void EndCombo() @trusted 980 { 981 igEndCombo(); 982 } 983 984 bool ComboChar(scope const(char)* label, scope int* current_item, scope const(char)** items, int items_count) @trusted 985 { 986 return igComboChar(label, current_item, items, items_count); 987 } 988 989 bool ComboCharEx(scope const(char)* label, scope int* current_item, scope const(char)** items, int items_count, int popup_max_height_in_items) @trusted 990 { 991 return igComboCharEx(label, current_item, items, items_count, popup_max_height_in_items); 992 } 993 994 bool Combo(scope const(char)* label, scope int* current_item, scope const(char)* items_separated_by_zeros) @trusted 995 { 996 return igCombo(label, current_item, items_separated_by_zeros); 997 } 998 999 bool ComboEx(scope const(char)* label, scope int* current_item, scope const(char)* items_separated_by_zeros, int popup_max_height_in_items) @trusted 1000 { 1001 return igComboEx(label, current_item, items_separated_by_zeros, popup_max_height_in_items); 1002 } 1003 1004 bool ComboCallback(scope const(char)* label, scope int* current_item, ImGuiGetterCallback getter, scope void* user_data, int items_count) @trusted 1005 { 1006 return igComboCallback(label, current_item, getter, user_data, items_count); 1007 } 1008 1009 bool ComboCallbackEx(scope const(char)* label, scope int* current_item, ImGuiGetterCallback getter, scope void* user_data, int items_count, int popup_max_height_in_items) @trusted 1010 { 1011 return igComboCallbackEx(label, current_item, getter, user_data, items_count, popup_max_height_in_items); 1012 } 1013 1014 /++ 1015 Widgets: Drag Sliders 1016 - CTRL+Click on any drag box to turn them into an input box. Manually input values aren't clamped by default and can go off-bounds. Use ImGuiSliderFlags_AlwaysClamp to always clamp. 1017 - For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every function, note that a 'float v[X]' function argument is the same as 'float* v', 1018 the array syntax is just a way to document the number of elements that are expected to be accessible. You can pass address of your first element out of a contiguous set, e.g. 1019 &myvector 1020 .x 1021 - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc. 1022 - Format string may also be set to NULL or use the default format ("%f" or "%d"). 1023 - Speed are per-pixel of mouse movement (v_speed=0.2f: mouse needs to move by 5 pixels to increase value by 1). For keyboard/gamepad navigation, minimum speed is Max(v_speed, minimum_step_at_given_precision). 1024 - Use v_min 1025 < 1026 v_max to clamp edits to given limits. Note that CTRL+Click manual input can override those limits if ImGuiSliderFlags_AlwaysClamp is not used. 1027 - Use v_max = FLT_MAX / INT_MAX etc to avoid clamping to a maximum, same with v_min = -FLT_MAX / INT_MIN to avoid clamping to a minimum. 1028 - We use the same sets of flags for DragXXX() and SliderXXX() functions as the features are the same and it makes it easier to swap them. 1029 - Legacy: Pre-1.78 there are DragXXX() function signatures that take a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument. 1030 If you get a warning converting a float to ImGuiSliderFlags, read https://github.com/ocornut/imgui/issues/3361 1031 +/ 1032 bool DragFloat(scope const(char)* label, scope float* v) @trusted 1033 { 1034 return igDragFloat(label, v); 1035 } 1036 1037 bool DragFloatEx(scope const(char)* label, scope float* v, float v_speed, float v_min, float v_max, scope const(char)* format, ImGuiSliderFlags flags) @trusted 1038 { 1039 return igDragFloatEx(label, v, v_speed, v_min, v_max, format, flags); 1040 } 1041 1042 bool DragFloat2(scope const(char)* label, scope float* v) @trusted 1043 { 1044 return igDragFloat2(label, v); 1045 } 1046 1047 bool DragFloat2Ex(scope const(char)* label, scope float* v, float v_speed, float v_min, float v_max, scope const(char)* format, ImGuiSliderFlags flags) @trusted 1048 { 1049 return igDragFloat2Ex(label, v, v_speed, v_min, v_max, format, flags); 1050 } 1051 1052 bool DragFloat3(scope const(char)* label, scope float* v) @trusted 1053 { 1054 return igDragFloat3(label, v); 1055 } 1056 1057 bool DragFloat3Ex(scope const(char)* label, scope float* v, float v_speed, float v_min, float v_max, scope const(char)* format, ImGuiSliderFlags flags) @trusted 1058 { 1059 return igDragFloat3Ex(label, v, v_speed, v_min, v_max, format, flags); 1060 } 1061 1062 bool DragFloat4(scope const(char)* label, scope float* v) @trusted 1063 { 1064 return igDragFloat4(label, v); 1065 } 1066 1067 bool DragFloat4Ex(scope const(char)* label, scope float* v, float v_speed, float v_min, float v_max, scope const(char)* format, ImGuiSliderFlags flags) @trusted 1068 { 1069 return igDragFloat4Ex(label, v, v_speed, v_min, v_max, format, flags); 1070 } 1071 1072 bool DragFloatRange2(scope const(char)* label, scope float* v_current_min, scope float* v_current_max) @trusted 1073 { 1074 return igDragFloatRange2(label, v_current_min, v_current_max); 1075 } 1076 1077 bool DragFloatRange2Ex(scope const(char)* label, scope float* v_current_min, scope float* v_current_max, float v_speed, float v_min, float v_max, scope const(char)* format, scope const(char)* format_max, ImGuiSliderFlags flags) @trusted 1078 { 1079 return igDragFloatRange2Ex(label, v_current_min, v_current_max, v_speed, v_min, v_max, format, format_max, flags); 1080 } 1081 1082 bool DragInt(scope const(char)* label, scope int* v) @trusted 1083 { 1084 return igDragInt(label, v); 1085 } 1086 1087 bool DragIntEx(scope const(char)* label, scope int* v, float v_speed, int v_min, int v_max, scope const(char)* format, ImGuiSliderFlags flags) @trusted 1088 { 1089 return igDragIntEx(label, v, v_speed, v_min, v_max, format, flags); 1090 } 1091 1092 bool DragInt2(scope const(char)* label, scope int* v) @trusted 1093 { 1094 return igDragInt2(label, v); 1095 } 1096 1097 bool DragInt2Ex(scope const(char)* label, scope int* v, float v_speed, int v_min, int v_max, scope const(char)* format, ImGuiSliderFlags flags) @trusted 1098 { 1099 return igDragInt2Ex(label, v, v_speed, v_min, v_max, format, flags); 1100 } 1101 1102 bool DragInt3(scope const(char)* label, scope int* v) @trusted 1103 { 1104 return igDragInt3(label, v); 1105 } 1106 1107 bool DragInt3Ex(scope const(char)* label, scope int* v, float v_speed, int v_min, int v_max, scope const(char)* format, ImGuiSliderFlags flags) @trusted 1108 { 1109 return igDragInt3Ex(label, v, v_speed, v_min, v_max, format, flags); 1110 } 1111 1112 bool DragInt4(scope const(char)* label, scope int* v) @trusted 1113 { 1114 return igDragInt4(label, v); 1115 } 1116 1117 bool DragInt4Ex(scope const(char)* label, scope int* v, float v_speed, int v_min, int v_max, scope const(char)* format, ImGuiSliderFlags flags) @trusted 1118 { 1119 return igDragInt4Ex(label, v, v_speed, v_min, v_max, format, flags); 1120 } 1121 1122 bool DragIntRange2(scope const(char)* label, scope int* v_current_min, scope int* v_current_max) @trusted 1123 { 1124 return igDragIntRange2(label, v_current_min, v_current_max); 1125 } 1126 1127 bool DragIntRange2Ex(scope const(char)* label, scope int* v_current_min, scope int* v_current_max, float v_speed, int v_min, int v_max, scope const(char)* format, scope const(char)* format_max, ImGuiSliderFlags flags) @trusted 1128 { 1129 return igDragIntRange2Ex(label, v_current_min, v_current_max, v_speed, v_min, v_max, format, format_max, flags); 1130 } 1131 1132 bool DragScalar(scope const(char)* label, ImGuiDataType data_type, scope void* p_data) @trusted 1133 { 1134 return igDragScalar(label, data_type, p_data); 1135 } 1136 1137 bool DragScalarEx(scope const(char)* label, ImGuiDataType data_type, scope void* p_data, float v_speed, scope const void* p_min, scope const void* p_max, scope const(char)* format, ImGuiSliderFlags flags) @trusted 1138 { 1139 return igDragScalarEx(label, data_type, p_data, v_speed, p_min, p_max, format, flags); 1140 } 1141 1142 bool DragScalarN(scope const(char)* label, ImGuiDataType data_type, scope void* p_data, int components) @trusted 1143 { 1144 return igDragScalarN(label, data_type, p_data, components); 1145 } 1146 1147 bool DragScalarNEx(scope const(char)* label, ImGuiDataType data_type, scope void* p_data, int components, float v_speed, scope const void* p_min, scope const void* p_max, scope const(char)* format, ImGuiSliderFlags flags) @trusted 1148 { 1149 return igDragScalarNEx(label, data_type, p_data, components, v_speed, p_min, p_max, format, flags); 1150 } 1151 1152 /++ 1153 Widgets: Regular Sliders 1154 - CTRL+Click on any slider to turn them into an input box. Manually input values aren't clamped by default and can go off-bounds. Use ImGuiSliderFlags_AlwaysClamp to always clamp. 1155 - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc. 1156 - Format string may also be set to NULL or use the default format ("%f" or "%d"). 1157 - Legacy: Pre-1.78 there are SliderXXX() function signatures that take a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument. 1158 If you get a warning converting a float to ImGuiSliderFlags, read https://github.com/ocornut/imgui/issues/3361 1159 +/ 1160 bool SliderFloat(scope const(char)* label, scope float* v, float v_min, float v_max) @trusted 1161 { 1162 return igSliderFloat(label, v, v_min, v_max); 1163 } 1164 1165 bool SliderFloatEx(scope const(char)* label, scope float* v, float v_min, float v_max, scope const(char)* format, ImGuiSliderFlags flags) @trusted 1166 { 1167 return igSliderFloatEx(label, v, v_min, v_max, format, flags); 1168 } 1169 1170 bool SliderFloat2(scope const(char)* label, scope float* v, float v_min, float v_max) @trusted 1171 { 1172 return igSliderFloat2(label, v, v_min, v_max); 1173 } 1174 1175 bool SliderFloat2Ex(scope const(char)* label, scope float* v, float v_min, float v_max, scope const(char)* format, ImGuiSliderFlags flags) @trusted 1176 { 1177 return igSliderFloat2Ex(label, v, v_min, v_max, format, flags); 1178 } 1179 1180 bool SliderFloat3(scope const(char)* label, scope float* v, float v_min, float v_max) @trusted 1181 { 1182 return igSliderFloat3(label, v, v_min, v_max); 1183 } 1184 1185 bool SliderFloat3Ex(scope const(char)* label, scope float* v, float v_min, float v_max, scope const(char)* format, ImGuiSliderFlags flags) @trusted 1186 { 1187 return igSliderFloat3Ex(label, v, v_min, v_max, format, flags); 1188 } 1189 1190 bool SliderFloat4(scope const(char)* label, scope float* v, float v_min, float v_max) @trusted 1191 { 1192 return igSliderFloat4(label, v, v_min, v_max); 1193 } 1194 1195 bool SliderFloat4Ex(scope const(char)* label, scope float* v, float v_min, float v_max, scope const(char)* format, ImGuiSliderFlags flags) @trusted 1196 { 1197 return igSliderFloat4Ex(label, v, v_min, v_max, format, flags); 1198 } 1199 1200 bool SliderAngle(scope const(char)* label, scope float* v_rad) @trusted 1201 { 1202 return igSliderAngle(label, v_rad); 1203 } 1204 1205 bool SliderAngleEx(scope const(char)* label, scope float* v_rad, float v_degrees_min, float v_degrees_max, scope const(char)* format, ImGuiSliderFlags flags) @trusted 1206 { 1207 return igSliderAngleEx(label, v_rad, v_degrees_min, v_degrees_max, format, flags); 1208 } 1209 1210 bool SliderInt(scope const(char)* label, scope int* v, int v_min, int v_max) @trusted 1211 { 1212 return igSliderInt(label, v, v_min, v_max); 1213 } 1214 1215 bool SliderIntEx(scope const(char)* label, scope int* v, int v_min, int v_max, scope const(char)* format, ImGuiSliderFlags flags) @trusted 1216 { 1217 return igSliderIntEx(label, v, v_min, v_max, format, flags); 1218 } 1219 1220 bool SliderInt2(scope const(char)* label, scope int* v, int v_min, int v_max) @trusted 1221 { 1222 return igSliderInt2(label, v, v_min, v_max); 1223 } 1224 1225 bool SliderInt2Ex(scope const(char)* label, scope int* v, int v_min, int v_max, scope const(char)* format, ImGuiSliderFlags flags) @trusted 1226 { 1227 return igSliderInt2Ex(label, v, v_min, v_max, format, flags); 1228 } 1229 1230 bool SliderInt3(scope const(char)* label, scope int* v, int v_min, int v_max) @trusted 1231 { 1232 return igSliderInt3(label, v, v_min, v_max); 1233 } 1234 1235 bool SliderInt3Ex(scope const(char)* label, scope int* v, int v_min, int v_max, scope const(char)* format, ImGuiSliderFlags flags) @trusted 1236 { 1237 return igSliderInt3Ex(label, v, v_min, v_max, format, flags); 1238 } 1239 1240 bool SliderInt4(scope const(char)* label, scope int* v, int v_min, int v_max) @trusted 1241 { 1242 return igSliderInt4(label, v, v_min, v_max); 1243 } 1244 1245 bool SliderInt4Ex(scope const(char)* label, scope int* v, int v_min, int v_max, scope const(char)* format, ImGuiSliderFlags flags) @trusted 1246 { 1247 return igSliderInt4Ex(label, v, v_min, v_max, format, flags); 1248 } 1249 1250 bool SliderScalar(scope const(char)* label, ImGuiDataType data_type, scope void* p_data, scope const void* p_min, scope const void* p_max) @trusted 1251 { 1252 return igSliderScalar(label, data_type, p_data, p_min, p_max); 1253 } 1254 1255 bool SliderScalarEx(scope const(char)* label, ImGuiDataType data_type, scope void* p_data, scope const void* p_min, scope const void* p_max, scope const(char)* format, ImGuiSliderFlags flags) @trusted 1256 { 1257 return igSliderScalarEx(label, data_type, p_data, p_min, p_max, format, flags); 1258 } 1259 1260 bool SliderScalarN(scope const(char)* label, ImGuiDataType data_type, scope void* p_data, int components, scope const void* p_min, scope const void* p_max) @trusted 1261 { 1262 return igSliderScalarN(label, data_type, p_data, components, p_min, p_max); 1263 } 1264 1265 bool SliderScalarNEx(scope const(char)* label, ImGuiDataType data_type, scope void* p_data, int components, scope const void* p_min, scope const void* p_max, scope const(char)* format, ImGuiSliderFlags flags) @trusted 1266 { 1267 return igSliderScalarNEx(label, data_type, p_data, components, p_min, p_max, format, flags); 1268 } 1269 1270 bool VSliderFloat(scope const(char)* label, ImVec2 size, scope float* v, float v_min, float v_max) @trusted 1271 { 1272 return igVSliderFloat(label, size, v, v_min, v_max); 1273 } 1274 1275 bool VSliderFloatEx(scope const(char)* label, ImVec2 size, scope float* v, float v_min, float v_max, scope const(char)* format, ImGuiSliderFlags flags) @trusted 1276 { 1277 return igVSliderFloatEx(label, size, v, v_min, v_max, format, flags); 1278 } 1279 1280 bool VSliderInt(scope const(char)* label, ImVec2 size, scope int* v, int v_min, int v_max) @trusted 1281 { 1282 return igVSliderInt(label, size, v, v_min, v_max); 1283 } 1284 1285 bool VSliderIntEx(scope const(char)* label, ImVec2 size, scope int* v, int v_min, int v_max, scope const(char)* format, ImGuiSliderFlags flags) @trusted 1286 { 1287 return igVSliderIntEx(label, size, v, v_min, v_max, format, flags); 1288 } 1289 1290 bool VSliderScalar(scope const(char)* label, ImVec2 size, ImGuiDataType data_type, scope void* p_data, scope const void* p_min, scope const void* p_max) @trusted 1291 { 1292 return igVSliderScalar(label, size, data_type, p_data, p_min, p_max); 1293 } 1294 1295 bool VSliderScalarEx(scope const(char)* label, ImVec2 size, ImGuiDataType data_type, scope void* p_data, scope const void* p_min, scope const void* p_max, scope const(char)* format, ImGuiSliderFlags flags) @trusted 1296 { 1297 return igVSliderScalarEx(label, size, data_type, p_data, p_min, p_max, format, flags); 1298 } 1299 1300 /++ 1301 Widgets: Input with Keyboard 1302 - If you want to use InputText() with std::string or any custom dynamic string type, see misc/cpp/imgui_stdlib.h and comments in imgui_demo.cpp. 1303 - Most of the ImGuiInputTextFlags flags are only useful for InputText() and not for InputFloatX, InputIntX, InputDouble etc. 1304 +/ 1305 bool InputText(scope const(char)* label, scope char* buf, size_t buf_size, ImGuiInputTextFlags flags) @trusted 1306 { 1307 return igInputText(label, buf, buf_size, flags); 1308 } 1309 1310 bool InputTextEx(scope const(char)* label, scope char* buf, size_t buf_size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, scope void* user_data) @trusted 1311 { 1312 return igInputTextEx(label, buf, buf_size, flags, callback, user_data); 1313 } 1314 1315 bool InputTextMultiline(scope const(char)* label, scope char* buf, size_t buf_size) @trusted 1316 { 1317 return igInputTextMultiline(label, buf, buf_size); 1318 } 1319 1320 bool InputTextMultilineEx(scope const(char)* label, scope char* buf, size_t buf_size, ImVec2 size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, scope void* user_data) @trusted 1321 { 1322 return igInputTextMultilineEx(label, buf, buf_size, size, flags, callback, user_data); 1323 } 1324 1325 bool InputTextWithHint(scope const(char)* label, scope const(char)* hint, scope char* buf, size_t buf_size, ImGuiInputTextFlags flags) @trusted 1326 { 1327 return igInputTextWithHint(label, hint, buf, buf_size, flags); 1328 } 1329 1330 bool InputTextWithHintEx(scope const(char)* label, scope const(char)* hint, scope char* buf, size_t buf_size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, scope void* user_data) @trusted 1331 { 1332 return igInputTextWithHintEx(label, hint, buf, buf_size, flags, callback, user_data); 1333 } 1334 1335 bool InputFloat(scope const(char)* label, scope float* v) @trusted 1336 { 1337 return igInputFloat(label, v); 1338 } 1339 1340 bool InputFloatEx(scope const(char)* label, scope float* v, float step, float step_fast, scope const(char)* format, ImGuiInputTextFlags flags) @trusted 1341 { 1342 return igInputFloatEx(label, v, step, step_fast, format, flags); 1343 } 1344 1345 bool InputFloat2(scope const(char)* label, scope float* v) @trusted 1346 { 1347 return igInputFloat2(label, v); 1348 } 1349 1350 bool InputFloat2Ex(scope const(char)* label, scope float* v, scope const(char)* format, ImGuiInputTextFlags flags) @trusted 1351 { 1352 return igInputFloat2Ex(label, v, format, flags); 1353 } 1354 1355 bool InputFloat3(scope const(char)* label, scope float* v) @trusted 1356 { 1357 return igInputFloat3(label, v); 1358 } 1359 1360 bool InputFloat3Ex(scope const(char)* label, scope float* v, scope const(char)* format, ImGuiInputTextFlags flags) @trusted 1361 { 1362 return igInputFloat3Ex(label, v, format, flags); 1363 } 1364 1365 bool InputFloat4(scope const(char)* label, scope float* v) @trusted 1366 { 1367 return igInputFloat4(label, v); 1368 } 1369 1370 bool InputFloat4Ex(scope const(char)* label, scope float* v, scope const(char)* format, ImGuiInputTextFlags flags) @trusted 1371 { 1372 return igInputFloat4Ex(label, v, format, flags); 1373 } 1374 1375 bool InputInt(scope const(char)* label, scope int* v) @trusted 1376 { 1377 return igInputInt(label, v); 1378 } 1379 1380 bool InputIntEx(scope const(char)* label, scope int* v, int step, int step_fast, ImGuiInputTextFlags flags) @trusted 1381 { 1382 return igInputIntEx(label, v, step, step_fast, flags); 1383 } 1384 1385 bool InputInt2(scope const(char)* label, scope int* v, ImGuiInputTextFlags flags) @trusted 1386 { 1387 return igInputInt2(label, v, flags); 1388 } 1389 1390 bool InputInt3(scope const(char)* label, scope int* v, ImGuiInputTextFlags flags) @trusted 1391 { 1392 return igInputInt3(label, v, flags); 1393 } 1394 1395 bool InputInt4(scope const(char)* label, scope int* v, ImGuiInputTextFlags flags) @trusted 1396 { 1397 return igInputInt4(label, v, flags); 1398 } 1399 1400 bool InputDouble(scope const(char)* label, scope double* v) @trusted 1401 { 1402 return igInputDouble(label, v); 1403 } 1404 1405 bool InputDoubleEx(scope const(char)* label, scope double* v, double step, double step_fast, scope const(char)* format, ImGuiInputTextFlags flags) @trusted 1406 { 1407 return igInputDoubleEx(label, v, step, step_fast, format, flags); 1408 } 1409 1410 bool InputScalar(scope const(char)* label, ImGuiDataType data_type, scope void* p_data) @trusted 1411 { 1412 return igInputScalar(label, data_type, p_data); 1413 } 1414 1415 bool InputScalarEx(scope const(char)* label, ImGuiDataType data_type, scope void* p_data, scope const void* p_step, scope const void* p_step_fast, scope const(char)* format, ImGuiInputTextFlags flags) @trusted 1416 { 1417 return igInputScalarEx(label, data_type, p_data, p_step, p_step_fast, format, flags); 1418 } 1419 1420 bool InputScalarN(scope const(char)* label, ImGuiDataType data_type, scope void* p_data, int components) @trusted 1421 { 1422 return igInputScalarN(label, data_type, p_data, components); 1423 } 1424 1425 bool InputScalarNEx(scope const(char)* label, ImGuiDataType data_type, scope void* p_data, int components, scope const void* p_step, scope const void* p_step_fast, scope const(char)* format, ImGuiInputTextFlags flags) @trusted 1426 { 1427 return igInputScalarNEx(label, data_type, p_data, components, p_step, p_step_fast, format, flags); 1428 } 1429 1430 /++ 1431 Widgets: Color Editor/Picker (tip: the ColorEdit* functions have a little color square that can be left-clicked to open a picker, and right-clicked to open an option menu.) 1432 - Note that in C++ a 'float v[X]' function argument is the _same_ as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. 1433 - You can pass the address of a first float element out of a contiguous structure, e.g. 1434 &myvector 1435 .x 1436 +/ 1437 bool ColorEdit3(scope const(char)* label, scope float* col, ImGuiColorEditFlags flags) @trusted 1438 { 1439 return igColorEdit3(label, col, flags); 1440 } 1441 1442 bool ColorEdit4(scope const(char)* label, scope float* col, ImGuiColorEditFlags flags) @trusted 1443 { 1444 return igColorEdit4(label, col, flags); 1445 } 1446 1447 bool ColorPicker3(scope const(char)* label, scope float* col, ImGuiColorEditFlags flags) @trusted 1448 { 1449 return igColorPicker3(label, col, flags); 1450 } 1451 1452 bool ColorPicker4(scope const(char)* label, scope float* col, ImGuiColorEditFlags flags, scope const float* ref_col) @trusted 1453 { 1454 return igColorPicker4(label, col, flags, ref_col); 1455 } 1456 1457 bool ColorButton(scope const(char)* desc_id, ImVec4 col, ImGuiColorEditFlags flags) @trusted 1458 { 1459 return igColorButton(desc_id, col, flags); 1460 } 1461 1462 bool ColorButtonEx(scope const(char)* desc_id, ImVec4 col, ImGuiColorEditFlags flags, ImVec2 size) @trusted 1463 { 1464 return igColorButtonEx(desc_id, col, flags, size); 1465 } 1466 1467 void SetColorEditOptions(ImGuiColorEditFlags flags) @trusted 1468 { 1469 igSetColorEditOptions(flags); 1470 } 1471 1472 /++ 1473 Widgets: Trees 1474 - TreeNode functions return true when the node is open, in which case you need to also call TreePop() when you are finished displaying the tree node contents. 1475 +/ 1476 bool TreeNode(scope const(char)* label) @trusted 1477 { 1478 return igTreeNode(label); 1479 } 1480 1481 bool TreeNodeStr(scope const(char)* str_id, scope const(char)* fmt) @trusted 1482 { 1483 return igTreeNodeStr(str_id, fmt); 1484 } 1485 1486 bool TreeNodePtr(scope const void* ptr_id, scope const(char)* fmt) @trusted 1487 { 1488 return igTreeNodePtr(ptr_id, fmt); 1489 } 1490 1491 alias TreeNodeV = igTreeNodeV; 1492 1493 alias TreeNodeVPtr = igTreeNodeVPtr; 1494 1495 bool TreeNodeEx(scope const(char)* label, ImGuiTreeNodeFlags flags) @trusted 1496 { 1497 return igTreeNodeEx(label, flags); 1498 } 1499 1500 bool TreeNodeExStr(scope const(char)* str_id, ImGuiTreeNodeFlags flags, scope const(char)* fmt) @trusted 1501 { 1502 return igTreeNodeExStr(str_id, flags, fmt); 1503 } 1504 1505 bool TreeNodeExPtr(scope const void* ptr_id, ImGuiTreeNodeFlags flags, scope const(char)* fmt) @trusted 1506 { 1507 return igTreeNodeExPtr(ptr_id, flags, fmt); 1508 } 1509 1510 alias TreeNodeExV = igTreeNodeExV; 1511 1512 alias TreeNodeExVPtr = igTreeNodeExVPtr; 1513 1514 void TreePush(scope const(char)* str_id) @trusted 1515 { 1516 igTreePush(str_id); 1517 } 1518 1519 void TreePushPtr(scope const void* ptr_id) @trusted 1520 { 1521 igTreePushPtr(ptr_id); 1522 } 1523 1524 void TreePop() @trusted 1525 { 1526 igTreePop(); 1527 } 1528 1529 float GetTreeNodeToLabelSpacing() @trusted 1530 { 1531 return igGetTreeNodeToLabelSpacing(); 1532 } 1533 1534 bool CollapsingHeader(scope const(char)* label, ImGuiTreeNodeFlags flags) @trusted 1535 { 1536 return igCollapsingHeader(label, flags); 1537 } 1538 1539 bool CollapsingHeaderBoolPtr(scope const(char)* label, scope bool* p_visible, ImGuiTreeNodeFlags flags) @trusted 1540 { 1541 return igCollapsingHeaderBoolPtr(label, p_visible, flags); 1542 } 1543 1544 void SetNextItemOpen(bool is_open, ImGuiCond cond) @trusted 1545 { 1546 igSetNextItemOpen(is_open, cond); 1547 } 1548 1549 void SetNextItemStorageID(ImGuiID storage_id) @trusted 1550 { 1551 igSetNextItemStorageID(storage_id); 1552 } 1553 1554 /++ 1555 Widgets: Selectables 1556 - A selectable highlights when hovered, and can display another color when selected. 1557 - Neighbors selectable extend their highlight bounds in order to leave no gap between them. This is so a series of selected Selectable appear contiguous. 1558 +/ 1559 bool Selectable(scope const(char)* label) @trusted 1560 { 1561 return igSelectable(label); 1562 } 1563 1564 bool SelectableEx(scope const(char)* label, bool selected, ImGuiSelectableFlags flags, ImVec2 size) @trusted 1565 { 1566 return igSelectableEx(label, selected, flags, size); 1567 } 1568 1569 bool SelectableBoolPtr(scope const(char)* label, scope bool* p_selected, ImGuiSelectableFlags flags) @trusted 1570 { 1571 return igSelectableBoolPtr(label, p_selected, flags); 1572 } 1573 1574 bool SelectableBoolPtrEx(scope const(char)* label, scope bool* p_selected, ImGuiSelectableFlags flags, ImVec2 size) @trusted 1575 { 1576 return igSelectableBoolPtrEx(label, p_selected, flags, size); 1577 } 1578 1579 /++ 1580 Multi-selection system for Selectable(), Checkbox(), TreeNode() functions [BETA] 1581 - This enables standard multi-selection/range-selection idioms (CTRL+Mouse/Keyboard, SHIFT+Mouse/Keyboard, etc.) in a way that also allow a clipper to be used. 1582 - ImGuiSelectionUserData is often used to store your item index within the current view (but may store something else). 1583 - Read comments near ImGuiMultiSelectIO for instructions/details and see 'Demo->Widgets->Selection State 1584 & 1585 Multi-Select' for demo. 1586 - TreeNode() is technically supported but... using this correctly is more complicated. You need some sort of linear/random access to your tree, 1587 which is suited to advanced trees setups already implementing filters and clipper. We will work simplifying the current demo. 1588 - 'selection_size' and 'items_count' parameters are optional and used by a few features. If they are costly for you to compute, you may avoid them. 1589 +/ 1590 ImGuiMultiSelectIO* BeginMultiSelect(ImGuiMultiSelectFlags flags) @trusted 1591 { 1592 return igBeginMultiSelect(flags); 1593 } 1594 1595 ImGuiMultiSelectIO* BeginMultiSelectEx(ImGuiMultiSelectFlags flags, int selection_size, int items_count) @trusted 1596 { 1597 return igBeginMultiSelectEx(flags, selection_size, items_count); 1598 } 1599 1600 ImGuiMultiSelectIO* EndMultiSelect() @trusted 1601 { 1602 return igEndMultiSelect(); 1603 } 1604 1605 void SetNextItemSelectionUserData(ImGuiSelectionUserData selection_user_data) @trusted 1606 { 1607 igSetNextItemSelectionUserData(selection_user_data); 1608 } 1609 1610 bool IsItemToggledSelection() @trusted 1611 { 1612 return igIsItemToggledSelection(); 1613 } 1614 1615 /++ 1616 Widgets: List Boxes 1617 - This is essentially a thin wrapper to using BeginChild/EndChild with the ImGuiChildFlags_FrameStyle flag for stylistic changes + displaying a label. 1618 - If you don't need a label you can probably simply use BeginChild() with the ImGuiChildFlags_FrameStyle flag for the same result. 1619 - You can submit contents and manage your selection state however you want it, by creating e.g. Selectable() or any other items. 1620 - The simplified/old ListBox() api are helpers over BeginListBox()/EndListBox() which are kept available for convenience purpose. This is analogous to how Combos are created. 1621 - Choose frame width: size.x > 0.0f: custom / size.x 1622 < 1623 0.0f or -FLT_MIN: right-align / size.x = 0.0f (default): use current ItemWidth 1624 - Choose frame height: size.y > 0.0f: custom / size.y 1625 < 1626 0.0f or -FLT_MIN: bottom-align / size.y = 0.0f (default): arbitrary default height which can fit ~7 items 1627 +/ 1628 bool BeginListBox(scope const(char)* label, ImVec2 size) @trusted 1629 { 1630 return igBeginListBox(label, size); 1631 } 1632 1633 void EndListBox() @trusted 1634 { 1635 igEndListBox(); 1636 } 1637 1638 bool ListBox(scope const(char)* label, scope int* current_item, scope const(char)** items, int items_count, int height_in_items) @trusted 1639 { 1640 return igListBox(label, current_item, items, items_count, height_in_items); 1641 } 1642 1643 bool ListBoxCallback(scope const(char)* label, scope int* current_item, ImGuiGetterCallback getter, scope void* user_data, int items_count) @trusted 1644 { 1645 return igListBoxCallback(label, current_item, getter, user_data, items_count); 1646 } 1647 1648 bool ListBoxCallbackEx(scope const(char)* label, scope int* current_item, ImGuiGetterCallback getter, scope void* user_data, int items_count, int height_in_items) @trusted 1649 { 1650 return igListBoxCallbackEx(label, current_item, getter, user_data, items_count, height_in_items); 1651 } 1652 1653 /++ 1654 Widgets: Data Plotting 1655 - Consider using ImPlot (https://github.com/epezent/implot) which is much better! 1656 +/ 1657 void PlotLines(scope const(char)* label, scope const float* values, int values_count) @trusted 1658 { 1659 igPlotLines(label, values, values_count); 1660 } 1661 1662 void PlotLinesEx(scope const(char)* label, scope const float* values, int values_count, int values_offset, scope const(char)* overlay_text, float scale_min, float scale_max, ImVec2 graph_size, int stride) @trusted 1663 { 1664 igPlotLinesEx(label, values, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size, stride); 1665 } 1666 1667 void PlotLinesCallback(scope const(char)* label, ImGuiValues_getterCallback values_getter, scope void* data, int values_count) @trusted 1668 { 1669 igPlotLinesCallback(label, values_getter, data, values_count); 1670 } 1671 1672 void PlotLinesCallbackEx(scope const(char)* label, ImGuiValues_getterCallback values_getter, scope void* data, int values_count, int values_offset, scope const(char)* overlay_text, float scale_min, float scale_max, ImVec2 graph_size) @trusted 1673 { 1674 igPlotLinesCallbackEx(label, values_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size); 1675 } 1676 1677 void PlotHistogram(scope const(char)* label, scope const float* values, int values_count) @trusted 1678 { 1679 igPlotHistogram(label, values, values_count); 1680 } 1681 1682 void PlotHistogramEx(scope const(char)* label, scope const float* values, int values_count, int values_offset, scope const(char)* overlay_text, float scale_min, float scale_max, ImVec2 graph_size, int stride) @trusted 1683 { 1684 igPlotHistogramEx(label, values, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size, stride); 1685 } 1686 1687 void PlotHistogramCallback(scope const(char)* label, ImGuiValues_getterCallback values_getter, scope void* data, int values_count) @trusted 1688 { 1689 igPlotHistogramCallback(label, values_getter, data, values_count); 1690 } 1691 1692 void PlotHistogramCallbackEx(scope const(char)* label, ImGuiValues_getterCallback values_getter, scope void* data, int values_count, int values_offset, scope const(char)* overlay_text, float scale_min, float scale_max, ImVec2 graph_size) @trusted 1693 { 1694 igPlotHistogramCallbackEx(label, values_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size); 1695 } 1696 1697 /++ 1698 Widgets: Menus 1699 - Use BeginMenuBar() on a window ImGuiWindowFlags_MenuBar to append to its menu bar. 1700 - Use BeginMainMenuBar() to create a menu bar at the top of the screen and append to it. 1701 - Use BeginMenu() to create a menu. You can call BeginMenu() multiple time with the same identifier to append more items to it. 1702 - Not that MenuItem() keyboardshortcuts are displayed as a convenience but _not processed_ by Dear ImGui at the moment. 1703 +/ 1704 bool BeginMenuBar() @trusted 1705 { 1706 return igBeginMenuBar(); 1707 } 1708 1709 void EndMenuBar() @trusted 1710 { 1711 igEndMenuBar(); 1712 } 1713 1714 bool BeginMainMenuBar() @trusted 1715 { 1716 return igBeginMainMenuBar(); 1717 } 1718 1719 void EndMainMenuBar() @trusted 1720 { 1721 igEndMainMenuBar(); 1722 } 1723 1724 bool BeginMenu(scope const(char)* label) @trusted 1725 { 1726 return igBeginMenu(label); 1727 } 1728 1729 bool BeginMenuEx(scope const(char)* label, bool enabled) @trusted 1730 { 1731 return igBeginMenuEx(label, enabled); 1732 } 1733 1734 void EndMenu() @trusted 1735 { 1736 igEndMenu(); 1737 } 1738 1739 bool MenuItem(scope const(char)* label) @trusted 1740 { 1741 return igMenuItem(label); 1742 } 1743 1744 bool MenuItemEx(scope const(char)* label, scope const(char)* shortcut, bool selected, bool enabled) @trusted 1745 { 1746 return igMenuItemEx(label, shortcut, selected, enabled); 1747 } 1748 1749 bool MenuItemBoolPtr(scope const(char)* label, scope const(char)* shortcut, scope bool* p_selected, bool enabled) @trusted 1750 { 1751 return igMenuItemBoolPtr(label, shortcut, p_selected, enabled); 1752 } 1753 1754 /++ 1755 Tooltips 1756 - Tooltips are windows following the mouse. They do not take focus away. 1757 - A tooltip window can contain items of any types. 1758 - SetTooltip() is more or less a shortcut for the 'if (BeginTooltip()) { Text(...); EndTooltip(); }' idiom (with a subtlety that it discard any previously submitted tooltip) 1759 +/ 1760 bool BeginTooltip() @trusted 1761 { 1762 return igBeginTooltip(); 1763 } 1764 1765 void EndTooltip() @trusted 1766 { 1767 igEndTooltip(); 1768 } 1769 1770 void SetTooltip(scope const(char)* fmt) @trusted 1771 { 1772 igSetTooltip(fmt); 1773 } 1774 1775 alias SetTooltipV = igSetTooltipV; 1776 1777 /++ 1778 Tooltips: helpers for showing a tooltip when hovering an item 1779 - BeginItemTooltip() is a shortcut for the 'if (IsItemHovered(ImGuiHoveredFlags_ForTooltip) 1780 & 1781 & 1782 BeginTooltip())' idiom. 1783 - SetItemTooltip() is a shortcut for the 'if (IsItemHovered(ImGuiHoveredFlags_ForTooltip)) { SetTooltip(...); }' idiom. 1784 - Where 'ImGuiHoveredFlags_ForTooltip' itself is a shortcut to use 'style.HoverFlagsForTooltipMouse' or 'style.HoverFlagsForTooltipNav' depending on active input type. For mouse it defaults to 'ImGuiHoveredFlags_Stationary | ImGuiHoveredFlags_DelayShort'. 1785 +/ 1786 bool BeginItemTooltip() @trusted 1787 { 1788 return igBeginItemTooltip(); 1789 } 1790 1791 void SetItemTooltip(scope const(char)* fmt) @trusted 1792 { 1793 igSetItemTooltip(fmt); 1794 } 1795 1796 alias SetItemTooltipV = igSetItemTooltipV; 1797 1798 /++ 1799 Popups, Modals 1800 - They block normal mouse hovering detection (and therefore most mouse interactions) behind them. 1801 - If not modal: they can be closed by clicking anywhere outside them, or by pressing ESCAPE. 1802 - Their visibility state (~bool) is held internally instead of being held by the programmer as we are used to with regular Begin*() calls. 1803 - The 3 properties above are related: we need to retain popup visibility state in the library because popups may be closed as any time. 1804 - You can bypass the hovering restriction by using ImGuiHoveredFlags_AllowWhenBlockedByPopup when calling IsItemHovered() or IsWindowHovered(). 1805 - IMPORTANT: Popup identifiers are relative to the current ID stack, so OpenPopup and BeginPopup generally needs to be at the same level of the stack. 1806 This is sometimes leading to confusing mistakes. May rework this in the future. 1807 - BeginPopup(): query popup state, if open start appending into the window. Call EndPopup() afterwards if returned true. ImGuiWindowFlags are forwarded to the window. 1808 - BeginPopupModal(): block every interaction behind the window, cannot be closed by user, add a dimming background, has a title bar. 1809 +/ 1810 bool BeginPopup(scope const(char)* str_id, ImGuiWindowFlags flags) @trusted 1811 { 1812 return igBeginPopup(str_id, flags); 1813 } 1814 1815 bool BeginPopupModal(scope const(char)* name, scope bool* p_open, ImGuiWindowFlags flags) @trusted 1816 { 1817 return igBeginPopupModal(name, p_open, flags); 1818 } 1819 1820 void EndPopup() @trusted 1821 { 1822 igEndPopup(); 1823 } 1824 1825 /++ 1826 Popups: open/close functions 1827 - OpenPopup(): set popup state to open. ImGuiPopupFlags are available for opening options. 1828 - If not modal: they can be closed by clicking anywhere outside them, or by pressing ESCAPE. 1829 - CloseCurrentPopup(): use inside the BeginPopup()/EndPopup() scope to close manually. 1830 - CloseCurrentPopup() is called by default by Selectable()/MenuItem() when activated (FIXME: need some options). 1831 - Use ImGuiPopupFlags_NoOpenOverExistingPopup to avoid opening a popup if there's already one at the same level. This is equivalent to e.g. testing for !IsAnyPopupOpen() prior to OpenPopup(). 1832 - Use IsWindowAppearing() after BeginPopup() to tell if a window just opened. 1833 - IMPORTANT: Notice that for OpenPopupOnItemClick() we exceptionally default flags to 1 (== ImGuiPopupFlags_MouseButtonRight) for backward compatibility with older API taking 'int mouse_button = 1' parameter 1834 +/ 1835 void OpenPopup(scope const(char)* str_id, ImGuiPopupFlags popup_flags) @trusted 1836 { 1837 igOpenPopup(str_id, popup_flags); 1838 } 1839 1840 void OpenPopupID(ImGuiID id, ImGuiPopupFlags popup_flags) @trusted 1841 { 1842 igOpenPopupID(id, popup_flags); 1843 } 1844 1845 void OpenPopupOnItemClick(scope const(char)* str_id, ImGuiPopupFlags popup_flags) @trusted 1846 { 1847 igOpenPopupOnItemClick(str_id, popup_flags); 1848 } 1849 1850 void CloseCurrentPopup() @trusted 1851 { 1852 igCloseCurrentPopup(); 1853 } 1854 1855 /++ 1856 Popups: open+begin combined functions helpers 1857 - Helpers to do OpenPopup+BeginPopup where the Open action is triggered by e.g. hovering an item and right-clicking. 1858 - They are convenient to easily create context menus, hence the name. 1859 - IMPORTANT: Notice that BeginPopupContextXXX takes ImGuiPopupFlags just like OpenPopup() and unlike BeginPopup(). For full consistency, we may add ImGuiWindowFlags to the BeginPopupContextXXX functions in the future. 1860 - IMPORTANT: Notice that we exceptionally default their flags to 1 (== ImGuiPopupFlags_MouseButtonRight) for backward compatibility with older API taking 'int mouse_button = 1' parameter, so if you add other flags remember to re-add the ImGuiPopupFlags_MouseButtonRight. 1861 +/ 1862 bool BeginPopupContextItem() @trusted 1863 { 1864 return igBeginPopupContextItem(); 1865 } 1866 1867 bool BeginPopupContextItemEx(scope const(char)* str_id, ImGuiPopupFlags popup_flags) @trusted 1868 { 1869 return igBeginPopupContextItemEx(str_id, popup_flags); 1870 } 1871 1872 bool BeginPopupContextWindow() @trusted 1873 { 1874 return igBeginPopupContextWindow(); 1875 } 1876 1877 bool BeginPopupContextWindowEx(scope const(char)* str_id, ImGuiPopupFlags popup_flags) @trusted 1878 { 1879 return igBeginPopupContextWindowEx(str_id, popup_flags); 1880 } 1881 1882 bool BeginPopupContextVoid() @trusted 1883 { 1884 return igBeginPopupContextVoid(); 1885 } 1886 1887 bool BeginPopupContextVoidEx(scope const(char)* str_id, ImGuiPopupFlags popup_flags) @trusted 1888 { 1889 return igBeginPopupContextVoidEx(str_id, popup_flags); 1890 } 1891 1892 /++ 1893 Popups: query functions 1894 - IsPopupOpen(): return true if the popup is open at the current BeginPopup() level of the popup stack. 1895 - IsPopupOpen() with ImGuiPopupFlags_AnyPopupId: return true if any popup is open at the current BeginPopup() level of the popup stack. 1896 - IsPopupOpen() with ImGuiPopupFlags_AnyPopupId + ImGuiPopupFlags_AnyPopupLevel: return true if any popup is open. 1897 +/ 1898 bool IsPopupOpen(scope const(char)* str_id, ImGuiPopupFlags flags) @trusted 1899 { 1900 return igIsPopupOpen(str_id, flags); 1901 } 1902 1903 /++ 1904 Tables 1905 - Full-featured replacement for old Columns API. 1906 - See Demo->Tables for demo code. See top of imgui_tables.cpp for general commentary. 1907 - See ImGuiTableFlags_ and ImGuiTableColumnFlags_ enums for a description of available flags. 1908 The typical call flow is: 1909 - 1. Call BeginTable(), early out if returning false. 1910 - 2. Optionally call TableSetupColumn() to submit column name/flags/defaults. 1911 - 3. Optionally call TableSetupScrollFreeze() to request scroll freezing of columns/rows. 1912 - 4. Optionally call TableHeadersRow() to submit a header row. Names are pulled from TableSetupColumn() data. 1913 - 5. Populate contents: 1914 - In most situations you can use TableNextRow() + TableSetColumnIndex(N) to start appending into a column. 1915 - If you are using tables as a sort of grid, where every column is holding the same type of contents, 1916 you may prefer using TableNextColumn() instead of TableNextRow() + TableSetColumnIndex(). 1917 TableNextColumn() will automatically wrap-around into the next row if needed. 1918 - IMPORTANT: Comparatively to the old Columns() API, we need to call TableNextColumn() for the first column! 1919 - Summary of possible call flow: 1920 - TableNextRow() -> TableSetColumnIndex(0) -> Text("Hello 0") -> TableSetColumnIndex(1) -> Text("Hello 1") // OK 1921 - TableNextRow() -> TableNextColumn() -> Text("Hello 0") -> TableNextColumn() -> Text("Hello 1") // OK 1922 - TableNextColumn() -> Text("Hello 0") -> TableNextColumn() -> Text("Hello 1") // OK: TableNextColumn() automatically gets to next row! 1923 - TableNextRow() -> Text("Hello 0") // Not OK! Missing TableSetColumnIndex() or TableNextColumn()! Text will not appear! 1924 - 5. Call EndTable() 1925 +/ 1926 bool BeginTable(scope const(char)* str_id, int columns, ImGuiTableFlags flags) @trusted 1927 { 1928 return igBeginTable(str_id, columns, flags); 1929 } 1930 1931 bool BeginTableEx(scope const(char)* str_id, int columns, ImGuiTableFlags flags, ImVec2 outer_size, float inner_width) @trusted 1932 { 1933 return igBeginTableEx(str_id, columns, flags, outer_size, inner_width); 1934 } 1935 1936 void EndTable() @trusted 1937 { 1938 igEndTable(); 1939 } 1940 1941 void TableNextRow() @trusted 1942 { 1943 igTableNextRow(); 1944 } 1945 1946 void TableNextRowEx(ImGuiTableRowFlags row_flags, float min_row_height) @trusted 1947 { 1948 igTableNextRowEx(row_flags, min_row_height); 1949 } 1950 1951 bool TableNextColumn() @trusted 1952 { 1953 return igTableNextColumn(); 1954 } 1955 1956 bool TableSetColumnIndex(int column_n) @trusted 1957 { 1958 return igTableSetColumnIndex(column_n); 1959 } 1960 1961 /++ 1962 Tables: Headers 1963 & 1964 Columns declaration 1965 - Use TableSetupColumn() to specify label, resizing policy, default width/weight, id, various other flags etc. 1966 - Use TableHeadersRow() to create a header row and automatically submit a TableHeader() for each column. 1967 Headers are required to perform: reordering, sorting, and opening the context menu. 1968 The context menu can also be made available in columns body using ImGuiTableFlags_ContextMenuInBody. 1969 - You may manually submit headers using TableNextRow() + TableHeader() calls, but this is only useful in 1970 some advanced use cases (e.g. adding custom widgets in header row). 1971 - Use TableSetupScrollFreeze() to lock columns/rows so they stay visible when scrolled. 1972 +/ 1973 void TableSetupColumn(scope const(char)* label, ImGuiTableColumnFlags flags) @trusted 1974 { 1975 igTableSetupColumn(label, flags); 1976 } 1977 1978 void TableSetupColumnEx(scope const(char)* label, ImGuiTableColumnFlags flags, float init_width_or_weight, ImGuiID user_id) @trusted 1979 { 1980 igTableSetupColumnEx(label, flags, init_width_or_weight, user_id); 1981 } 1982 1983 void TableSetupScrollFreeze(int cols, int rows) @trusted 1984 { 1985 igTableSetupScrollFreeze(cols, rows); 1986 } 1987 1988 void TableHeader(scope const(char)* label) @trusted 1989 { 1990 igTableHeader(label); 1991 } 1992 1993 void TableHeadersRow() @trusted 1994 { 1995 igTableHeadersRow(); 1996 } 1997 1998 void TableAngledHeadersRow() @trusted 1999 { 2000 igTableAngledHeadersRow(); 2001 } 2002 2003 /++ 2004 Tables: Sorting 2005 & 2006 Miscellaneous functions 2007 - Sorting: call TableGetSortSpecs() to retrieve latest sort specs for the table. NULL when not sorting. 2008 When 'sort_specs->SpecsDirty == true' you should sort your data. It will be true when sorting specs have 2009 changed since last call, or the first time. Make sure to set 'SpecsDirty = false' after sorting, 2010 else you may wastefully sort your data every frame! 2011 - Functions args 'int column_n' treat the default value of -1 as the same as passing the current column index. 2012 +/ 2013 ImGuiTableSortSpecs* TableGetSortSpecs() @trusted 2014 { 2015 return igTableGetSortSpecs(); 2016 } 2017 2018 int TableGetColumnCount() @trusted 2019 { 2020 return igTableGetColumnCount(); 2021 } 2022 2023 int TableGetColumnIndex() @trusted 2024 { 2025 return igTableGetColumnIndex(); 2026 } 2027 2028 int TableGetRowIndex() @trusted 2029 { 2030 return igTableGetRowIndex(); 2031 } 2032 2033 const(char)* TableGetColumnName(int column_n) @trusted 2034 { 2035 return igTableGetColumnName(column_n); 2036 } 2037 2038 ImGuiTableColumnFlags TableGetColumnFlags(int column_n) @trusted 2039 { 2040 return igTableGetColumnFlags(column_n); 2041 } 2042 2043 void TableSetColumnEnabled(int column_n, bool v) @trusted 2044 { 2045 igTableSetColumnEnabled(column_n, v); 2046 } 2047 2048 int TableGetHoveredColumn() @trusted 2049 { 2050 return igTableGetHoveredColumn(); 2051 } 2052 2053 void TableSetBgColor(ImGuiTableBgTarget target, ImU32 color, int column_n) @trusted 2054 { 2055 igTableSetBgColor(target, color, column_n); 2056 } 2057 2058 /++ 2059 Legacy Columns API (prefer using Tables!) 2060 - You can also use SameLine(pos_x) to mimic simplified columns. 2061 +/ 2062 void Columns() @trusted 2063 { 2064 igColumns(); 2065 } 2066 2067 void ColumnsEx(int count, scope const(char)* id, bool borders) @trusted 2068 { 2069 igColumnsEx(count, id, borders); 2070 } 2071 2072 void NextColumn() @trusted 2073 { 2074 igNextColumn(); 2075 } 2076 2077 int GetColumnIndex() @trusted 2078 { 2079 return igGetColumnIndex(); 2080 } 2081 2082 float GetColumnWidth(int column_index) @trusted 2083 { 2084 return igGetColumnWidth(column_index); 2085 } 2086 2087 void SetColumnWidth(int column_index, float width) @trusted 2088 { 2089 igSetColumnWidth(column_index, width); 2090 } 2091 2092 float GetColumnOffset(int column_index) @trusted 2093 { 2094 return igGetColumnOffset(column_index); 2095 } 2096 2097 void SetColumnOffset(int column_index, float offset_x) @trusted 2098 { 2099 igSetColumnOffset(column_index, offset_x); 2100 } 2101 2102 int GetColumnsCount() @trusted 2103 { 2104 return igGetColumnsCount(); 2105 } 2106 2107 /++ 2108 Tab Bars, Tabs 2109 - Note: Tabs are automatically created by the docking system (when in 'docking' branch). Use this to create tab bars/tabs yourself. 2110 +/ 2111 bool BeginTabBar(scope const(char)* str_id, ImGuiTabBarFlags flags) @trusted 2112 { 2113 return igBeginTabBar(str_id, flags); 2114 } 2115 2116 void EndTabBar() @trusted 2117 { 2118 igEndTabBar(); 2119 } 2120 2121 bool BeginTabItem(scope const(char)* label, scope bool* p_open, ImGuiTabItemFlags flags) @trusted 2122 { 2123 return igBeginTabItem(label, p_open, flags); 2124 } 2125 2126 void EndTabItem() @trusted 2127 { 2128 igEndTabItem(); 2129 } 2130 2131 bool TabItemButton(scope const(char)* label, ImGuiTabItemFlags flags) @trusted 2132 { 2133 return igTabItemButton(label, flags); 2134 } 2135 2136 void SetTabItemClosed(scope const(char)* tab_or_docked_window_label) @trusted 2137 { 2138 igSetTabItemClosed(tab_or_docked_window_label); 2139 } 2140 2141 /++ 2142 Logging/Capture 2143 - All text output from the interface can be captured into tty/file/clipboard. By default, tree nodes are automatically opened during logging. 2144 +/ 2145 void LogToTTY(int auto_open_depth) @trusted 2146 { 2147 igLogToTTY(auto_open_depth); 2148 } 2149 2150 void LogToFile(int auto_open_depth, scope const(char)* filename) @trusted 2151 { 2152 igLogToFile(auto_open_depth, filename); 2153 } 2154 2155 void LogToClipboard(int auto_open_depth) @trusted 2156 { 2157 igLogToClipboard(auto_open_depth); 2158 } 2159 2160 void LogFinish() @trusted 2161 { 2162 igLogFinish(); 2163 } 2164 2165 void LogButtons() @trusted 2166 { 2167 igLogButtons(); 2168 } 2169 2170 void LogText(scope const(char)* fmt) @trusted 2171 { 2172 igLogText(fmt); 2173 } 2174 2175 alias LogTextV = igLogTextV; 2176 2177 /++ 2178 Drag and Drop 2179 - On source items, call BeginDragDropSource(), if it returns true also call SetDragDropPayload() + EndDragDropSource(). 2180 - On target candidates, call BeginDragDropTarget(), if it returns true also call AcceptDragDropPayload() + EndDragDropTarget(). 2181 - If you stop calling BeginDragDropSource() the payload is preserved however it won't have a preview tooltip (we currently display a fallback "..." tooltip, see #1725) 2182 - An item can be both drag source and drop target. 2183 +/ 2184 bool BeginDragDropSource(ImGuiDragDropFlags flags) @trusted 2185 { 2186 return igBeginDragDropSource(flags); 2187 } 2188 2189 bool SetDragDropPayload(scope const(char)* type, scope const void* data, size_t sz, ImGuiCond cond) @trusted 2190 { 2191 return igSetDragDropPayload(type, data, sz, cond); 2192 } 2193 2194 void EndDragDropSource() @trusted 2195 { 2196 igEndDragDropSource(); 2197 } 2198 2199 bool BeginDragDropTarget() @trusted 2200 { 2201 return igBeginDragDropTarget(); 2202 } 2203 2204 scope const(ImGuiPayload)* AcceptDragDropPayload(const(char)* type, ImGuiDragDropFlags flags) @trusted 2205 { 2206 return igAcceptDragDropPayload(type, flags); 2207 } 2208 2209 void EndDragDropTarget() @trusted 2210 { 2211 igEndDragDropTarget(); 2212 } 2213 2214 scope const(ImGuiPayload)* GetDragDropPayload() @trusted 2215 { 2216 return igGetDragDropPayload(); 2217 } 2218 2219 /++ 2220 Disabling [BETA API] 2221 - Disable all user interactions and dim items visuals (applying style.DisabledAlpha over current colors) 2222 - Those can be nested but it cannot be used to enable an already disabled section (a single BeginDisabled(true) in the stack is enough to keep everything disabled) 2223 - Tooltips windows by exception are opted out of disabling. 2224 - BeginDisabled(false)/EndDisabled() essentially does nothing but is provided to facilitate use of boolean expressions (as a micro-optimization: if you have tens of thousands of BeginDisabled(false)/EndDisabled() pairs, you might want to reformulate your code to avoid making those calls) 2225 +/ 2226 void BeginDisabled(bool disabled) @trusted 2227 { 2228 igBeginDisabled(disabled); 2229 } 2230 2231 void EndDisabled() @trusted 2232 { 2233 igEndDisabled(); 2234 } 2235 2236 /++ 2237 Clipping 2238 - Mouse hovering is affected by ImGui::PushClipRect() calls, unlike direct calls to ImDrawList::PushClipRect() which are render only. 2239 +/ 2240 void PushClipRect(ImVec2 clip_rect_min, ImVec2 clip_rect_max, bool intersect_with_current_clip_rect) @trusted 2241 { 2242 igPushClipRect(clip_rect_min, clip_rect_max, intersect_with_current_clip_rect); 2243 } 2244 2245 void PopClipRect() @trusted 2246 { 2247 igPopClipRect(); 2248 } 2249 2250 /++ 2251 Focus, Activation 2252 +/ 2253 void SetItemDefaultFocus() @trusted 2254 { 2255 igSetItemDefaultFocus(); 2256 } 2257 2258 void SetKeyboardFocusHere() @trusted 2259 { 2260 igSetKeyboardFocusHere(); 2261 } 2262 2263 void SetKeyboardFocusHereEx(int offset) @trusted 2264 { 2265 igSetKeyboardFocusHereEx(offset); 2266 } 2267 2268 /++ 2269 Keyboard/Gamepad Navigation 2270 +/ 2271 void SetNavCursorVisible(bool visible) @trusted 2272 { 2273 igSetNavCursorVisible(visible); 2274 } 2275 2276 /++ 2277 Overlapping mode 2278 +/ 2279 void SetNextItemAllowOverlap() @trusted 2280 { 2281 igSetNextItemAllowOverlap(); 2282 } 2283 2284 /++ 2285 Item/Widgets Utilities and Query Functions 2286 - Most of the functions are referring to the previous Item that has been submitted. 2287 - See Demo Window under "Widgets->Querying Status" for an interactive visualization of most of those functions. 2288 +/ 2289 bool IsItemHovered(ImGuiHoveredFlags flags) @trusted 2290 { 2291 return igIsItemHovered(flags); 2292 } 2293 2294 bool IsItemActive() @trusted 2295 { 2296 return igIsItemActive(); 2297 } 2298 2299 bool IsItemFocused() @trusted 2300 { 2301 return igIsItemFocused(); 2302 } 2303 2304 bool IsItemClicked() @trusted 2305 { 2306 return igIsItemClicked(); 2307 } 2308 2309 bool IsItemClickedEx(ImGuiMouseButton mouse_button) @trusted 2310 { 2311 return igIsItemClickedEx(mouse_button); 2312 } 2313 2314 bool IsItemVisible() @trusted 2315 { 2316 return igIsItemVisible(); 2317 } 2318 2319 bool IsItemEdited() @trusted 2320 { 2321 return igIsItemEdited(); 2322 } 2323 2324 bool IsItemActivated() @trusted 2325 { 2326 return igIsItemActivated(); 2327 } 2328 2329 bool IsItemDeactivated() @trusted 2330 { 2331 return igIsItemDeactivated(); 2332 } 2333 2334 bool IsItemDeactivatedAfterEdit() @trusted 2335 { 2336 return igIsItemDeactivatedAfterEdit(); 2337 } 2338 2339 bool IsItemToggledOpen() @trusted 2340 { 2341 return igIsItemToggledOpen(); 2342 } 2343 2344 bool IsAnyItemHovered() @trusted 2345 { 2346 return igIsAnyItemHovered(); 2347 } 2348 2349 bool IsAnyItemActive() @trusted 2350 { 2351 return igIsAnyItemActive(); 2352 } 2353 2354 bool IsAnyItemFocused() @trusted 2355 { 2356 return igIsAnyItemFocused(); 2357 } 2358 2359 ImGuiID GetItemID() @trusted 2360 { 2361 return igGetItemID(); 2362 } 2363 2364 ImVec2 GetItemRectMin() @trusted 2365 { 2366 return igGetItemRectMin(); 2367 } 2368 2369 ImVec2 GetItemRectMax() @trusted 2370 { 2371 return igGetItemRectMax(); 2372 } 2373 2374 ImVec2 GetItemRectSize() @trusted 2375 { 2376 return igGetItemRectSize(); 2377 } 2378 2379 /++ 2380 Viewports 2381 - Currently represents the Platform Window created by the application which is hosting our Dear ImGui windows. 2382 - In 'docking' branch with multi-viewport enabled, we extend this concept to have multiple active viewports. 2383 - In the future we will extend this concept further to also represent Platform Monitor and support a "no main platform window" operation mode. 2384 +/ 2385 ImGuiViewport* GetMainViewport() @trusted 2386 { 2387 return igGetMainViewport(); 2388 } 2389 2390 /++ 2391 Background/Foreground Draw Lists 2392 +/ 2393 ImDrawList* GetBackgroundDrawList() @trusted 2394 { 2395 return igGetBackgroundDrawList(); 2396 } 2397 2398 ImDrawList* GetForegroundDrawList() @trusted 2399 { 2400 return igGetForegroundDrawList(); 2401 } 2402 2403 /++ 2404 Miscellaneous Utilities 2405 +/ 2406 bool IsRectVisibleBySize(ImVec2 size) @trusted 2407 { 2408 return igIsRectVisibleBySize(size); 2409 } 2410 2411 bool IsRectVisible(ImVec2 rect_min, ImVec2 rect_max) @trusted 2412 { 2413 return igIsRectVisible(rect_min, rect_max); 2414 } 2415 2416 double GetTime() @trusted 2417 { 2418 return igGetTime(); 2419 } 2420 2421 int GetFrameCount() @trusted 2422 { 2423 return igGetFrameCount(); 2424 } 2425 2426 ImDrawListSharedData* GetDrawListSharedData() @trusted 2427 { 2428 return igGetDrawListSharedData(); 2429 } 2430 2431 const(char)* GetStyleColorName(ImGuiCol idx) @trusted 2432 { 2433 return igGetStyleColorName(idx); 2434 } 2435 2436 void SetStateStorage(scope ImGuiStorage* storage) @trusted 2437 { 2438 igSetStateStorage(storage); 2439 } 2440 2441 ImGuiStorage* GetStateStorage() @trusted 2442 { 2443 return igGetStateStorage(); 2444 } 2445 2446 /++ 2447 Text Utilities 2448 +/ 2449 ImVec2 CalcTextSize(scope const(char)* text) @trusted 2450 { 2451 return igCalcTextSize(text); 2452 } 2453 2454 ImVec2 CalcTextSizeEx(scope const(char)* text, scope const(char)* text_end, bool hide_text_after_double_hash, float wrap_width) @trusted 2455 { 2456 return igCalcTextSizeEx(text, text_end, hide_text_after_double_hash, wrap_width); 2457 } 2458 2459 /++ 2460 Color Utilities 2461 +/ 2462 ImVec4 ColorConvertU32ToFloat4(ImU32 in_) @trusted 2463 { 2464 return igColorConvertU32ToFloat4(in_); 2465 } 2466 2467 ImU32 ColorConvertFloat4ToU32(ImVec4 in_) @trusted 2468 { 2469 return igColorConvertFloat4ToU32(in_); 2470 } 2471 2472 alias ColorConvertRGBtoHSV = igColorConvertRGBtoHSV; 2473 2474 void ColorConvertHSVtoRGB(float h, float s, float v, scope float* out_r, scope float* out_g, scope float* out_b) @trusted 2475 { 2476 igColorConvertHSVtoRGB(h, s, v, out_r, out_g, out_b); 2477 } 2478 2479 /++ 2480 Inputs Utilities: Keyboard/Mouse/Gamepad 2481 - the ImGuiKey enum contains all possible keyboard, mouse and gamepad inputs (e.g. ImGuiKey_A, ImGuiKey_MouseLeft, ImGuiKey_GamepadDpadUp...). 2482 - (legacy: before v1.87, we used ImGuiKey to carry native/user indices as defined by each backends. This was obsoleted in 1.87 (2022-02) and completely removed in 1.91.5 (2024-11). See https://github.com/ocornut/imgui/issues/4921) 2483 - (legacy: any use of ImGuiKey will assert when key 2484 < 2485 512 to detect passing legacy native/user indices) 2486 +/ 2487 bool IsKeyDown(ImGuiKey key) @trusted 2488 { 2489 return igIsKeyDown(key); 2490 } 2491 2492 bool IsKeyPressed(ImGuiKey key) @trusted 2493 { 2494 return igIsKeyPressed(key); 2495 } 2496 2497 bool IsKeyPressedEx(ImGuiKey key, bool repeat) @trusted 2498 { 2499 return igIsKeyPressedEx(key, repeat); 2500 } 2501 2502 bool IsKeyReleased(ImGuiKey key) @trusted 2503 { 2504 return igIsKeyReleased(key); 2505 } 2506 2507 bool IsKeyChordPressed(ImGuiKeyChord key_chord) @trusted 2508 { 2509 return igIsKeyChordPressed(key_chord); 2510 } 2511 2512 int GetKeyPressedAmount(ImGuiKey key, float repeat_delay, float rate) @trusted 2513 { 2514 return igGetKeyPressedAmount(key, repeat_delay, rate); 2515 } 2516 2517 const(char)* GetKeyName(ImGuiKey key) @trusted 2518 { 2519 return igGetKeyName(key); 2520 } 2521 2522 void SetNextFrameWantCaptureKeyboard(bool want_capture_keyboard) @trusted 2523 { 2524 igSetNextFrameWantCaptureKeyboard(want_capture_keyboard); 2525 } 2526 2527 /++ 2528 Inputs Utilities: Shortcut Testing 2529 & 2530 Routing [BETA] 2531 - ImGuiKeyChord = a ImGuiKey + optional ImGuiMod_Alt/ImGuiMod_Ctrl/ImGuiMod_Shift/ImGuiMod_Super. 2532 ImGuiKey_C // Accepted by functions taking ImGuiKey or ImGuiKeyChord arguments) 2533 ImGuiMod_Ctrl | ImGuiKey_C // Accepted by functions taking ImGuiKeyChord arguments) 2534 only ImGuiMod_XXX values are legal to combine with an ImGuiKey. You CANNOT combine two ImGuiKey values. 2535 - The general idea is that several callers may register interest in a shortcut, and only one owner gets it. 2536 Parent -> call Shortcut(Ctrl+S) // When Parent is focused, Parent gets the shortcut. 2537 Child1 -> call Shortcut(Ctrl+S) // When Child1 is focused, Child1 gets the shortcut (Child1 overrides Parent shortcuts) 2538 Child2 -> no call // When Child2 is focused, Parent gets the shortcut. 2539 The whole system is order independent, so if Child1 makes its calls before Parent, results will be identical. 2540 This is an important property as it facilitate working with foreign code or larger codebase. 2541 - To understand the difference: 2542 - IsKeyChordPressed() compares mods and call IsKeyPressed() -> function has no side-effect. 2543 - Shortcut() submits a route, routes are resolved, if it currently can be routed it calls IsKeyChordPressed() -> function has (desirable) side-effects as it can prevents another call from getting the route. 2544 - Visualize registered routes in 'Metrics/Debugger->Inputs'. 2545 +/ 2546 bool Shortcut(ImGuiKeyChord key_chord, ImGuiInputFlags flags) @trusted 2547 { 2548 return igShortcut(key_chord, flags); 2549 } 2550 2551 void SetNextItemShortcut(ImGuiKeyChord key_chord, ImGuiInputFlags flags) @trusted 2552 { 2553 igSetNextItemShortcut(key_chord, flags); 2554 } 2555 2556 /++ 2557 Inputs Utilities: Key/Input Ownership [BETA] 2558 - One common use case would be to allow your items to disable standard inputs behaviors such 2559 as Tab or Alt key handling, Mouse Wheel scrolling, etc. 2560 e.g. Button(...); SetItemKeyOwner(ImGuiKey_MouseWheelY); to make hovering/activating a button disable wheel for scrolling. 2561 - Reminder ImGuiKey enum include access to mouse buttons and gamepad, so key ownership can apply to them. 2562 - Many related features are still in imgui_internal.h. For instance, most IsKeyXXX()/IsMouseXXX() functions have an owner-id-aware version. 2563 +/ 2564 void SetItemKeyOwner(ImGuiKey key) @trusted 2565 { 2566 igSetItemKeyOwner(key); 2567 } 2568 2569 /++ 2570 Inputs Utilities: Mouse 2571 - To refer to a mouse button, you may use named enums in your code e.g. ImGuiMouseButton_Left, ImGuiMouseButton_Right. 2572 - You can also use regular integer: it is forever guaranteed that 0=Left, 1=Right, 2=Middle. 2573 - Dragging operations are only reported after mouse has moved a certain distance away from the initial clicking position (see 'lock_threshold' and 'io.MouseDraggingThreshold') 2574 +/ 2575 bool IsMouseDown(ImGuiMouseButton button) @trusted 2576 { 2577 return igIsMouseDown(button); 2578 } 2579 2580 bool IsMouseClicked(ImGuiMouseButton button) @trusted 2581 { 2582 return igIsMouseClicked(button); 2583 } 2584 2585 bool IsMouseClickedEx(ImGuiMouseButton button, bool repeat) @trusted 2586 { 2587 return igIsMouseClickedEx(button, repeat); 2588 } 2589 2590 bool IsMouseReleased(ImGuiMouseButton button) @trusted 2591 { 2592 return igIsMouseReleased(button); 2593 } 2594 2595 bool IsMouseDoubleClicked(ImGuiMouseButton button) @trusted 2596 { 2597 return igIsMouseDoubleClicked(button); 2598 } 2599 2600 bool IsMouseReleasedWithDelay(ImGuiMouseButton button, float delay) @trusted 2601 { 2602 return igIsMouseReleasedWithDelay(button, delay); 2603 } 2604 2605 int GetMouseClickedCount(ImGuiMouseButton button) @trusted 2606 { 2607 return igGetMouseClickedCount(button); 2608 } 2609 2610 bool IsMouseHoveringRect(ImVec2 r_min, ImVec2 r_max) @trusted 2611 { 2612 return igIsMouseHoveringRect(r_min, r_max); 2613 } 2614 2615 bool IsMouseHoveringRectEx(ImVec2 r_min, ImVec2 r_max, bool clip) @trusted 2616 { 2617 return igIsMouseHoveringRectEx(r_min, r_max, clip); 2618 } 2619 2620 bool IsMousePosValid(scope ImVec2* mouse_pos) @trusted 2621 { 2622 return igIsMousePosValid(mouse_pos); 2623 } 2624 2625 bool IsAnyMouseDown() @trusted 2626 { 2627 return igIsAnyMouseDown(); 2628 } 2629 2630 ImVec2 GetMousePos() @trusted 2631 { 2632 return igGetMousePos(); 2633 } 2634 2635 ImVec2 GetMousePosOnOpeningCurrentPopup() @trusted 2636 { 2637 return igGetMousePosOnOpeningCurrentPopup(); 2638 } 2639 2640 bool IsMouseDragging(ImGuiMouseButton button, float lock_threshold) @trusted 2641 { 2642 return igIsMouseDragging(button, lock_threshold); 2643 } 2644 2645 ImVec2 GetMouseDragDelta(ImGuiMouseButton button, float lock_threshold) @trusted 2646 { 2647 return igGetMouseDragDelta(button, lock_threshold); 2648 } 2649 2650 void ResetMouseDragDelta() @trusted 2651 { 2652 igResetMouseDragDelta(); 2653 } 2654 2655 void ResetMouseDragDeltaEx(ImGuiMouseButton button) @trusted 2656 { 2657 igResetMouseDragDeltaEx(button); 2658 } 2659 2660 ImGuiMouseCursor GetMouseCursor() @trusted 2661 { 2662 return igGetMouseCursor(); 2663 } 2664 2665 void SetMouseCursor(ImGuiMouseCursor cursor_type) @trusted 2666 { 2667 igSetMouseCursor(cursor_type); 2668 } 2669 2670 void SetNextFrameWantCaptureMouse(bool want_capture_mouse) @trusted 2671 { 2672 igSetNextFrameWantCaptureMouse(want_capture_mouse); 2673 } 2674 2675 /++ 2676 Clipboard Utilities 2677 - Also see the LogToClipboard() function to capture GUI into clipboard, or easily output text data to the clipboard. 2678 +/ 2679 const(char)* GetClipboardText() @trusted 2680 { 2681 return igGetClipboardText(); 2682 } 2683 2684 void SetClipboardText(scope const(char)* text) @trusted 2685 { 2686 igSetClipboardText(text); 2687 } 2688 2689 /++ 2690 Settings/.Ini Utilities 2691 - The disk functions are automatically called if io.IniFilename != NULL (default is "imgui.ini"). 2692 - Set io.IniFilename to NULL to load/save manually. Read io.WantSaveIniSettings description about handling .ini saving manually. 2693 - Important: default value "imgui.ini" is relative to current working dir! Most apps will want to lock this to an absolute path (e.g. same path as executables). 2694 +/ 2695 void LoadIniSettingsFromDisk(scope const(char)* ini_filename) @trusted 2696 { 2697 igLoadIniSettingsFromDisk(ini_filename); 2698 } 2699 2700 void LoadIniSettingsFromMemory(scope const(char)* ini_data, size_t ini_size) @trusted 2701 { 2702 igLoadIniSettingsFromMemory(ini_data, ini_size); 2703 } 2704 2705 void SaveIniSettingsToDisk(scope const(char)* ini_filename) @trusted 2706 { 2707 igSaveIniSettingsToDisk(ini_filename); 2708 } 2709 2710 const(char)* SaveIniSettingsToMemory(size_t* out_ini_size) @trusted 2711 { 2712 return igSaveIniSettingsToMemory(out_ini_size); 2713 } 2714 2715 /++ 2716 Debug Utilities 2717 - Your main debugging friend is the ShowMetricsWindow() function, which is also accessible from Demo->Tools->Metrics Debugger 2718 +/ 2719 void DebugTextEncoding(scope const(char)* text) @trusted 2720 { 2721 igDebugTextEncoding(text); 2722 } 2723 2724 void DebugFlashStyleColor(ImGuiCol idx) @trusted 2725 { 2726 igDebugFlashStyleColor(idx); 2727 } 2728 2729 void DebugStartItemPicker() @trusted 2730 { 2731 igDebugStartItemPicker(); 2732 } 2733 2734 bool DebugCheckVersionAndDataLayout(scope const(char)* version_str, size_t sz_io, size_t sz_style, size_t sz_vec2, size_t sz_vec4, size_t sz_drawvert, size_t sz_drawidx) @trusted 2735 { 2736 return igDebugCheckVersionAndDataLayout(version_str, sz_io, sz_style, sz_vec2, sz_vec4, sz_drawvert, sz_drawidx); 2737 } 2738 2739 void DebugLog(scope const(char)* fmt) @trusted 2740 { 2741 igDebugLog(fmt); 2742 } 2743 2744 alias DebugLogV = igDebugLogV; 2745 2746 /++ 2747 Memory Allocators 2748 - Those functions are not reliant on the current context. 2749 - DLL users: heaps and globals are not shared across DLL boundaries! You will need to call SetCurrentContext() + SetAllocatorFunctions() 2750 for each static/DLL boundary you are calling from. Read "Context and Memory Allocators" section of imgui.cpp for more details. 2751 +/ 2752 void SetAllocatorFunctions(ImGuiMemAllocFunc alloc_func, ImGuiMemFreeFunc free_func, scope void* user_data) @trusted 2753 { 2754 igSetAllocatorFunctions(alloc_func, free_func, user_data); 2755 } 2756 2757 void GetAllocatorFunctions(scope ImGuiMemAllocFunc* p_alloc_func, scope ImGuiMemFreeFunc* p_free_func, scope void** p_user_data) @trusted 2758 { 2759 igGetAllocatorFunctions(p_alloc_func, p_free_func, p_user_data); 2760 } 2761 2762 void* MemAlloc(size_t size) @trusted 2763 { 2764 return igMemAlloc(size); 2765 } 2766 2767 void MemFree(scope void* ptr) @trusted 2768 { 2769 igMemFree(ptr); 2770 } 2771 2772 /++ 2773 OBSOLETED in 1.92.0 (from June 2025) 2774 +/ 2775 void PushFont(scope ImFont* font) @trusted 2776 { 2777 igPushFont(font); 2778 } 2779 2780 void SetWindowFontScale(float scale) @trusted 2781 { 2782 igSetWindowFontScale(scale); 2783 } 2784 2785 /++ 2786 OBSOLETED in 1.91.9 (from February 2025) 2787 +/ 2788 void ImageImVec4(ImTextureRef tex_ref, ImVec2 image_size, ImVec2 uv0, ImVec2 uv1, ImVec4 tint_col, ImVec4 border_col) @trusted 2789 { 2790 igImageImVec4(tex_ref, image_size, uv0, uv1, tint_col, border_col); 2791 } 2792 2793 /++ 2794 OBSOLETED in 1.91.0 (from July 2024) 2795 +/ 2796 void PushButtonRepeat(bool repeat) @trusted 2797 { 2798 igPushButtonRepeat(repeat); 2799 } 2800 2801 void PopButtonRepeat() @trusted 2802 { 2803 igPopButtonRepeat(); 2804 } 2805 2806 void PushTabStop(bool tab_stop) @trusted 2807 { 2808 igPushTabStop(tab_stop); 2809 } 2810 2811 void PopTabStop() @trusted 2812 { 2813 igPopTabStop(); 2814 } 2815 2816 ImVec2 GetContentRegionMax() @trusted 2817 { 2818 return igGetContentRegionMax(); 2819 } 2820 2821 ImVec2 GetWindowContentRegionMin() @trusted 2822 { 2823 return igGetWindowContentRegionMin(); 2824 } 2825 2826 ImVec2 GetWindowContentRegionMax() @trusted 2827 { 2828 return igGetWindowContentRegionMax(); 2829 } 2830 2831 /++ 2832 OBSOLETED in 1.90.0 (from September 2023) 2833 +/ 2834 bool BeginChildFrame(ImGuiID id, ImVec2 size) @trusted 2835 { 2836 return igBeginChildFrame(id, size); 2837 } 2838 2839 bool BeginChildFrameEx(ImGuiID id, ImVec2 size, ImGuiWindowFlags window_flags) @trusted 2840 { 2841 return igBeginChildFrameEx(id, size, window_flags); 2842 } 2843 2844 void EndChildFrame() @trusted 2845 { 2846 igEndChildFrame(); 2847 } 2848 2849 /++ 2850 static inline bool BeginChild(const char* str_id, const ImVec2 2851 & 2852 size_arg, bool borders, ImGuiWindowFlags window_flags){ return BeginChild(str_id, size_arg, borders ? ImGuiChildFlags_Borders : ImGuiChildFlags_None, window_flags); } // Unnecessary as true == ImGuiChildFlags_Borders 2853 static inline bool BeginChild(ImGuiID id, const ImVec2 2854 & 2855 size_arg, bool borders, ImGuiWindowFlags window_flags) { return BeginChild(id, size_arg, borders ? ImGuiChildFlags_Borders : ImGuiChildFlags_None, window_flags); } // Unnecessary as true == ImGuiChildFlags_Borders 2856 +/ 2857 void ShowStackToolWindow(scope bool* p_open) @trusted 2858 { 2859 igShowStackToolWindow(p_open); 2860 } 2861 2862 bool ComboObsolete(scope const(char)* label, scope int* current_item, ImGuiOld_callbackCallback old_callback, scope void* user_data, int items_count) @trusted 2863 { 2864 return igComboObsolete(label, current_item, old_callback, user_data, items_count); 2865 } 2866 2867 bool ComboObsoleteEx(scope const(char)* label, scope int* current_item, ImGuiOld_callbackCallback old_callback, scope void* user_data, int items_count, int popup_max_height_in_items) @trusted 2868 { 2869 return igComboObsoleteEx(label, current_item, old_callback, user_data, items_count, popup_max_height_in_items); 2870 } 2871 2872 bool ListBoxObsolete(scope const(char)* label, scope int* current_item, ImGuiOld_callbackCallback old_callback, scope void* user_data, int items_count) @trusted 2873 { 2874 return igListBoxObsolete(label, current_item, old_callback, user_data, items_count); 2875 } 2876 2877 bool ListBoxObsoleteEx(scope const(char)* label, scope int* current_item, ImGuiOld_callbackCallback old_callback, scope void* user_data, int items_count, int height_in_items) @trusted 2878 { 2879 return igListBoxObsoleteEx(label, current_item, old_callback, user_data, items_count, height_in_items); 2880 } 2881 2882 /++ 2883 OBSOLETED in 1.89.7 (from June 2023) 2884 +/ 2885 void SetItemAllowOverlap() @trusted 2886 { 2887 igSetItemAllowOverlap(); 2888 }