if(g_pFontTextureView){g_pFontTextureView->Release();g_pFontTextureView=NULL;ImGui::GetIO().Fonts->TexID =NULL;}// We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.
if(g_pFontTextureView){g_pFontTextureView->Release();g_pFontTextureView=NULL;ImGui::GetIO().Fonts->SetTexID(NULL);}// We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.
if(g_pFontTextureView){g_pFontTextureView->Release();g_pFontTextureView=NULL;ImGui::GetIO().Fonts->TexID =NULL;}// We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.
if(g_pFontTextureView){g_pFontTextureView->Release();g_pFontTextureView=NULL;ImGui::GetIO().Fonts->SetTexID(NULL);}// We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.
if(g_FontTexture){g_FontTexture->Release();g_FontTexture=NULL;ImGui::GetIO().Fonts->TexID =NULL;}// We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.
if(g_FontTexture){g_FontTexture->Release();g_FontTexture=NULL;ImGui::GetIO().Fonts->SetTexID(NULL);}// We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.
- Backends: GLFW: Added ImGui_ImplGlfw_InitForWebGPU() init point. It currently has strictly no effect on anything,
but because some multi-viewport renderers require knowledge of the render stack in the Platform back-end, we're
- Backends: GLFW: Added ImGui_ImplGlfw_InitForWebGPU() init point. It currently has strictly no effect on anything,
but because some multi-viewport renderers require knowledge of the render stack in the Platform back-end, we're
adding it for consistency. (#3632)
@ -304,7 +330,7 @@ Other Changes:
- InputText: Fixed callback's helper DeleteChars() function when cursor is inside the deleted block. (#3454)
- InputText: Made pressing Down arrow on the last line when it doesn't have a carriage return not move to
the end of the line (so it is consistent with Up arrow, and behave same as Notepad and Visual Studio.
Note that some other text editors instead would move the crusor to the end of the line). [@Xipiryon]
Note that some other text editors instead would move the cursor to the end of the line). [@Xipiryon]
- DragFloat, DragScalar: Fixed ImGuiSliderFlags_ClampOnInput not being honored in the special case
where v_min == v_max. (#3361)
- SliderInt, SliderScalar: Fixed reaching of maximum value with inverted integer min/max ranges, both
@ -332,7 +358,7 @@ Other Changes:
tabs reordered in the tab list popup. [@Xipiryon]
- Columns: Fix inverted ClipRect being passed to renderer when using certain primitives inside of
a fully clipped column. (#3475) [@szreder]
- Popups, Tooltips: Fix edge cases issues with positionning popups and tooltips when they are larger than
- Popups, Tooltips: Fix edge cases issues with positioning popups and tooltips when they are larger than
viewport on either or both axises. [@Rokups]
- Fonts: AddFontDefault() adjust its vertical offset based on floor(size/13) instead of always +1.
Was previously done by altering DisplayOffset.y but wouldn't work for DPI scaled font.
@ -496,7 +522,7 @@ Other Changes:
- Popups: Added ImGuiPopupFlags_AnyPopupId and ImGuiPopupFlags_AnyPopupLevel flags for IsPopupOpen(),
allowing to check if any popup is open at the current level, if a given popup is open at any popup
level, if any popup is open at all.
- Popups: Fix an edge case where programatically closing a popup while clicking on its empty space
- Popups: Fix an edge case where programmatically closing a popup while clicking on its empty space
would attempt to focus it and close other popups. (#2880)
- Popups: Fix BeginPopupContextVoid() when clicking over the area made unavailable by a modal. (#1636)
- Popups: Clarified some of the comments and function prototypes.
@ -1634,7 +1660,7 @@ Other Changes:
- ImFontAtlas: Added GetGlyphRangesChineseSimplifiedCommon() helper that returns a list of ~2500 most common Simplified Chinese
characters. (#1859) [@JX-Master, @ocornut]
- Examples: OSX: Added imgui_impl_osx.mm backend to be used along with e.g. imgui_impl_opengl2.cpp. (#281, #1870) [@pagghiu, @itamago, @ocornut]
- Examples: GLFW: Made it possible to Shutdown/Init the backend again (by reseting the time storage properly). (#1827) [@ice1000]
- Examples: GLFW: Made it possible to Shutdown/Init the backend again (by resetting the time storage properly). (#1827) [@ice1000]
- Examples: Win32: Fixed handling of mouse wheel messages to support sub-unit scrolling messages (typically sent by track-pads). (#1874) [@zx64]
- Examples: SDL+Vulkan: Added SDL+Vulkan example.
- Examples: Allegro5: Added support for ImGuiConfigFlags_NoMouseCursorChange flag. Added clipboard support.
@ -2409,7 +2435,7 @@ Other Changes:
- Combo(): Right-most button stays highlighted when pop-up is open.
- Combo(): Display pop-up above if there's isn't enough space below / or select largest side. (#505)
- DragFloat(), SliderFloat(), InputFloat(): fixed cases of erroneously returning true repeatedly after a text input modification (e.g. "0.0" --> "0.000" would keep returning true). (#564)
- DragFloat(): Always apply value when mouse is held/widget active, so that an always-reseting variable (e.g. non saved local) can be passed.
- DragFloat(): Always apply value when mouse is held/widget active, so that an always-resetting variable (e.g. non saved local) can be passed.
- InputText(): OS X friendly behaviors: Word movement uses ALT key; Shortcuts uses CMD key; Double-clicking text select a single word; Jumping to next word sets cursor to end of current word instead of beginning of current word. (@zhiayang), (#473)
- InputText(): Added BufTextLen in ImGuiTextEditCallbackData. Requesting user to maintain it if buffer is modified. Zero-ing structure properly before use. (#541)
- CheckboxFlags(): Added support for testing/setting multiple flags at the same time. (@DMartinek) (#555)
From November 2014 to December 2019, ongoing development has also been financially supported by its users on Patreon and through individual donations. Please see [detailed list of Dear ImGui supporters](https://github.com/ocornut/imgui/wiki/Sponsors).
Please see [detailed list of Dear ImGui supporters](https://github.com/ocornut/imgui/wiki/Sponsors) for past sponsors.
From November 2014 to December 2019, ongoing development has also been financially supported by its users on Patreon and through individual donations.
**THANK YOU to all past and present supporters for helping to keep this project alive and thriving!**
@ -213,12 +213,11 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
- combo: flag for BeginCombo to not return true when unchanged (#1182)
- combo: a way/helper to customize the combo preview (#1658)
- combo/listbox: keyboard control. need InputText-like non-active focus + key handling. considering keyboard for custom listbox (pr #203)
- listbox: refactor and clean the begin/end api
- listbox: multiple selection.
- listbox: unselect option (#1208)
- listbox: make it easier/more natural to implement range-select (need some sort of info/ref about the last clicked/focused item that user can translate to an index?) (wip stash)
- listbox: user may want to initial scroll to focus on the one selected value?
- listbox: expose hovered item for a basic ListBox
- listbox: expose hovered item for a simplified ListBox api
- listbox: keyboard navigation.
- listbox: disable capturing mouse wheel if the listbox has no scrolling. (#1681)
- listbox: scrolling should track modified selection.
@ -275,12 +274,14 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
- style: gradients fill (#1223) ~ 2 bg colors for each fill? tricky with rounded shapes and using textures for corners.
- style editor: color child window height expressed in multiple of line height.
- log: improve logging of ArrowButton, ListBox, TabItem
- log: carry on indent / tree depth when opening a child window
- log: enabling log ends up pushing and growing vertices buffers because we don't distinguish layout vs render clipping
- log: have more control over the log scope (e.g. stop logging when leaving current tree node scope)
- log: be able to log anything (e.g. right-click on a window/tree-node, shows context menu? log into tty/file/clipboard)
- log: let user copy any window content to clipboard easily (CTRL+C on windows? while moving it? context menu?). code is commented because it fails with multiple Begin/End pairs.
window->DC.CursorPos+=offset;// As we happen to move the window while it is being appended to (which is a bad idea - will smear) let's at least offset the cursor
window->DC.CursorMaxPos+=offset;// And more importantly we need to offset CursorMaxPos/CursorStartPos this so ContentSize calculation doesn't get affected.
window->DC.IdealMaxPos+=offset;
window->DC.CursorStartPos+=offset;
}
@ -8296,7 +8305,7 @@ void ImGui::BeginGroup()
window->DC.CursorMaxPos=window->DC.CursorPos;
window->DC.CurrLineSize=ImVec2(0.0f,0.0f);
if(g.LogEnabled)
g.LogLinePosY=-FLT_MAX;// To enforce Log carriage return
g.LogLinePosY=-FLT_MAX;// To enforce a carriage return
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
// - The BeginCombo()/EndCombo() api allows you to manage your contents and selection state however you want it, by creating e.g. Selectable() items.
// - The old Combo() api are helpers over BeginCombo()/EndCombo() which are kept available for convenience purpose.
// - The old Combo() api are helpers over BeginCombo()/EndCombo() which are kept available for convenience purpose. This is analogous to how ListBox are created.
IMGUI_APIboolSelectable(constchar*label,bool*p_selected,ImGuiSelectableFlagsflags=0,constImVec2&size=ImVec2(0,0));// "bool* p_selected" point to the selection state (read-write), as a convenient helper.
// Widgets: List Boxes
// - FIXME: To be consistent with all the newer API, ListBoxHeader/ListBoxFooter should in reality be called BeginListBox/EndListBox. Will rename them.
// - This is essentially a thin wrapper to using BeginChild/EndChild with some stylistic changes.
// - The BeginListBox()/EndListBox() api allows you to manage your contents and selection state however you want it, by creating e.g. Selectable() or any items.
// - 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.
// - Choose frame width: size.x > 0.0f: custom / size.x < 0.0f or -FLT_MIN: right-align / size.x = 0.0f (default): use current ItemWidth
// - Choose frame height: size.y > 0.0f: custom / size.y < 0.0f or -FLT_MIN: bottom-align / size.y = 0.0f (default): arbitrary default height which can fit ~7 items
IMGUI_APIboolBeginListBox(constchar*label,constImVec2&size=ImVec2(0,0));// open a framed scrolling region
IMGUI_APIvoidEndListBox();// only call EndListBox() if BeginListBox() returned true!
IMGUI_APIboolListBoxHeader(constchar*label,constImVec2&size=ImVec2(0,0));// use if you want to reimplement ListBox() will custom data or interactions. if the function return true, you can output elements then call ListBoxFooter() afterwards.
ImGuiTableFlags_SizingFixedFit=1<<13,// Columns default to _WidthFixed or _WidthAuto (if resizable or not resizable), matching contents width.
ImGuiTableFlags_SizingFixedSame=2<<13,// Columns default to _WidthFixed or _WidthAuto (if resizable or not resizable), matching the maximum contents width of all columns. Implicitly enable ImGuiTableFlags_NoKeepColumnsVisible.
ImGuiTableFlags_SizingStretchProp=3<<13,// Columns default to _WidthStretch with default weights proportional to each columns contents widths.
ImGuiTableFlags_SizingStretchSame=4<<13,// Columns default to _WidthStretch with default weights all equal, unless overriden by TableSetupColumn().
ImGuiTableFlags_SizingStretchSame=4<<13,// Columns default to _WidthStretch with default weights all equal, unless overridden by TableSetupColumn().
// Sizing Extra Options
ImGuiTableFlags_NoHostExtendX=1<<16,// Make outer width auto-fit to columns, overriding outer_size.x value. Only available when ScrollX/ScrollY are disabled and Stretch columns are not used.
ImGuiTableFlags_NoHostExtendY=1<<17,// Make outer height stop exactly at outer_size.y (prevent auto-extending table past the limit). Only available when ScrollX/ScrollY are disabled. Data below the limit will be clipped and not visible.
@ -2066,6 +2070,10 @@ struct ImGuiTableSortSpecs
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
namespaceImGui
{
// OBSOLETED in 1.81 (from February 2021)
IMGUI_APIboolListBoxHeader(constchar*label,intitems_count,intheight_in_items=-1);// Helper to calculate size from items_count and height_in_items
staticinlinevoidOpenPopupContextItem(constchar*str_id=NULL,ImGuiMouseButtonmb=1){OpenPopupOnItemClick(str_id,mb);}// Bool return value removed. Use IsWindowAppearing() in BeginPopup() instead. Renamed in 1.77, renamed back in 1.79. Sorry!
// OBSOLETED in 1.78 (from June 2020)
@ -2507,9 +2515,9 @@ struct ImDrawList
inlinevoidPathFillConvex(ImU32col){AddConvexPolyFilled(_Path.Data,_Path.Size,col);_Path.Size=0;}// Note: Anti-aliased filling requires points to be in clockwise order.
boolValid;// Only valid after Render() is called and before the next NewFrame() is called.
ImDrawList**CmdLists;// Array of ImDrawList* to render. The ImDrawList are owned by ImGuiContext and only pointed to from here.
intCmdListsCount;// Number of ImDrawList* to render
intTotalIdxCount;// For convenience, sum of all ImDrawList's IdxBuffer.Size
intTotalVtxCount;// For convenience, sum of all ImDrawList's VtxBuffer.Size
ImDrawList**CmdLists;// Array of ImDrawList* to render. The ImDrawList are owned by ImGuiContext and only pointed to from here.
ImVec2DisplayPos;// Upper-left position of the viewport to render (== upper-left of the orthogonal projection matrix to use)
ImVec2DisplaySize;// Size of the viewport to render (== io.DisplaySize for the main viewport) (DisplayPos + DisplaySize == lower-right of the orthogonal projection matrix to use)
ImVec2FramebufferScale;// Amount of pixels for each unit of DisplaySize. Based on io.DisplayFramebufferScale. Generally (1,1) on normal display, (2,2) on OSX with Retina display.
ImGuiViewport*OwnerViewport;// Viewport carrying the ImDrawData instance, might be of use to the renderer (generally not).
// Functions
ImDrawData(){Valid=false;Clear();}
~ImDrawData(){Clear();}
voidClear(){Valid=false;CmdLists=NULL;CmdListsCount=TotalVtxCount=TotalIdxCount=0;DisplayPos=DisplaySize=FramebufferScale=ImVec2(0.f,0.f);OwnerViewport=NULL;}// The ImDrawList are owned by ImGuiContext!
ImDrawData(){Clear();}
voidClear(){memset(this,0,sizeof(*this));}// The ImDrawList are owned by ImGuiContext!
IMGUI_APIvoidDeIndexAllBuffers();// Helper to convert all buffers from indexed to non-indexed, in case you cannot render indexed. Note: this is slow and most likely a waste of resources. Always prefer indexed rendering!
IMGUI_APIvoidScaleClipRects(constImVec2&fb_scale);// Helper to scale the ClipRect field of each ImDrawCmd. Use if your final output buffer is at a different scale than Dear ImGui expects, or if there is a difference between your window resolution and framebuffer resolution.
};
@ -2587,8 +2594,8 @@ struct ImFontConfig
boolFontDataOwnedByAtlas;// true // TTF/OTF data ownership taken by the container ImFontAtlas (will delete memory itself).
intFontNo;// 0 // Index of font within TTF/OTF file
floatSizePixels;// // Size in pixels for rasterizer (more or less maps to the resulting font height).
intOversampleH;// 3 // Rasterize at higher quality for sub-pixel positioning. Read https://github.com/nothings/stb/blob/master/tests/oversample/README.md for details.
intOversampleV;// 1 // Rasterize at higher quality for sub-pixel positioning. We don't use sub-pixel positions on the Y axis.
intOversampleH;// 3 // Rasterize at higher quality for sub-pixel positioning. Note the difference between 2 and 3 is minimal so you can reduce this to 2 to save memory. Read https://github.com/nothings/stb/blob/master/tests/oversample/README.md for details.
intOversampleV;// 1 // Rasterize at higher quality for sub-pixel positioning. This is not really useful as we don't use sub-pixel positions on the Y axis.
boolPixelSnapH;// false // Align every glyph to pixel boundary. Useful e.g. if you are merging a non-pixel aligned font with the default font. If enabled, you can set OversampleH/V to 1.
ImVec2GlyphExtraSpacing;// 0, 0 // Extra spacing (in pixels) between glyphs. Only X axis is supported for now.
ImVec2GlyphOffset;// 0, 0 // Offset all glyphs from this font input.
@ -2611,8 +2618,9 @@ struct ImFontConfig
// (Note: some language parsers may fail to convert the 31+1 bitfield members, in this case maybe drop store a single u32 or we can rework this)
structImFontGlyph
{
unsignedintCodepoint:31;// 0x0000..0xFFFF
unsignedintVisible:1;// Flag to allow early out when rendering
unsignedintColored:1;// Flag to indicate glyph is colored and should generally ignore tinting (make it usable with no shift on little-endian as this is used in loops)
unsignedintVisible:1;// Flag to indicate glyph has no visible pixels (e.g. space). Allow early out when rendering.
unsignedintCodepoint:30;// 0x0000..0x10FFFF
floatAdvanceX;// Distance to next character (= data from font + ImFontConfig::GlyphExtraSpacing.x baked in)
"Refer to the \"Combo\" section below for an explanation of the full BeginCombo/EndCombo API, "
"and demonstration of various flags.\n");
"Using the simplified one-liner Combo API here.\nRefer to the \"Combo\" section below for an explanation of how to use the more flexible and general BeginCombo/EndCombo API.");
"Using the simplified one-liner ListBox API here.\nRefer to the \"List boxes\" section below for an explanation of how to use the more flexible and general BeginListBox/EndListBox API.");
ImGuiTableDrawChannelIdxBg2DrawChannelCurrent;// For Selectable() and other widgets drawing accross columns after the freezing line. Index within DrawSplitter.Channels[]
ImGuiTableDrawChannelIdxBg2DrawChannelCurrent;// For Selectable() and other widgets drawing across columns after the freezing line. Index within DrawSplitter.Channels[]
ImGuiTableDrawChannelIdxBg2DrawChannelUnfrozen;
boolIsLayoutLocked;// Set by TableUpdateLayout() which is called when beginning the first row.
boolIsInsideRow;// Set when inside TableBeginRow()/TableEndRow().
@ -2332,7 +2335,7 @@ struct ImGuiTable
boolIsResetAllRequest;
boolIsResetDisplayOrderRequest;
boolIsUnfrozenRows;// Set when we got past the frozen row.
boolIsDefaultSizingPolicy;// Set if user didn't explicitely set a sizing policy in BeginTable()
boolIsDefaultSizingPolicy;// Set if user didn't explicitly set a sizing policy in BeginTable()
boolMemoryCompacted;
boolHostSkipItems;// Backup of InnerWindow->SkipItem at the end of BeginTable(), because we will overwrite InnerWindow->SkipItem on a per-column basis
@ -2494,6 +2497,8 @@ namespace ImGui
// Logging/Capture
IMGUI_APIvoidLogBegin(ImGuiLogTypetype,intauto_open_depth);// -> BeginCapture() when we design v2 api, for now stay under the radar by using the old name.
IMGUI_APIvoidLogToBuffer(intauto_open_depth=-1);// Start logging/capturing to internal buffer
IMGUI_APIintTableGetHoveredColumn();// May use (TableGetColumnFlags() & ImGuiTableColumnFlags_IsHovered) instead. Return hovered column. return -1 when table is not hovered. return columns_count if the unused space at the right of visible columns is hovered.
// - with Table policy ImGuiTableFlags_SizingFixedSame --> default Column policy is ImGuiTableColumnFlags_WidthFixed, default Width is max of all contents width
// - with Table policy ImGuiTableFlags_SizingStretchSame --> default Column policy is ImGuiTableColumnFlags_WidthStretch, default Weight is 1.0f
// - with Table policy ImGuiTableFlags_SizingStretchWeight --> default Column policy is ImGuiTableColumnFlags_WidthStretch, default Weight is proportional to contents
// Default Width and default Weight can be overriden when calling TableSetupColumn().
// Default Width and default Weight can be overridden when calling TableSetupColumn().
draw_window->DC.NavLayerActiveMaskNext|=(1<<draw_window->DC.NavLayerCurrent);// This is to ensure that EndChild() will display a navigation highlight so we can "enter" into it.
// NB: '##' is normally used to hide text (as a library-wide feature), so we need to specify the text range to make sure the ## aren't stripped out here.
// We don't support (size < 0.0f) in Selectable() because the ItemSpacing extension would make explicitely right-aligned sizes not visibly match other widgets.
// We don't support (size < 0.0f) in Selectable() because the ItemSpacing extension would make explicitly right-aligned sizes not visibly match other widgets.
// Tip: To have a list filling the entire window width, use size.x = -FLT_MIN and pass an non-visible label e.g. "##empty"
// Tip: If your vertical size is calculated from an item count (e.g. 10 * item_height) consider adding a fractional part to facilitate seeing scrolling boundaries (e.g. 10.25 * item_height).
// We add +25% worth of item height to allow the user to see at a glance if there are more items up/down, without looking at the scrollbar.
// We don't add this extra bit if items_count <= height_in_items. It is slightly dodgy, because it means a dynamic list of items will make the widget resize occasionally when it crosses that size.
// I am expecting that someone will come and complain about this behavior in a remote future, then we can advise on a better solution.
// We include ItemSpacing.y so that a list sized for the exact number of items doesn't make a scrollbar appears. We could also enforce that by passing a flag to BeginChild().
// If height_in_items == -1, default height is maximum 7.
// FIXME: In principle this function should be called EndListBox(). We should rename it after re-evaluating if we want to keep the same signature.
voidImGui::ListBoxFooter()
voidImGui::EndListBox()
{
ImGuiWindow*window=GetCurrentWindow();
IM_ASSERT((window->Flags&ImGuiWindowFlags_ChildWindow)&&"Mismatched ListBoxHeader/ListBoxFooter calls. Did you test the return value of ListBoxHeader()?");
ImGuiWindow*parent_window=window->ParentWindow;
constImRectbb=parent_window->DC.LastItemRect;
constImGuiStyle&style=GetStyle();
ImGuiContext&g=*GImGui;
ImGuiWindow*window=g.CurrentWindow;
IM_ASSERT((window->Flags&ImGuiWindowFlags_ChildWindow)&&"Mismatched BeginListBox/EndListBox calls. Did you test the return value of BeginListBox?");
EndChildFrame();
// Redeclare item size so that it includes the label (we have stored the full size in LastItemRect)
// We call SameLine() to restore DC.CurrentLine* data
SameLine();
parent_window->DC.CursorPos=bb.Min;
ItemSize(bb,style.FramePadding.y);
EndGroup();
EndGroup();// This is only required to be able to do IsItemXXX query on the whole ListBox including label
// Assume all items have even height (= 1 line of text). If you need items of different or variable sizes you can create a custom version of ListBox() in your code without using the clipper.
ImGuiContext&g=*GImGui;
// Assume all items have even height (= 1 line of text). If you need items of different height,
// you can create a custom version of ListBox() in your code without using the clipper.
boolvalue_changed=false;
ImGuiListClipperclipper;
clipper.Begin(items_count,GetTextLineHeightWithSpacing());// We know exactly our line height here so we pass it as a minor optimization, but generally you don't need to.
// We overwrite CursorMaxPos because BeginGroup sets it to CursorPos (essentially the .EmitItem hack in EndMenuBar() would need something analoguous here, maybe a BeginGroupEx() with flags).
// We overwrite CursorMaxPos because BeginGroup sets it to CursorPos (essentially the .EmitItem hack in EndMenuBar() would need something analogous here, maybe a BeginGroupEx() with flags).
SetNextWindowPos(popup_pos,ImGuiCond_Always);// Note: this is super misleading! The value will serve as reference for FindBestWindowPosForPopup(), not actual pos.
menu_is_open=BeginPopupEx(id,flags);// menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display)