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