// (minor and older changes stripped away, please see git history for details)
// 2019-05-11: Inputs: Don't filter value from character callback before calling AddInputCharacter().
// 2018-11-30: Misc: Setting up io.BackendPlatformName/io.BackendRendererName so they can be displayed in the About Window.
// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_Marmalade_RenderDrawData() in the .h file so you can call it yourself.
// 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
// (minor and older changes stripped away, please see git history for details)
// 2018-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
// 2019-05-11: Inputs: Don't filter value from WM_CHAR before calling AddInputCharacter().
// 2019-01-17: Misc: Using GetForegroundWindow()+IsChild() instead of GetActiveWindow() to be compatible with windows created in a different thread or parent.
// 2019-01-17: Inputs: Added support for mouse buttons 4 and 5 via WM_XBUTTON* messages.
// 2019-01-15: Inputs: Added support for XInput gamepads (if ImGuiConfigFlags_NavEnableGamepad is set by user application).
ImVec2size_on_first_use=(g.NextWindowData.SizeCond !=0)?g.NextWindowData.SizeVal:ImVec2(0.0f,0.0f);// Any condition flag will do since we are creating a new window here.
ImVec2size_on_first_use=(g.NextWindowData.Flags &ImGuiNextWindowDataFlags_HasSize)?g.NextWindowData.SizeVal:ImVec2(0.0f,0.0f);// Any condition flag will do since we are creating a new window here.
// When we are about to select this tab (which will only be visible on the _next frame_), flag it with a non-zero HiddenFramesCannotSkipItems.
// This will have the important effect of actually returning true in Begin() and not setting SkipItems, allowing an earlier submission of the window contents.
g.NextWindowData.ContentSizeVal=size;// In Begin() we will add the size of window decorations (title bar, menu etc.) to that to form a SizeContents value.
g.NextWindowData.FocusCond =ImGuiCond_Always;// Using a Cond member for consistency (may transition all of them to single flag set for fast Clear() op)
g.NextWindowData.BgAlphaCond=ImGuiCond_Always;// Using a Cond member for consistency (may transition all of them to single flag set for fast Clear() op)
g.LogLinePosY=-FLT_MAX;// To enforce Log carriage return
if(group_data.AdvanceCursor)
if(!group_data.EmitItem)
{
window->DC.CurrentLineTextBaseOffset=ImMax(window->DC.PrevLineTextBaseOffset,group_data.BackupCurrentLineTextBaseOffset);// FIXME: Incorrect, we should grab the base offset from the *first line* of the group but it is hard to obtain now.
window->DC.GroupStack.pop_back();
return;
}
window->DC.CurrLineTextBaseOffset=ImMax(window->DC.PrevLineTextBaseOffset,group_data.BackupCurrLineTextBaseOffset);// FIXME: Incorrect, we should grab the base offset from the *first line* of the group but it is hard to obtain now.
ItemSize(group_bb.GetSize(),0.0f);
ItemAdd(group_bb,0);
}
// If the current ActiveId was declared within the boundary of our group, we copy it to LastItemId so IsItemActive(), IsItemDeactivated() etc. will be functional on the entire group.
// It would be be neater if we replaced window.DC.LastItemId by e.g. 'bool LastItemIsActive', but would put a little more burden on individual widgets.
// (and if you grep for LastItemId you'll notice it is only used in that context.
IMGUI_APIvoidTreeAdvanceToLabelPos();// advance cursor x position by GetTreeNodeToLabelSpacing()
IMGUI_APIfloatGetTreeNodeToLabelSpacing();// horizontal distance preceding label when using TreeNode*() or Bullet() == (g.FontSize + style.FramePadding.x*2) for a regular unframed TreeNode
IMGUI_APIvoidSetNextTreeNodeOpen(boolis_open,ImGuiCondcond=0);// set next TreeNode/CollapsingHeader open state.
IMGUI_APIboolCollapsingHeader(constchar*label,ImGuiTreeNodeFlagsflags=0);// if returning 'true' the header is open. doesn't indent nor push on ID stack. user doesn't have to call TreePop().
IMGUI_APIboolCollapsingHeader(constchar*label,bool*p_open,ImGuiTreeNodeFlagsflags=0);// when 'p_open' isn't NULL, display an additional small close button on upper right of the header
IMGUI_APIvoidSetNextItemOpen(boolis_open,ImGuiCondcond=0);// set next TreeNode/CollapsingHeader open state.
// Widgets: Selectables
// - A selectable highlights when hovered, and can display another color when selected.
ImGuiInputTextFlags_CallbackResize=1<<18,// Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. Notify when the string wants to be resized (for string types which hold a cache of their Size). You will be provided a new BufSize in the callback and NEED to honor it. (see misc/cpp/imgui_stdlib.h for an example of using this)
// [Internal]
ImGuiInputTextFlags_Multiline=1<<20// For internal use by InputTextMultiline()
ImGuiInputTextFlags_Multiline=1<<20,// For internal use by InputTextMultiline()
ImGuiInputTextFlags_NoMarkEdited=1<<21// For internal use by functions using InputText() before reformatting data
};
// Flags for ImGui::TreeNodeEx(), ImGui::CollapsingHeader*()
@ -1244,7 +1245,7 @@ enum ImGuiMouseCursor_
#endif
};
// Enumateration for ImGui::SetWindow***(), SetNextWindow***(), SetNextTreeNode***() functions
// Enumateration for ImGui::SetWindow***(), SetNextWindow***(), SetNextItem***() functions
// Represent a condition.
// Important: Treat as a regular enum! Do NOT combine multiple values using binary operators! All the functions above treat 0 as a shortcut to ImGuiCond_Always.
enumImGuiCond_
@ -1481,7 +1482,7 @@ struct ImGuiIO
floatNavInputs[ImGuiNavInput_COUNT];// Gamepad inputs. Cleared back to zero by EndFrame(). Keyboard keys will be auto-mapped and be written here by NewFrame().
// Functions
IMGUI_APIvoidAddInputCharacter(ImWcharc);// Queue new character input
IMGUI_APIvoidAddInputCharacter(unsignedintc);// Queue new character input
IMGUI_APIvoidAddInputCharactersUTF8(constchar*str);// Queue new characters input from an UTF-8 string
IMGUI_APIvoidClearInputCharacters();// Clear the text input buffer manually
typedefintImGuiNavHighlightFlags;// -> enum ImGuiNavHighlightFlags_ // Flags: for RenderNavHighlight()
typedefintImGuiNavDirSourceFlags;// -> enum ImGuiNavDirSourceFlags_ // Flags: for GetNavInputAmount2d()
typedefintImGuiNavMoveFlags;// -> enum ImGuiNavMoveFlags_ // Flags: for navigation requests
typedefintImGuiSeparatorFlags;// -> enum ImGuiSeparatorFlags_ // Flags: for Separator() - internal
typedefintImGuiNextItemDataFlags;// -> enum ImGuiNextItemDataFlags_ // Flags: for SetNextItemXXX() functions
typedefintImGuiNextWindowDataFlags;// -> enum ImGuiNextWindowDataFlags_// Flags: for SetNextWindowXXX() functions
typedefintImGuiSeparatorFlags;// -> enum ImGuiSeparatorFlags_ // Flags: for SeparatorEx()
typedefintImGuiSliderFlags;// -> enum ImGuiSliderFlags_ // Flags: for SliderBehavior()
typedefintImGuiTextFlags;// -> enum ImGuiTextFlags_ // Flags: for TextEx()
@ -386,7 +389,9 @@ enum ImGuiItemStatusFlags_
ImGuiItemStatusFlags_HoveredRect=1<<0,
ImGuiItemStatusFlags_HasDisplayRect=1<<1,
ImGuiItemStatusFlags_Edited=1<<2,// Value exposed by item was edited in the current frame (should match the bool return value of most widgets)
ImGuiItemStatusFlags_ToggledSelection=1<<3// Set when Selectable(), TreeNode() reports toggling a selection. We can't report "Selected" because reporting the change allows us to handle clipping with less issues.
ImGuiItemStatusFlags_ToggledSelection=1<<3,// Set when Selectable(), TreeNode() reports toggling a selection. We can't report "Selected" because reporting the change allows us to handle clipping with less issues.
ImGuiItemStatusFlags_HasDeactivated=1<<4,// Set if the widget/group is able to provide data for the ImGuiItemStatusFlags_Deactivated flag.
ImGuiItemStatusFlags_Deactivated=1<<5// Only valid if ImGuiItemStatusFlags_HasDeactivated is set.
#ifdef IMGUI_ENABLE_TEST_ENGINE
,// [imgui-test only]
@ -587,11 +592,11 @@ struct ImGuiGroupData
ImVec2BackupCursorMaxPos;
ImVec1BackupIndent;
ImVec1BackupGroupOffset;
ImVec2BackupCurrentLineSize;
floatBackupCurrentLineTextBaseOffset;
ImVec2BackupCurrLineSize;
floatBackupCurrLineTextBaseOffset;
ImGuiIDBackupActiveIdIsAlive;
boolBackupActiveIdPreviousFrameIsAlive;
boolAdvanceCursor;
boolEmitItem;
};
// Simple column measurement, currently used for MenuItem() only.. This is very short-sighted/throw-away code and NOT a generic helper.
floatFontSize;// (Shortcut) == FontBaseSize * g.CurrentWindow->FontWindowScale == window->FontSize(). Text height for current window.
floatFontBaseSize;// (Shortcut) == IO.FontGlobalScale * Font->Scale * Font->FontSize. Base text height.
ImDrawListSharedDataDrawListSharedData;
doubleTime;
intFrameCount;
intFrameCountEnded;
intFrameCountPlatformEnded;
intFrameCountRendered;
// Windows state
ImVector<ImGuiWindow*>Windows;// Windows, sorted in display order, back to front
ImVector<ImGuiWindow*>WindowsFocusOrder;// Windows, sorted in focus order, back to front
ImVector<ImGuiWindow*>WindowsSortBuffer;
@ -967,39 +985,45 @@ struct ImGuiContext
ImGuiWindow*HoveredWindow;// Will catch mouse inputs
ImGuiWindow*HoveredRootWindow;// Will catch mouse inputs (for focus/move only)
ImGuiWindow*HoveredWindowUnderMovingWindow;// Hovered window ignoring MovingWindow. Only set if MovingWindow is set.
ImGuiWindow*MovingWindow;// Track the window we clicked on (in order to preserve focus). The actually window that is moved is generally MovingWindow->RootWindow.
// Item/widgets state and tracking information
ImGuiIDHoveredId;// Hovered widget
boolHoveredIdAllowOverlap;
ImGuiIDHoveredIdPreviousFrame;
floatHoveredIdTimer;// Measure contiguous hovering time
floatHoveredIdNotActiveTimer;// Measure contiguous hovering time where the item has not been active
ImGuiIDActiveId;// Active widget
ImGuiIDActiveIdPreviousFrame;
ImGuiIDActiveIdIsAlive;// Active widget has been seen this frame (we can't use a bool as the ActiveId may change within the frame)
floatActiveIdTimer;
boolActiveIdIsJustActivated;// Set at the time of activation for one frame
boolActiveIdAllowOverlap;// Active widget allows another widget to steal active id (generally for overlapping widgets, but not always)
boolActiveIdHasBeenPressed;// Track whether the active id led to a press (this is to allow changing between PressOnClick and PressOnRelease without pressing twice). Used by range_select branch.
boolActiveIdHasBeenEdited;// Was the value associated to the widget Edited over the course of the Active state.
boolActiveIdPreviousFrameIsAlive;
boolActiveIdPreviousFrameHasBeenEdited;
boolActiveIdHasBeenPressedBefore;// Track whether the active id led to a press (this is to allow changing between PressOnClick and PressOnRelease without pressing twice). Used by range_select branch.
boolActiveIdHasBeenEditedBefore;// Was the value associated to the widget Edited over the course of the Active state.
boolActiveIdHasBeenEditedThisFrame;
intActiveIdAllowNavDirFlags;// Active widget allows using directional navigation (e.g. can activate a button and move away from it)
intActiveIdBlockNavInputFlags;
ImVec2ActiveIdClickOffset;// Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior)
ImGuiWindow*ActiveIdWindow;
ImGuiWindow*ActiveIdPreviousFrameWindow;
ImGuiInputSourceActiveIdSource;// Activating with mouse or nav (gamepad/keyboard)
ImGuiIDActiveIdPreviousFrame;
boolActiveIdPreviousFrameIsAlive;
boolActiveIdPreviousFrameHasBeenEditedBefore;
ImGuiWindow*ActiveIdPreviousFrameWindow;
ImGuiIDLastActiveId;// Store the last non-zero ActiveId, useful for animation.
floatLastActiveIdTimer;// Store the last non-zero ActiveId timer since the beginning of activation, useful for animation.
ImVec2LastValidMousePos;
ImGuiWindow*MovingWindow;// Track the window we clicked on (in order to preserve focus). The actually window that is moved is generally MovingWindow->RootWindow.
// Next window/item data
ImGuiNextWindowDataNextWindowData;// Storage for SetNextWindow** functions
ImGuiNextItemDataNextItemData;// Storage for SetNextItem** functions
// Shared stacks
ImVector<ImGuiColorMod>ColorModifiers;// Stack for PushStyleColor()/PopStyleColor()
ImVector<ImGuiStyleMod>StyleModifiers;// Stack for PushStyleVar()/PopStyleVar()
ImVector<ImFont*>FontStack;// Stack for PushFont()/PopFont()
ImVector<ImGuiPopupData>OpenPopupStack;// Which popups are open (persistent)
ImVector<ImGuiPopupData>BeginPopupStack;// Which level of BeginPopup() we are in (reset every frame)
ImGuiNextWindowDataNextWindowData;// Storage for SetNextWindow** functions
boolNextTreeNodeOpenVal;// Storage for SetNextTreeNode** functions
ImGuiCondNextTreeNodeOpenCond;
// Viewports
ImVector<ImGuiViewportP*>Viewports;// Active viewports (always 1+, and generally 1 unless multi-viewports are enabled). Each viewports hold their copy of ImDrawData.
ImVec2CursorStartPos;// Initial position in client area with padding
ImVec2CursorMaxPos;// Used to implicitly calculate the size of our contents, always growing during the frame. Turned into window->SizeContents at the beginning of next frame
ImVec2CurrentLineSize;
floatCurrentLineTextBaseOffset;
ImVec2CurrLineSize;
ImVec2PrevLineSize;
floatCurrLineTextBaseOffset;
floatPrevLineTextBaseOffset;
intTreeDepth;
ImU32TreeStoreMayJumpToParentOnPop;// Store a copy of !g.NavIdIsAlive for TreeDepth 0..31.. Could be turned into a ImU64 if necessary.
// We store the current settings outside of the vectors to increase memory locality (reduce cache misses). The vectors are rarely modified. Also it allows us to not heap allocate for short-lived windows which are not using those settings.
IMGUI_APIboolTreeNodeBehaviorIsOpen(ImGuiIDid,ImGuiTreeNodeFlagsflags=0);// Consume previous SetNextTreeNodeOpened() data, if any. May return true when logging
IMGUI_APIboolTreeNodeBehaviorIsOpen(ImGuiIDid,ImGuiTreeNodeFlagsflags=0);// Consume previous SetNextItemOpen() data, if any. May return true when logging
IMGUI_APIvoidTreePushOverrideID(ImGuiIDid);
// Template functions are instantiated in imgui_widgets.cpp for a finite number of types.
if((flags&ImGuiButtonFlags_AlignTextBaseLine)&&style.FramePadding.y<window->DC.CurrentLineTextBaseOffset)// Try to vertically align buttons that are smaller/have no padding so that text baseline matches (bit hacky, since it shouldn't be a flag)
if((flags&ImGuiButtonFlags_AlignTextBaseLine)&&style.FramePadding.y<window->DC.CurrLineTextBaseOffset)// Try to vertically align buttons that are smaller/have no padding so that text baseline matches (bit hacky, since it shouldn't be a flag)
ImVec2size=CalcItemSize(size_arg,GetNextItemWidth(),(is_multiline?GetTextLineHeight()*8.0f:label_size.y)+style.FramePadding.y*2.0f);// Arbitrary default of 8 lines high for multi-line
ImVec2size=CalcItemSize(size_arg,CalcItemWidth(),(is_multiline?GetTextLineHeight()*8.0f:label_size.y)+style.FramePadding.y*2.0f);// Arbitrary default of 8 lines high for multi-line
window->DC.MenuBarOffset.x=window->DC.CursorPos.x-window->MenuBarRect().Min.x;// Save horizontal position so next append can reuse it. This is kinda equivalent to a per-layer CursorPos.
// - v0.56: (2018/06/08) added support for ImFontConfig::GlyphMinAdvanceX, GlyphMaxAdvanceX.
// - v0.60: (2019/01/10) re-factored to match big update in STB builder. fixed texture height waste. fixed redundant glyphs when merging. support for glyph padding.
// - v0.61: (2019/01/15) added support for imgui allocators + added FreeType only override function SetAllocatorFunctions().
// - v0.62: (2019/02/09) added RasterizerFlags::Monochrome flag to disable font anti-aliasing (combine with ::MonoHinting for best results!)
// Gamma Correct Blending:
// FreeType assumes blending in linear space rather than gamma space.
LightHinting=1<<3,// A lighter hinting algorithm for gray-level modes. Many generated glyphs are fuzzier but better resemble their original shape. This is achieved by snapping glyphs to the pixel grid only vertically (Y-axis), as is done by Microsoft's ClearType and Adobe's proprietary font renderer. This preserves inter-glyph spacing in horizontal text.
MonoHinting=1<<4,// Strong hinting algorithm that should only be used for monochrome output.
Bold=1<<5,// Styling: Should we artificially embolden the font?
Oblique=1<<6// Styling: Should we slant the font, emulating italic style?
Oblique=1<<6,// Styling: Should we slant the font, emulating italic style?
Monochrome=1<<7// Disable anti-aliasing. Combine this with MonoHinting for best results!