@ -27,11 +27,11 @@ In the [misc/fonts/](https://github.com/ocornut/imgui/tree/master/misc/fonts) fo
---------------------------------------
## Readme First
- All loaded fonts glyphs are rendered into a single texture atlas ahead of time. Calling either of `io.Fonts->GetTexDataAsAlpha8()`, `io.Fonts->GetTexDataAsRGBA32()` or `io.Fonts->Build()` will build the atlas.
- You can use the `Metrics/Debugger` window (available in `Demo>Tools`) to browse your fonts and understand what's going on if you have an issue. You can also reach it in `Demo->Tools->Style Editor->Fonts`. The same information are also available in the Style Editor under Fonts.
- You can use the style editor `ImGui::ShowStyleEditor()` in the "Fonts" section to browse your fonts and understand what's going on if you have an issue. You can also reach it in `Demo->Tools->Style Editor->Fonts`:
- All loaded fonts glyphs are rendered into a single texture atlas ahead of time. Calling either of `io.Fonts->GetTexDataAsAlpha8()`, `io.Fonts->GetTexDataAsRGBA32()` or `io.Fonts->Build()` will build the atlas.
- Make sure your font ranges data are persistent (available during the calls to `GetTexDataAsAlpha8()`/`GetTexDataAsRGBA32()/`Build()`.
// It is very strongly recommended to NOT disable the demo windows during development. Please read comments in imgui_demo.cpp.
//#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty.
//#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. Not recommended.
//#define IMGUI_DISABLE_METRICS_WINDOW // Disable metrics/debugger window: ShowMetricsWindow() will be empty.
//#define IMGUI_DISABLE_METRICS_WINDOW // Disable metrics/debugger and other debug tools: ShowMetricsWindow() and ShowStackToolWindow() will be empty.
//---- Don't implement some functions to reduce linkage requirements.
//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. (user32.lib/.a, kernel32.lib/.a)
IM_ASSERT((flags&(ImGuiHoveredFlags_RootWindow |ImGuiHoveredFlags_ChildWindows))==0);// Flags not supported by this function
IM_ASSERT((flags&(ImGuiHoveredFlags_AnyWindow |ImGuiHoveredFlags_RootWindow |ImGuiHoveredFlags_ChildWindows|ImGuiHoveredFlags_NoPopupHierarchy|ImGuiHoveredFlags_DockHierarchy))==0);// Flags not supported by this function
// Test if we are hovering the right window (our window could be behind another window)
// [2021/03/02] Reworked / reverted the revert, finally. Note we want e.g. BeginGroup/ItemAdd/EndGroup to work as well. (#3851)
g.TabFocusRequestNextCounterTabStop=window->DC.FocusCounterTabStop+(g.IO.KeyShift?(is_tab_stop?-1:0):+1);// Modulo on index will be applied at the end of frame once we've got the total counter of items.
// The Item Picker tool is super useful to visually select an item and break into the call-stack of where it was submitted.
if(Button("Item Picker.."))
DebugStartItemPicker();
// Stack Tool is your best friend!
Checkbox("Show stack tool",&cfg->ShowStackTool);
SameLine();
MetricsHelpMarker("Will call the IM_DEBUG_BREAK() macro to break in debugger.\nWarning: If you don't have a debugger attached, this will probably crash.");
MetricsHelpMarker("You can also call ImGui::ShowStackToolWindow() from your code.");
Checkbox("Show windows begin order",&cfg->ShowWindowsBeginOrder);
Checkbox("Show windows rectangles",&cfg->ShowWindowsRects);
// The Item Picker tool is super useful to visually select an item and break into the call-stack of where it was submitted.
if(Button("Item Picker.."))
DebugStartItemPicker();
SameLine();
MetricsHelpMarker("Will call the IM_DEBUG_BREAK() macro to break in debugger.\nWarning: If you don't have a debugger attached, this will probably crash.");
if(info->Desc[0]==0)// PushOverrideID() is often used to avoid hashing twice, which would lead to 2 calls to DebugHookIdInfo(). We prioritize the first one.
MetricsHelpMarker("Hover an item with the mouse to display elements of the ID Stack leading to the item's final ID.\nEach level of the stack correspond to a PushID() call.\nAll levels of the stack are hashed together to make the final ID of a widget (ID displayed at the bottom level of the stack).\nRead FAQ entry about the ID stack for details.");
if(window)// Source: window name (because the root ID don't call GetID() and so doesn't get hooked)
Text("\"%s\" [window]",window->Name);
elseif(info->QuerySuccess)// Source: GetID() hooks (prioritize over ItemInfo() because we frequently use patterns like: PushID(str), Button("") where they both have same id)
TextUnformatted(info->Desc);
elseif(tool->StackLevel>=tool->Results.Size)// Only start using fallback below when all queries are done, so during queries we don't flickering ??? markers.
// (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)
IMGUI_APIvoidShowDemoWindow(bool*p_open=NULL);// create Demo window. demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application!
IMGUI_APIvoidShowMetricsWindow(bool*p_open=NULL);// create Metrics/Debugger window. display Dear ImGui internals: windows, draw commands, various internal state, etc.
IMGUI_APIvoidShowStackToolWindow(bool*p_open=NULL);// create Stack Tool window. hover items with mouse to query information about the source of their unique ID.
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.
@ -1331,8 +1332,8 @@ enum ImGuiHoveredFlags_
ImGuiHoveredFlags_AllowWhenBlockedByPopup=1<<5,// Return true even if a popup window is normally blocking access to this item/window
//ImGuiHoveredFlags_AllowWhenBlockedByModal = 1 << 6, // Return true even if a modal popup window is normally blocking access to this item/window. FIXME-TODO: Unavailable yet.
ImGuiHoveredFlags_AllowWhenBlockedByActiveItem=1<<7,// Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns.
ImGuiHoveredFlags_AllowWhenOverlapped=1<<8,// Return true even if the position is obstructed or overlapped by another window
ImGuiHoveredFlags_AllowWhenDisabled=1<<9,// Return true even if the item is disabled
ImGuiHoveredFlags_AllowWhenOverlapped=1<<8,// IsItemHovered() only: Return true even if the position is obstructed or overlapped by another window
ImGuiHoveredFlags_AllowWhenDisabled=1<<9,// IsItemHovered() only: Return true even if the item is disabled
@ -157,6 +157,7 @@ typedef int ImGuiNavDirSourceFlags; // -> enum ImGuiNavDirSourceFlags_ // F
typedefintImGuiNavMoveFlags;// -> enum ImGuiNavMoveFlags_ // Flags: for navigation requests
typedefintImGuiNextItemDataFlags;// -> enum ImGuiNextItemDataFlags_ // Flags: for SetNextItemXXX() functions
typedefintImGuiNextWindowDataFlags;// -> enum ImGuiNextWindowDataFlags_// Flags: for SetNextWindowXXX() functions
typedefintImGuiScrollFlags;// -> enum ImGuiScrollFlags_ // Flags: for ScrollToItem() and navigation requests
typedefintImGuiSeparatorFlags;// -> enum ImGuiSeparatorFlags_ // Flags: for SeparatorEx()
typedefintImGuiTextFlags;// -> enum ImGuiTextFlags_ // Flags: for TextEx()
typedefintImGuiTooltipFlags;// -> enum ImGuiTooltipFlags_ // Flags: for BeginTooltipEx()
@ -1195,6 +1196,21 @@ enum ImGuiActivateFlags_
ImGuiActivateFlags_TryToPreserveState=1<<2// Request widget to preserve state if it can (e.g. InputText will try to preserve cursor/selection)
};
// Early work-in-progress API for ScrollToItem()
enumImGuiScrollFlags_
{
ImGuiScrollFlags_None=0,
ImGuiScrollFlags_KeepVisibleEdgeX=1<<0,// If item is not visible: scroll as little as possible on X axis to bring item back into view [default for X axis]
ImGuiScrollFlags_KeepVisibleEdgeY=1<<1,// If item is not visible: scroll as little as possible on Y axis to bring item back into view [default for Y axis for windows that are already visible]
ImGuiScrollFlags_KeepVisibleCenterX=1<<2,// If item is not visible: scroll to make the item centered on X axis [rarely used]
ImGuiScrollFlags_KeepVisibleCenterY=1<<3,// If item is not visible: scroll to make the item centered on Y axis
ImGuiScrollFlags_AlwaysCenterX=1<<4,// Always center the result item on X axis [rarely used]
ImGuiScrollFlags_AlwaysCenterY=1<<5,// Always center the result item on Y axis [default for Y axis for appearing window)
ImGuiScrollFlags_NoScrollParent=1<<6,// Disable forwarding scrolling to parent window if required to keep item/rect visible (only scroll window the function was applied to).
ImGuiNavMoveFlags_WrapY=1<<3,// This is not super useful but provided for completeness
ImGuiNavMoveFlags_AllowCurrentNavId=1<<4,// Allow scoring and considering the current NavId as a move target candidate. This is used when the move source is offset (e.g. pressing PageDown actually needs to send a Up move request, if we are pressing PageDown from the bottom-most item we need to stay in place)
ImGuiNavMoveFlags_AlsoScoreVisibleSet=1<<5,// Store alternate result in NavMoveResultLocalVisible that only comprise elements that are already fully visible (used by PageUp/PageDown)
ImGuiNavMoveFlags_ScrollToEdge=1<<6,
ImGuiNavMoveFlags_ScrollToEdgeY=1<<6,// Force scrolling to min/max (used by Home/End) // FIXME-NAV: Aim to remove or reword, probably unnecessary
boolTestEngineHookItems;// Will call test engine hooks: ImGuiTestEngineHook_ItemAdd(), ImGuiTestEngineHook_ItemInfo(), ImGuiTestEngineHook_Log()
ImGuiIDTestEngineHookIdInfo;// Will call test engine hooks: ImGuiTestEngineHook_IdInfo() from GetID()
void*TestEngine;// Test engine user data
// Windows state
@ -1629,6 +1667,7 @@ struct ImGuiContext
floatWheelingWindowTimer;
// Item/widgets state and tracking information
ImGuiIDDebugHookIdInfo;// Will call core hooks: DebugHookIdInfo() from GetID functions, used by Stack Tool [next HoveredId/ActiveId to not pull in an extra cache-line]
ImGuiIDHoveredId;// Hovered widget, filled during the frame
ImGuiIDHoveredIdPreviousFrame;
boolHoveredIdAllowOverlap;
@ -1720,6 +1759,7 @@ struct ImGuiContext
boolNavMoveScoringItems;// Move request submitted, still scoring incoming items
boolNavMoveForwardToNextFrame;
ImGuiNavMoveFlagsNavMoveFlags;
ImGuiScrollFlagsNavMoveScrollFlags;
ImGuiKeyModFlagsNavMoveKeyMods;
ImGuiDirNavMoveDir;// Direction of the move request (left/right/up/down)
ImGuiDirNavMoveDirForDebug;
@ -1843,8 +1883,9 @@ struct ImGuiContext
// Debug Tools
boolDebugItemPickerActive;// Item picker is active (started with DebugStartItemPicker())
ImGuiIDDebugItemPickerBreakId;// Will call IM_DEBUG_BREAK() when encountering this id
ImGuiIDDebugItemPickerBreakId;// Will call IM_DEBUG_BREAK() when encountering this ID
ImGuiMetricsConfigDebugMetricsConfig;
ImGuiStackToolDebugStackTool;
// Misc
floatFramerateSecPerFrame[120];// Calculate estimate of framerate for user over the last 2 seconds.
#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS) if (g.TestEngineHookItems) ImGuiTestEngineHook_ItemInfo(&g, _ID, _LABEL, _FLAGS) // Register item label and status flags (optional)
#define IMGUI_TEST_ENGINE_LOG(_FMT,...) if (g.TestEngineHookItems) ImGuiTestEngineHook_Log(&g, _FMT, __VA_ARGS__) // Custom log entry from user land into test log