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).
- input text: easier ways to update buffer (from source char*) while owned. preserve some sort of cursor position for multi-line text.
- input text: add flag (e.g. ImGuiInputTextFlags_EscapeClearsBuffer) to clear instead of revert. what to do with focus? (also see #2890)
- input text: add discard flag (e.g. ImGuiInputTextFlags_DiscardActiveBuffer) or make it easier to clear active focus for text replacement during edition (#725)
- input text: display bug when clicking a drag/slider after an input text in a different window has all-selected text (order dependent). actually a very old bug but no one appears to have noticed it.
- input text: allow centering/positioning text so that ctrl+clicking Drag or Slider keeps the textual value at the same pixel position.
@ -191,6 +192,9 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
- tabs: make EndTabBar fail if users doesn't respect BeginTabBar return value, for consistency/future-proofing.
- tabs: persistent order/focus in BeginTabBar() api (#261, #351)
- tabs: TabItem could honor SetNextItemWidth()?
- tabs: explicit api (even if internal) to cleanly manipulate tab order.
- tabs: Mouse wheel over tab bar could scroll? (#2702)
- image/image button: misalignment on padded/bordered button?
- image/image button: parameters are confusing, image() has tint_col,border_col whereas imagebutton() has bg_col/tint_col. Even thou they are different parameters ordering could be more consistent. can we fix that?
@ -239,7 +243,6 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
- tooltip: tooltips with delay timers? or general timer policy? (instantaneous vs timed): IsItemHovered() with timer + implicit aabb-id for items with no ID. (#1485)
- tooltip: drag tooltip hovering over source widget with IsItemHovered/SetTooltip flickers.
- menus: calling BeginMenu() twice with a same name doesn't append as Begin() does for regular windows (#1207)
- menus: menu bars inside modal windows are acting weird.
- status-bar: add a per-window status bar helper similar to what menu-bar does.
- shortcuts: local-style shortcut api, e.g. parse "&Save"
// The reason this is exposed in imgui_internal.h is: on touch-based system that don't have hovering, we want to dispatch inputs to the right target (imgui vs imgui+app)
voidImGui::UpdateHoveredWindowAndCaptureFlags()
{
@ -3813,34 +4018,21 @@ void ImGui::NewFrame()
NewFrameSanityChecks();
g.ConfigFlagsCurrFrame=g.IO.ConfigFlags;
// Load settings on first frame (if not explicitly loaded manually before)
if(!g.SettingsLoaded)
{
IM_ASSERT(g.SettingsWindows.empty());
if(g.IO.IniFilename)
LoadIniSettingsFromDisk(g.IO.IniFilename);
g.SettingsLoaded=true;
}
// Save settings (with a delay after the last modification, so we don't spam disk too much)
if(g.SettingsDirtyTimer>0.0f)
{
g.SettingsDirtyTimer-=g.IO.DeltaTime;
if(g.SettingsDirtyTimer<=0.0f)
{
if(g.IO.IniFilename!=NULL)
SaveIniSettingsToDisk(g.IO.IniFilename);
else
g.IO.WantSaveIniSettings=true;// Let user know they can call SaveIniSettingsToMemory(). user will need to clear io.WantSaveIniSettings themselves.
g.SettingsDirtyTimer=0.0f;
}
}
// Load settings on first frame, save settings when modified (after a delay)
UpdateSettings();
g.Time+=g.IO.DeltaTime;
g.WithinFrameScope=true;
g.FrameCount+=1;
g.TooltipOverrideCount=0;
g.WindowsActiveCount=0;
g.MenusIdSubmittedThisFrame.resize(0);
// Calculate frame-rate for the user, as a purely luxurious feature
IMGUI_APIImGuiIO&GetIO();// access the IO structure (mouse/keyboard/gamepad inputs, time, various configuration options/flags)
IMGUI_APIImGuiStyle&GetStyle();// access the Style structure (colors, sizes). Always use PushStyleCol(), PushStyleVar() to modify style mid-frame.
IMGUI_APIImGuiStyle&GetStyle();// access the Style structure (colors, sizes). Always use PushStyleCol(), PushStyleVar() to modify style mid-frame!
IMGUI_APIvoidNewFrame();// start a new Dear ImGui frame, you can submit any command from this point until Render()/EndFrame().
IMGUI_APIvoidEndFrame();// ends the Dear ImGui frame. automatically called by Render(), you likely don't need to call that yourself directly. If you don't need to render data (skipping rendering) you may call EndFrame() but you'll have wasted CPU already! If you don't need to render, better to not create any imgui windows and not call NewFrame() at all!
IMGUI_APIvoidRender();// ends the Dear ImGui frame, finalize the draw data. You can get call GetDrawData() to obtain it and run your rendering function. (Obsolete: this used to call io.RenderDrawListsFn(). Nowadays, we allow and prefer calling your render function yourself.)
IMGUI_APIvoidEndFrame();// ends the Dear ImGui frame. automatically called by Render(). If you don't need to render data (skipping rendering) you may call EndFrame() without Render()... but you'll have wasted CPU already! If you don't need to render, better to not create any windows and not call NewFrame() at all!
IMGUI_APIvoidRender();// ends the Dear ImGui frame, finalize the draw data. You can get call GetDrawData() to obtain it and run your rendering function (up to v1.60, this used to call io.RenderDrawListsFn(). Nowadays, we allow and prefer calling your render function yourself.)
IMGUI_APIImDrawData*GetDrawData();// valid after Render() and until the next call to NewFrame(). this is what you have to render.
// Demo, Debug, Information
IMGUI_APIvoidShowDemoWindow(bool*p_open=NULL);// create Demo window (previously called ShowTestWindow). demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application!
IMGUI_APIvoidShowAboutWindow(bool*p_open=NULL);// create About window. display Dear ImGui version, credits and build/system information.
IMGUI_APIvoidShowStyleEditor(ImGuiStyle*ref=NULL);// add style editor block (not a window). you can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it uses the default style)
IMGUI_APIboolShowStyleSelector(constchar*label);// add style selector block (not a window), essentially a combo listing the default styles.
IMGUI_APIvoidShowFontSelector(constchar*label);// add font selector block (not a window), essentially a combo listing the loaded fonts.
@ -357,11 +357,11 @@ namespace ImGui
IMGUI_APIImU32GetColorU32(ImU32col);// retrieve given color with style alpha applied
// Parameters stacks (current window)
IMGUI_APIvoidPushItemWidth(floatitem_width);// set width of items for common large "item+label" widgets. >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -1.0f always align width to the right side). 0.0f = default to ~2/3 of windows width,
IMGUI_APIvoidPushItemWidth(floatitem_width);// push width of items for common large "item+label" widgets. >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -1.0f always align width to the right side). 0.0f = default to ~2/3 of windows width,
IMGUI_APIvoidPopItemWidth();
IMGUI_APIvoidSetNextItemWidth(floatitem_width);// set width of the _next_ common large "item+label" widget. >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -1.0f always align width to the right side)
IMGUI_APIfloatCalcItemWidth();// width of item given pushed settings and current cursor position. NOT necessarily the width of last item unlike most 'Item' functions.
IMGUI_APIvoidPushTextWrapPos(floatwrap_local_pos_x=0.0f);// word-wrapping for Text*() commands. < 0.0f: no wrapping; 0.0f: wrap to end of window (or column); > 0.0f: wrap at 'wrap_pos_x' position in window local space
IMGUI_APIvoidPushTextWrapPos(floatwrap_local_pos_x=0.0f);// push word-wrapping position for Text*() commands. < 0.0f: no wrapping; 0.0f: wrap to end of window (or column); > 0.0f: wrap at 'wrap_pos_x' position in window local space
IMGUI_APIvoidPopTextWrapPos();
IMGUI_APIvoidPushAllowKeyboardFocus(boolallow_keyboard_focus);// allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets
IMGUI_APIvoidPopAllowKeyboardFocus();
@ -372,6 +372,9 @@ namespace ImGui
// - By "cursor" we mean the current output position.
// - The typical widget behavior is to output themselves at the current cursor position, then move the cursor one line down.
// - You can call SameLine() between widgets to undo the last carriage return and output at the right of the preceeding widget.
// - Attention! We currently have inconsistencies between window-local and absolute positions we will aim to fix with future API:
// Absolute coordinate: GetCursorScreenPos(), SetCursorScreenPos(), all ImDrawList:: functions.
IMGUI_APIvoidSeparator();// separator, generally horizontal. inside a menu bar or in horizontal layout mode, this becomes a vertical separator.
IMGUI_APIvoidSameLine(floatoffset_from_start_x=0.0f,floatspacing=-1.0f);// call between widgets or groups to layout them horizontally. X position given in window coordinates.
IMGUI_APIvoidNewLine();// undo a SameLine() or force a new line when in an horizontal-layout context.
@ -568,7 +571,8 @@ namespace ImGui
// Widgets: Menus
// - Use BeginMenuBar() on a window ImGuiWindowFlags_MenuBar to append to its menu bar.
// - Use BeginMainMenuBar() to create a menu bar at the top of the screen.
// - Use BeginMainMenuBar() to create a menu bar at the top of the screen and append to it.
// - Use BeginMenu() to create a menu. You can call BeginMenu() multiple time with the same identifier to append more items to it.
IMGUI_APIboolBeginMenuBar();// append to menu-bar of current window (requires ImGuiWindowFlags_MenuBar flag set on parent window).
IMGUI_APIvoidEndMenuBar();// only call EndMenuBar() if BeginMenuBar() returns true!
IMGUI_APIboolBeginMainMenuBar();// create and append to a full screen menu-bar.
@ -609,7 +613,7 @@ namespace ImGui
// - You can also use SameLine(pos_x) to mimic simplified columns.
// - The columns API is work-in-progress and rather lacking (columns are arguably the worst part of dear imgui at the moment!)
// - There is a maximum of 64 columns.
// - Currently working on new 'Tables' api which will replace columns (see GitHub #2957)
// - Currently working on new 'Tables' api which will replace columns around Q2 2020 (see GitHub #2957).
IMGUI_APIvoidNextColumn();// next column, defaults to current row or next row if the current row is finished
IMGUI_APIintGetColumnIndex();// get current column index
@ -704,11 +708,13 @@ namespace ImGui
IMGUI_APIconstchar*GetStyleColorName(ImGuiColidx);// get a string corresponding to the enum value (for display, saving, etc.).
IMGUI_APIvoidSetStateStorage(ImGuiStorage*storage);// replace current window storage with our own (if you want to manipulate it yourself, typically clear subsection of it)
IMGUI_APIvoidCalcListClipping(intitems_count,floatitems_height,int*out_items_display_start,int*out_items_display_end);// calculate coarse clipping for large list of evenly sized items. Prefer using the ImGuiListClipper higher-level helper if you can.
IMGUI_APIboolBeginChildFrame(ImGuiIDid,constImVec2&size,ImGuiWindowFlagsflags=0);// helper to create a child window / scrolling region that looks like a normal widget frame
IMGUI_APIvoidEndChildFrame();// always call EndChildFrame() regardless of BeginChildFrame() return values (which indicates a collapsed/clipped window)
#pragma clang diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function // using printf() is a misery with this as C++ va_arg ellipsis changes float to double.
#pragma clang diagnostic ignored "-Wdeprecated-enum-enum-conversion" // warning: bitwise operation between different enumeration types ('XXXFlags_' and 'XXXFlagsPrivate_') is deprecated
// Sub-menus are ChildWindow so that mouse can be hovering across them (otherwise top-most popup menu would steal focus and not allow hovering on parent menu)
// If a menu with same the ID was already submitted, we will append to it, matching the behavior of Begin().
// We are relying on a O(N) search - so O(N log N) over the frame - which seems like the most efficient for the expected small amount of BeginMenu() calls per frame.
// If somehow this is ever becoming a problem we can switch to use e.g. a ImGuiStorager mapping key to last frame used.
if(g.MenusIdSubmittedThisFrame.contains(id))
{
if(menu_is_open)
menu_is_open=BeginPopupEx(id,flags);// menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display)
else
g.NextWindowData.ClearFlags();// we behave like Begin() and need to consume those values
returnmenu_is_open;
}
// Tag menu as used. Next time BeginMenu() with same ID is called it will append to existing menu
// Sub-menus are ChildWindow so that mouse can be hovering across them (otherwise top-most popup menu would steal focus and not allow hovering on parent menu)