update imgui v1.83 to v1.85
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.83
|
// dear imgui, v1.85
|
||||||
// (headers)
|
// (headers)
|
||||||
|
|
||||||
// Help:
|
// Help:
|
||||||
@@ -11,11 +11,14 @@
|
|||||||
// - FAQ http://dearimgui.org/faq
|
// - FAQ http://dearimgui.org/faq
|
||||||
// - Homepage & latest https://github.com/ocornut/imgui
|
// - Homepage & latest https://github.com/ocornut/imgui
|
||||||
// - Releases & changelog https://github.com/ocornut/imgui/releases
|
// - Releases & changelog https://github.com/ocornut/imgui/releases
|
||||||
// - Gallery https://github.com/ocornut/imgui/issues/3793 (please post your screenshots/video there!)
|
// - Gallery https://github.com/ocornut/imgui/issues/4451 (please post your screenshots/video there!)
|
||||||
// - Wiki https://github.com/ocornut/imgui/wiki (lots of good stuff there)
|
// - Wiki https://github.com/ocornut/imgui/wiki (lots of good stuff there)
|
||||||
// - Glossary https://github.com/ocornut/imgui/wiki/Glossary
|
// - Glossary https://github.com/ocornut/imgui/wiki/Glossary
|
||||||
// - Issues & support https://github.com/ocornut/imgui/issues
|
// - Issues & support https://github.com/ocornut/imgui/issues
|
||||||
// - Discussions https://github.com/ocornut/imgui/discussions
|
|
||||||
|
// Getting Started?
|
||||||
|
// - For first-time users having issues compiling/linking/running or issues loading fonts:
|
||||||
|
// please post in https://github.com/ocornut/imgui/discussions if you cannot find a solution in resources above.
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@@ -60,8 +63,8 @@ Index of this file:
|
|||||||
|
|
||||||
// Version
|
// Version
|
||||||
// (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)
|
// (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)
|
||||||
#define IMGUI_VERSION "1.83"
|
#define IMGUI_VERSION "1.85"
|
||||||
#define IMGUI_VERSION_NUM 18300
|
#define IMGUI_VERSION_NUM 18500
|
||||||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
||||||
#define IMGUI_HAS_TABLE
|
#define IMGUI_HAS_TABLE
|
||||||
|
|
||||||
@@ -89,12 +92,12 @@ Index of this file:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Helper Macros - IM_FMTARGS, IM_FMTLIST: Apply printf-style warnings to our formatting functions.
|
// Helper Macros - IM_FMTARGS, IM_FMTLIST: Apply printf-style warnings to our formatting functions.
|
||||||
#if !defined(IMGUI_USE_STB_SPRINTF) && defined(__clang__)
|
#if !defined(IMGUI_USE_STB_SPRINTF) && defined(__MINGW32__) && !defined(__clang__)
|
||||||
#define IM_FMTARGS(FMT) __attribute__((format(printf, FMT, FMT+1)))
|
|
||||||
#define IM_FMTLIST(FMT) __attribute__((format(printf, FMT, 0)))
|
|
||||||
#elif !defined(IMGUI_USE_STB_SPRINTF) && defined(__GNUC__) && defined(__MINGW32__)
|
|
||||||
#define IM_FMTARGS(FMT) __attribute__((format(gnu_printf, FMT, FMT+1)))
|
#define IM_FMTARGS(FMT) __attribute__((format(gnu_printf, FMT, FMT+1)))
|
||||||
#define IM_FMTLIST(FMT) __attribute__((format(gnu_printf, FMT, 0)))
|
#define IM_FMTLIST(FMT) __attribute__((format(gnu_printf, FMT, 0)))
|
||||||
|
#elif !defined(IMGUI_USE_STB_SPRINTF) && (defined(__clang__) || defined(__GNUC__))
|
||||||
|
#define IM_FMTARGS(FMT) __attribute__((format(printf, FMT, FMT+1)))
|
||||||
|
#define IM_FMTLIST(FMT) __attribute__((format(printf, FMT, 0)))
|
||||||
#else
|
#else
|
||||||
#define IM_FMTARGS(FMT)
|
#define IM_FMTARGS(FMT)
|
||||||
#define IM_FMTLIST(FMT)
|
#define IM_FMTLIST(FMT)
|
||||||
@@ -160,7 +163,7 @@ struct ImGuiTextBuffer; // Helper to hold and append into a text buf
|
|||||||
struct ImGuiTextFilter; // Helper to parse and apply text filters (e.g. "aaaaa[,bbbbb][,ccccc]")
|
struct ImGuiTextFilter; // Helper to parse and apply text filters (e.g. "aaaaa[,bbbbb][,ccccc]")
|
||||||
struct ImGuiViewport; // A Platform Window (always only one in 'master' branch), in the future may represent Platform Monitor
|
struct ImGuiViewport; // A Platform Window (always only one in 'master' branch), in the future may represent Platform Monitor
|
||||||
|
|
||||||
// Enums/Flags (declared as int for compatibility with old C++, to allow using as flags and to not pollute the top of this file)
|
// Enums/Flags (declared as int for compatibility with old C++, to allow using as flags without overhead, and to not pollute the top of this file)
|
||||||
// - Tip: Use your programming IDE navigation facilities on the names in the _central column_ below to find the actual flags/enum lists!
|
// - Tip: Use your programming IDE navigation facilities on the names in the _central column_ below to find the actual flags/enum lists!
|
||||||
// In Visual Studio IDE: CTRL+comma ("Edit.NavigateTo") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot.
|
// In Visual Studio IDE: CTRL+comma ("Edit.NavigateTo") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot.
|
||||||
// With Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can also follow symbols in comments.
|
// With Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can also follow symbols in comments.
|
||||||
@@ -200,27 +203,22 @@ typedef int ImGuiTreeNodeFlags; // -> enum ImGuiTreeNodeFlags_ // Flags: f
|
|||||||
typedef int ImGuiViewportFlags; // -> enum ImGuiViewportFlags_ // Flags: for ImGuiViewport
|
typedef int ImGuiViewportFlags; // -> enum ImGuiViewportFlags_ // Flags: for ImGuiViewport
|
||||||
typedef int ImGuiWindowFlags; // -> enum ImGuiWindowFlags_ // Flags: for Begin(), BeginChild()
|
typedef int ImGuiWindowFlags; // -> enum ImGuiWindowFlags_ // Flags: for Begin(), BeginChild()
|
||||||
|
|
||||||
// Other types
|
// ImTexture: user data for renderer backend to identify a texture [Compile-time configurable type]
|
||||||
#ifndef ImTextureID // ImTextureID [configurable type: override in imconfig.h with '#define ImTextureID xxx']
|
// - To use something else than an opaque void* pointer: override with e.g. '#define ImTextureID MyTextureType*' in your imconfig.h file.
|
||||||
typedef void* ImTextureID; // User data for rendering backend to identify a texture. This is whatever to you want it to be! read the FAQ about ImTextureID for details.
|
// - This can be whatever to you want it to be! read the FAQ about ImTextureID for details.
|
||||||
#endif
|
#ifndef ImTextureID
|
||||||
typedef unsigned int ImGuiID; // A unique ID used by widgets, typically hashed from a stack of string.
|
typedef void* ImTextureID; // Default: store a pointer or an integer fitting in a pointer (most renderer backends are ok with that)
|
||||||
typedef int (*ImGuiInputTextCallback)(ImGuiInputTextCallbackData* data); // Callback function for ImGui::InputText()
|
|
||||||
typedef void (*ImGuiSizeCallback)(ImGuiSizeCallbackData* data); // Callback function for ImGui::SetNextWindowSizeConstraints()
|
|
||||||
typedef void* (*ImGuiMemAllocFunc)(size_t sz, void* user_data); // Function signature for ImGui::SetAllocatorFunctions()
|
|
||||||
typedef void (*ImGuiMemFreeFunc)(void* ptr, void* user_data); // Function signature for ImGui::SetAllocatorFunctions()
|
|
||||||
|
|
||||||
// Character types
|
|
||||||
// (we generally use UTF-8 encoded string in the API. This is storage specifically for a decoded character used for keyboard input and display)
|
|
||||||
typedef unsigned short ImWchar16; // A single decoded U16 character/code point. We encode them as multi bytes UTF-8 when used in strings.
|
|
||||||
typedef unsigned int ImWchar32; // A single decoded U32 character/code point. We encode them as multi bytes UTF-8 when used in strings.
|
|
||||||
#ifdef IMGUI_USE_WCHAR32 // ImWchar [configurable type: override in imconfig.h with '#define IMGUI_USE_WCHAR32' to support Unicode planes 1-16]
|
|
||||||
typedef ImWchar32 ImWchar;
|
|
||||||
#else
|
|
||||||
typedef ImWchar16 ImWchar;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Basic scalar data types
|
// ImDrawIdx: vertex index. [Compile-time configurable type]
|
||||||
|
// - To use 16-bit indices + allow large meshes: backend need to set 'io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset' and handle ImDrawCmd::VtxOffset (recommended).
|
||||||
|
// - To use 32-bit indices: override with '#define ImDrawIdx unsigned int' in your imconfig.h file.
|
||||||
|
#ifndef ImDrawIdx
|
||||||
|
typedef unsigned short ImDrawIdx; // Default: 16-bit (for maximum compatibility with renderer backends)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Scalar data types
|
||||||
|
typedef unsigned int ImGuiID;// A unique ID used by widgets (typically the result of hashing a stack of string)
|
||||||
typedef signed char ImS8; // 8-bit signed integer
|
typedef signed char ImS8; // 8-bit signed integer
|
||||||
typedef unsigned char ImU8; // 8-bit unsigned integer
|
typedef unsigned char ImU8; // 8-bit unsigned integer
|
||||||
typedef signed short ImS16; // 16-bit signed integer
|
typedef signed short ImS16; // 16-bit signed integer
|
||||||
@@ -239,7 +237,24 @@ typedef signed long long ImS64; // 64-bit signed integer (post C++11)
|
|||||||
typedef unsigned long long ImU64; // 64-bit unsigned integer (post C++11)
|
typedef unsigned long long ImU64; // 64-bit unsigned integer (post C++11)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// 2D vector (often used to store positions or sizes)
|
// Character types
|
||||||
|
// (we generally use UTF-8 encoded string in the API. This is storage specifically for a decoded character used for keyboard input and display)
|
||||||
|
typedef unsigned short ImWchar16; // A single decoded U16 character/code point. We encode them as multi bytes UTF-8 when used in strings.
|
||||||
|
typedef unsigned int ImWchar32; // A single decoded U32 character/code point. We encode them as multi bytes UTF-8 when used in strings.
|
||||||
|
#ifdef IMGUI_USE_WCHAR32 // ImWchar [configurable type: override in imconfig.h with '#define IMGUI_USE_WCHAR32' to support Unicode planes 1-16]
|
||||||
|
typedef ImWchar32 ImWchar;
|
||||||
|
#else
|
||||||
|
typedef ImWchar16 ImWchar;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Callback and functions types
|
||||||
|
typedef int (*ImGuiInputTextCallback)(ImGuiInputTextCallbackData* data); // Callback function for ImGui::InputText()
|
||||||
|
typedef void (*ImGuiSizeCallback)(ImGuiSizeCallbackData* data); // Callback function for ImGui::SetNextWindowSizeConstraints()
|
||||||
|
typedef void* (*ImGuiMemAllocFunc)(size_t sz, void* user_data); // Function signature for ImGui::SetAllocatorFunctions()
|
||||||
|
typedef void (*ImGuiMemFreeFunc)(void* ptr, void* user_data); // Function signature for ImGui::SetAllocatorFunctions()
|
||||||
|
|
||||||
|
// ImVec2: 2D vector used to store positions, sizes etc. [Compile-time configurable type]
|
||||||
|
// This is a frequently used type in the API. Consider using IM_VEC2_CLASS_EXTRA to create implicit cast from/to our preferred type.
|
||||||
IM_MSVC_RUNTIME_CHECKS_OFF
|
IM_MSVC_RUNTIME_CHECKS_OFF
|
||||||
struct ImVec2
|
struct ImVec2
|
||||||
{
|
{
|
||||||
@@ -253,7 +268,7 @@ struct ImVec2
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// 4D vector (often used to store floating-point colors)
|
// ImVec4: 4D vector used to store clipping rectangles, colors etc. [Compile-time configurable type]
|
||||||
struct ImVec4
|
struct ImVec4
|
||||||
{
|
{
|
||||||
float x, y, z, w;
|
float x, y, z, w;
|
||||||
@@ -292,6 +307,7 @@ namespace ImGui
|
|||||||
// Demo, Debug, Information
|
// Demo, Debug, Information
|
||||||
IMGUI_API void ShowDemoWindow(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_API void ShowDemoWindow(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_API void ShowMetricsWindow(bool* p_open = NULL); // create Metrics/Debugger window. display Dear ImGui internals: windows, draw commands, various internal state, etc.
|
IMGUI_API void ShowMetricsWindow(bool* p_open = NULL); // create Metrics/Debugger window. display Dear ImGui internals: windows, draw commands, various internal state, etc.
|
||||||
|
IMGUI_API void ShowStackToolWindow(bool* p_open = NULL); // create Stack Tool window. hover items with mouse to query information about the source of their unique ID.
|
||||||
IMGUI_API void ShowAboutWindow(bool* p_open = NULL); // create About window. display Dear ImGui version, credits and build/system information.
|
IMGUI_API void ShowAboutWindow(bool* p_open = NULL); // create About window. display Dear ImGui version, credits and build/system information.
|
||||||
IMGUI_API void ShowStyleEditor(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_API void ShowStyleEditor(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_API bool ShowStyleSelector(const char* label); // add style selector block (not a window), essentially a combo listing the default styles.
|
IMGUI_API bool ShowStyleSelector(const char* label); // add style selector block (not a window), essentially a combo listing the default styles.
|
||||||
@@ -343,7 +359,8 @@ namespace ImGui
|
|||||||
IMGUI_API float GetWindowWidth(); // get current window width (shortcut for GetWindowSize().x)
|
IMGUI_API float GetWindowWidth(); // get current window width (shortcut for GetWindowSize().x)
|
||||||
IMGUI_API float GetWindowHeight(); // get current window height (shortcut for GetWindowSize().y)
|
IMGUI_API float GetWindowHeight(); // get current window height (shortcut for GetWindowSize().y)
|
||||||
|
|
||||||
// Prefer using SetNextXXX functions (before Begin) rather that SetXXX functions (after Begin).
|
// Window manipulation
|
||||||
|
// - Prefer using SetNextXXX functions (before Begin) rather that SetXXX functions (after Begin).
|
||||||
IMGUI_API void SetNextWindowPos(const ImVec2& pos, ImGuiCond cond = 0, const ImVec2& pivot = ImVec2(0, 0)); // set next window position. call before Begin(). use pivot=(0.5f,0.5f) to center on given point, etc.
|
IMGUI_API void SetNextWindowPos(const ImVec2& pos, ImGuiCond cond = 0, const ImVec2& pivot = ImVec2(0, 0)); // set next window position. call before Begin(). use pivot=(0.5f,0.5f) to center on given point, etc.
|
||||||
IMGUI_API void SetNextWindowSize(const ImVec2& size, ImGuiCond cond = 0); // set next window size. set axis to 0.0f to force an auto-fit on this axis. call before Begin()
|
IMGUI_API void SetNextWindowSize(const ImVec2& size, ImGuiCond cond = 0); // set next window size. set axis to 0.0f to force an auto-fit on this axis. call before Begin()
|
||||||
IMGUI_API void SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& size_max, ImGuiSizeCallback custom_callback = NULL, void* custom_callback_data = NULL); // set next window size limits. use -1,-1 on either X/Y axis to preserve the current size. Sizes will be rounded down. Use callback to apply non-trivial programmatic constraints.
|
IMGUI_API void SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& size_max, ImGuiSizeCallback custom_callback = NULL, void* custom_callback_data = NULL); // set next window size limits. use -1,-1 on either X/Y axis to preserve the current size. Sizes will be rounded down. Use callback to apply non-trivial programmatic constraints.
|
||||||
@@ -355,7 +372,7 @@ namespace ImGui
|
|||||||
IMGUI_API void SetWindowSize(const ImVec2& size, ImGuiCond cond = 0); // (not recommended) set current window size - call within Begin()/End(). set to ImVec2(0, 0) to force an auto-fit. prefer using SetNextWindowSize(), as this may incur tearing and minor side-effects.
|
IMGUI_API void SetWindowSize(const ImVec2& size, ImGuiCond cond = 0); // (not recommended) set current window size - call within Begin()/End(). set to ImVec2(0, 0) to force an auto-fit. prefer using SetNextWindowSize(), as this may incur tearing and minor side-effects.
|
||||||
IMGUI_API void SetWindowCollapsed(bool collapsed, ImGuiCond cond = 0); // (not recommended) set current window collapsed state. prefer using SetNextWindowCollapsed().
|
IMGUI_API void SetWindowCollapsed(bool collapsed, ImGuiCond cond = 0); // (not recommended) set current window collapsed state. prefer using SetNextWindowCollapsed().
|
||||||
IMGUI_API void SetWindowFocus(); // (not recommended) set current window to be focused / top-most. prefer using SetNextWindowFocus().
|
IMGUI_API void SetWindowFocus(); // (not recommended) set current window to be focused / top-most. prefer using SetNextWindowFocus().
|
||||||
IMGUI_API void SetWindowFontScale(float scale); // set font scale. Adjust IO.FontGlobalScale if you want to scale all windows. This is an old API! For correct scaling, prefer to reload font + rebuild ImFontAtlas + call style.ScaleAllSizes().
|
IMGUI_API void SetWindowFontScale(float scale); // [OBSOLETE] set font scale. Adjust IO.FontGlobalScale if you want to scale all windows. This is an old API! For correct scaling, prefer to reload font + rebuild ImFontAtlas + call style.ScaleAllSizes().
|
||||||
IMGUI_API void SetWindowPos(const char* name, const ImVec2& pos, ImGuiCond cond = 0); // set named window position.
|
IMGUI_API void SetWindowPos(const char* name, const ImVec2& pos, ImGuiCond cond = 0); // set named window position.
|
||||||
IMGUI_API void SetWindowSize(const char* name, const ImVec2& size, ImGuiCond cond = 0); // set named window size. set axis to 0.0f to force an auto-fit on this axis.
|
IMGUI_API void SetWindowSize(const char* name, const ImVec2& size, ImGuiCond cond = 0); // set named window size. set axis to 0.0f to force an auto-fit on this axis.
|
||||||
IMGUI_API void SetWindowCollapsed(const char* name, bool collapsed, ImGuiCond cond = 0); // set named window collapsed state
|
IMGUI_API void SetWindowCollapsed(const char* name, bool collapsed, ImGuiCond cond = 0); // set named window collapsed state
|
||||||
@@ -366,9 +383,8 @@ namespace ImGui
|
|||||||
// - Those functions are bound to be redesigned (they are confusing, incomplete and the Min/Max return values are in local window coordinates which increases confusion)
|
// - Those functions are bound to be redesigned (they are confusing, incomplete and the Min/Max return values are in local window coordinates which increases confusion)
|
||||||
IMGUI_API ImVec2 GetContentRegionAvail(); // == GetContentRegionMax() - GetCursorPos()
|
IMGUI_API ImVec2 GetContentRegionAvail(); // == GetContentRegionMax() - GetCursorPos()
|
||||||
IMGUI_API ImVec2 GetContentRegionMax(); // current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates
|
IMGUI_API ImVec2 GetContentRegionMax(); // current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates
|
||||||
IMGUI_API ImVec2 GetWindowContentRegionMin(); // content boundaries min (roughly (0,0)-Scroll), in window coordinates
|
IMGUI_API ImVec2 GetWindowContentRegionMin(); // content boundaries min for the full window (roughly (0,0)-Scroll), in window coordinates
|
||||||
IMGUI_API ImVec2 GetWindowContentRegionMax(); // content boundaries max (roughly (0,0)+Size-Scroll) where Size can be override with SetNextWindowContentSize(), in window coordinates
|
IMGUI_API ImVec2 GetWindowContentRegionMax(); // content boundaries max for the full window (roughly (0,0)+Size-Scroll) where Size can be override with SetNextWindowContentSize(), in window coordinates
|
||||||
IMGUI_API float GetWindowContentRegionWidth(); //
|
|
||||||
|
|
||||||
// Windows Scrolling
|
// Windows Scrolling
|
||||||
IMGUI_API float GetScrollX(); // get scrolling amount [0 .. GetScrollMaxX()]
|
IMGUI_API float GetScrollX(); // get scrolling amount [0 .. GetScrollMaxX()]
|
||||||
@@ -405,6 +421,7 @@ namespace ImGui
|
|||||||
IMGUI_API void PopTextWrapPos();
|
IMGUI_API void PopTextWrapPos();
|
||||||
|
|
||||||
// Style read access
|
// Style read access
|
||||||
|
// - Use the style editor (ShowStyleEditor() function) to interactively see what the colors are)
|
||||||
IMGUI_API ImFont* GetFont(); // get current font
|
IMGUI_API ImFont* GetFont(); // get current font
|
||||||
IMGUI_API float GetFontSize(); // get current font size (= height in pixels) of current font with current scale applied
|
IMGUI_API float GetFontSize(); // get current font size (= height in pixels) of current font with current scale applied
|
||||||
IMGUI_API ImVec2 GetFontTexUvWhitePixel(); // get UV coordinate for a while pixel, useful to draw custom shapes via the ImDrawList API
|
IMGUI_API ImVec2 GetFontTexUvWhitePixel(); // get UV coordinate for a while pixel, useful to draw custom shapes via the ImDrawList API
|
||||||
@@ -445,11 +462,15 @@ namespace ImGui
|
|||||||
IMGUI_API float GetFrameHeightWithSpacing(); // ~ FontSize + style.FramePadding.y * 2 + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of framed widgets)
|
IMGUI_API float GetFrameHeightWithSpacing(); // ~ FontSize + style.FramePadding.y * 2 + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of framed widgets)
|
||||||
|
|
||||||
// ID stack/scopes
|
// ID stack/scopes
|
||||||
// - Read the FAQ for more details about how ID are handled in dear imgui. If you are creating widgets in a loop you most
|
// Read the FAQ (docs/FAQ.md or http://dearimgui.org/faq) for more details about how ID are handled in dear imgui.
|
||||||
// likely want to push a unique identifier (e.g. object pointer, loop index) to uniquely differentiate them.
|
// - Those questions are answered and impacted by understanding of the ID stack system:
|
||||||
// - The resulting ID are hashes of the entire stack.
|
// - "Q: Why is my widget not reacting when I click on it?"
|
||||||
|
// - "Q: How can I have widgets with an empty label?"
|
||||||
|
// - "Q: How can I have multiple widgets with the same label?"
|
||||||
|
// - Short version: ID are hashes of the entire ID stack. If you are creating widgets in a loop you most likely
|
||||||
|
// want to push a unique identifier (e.g. object pointer, loop index) to uniquely differentiate them.
|
||||||
// - You can also use the "Label##foobar" syntax within widget label to distinguish them from each others.
|
// - You can also use the "Label##foobar" syntax within widget label to distinguish them from each others.
|
||||||
// - In this header file we use the "label"/"name" terminology to denote a string that will be displayed and used as an ID,
|
// - In this header file we use the "label"/"name" terminology to denote a string that will be displayed + used as an ID,
|
||||||
// whereas "str_id" denote a string that is only used as an ID and not normally displayed.
|
// whereas "str_id" denote a string that is only used as an ID and not normally displayed.
|
||||||
IMGUI_API void PushID(const char* str_id); // push string into the ID stack (will hash string).
|
IMGUI_API void PushID(const char* str_id); // push string into the ID stack (will hash string).
|
||||||
IMGUI_API void PushID(const char* str_id_begin, const char* str_id_end); // push string into the ID stack (will hash string).
|
IMGUI_API void PushID(const char* str_id_begin, const char* str_id_end); // push string into the ID stack (will hash string).
|
||||||
@@ -502,12 +523,12 @@ namespace ImGui
|
|||||||
IMGUI_API bool Combo(const char* label, int* current_item, bool(*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int popup_max_height_in_items = -1);
|
IMGUI_API bool Combo(const char* label, int* current_item, bool(*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int popup_max_height_in_items = -1);
|
||||||
|
|
||||||
// Widgets: Drag Sliders
|
// Widgets: Drag Sliders
|
||||||
// - CTRL+Click on any drag box to turn them into an input box. Manually input values aren't clamped and can go off-bounds.
|
// - 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.
|
||||||
// - For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every functions, note that 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. You can pass address of your first element out of a contiguous set, e.g. &myvector.x
|
// - For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every functions, note that 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. You can pass address of your first element out of a contiguous set, e.g. &myvector.x
|
||||||
// - 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.
|
// - 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.
|
||||||
// - Format string may also be set to NULL or use the default format ("%f" or "%d").
|
// - Format string may also be set to NULL or use the default format ("%f" or "%d").
|
||||||
// - Speed are per-pixel of mouse movement (v_speed=0.2f: mouse needs to move by 5 pixels to increase value by 1). For gamepad/keyboard navigation, minimum speed is Max(v_speed, minimum_step_at_given_precision).
|
// - Speed are per-pixel of mouse movement (v_speed=0.2f: mouse needs to move by 5 pixels to increase value by 1). For gamepad/keyboard navigation, minimum speed is Max(v_speed, minimum_step_at_given_precision).
|
||||||
// - Use v_min < v_max to clamp edits to given limits. Note that CTRL+Click manual input can override those limits.
|
// - Use v_min < v_max to clamp edits to given limits. Note that CTRL+Click manual input can override those limits if ImGuiSliderFlags_AlwaysClamp is not used.
|
||||||
// - 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.
|
// - 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.
|
||||||
// - 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.
|
// - 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.
|
||||||
// - Legacy: Pre-1.78 there are DragXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
|
// - Legacy: Pre-1.78 there are DragXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
|
||||||
@@ -526,7 +547,7 @@ namespace ImGui
|
|||||||
IMGUI_API bool DragScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, float v_speed = 1.0f, const void* p_min = NULL, const void* p_max = NULL, const char* format = NULL, ImGuiSliderFlags flags = 0);
|
IMGUI_API bool DragScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, float v_speed = 1.0f, const void* p_min = NULL, const void* p_max = NULL, const char* format = NULL, ImGuiSliderFlags flags = 0);
|
||||||
|
|
||||||
// Widgets: Regular Sliders
|
// Widgets: Regular Sliders
|
||||||
// - CTRL+Click on any slider to turn them into an input box. Manually input values aren't clamped and can go off-bounds.
|
// - 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.
|
||||||
// - 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.
|
// - 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.
|
||||||
// - Format string may also be set to NULL or use the default format ("%f" or "%d").
|
// - Format string may also be set to NULL or use the default format ("%f" or "%d").
|
||||||
// - Legacy: Pre-1.78 there are SliderXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
|
// - Legacy: Pre-1.78 there are SliderXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
|
||||||
@@ -612,7 +633,7 @@ namespace ImGui
|
|||||||
IMGUI_API bool ListBox(const char* label, int* current_item, bool (*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1);
|
IMGUI_API bool ListBox(const char* label, int* current_item, bool (*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1);
|
||||||
|
|
||||||
// Widgets: Data Plotting
|
// Widgets: Data Plotting
|
||||||
// - Consider using ImPlot (https://github.com/epezent/implot)
|
// - Consider using ImPlot (https://github.com/epezent/implot) which is much better!
|
||||||
IMGUI_API void PlotLines(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0), int stride = sizeof(float));
|
IMGUI_API void PlotLines(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0), int stride = sizeof(float));
|
||||||
IMGUI_API void PlotLines(const char* label, float(*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0));
|
IMGUI_API void PlotLines(const char* label, float(*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0));
|
||||||
IMGUI_API void PlotHistogram(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0), int stride = sizeof(float));
|
IMGUI_API void PlotHistogram(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0), int stride = sizeof(float));
|
||||||
@@ -654,12 +675,14 @@ namespace ImGui
|
|||||||
// - You can bypass the hovering restriction by using ImGuiHoveredFlags_AllowWhenBlockedByPopup when calling IsItemHovered() or IsWindowHovered().
|
// - You can bypass the hovering restriction by using ImGuiHoveredFlags_AllowWhenBlockedByPopup when calling IsItemHovered() or IsWindowHovered().
|
||||||
// - 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.
|
// - 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.
|
||||||
// This is sometimes leading to confusing mistakes. May rework this in the future.
|
// This is sometimes leading to confusing mistakes. May rework this in the future.
|
||||||
|
|
||||||
// Popups: begin/end functions
|
// Popups: begin/end functions
|
||||||
// - BeginPopup(): query popup state, if open start appending into the window. Call EndPopup() afterwards. ImGuiWindowFlags are forwarded to the window.
|
// - BeginPopup(): query popup state, if open start appending into the window. Call EndPopup() afterwards. ImGuiWindowFlags are forwarded to the window.
|
||||||
// - BeginPopupModal(): block every interactions behind the window, cannot be closed by user, add a dimming background, has a title bar.
|
// - BeginPopupModal(): block every interactions behind the window, cannot be closed by user, add a dimming background, has a title bar.
|
||||||
IMGUI_API bool BeginPopup(const char* str_id, ImGuiWindowFlags flags = 0); // return true if the popup is open, and you can start outputting to it.
|
IMGUI_API bool BeginPopup(const char* str_id, ImGuiWindowFlags flags = 0); // return true if the popup is open, and you can start outputting to it.
|
||||||
IMGUI_API bool BeginPopupModal(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0); // return true if the modal is open, and you can start outputting to it.
|
IMGUI_API bool BeginPopupModal(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0); // return true if the modal is open, and you can start outputting to it.
|
||||||
IMGUI_API void EndPopup(); // only call EndPopup() if BeginPopupXXX() returns true!
|
IMGUI_API void EndPopup(); // only call EndPopup() if BeginPopupXXX() returns true!
|
||||||
|
|
||||||
// Popups: open/close functions
|
// Popups: open/close functions
|
||||||
// - OpenPopup(): set popup state to open. ImGuiPopupFlags are available for opening options.
|
// - OpenPopup(): set popup state to open. ImGuiPopupFlags are available for opening options.
|
||||||
// - If not modal: they can be closed by clicking anywhere outside them, or by pressing ESCAPE.
|
// - If not modal: they can be closed by clicking anywhere outside them, or by pressing ESCAPE.
|
||||||
@@ -671,6 +694,7 @@ namespace ImGui
|
|||||||
IMGUI_API void OpenPopup(ImGuiID id, ImGuiPopupFlags popup_flags = 0); // id overload to facilitate calling from nested stacks
|
IMGUI_API void OpenPopup(ImGuiID id, ImGuiPopupFlags popup_flags = 0); // id overload to facilitate calling from nested stacks
|
||||||
IMGUI_API void OpenPopupOnItemClick(const char* str_id = NULL, ImGuiPopupFlags popup_flags = 1); // helper to open popup when clicked on last item. Default to ImGuiPopupFlags_MouseButtonRight == 1. (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors)
|
IMGUI_API void OpenPopupOnItemClick(const char* str_id = NULL, ImGuiPopupFlags popup_flags = 1); // helper to open popup when clicked on last item. Default to ImGuiPopupFlags_MouseButtonRight == 1. (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors)
|
||||||
IMGUI_API void CloseCurrentPopup(); // manually close the popup we have begin-ed into.
|
IMGUI_API void CloseCurrentPopup(); // manually close the popup we have begin-ed into.
|
||||||
|
|
||||||
// Popups: open+begin combined functions helpers
|
// Popups: open+begin combined functions helpers
|
||||||
// - Helpers to do OpenPopup+BeginPopup where the Open action is triggered by e.g. hovering an item and right-clicking.
|
// - Helpers to do OpenPopup+BeginPopup where the Open action is triggered by e.g. hovering an item and right-clicking.
|
||||||
// - They are convenient to easily create context menus, hence the name.
|
// - They are convenient to easily create context menus, hence the name.
|
||||||
@@ -679,6 +703,7 @@ namespace ImGui
|
|||||||
IMGUI_API bool BeginPopupContextItem(const char* str_id = NULL, ImGuiPopupFlags popup_flags = 1); // open+begin popup when clicked on last item. Use str_id==NULL to associate the popup to previous item. If you want to use that on a non-interactive item such as Text() you need to pass in an explicit ID here. read comments in .cpp!
|
IMGUI_API bool BeginPopupContextItem(const char* str_id = NULL, ImGuiPopupFlags popup_flags = 1); // open+begin popup when clicked on last item. Use str_id==NULL to associate the popup to previous item. If you want to use that on a non-interactive item such as Text() you need to pass in an explicit ID here. read comments in .cpp!
|
||||||
IMGUI_API bool BeginPopupContextWindow(const char* str_id = NULL, ImGuiPopupFlags popup_flags = 1);// open+begin popup when clicked on current window.
|
IMGUI_API bool BeginPopupContextWindow(const char* str_id = NULL, ImGuiPopupFlags popup_flags = 1);// open+begin popup when clicked on current window.
|
||||||
IMGUI_API bool BeginPopupContextVoid(const char* str_id = NULL, ImGuiPopupFlags popup_flags = 1); // open+begin popup when clicked in void (where there are no windows).
|
IMGUI_API bool BeginPopupContextVoid(const char* str_id = NULL, ImGuiPopupFlags popup_flags = 1); // open+begin popup when clicked in void (where there are no windows).
|
||||||
|
|
||||||
// Popups: query functions
|
// Popups: query functions
|
||||||
// - IsPopupOpen(): return true if the popup is open at the current BeginPopup() level of the popup stack.
|
// - IsPopupOpen(): return true if the popup is open at the current BeginPopup() level of the popup stack.
|
||||||
// - IsPopupOpen() with ImGuiPopupFlags_AnyPopupId: return true if any popup is open at the current BeginPopup() level of the popup stack.
|
// - IsPopupOpen() with ImGuiPopupFlags_AnyPopupId: return true if any popup is open at the current BeginPopup() level of the popup stack.
|
||||||
@@ -715,6 +740,7 @@ namespace ImGui
|
|||||||
IMGUI_API void TableNextRow(ImGuiTableRowFlags row_flags = 0, float min_row_height = 0.0f); // append into the first cell of a new row.
|
IMGUI_API void TableNextRow(ImGuiTableRowFlags row_flags = 0, float min_row_height = 0.0f); // append into the first cell of a new row.
|
||||||
IMGUI_API bool TableNextColumn(); // append into the next column (or first column of next row if currently in last column). Return true when column is visible.
|
IMGUI_API bool TableNextColumn(); // append into the next column (or first column of next row if currently in last column). Return true when column is visible.
|
||||||
IMGUI_API bool TableSetColumnIndex(int column_n); // append into the specified column. Return true when column is visible.
|
IMGUI_API bool TableSetColumnIndex(int column_n); // append into the specified column. Return true when column is visible.
|
||||||
|
|
||||||
// Tables: Headers & Columns declaration
|
// Tables: Headers & Columns declaration
|
||||||
// - Use TableSetupColumn() to specify label, resizing policy, default width/weight, id, various other flags etc.
|
// - Use TableSetupColumn() to specify label, resizing policy, default width/weight, id, various other flags etc.
|
||||||
// - Use TableHeadersRow() to create a header row and automatically submit a TableHeader() for each column.
|
// - Use TableHeadersRow() to create a header row and automatically submit a TableHeader() for each column.
|
||||||
@@ -727,6 +753,7 @@ namespace ImGui
|
|||||||
IMGUI_API void TableSetupScrollFreeze(int cols, int rows); // lock columns/rows so they stay visible when scrolled.
|
IMGUI_API void TableSetupScrollFreeze(int cols, int rows); // lock columns/rows so they stay visible when scrolled.
|
||||||
IMGUI_API void TableHeadersRow(); // submit all headers cells based on data provided to TableSetupColumn() + submit context menu
|
IMGUI_API void TableHeadersRow(); // submit all headers cells based on data provided to TableSetupColumn() + submit context menu
|
||||||
IMGUI_API void TableHeader(const char* label); // submit one header cell manually (rarely used)
|
IMGUI_API void TableHeader(const char* label); // submit one header cell manually (rarely used)
|
||||||
|
|
||||||
// Tables: Sorting
|
// Tables: Sorting
|
||||||
// - Call TableGetSortSpecs() to retrieve latest sort specs for the table. NULL when not sorting.
|
// - Call TableGetSortSpecs() to retrieve latest sort specs for the table. NULL when not sorting.
|
||||||
// - When 'SpecsDirty == true' you should sort your data. It will be true when sorting specs have changed
|
// - When 'SpecsDirty == true' you should sort your data. It will be true when sorting specs have changed
|
||||||
@@ -734,6 +761,7 @@ namespace ImGui
|
|||||||
// wastefully sort your data every frame!
|
// wastefully sort your data every frame!
|
||||||
// - Lifetime: don't hold on this pointer over multiple frames or past any subsequent call to BeginTable().
|
// - Lifetime: don't hold on this pointer over multiple frames or past any subsequent call to BeginTable().
|
||||||
IMGUI_API ImGuiTableSortSpecs* TableGetSortSpecs(); // get latest sort specs for the table (NULL if not sorting).
|
IMGUI_API ImGuiTableSortSpecs* TableGetSortSpecs(); // get latest sort specs for the table (NULL if not sorting).
|
||||||
|
|
||||||
// Tables: Miscellaneous functions
|
// Tables: Miscellaneous functions
|
||||||
// - Functions args 'int column_n' treat the default value of -1 as the same as passing the current column index.
|
// - Functions args 'int column_n' treat the default value of -1 as the same as passing the current column index.
|
||||||
IMGUI_API int TableGetColumnCount(); // return number of columns (value passed to BeginTable)
|
IMGUI_API int TableGetColumnCount(); // return number of columns (value passed to BeginTable)
|
||||||
@@ -741,10 +769,10 @@ namespace ImGui
|
|||||||
IMGUI_API int TableGetRowIndex(); // return current row index.
|
IMGUI_API int TableGetRowIndex(); // return current row index.
|
||||||
IMGUI_API const char* TableGetColumnName(int column_n = -1); // return "" if column didn't have a name declared by TableSetupColumn(). Pass -1 to use current column.
|
IMGUI_API const char* TableGetColumnName(int column_n = -1); // return "" if column didn't have a name declared by TableSetupColumn(). Pass -1 to use current column.
|
||||||
IMGUI_API ImGuiTableColumnFlags TableGetColumnFlags(int column_n = -1); // return column flags so you can query their Enabled/Visible/Sorted/Hovered status flags. Pass -1 to use current column.
|
IMGUI_API ImGuiTableColumnFlags TableGetColumnFlags(int column_n = -1); // return column flags so you can query their Enabled/Visible/Sorted/Hovered status flags. Pass -1 to use current column.
|
||||||
IMGUI_API void TableSetColumnEnabled(int column_n, bool v);// change enabled/disabled state of a column, set to false to hide the column. Note that end-user can use the context menu to change this themselves (right-click in headers, or right-click in columns body with ImGuiTableFlags_ContextMenuInBody)
|
IMGUI_API void TableSetColumnEnabled(int column_n, bool v);// change user accessible enabled/disabled state of a column. Set to false to hide the column. User can use the context menu to change this themselves (right-click in headers, or right-click in columns body with ImGuiTableFlags_ContextMenuInBody)
|
||||||
IMGUI_API void TableSetBgColor(ImGuiTableBgTarget target, ImU32 color, int column_n = -1); // change the color of a cell, row, or column. See ImGuiTableBgTarget_ flags for details.
|
IMGUI_API void TableSetBgColor(ImGuiTableBgTarget target, ImU32 color, int column_n = -1); // change the color of a cell, row, or column. See ImGuiTableBgTarget_ flags for details.
|
||||||
|
|
||||||
// Legacy Columns API (2020: prefer using Tables!)
|
// Legacy Columns API (prefer using Tables!)
|
||||||
// - You can also use SameLine(pos_x) to mimic simplified columns.
|
// - You can also use SameLine(pos_x) to mimic simplified columns.
|
||||||
IMGUI_API void Columns(int count = 1, const char* id = NULL, bool border = true);
|
IMGUI_API void Columns(int count = 1, const char* id = NULL, bool border = true);
|
||||||
IMGUI_API void NextColumn(); // next column, defaults to current row or next row if the current row is finished
|
IMGUI_API void NextColumn(); // next column, defaults to current row or next row if the current row is finished
|
||||||
@@ -786,6 +814,13 @@ namespace ImGui
|
|||||||
IMGUI_API void EndDragDropTarget(); // only call EndDragDropTarget() if BeginDragDropTarget() returns true!
|
IMGUI_API void EndDragDropTarget(); // only call EndDragDropTarget() if BeginDragDropTarget() returns true!
|
||||||
IMGUI_API const ImGuiPayload* GetDragDropPayload(); // peek directly into the current payload from anywhere. may return NULL. use ImGuiPayload::IsDataType() to test for the payload type.
|
IMGUI_API const ImGuiPayload* GetDragDropPayload(); // peek directly into the current payload from anywhere. may return NULL. use ImGuiPayload::IsDataType() to test for the payload type.
|
||||||
|
|
||||||
|
// Disabling [BETA API]
|
||||||
|
// - Disable all user interactions and dim items visuals (applying style.DisabledAlpha over current colors)
|
||||||
|
// - 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)
|
||||||
|
// - BeginDisabled(false) essentially does nothing useful but is provided to facilitate use of boolean expressions. If you can avoid calling BeginDisabled(False)/EndDisabled() best to avoid it.
|
||||||
|
IMGUI_API void BeginDisabled(bool disabled = true);
|
||||||
|
IMGUI_API void EndDisabled();
|
||||||
|
|
||||||
// Clipping
|
// Clipping
|
||||||
// - Mouse hovering is affected by ImGui::PushClipRect() calls, unlike direct calls to ImDrawList::PushClipRect() which are render only.
|
// - Mouse hovering is affected by ImGui::PushClipRect() calls, unlike direct calls to ImDrawList::PushClipRect() which are render only.
|
||||||
IMGUI_API void PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect);
|
IMGUI_API void PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect);
|
||||||
@@ -885,6 +920,7 @@ namespace ImGui
|
|||||||
// Settings/.Ini Utilities
|
// Settings/.Ini Utilities
|
||||||
// - The disk functions are automatically called if io.IniFilename != NULL (default is "imgui.ini").
|
// - The disk functions are automatically called if io.IniFilename != NULL (default is "imgui.ini").
|
||||||
// - Set io.IniFilename to NULL to load/save manually. Read io.WantSaveIniSettings description about handling .ini saving manually.
|
// - Set io.IniFilename to NULL to load/save manually. Read io.WantSaveIniSettings description about handling .ini saving manually.
|
||||||
|
// - 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).
|
||||||
IMGUI_API void LoadIniSettingsFromDisk(const char* ini_filename); // call after CreateContext() and before the first call to NewFrame(). NewFrame() automatically calls LoadIniSettingsFromDisk(io.IniFilename).
|
IMGUI_API void LoadIniSettingsFromDisk(const char* ini_filename); // call after CreateContext() and before the first call to NewFrame(). NewFrame() automatically calls LoadIniSettingsFromDisk(io.IniFilename).
|
||||||
IMGUI_API void LoadIniSettingsFromMemory(const char* ini_data, size_t ini_size=0); // call after CreateContext() and before the first call to NewFrame() to provide .ini data from your own data source.
|
IMGUI_API void LoadIniSettingsFromMemory(const char* ini_data, size_t ini_size=0); // call after CreateContext() and before the first call to NewFrame() to provide .ini data from your own data source.
|
||||||
IMGUI_API void SaveIniSettingsToDisk(const char* ini_filename); // this is automatically called (if io.IniFilename is not empty) a few seconds after any modification that should be reflected in the .ini file (and also by DestroyContext).
|
IMGUI_API void SaveIniSettingsToDisk(const char* ini_filename); // this is automatically called (if io.IniFilename is not empty) a few seconds after any modification that should be reflected in the .ini file (and also by DestroyContext).
|
||||||
@@ -932,7 +968,7 @@ enum ImGuiWindowFlags_
|
|||||||
ImGuiWindowFlags_AlwaysUseWindowPadding = 1 << 16, // Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windows, because more convenient)
|
ImGuiWindowFlags_AlwaysUseWindowPadding = 1 << 16, // Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windows, because more convenient)
|
||||||
ImGuiWindowFlags_NoNavInputs = 1 << 18, // No gamepad/keyboard navigation within the window
|
ImGuiWindowFlags_NoNavInputs = 1 << 18, // No gamepad/keyboard navigation within the window
|
||||||
ImGuiWindowFlags_NoNavFocus = 1 << 19, // No focusing toward this window with gamepad/keyboard navigation (e.g. skipped by CTRL+TAB)
|
ImGuiWindowFlags_NoNavFocus = 1 << 19, // No focusing toward this window with gamepad/keyboard navigation (e.g. skipped by CTRL+TAB)
|
||||||
ImGuiWindowFlags_UnsavedDocument = 1 << 20, // Append '*' to title without affecting the ID, as a convenience to avoid using the ### operator. When used in a tab/docking context, tab is selected on closure and closure is deferred by one frame to allow code to cancel the closure (with a confirmation popup, etc.) without flicker.
|
ImGuiWindowFlags_UnsavedDocument = 1 << 20, // Display a dot next to the title. When used in a tab/docking context, tab is selected when clicking the X + closure is not assumed (will wait for user to stop submitting the tab). Otherwise closure is assumed when pressing the X, so if you keep submitting the tab may reappear at end of tab bar.
|
||||||
ImGuiWindowFlags_NoNav = ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus,
|
ImGuiWindowFlags_NoNav = ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus,
|
||||||
ImGuiWindowFlags_NoDecoration = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoCollapse,
|
ImGuiWindowFlags_NoDecoration = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoCollapse,
|
||||||
ImGuiWindowFlags_NoInputs = ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus,
|
ImGuiWindowFlags_NoInputs = ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus,
|
||||||
@@ -1070,7 +1106,7 @@ enum ImGuiTabBarFlags_
|
|||||||
enum ImGuiTabItemFlags_
|
enum ImGuiTabItemFlags_
|
||||||
{
|
{
|
||||||
ImGuiTabItemFlags_None = 0,
|
ImGuiTabItemFlags_None = 0,
|
||||||
ImGuiTabItemFlags_UnsavedDocument = 1 << 0, // Append '*' to title without affecting the ID, as a convenience to avoid using the ### operator. Also: tab is selected on closure and closure is deferred by one frame to allow code to undo it without flicker.
|
ImGuiTabItemFlags_UnsavedDocument = 1 << 0, // Display a dot next to the title + tab is selected when clicking the X + closure is not assumed (will wait for user to stop submitting the tab). Otherwise closure is assumed when pressing the X, so if you keep submitting the tab may reappear at end of tab bar.
|
||||||
ImGuiTabItemFlags_SetSelected = 1 << 1, // Trigger flag to programmatically make the tab selected when calling BeginTabItem()
|
ImGuiTabItemFlags_SetSelected = 1 << 1, // Trigger flag to programmatically make the tab selected when calling BeginTabItem()
|
||||||
ImGuiTabItemFlags_NoCloseWithMiddleMouseButton = 1 << 2, // Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. You can still repro this behavior on user's side with if (IsItemHovered() && IsMouseClicked(2)) *p_open = false.
|
ImGuiTabItemFlags_NoCloseWithMiddleMouseButton = 1 << 2, // Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. You can still repro this behavior on user's side with if (IsItemHovered() && IsMouseClicked(2)) *p_open = false.
|
||||||
ImGuiTabItemFlags_NoPushId = 1 << 3, // Don't call PushID(tab->ID)/PopID() on BeginTabItem()/EndTabItem()
|
ImGuiTabItemFlags_NoPushId = 1 << 3, // Don't call PushID(tab->ID)/PopID() on BeginTabItem()/EndTabItem()
|
||||||
@@ -1164,28 +1200,30 @@ enum ImGuiTableColumnFlags_
|
|||||||
{
|
{
|
||||||
// Input configuration flags
|
// Input configuration flags
|
||||||
ImGuiTableColumnFlags_None = 0,
|
ImGuiTableColumnFlags_None = 0,
|
||||||
ImGuiTableColumnFlags_DefaultHide = 1 << 0, // Default as a hidden/disabled column.
|
ImGuiTableColumnFlags_Disabled = 1 << 0, // Overriding/master disable flag: hide column, won't show in context menu (unlike calling TableSetColumnEnabled() which manipulates the user accessible state)
|
||||||
ImGuiTableColumnFlags_DefaultSort = 1 << 1, // Default as a sorting column.
|
ImGuiTableColumnFlags_DefaultHide = 1 << 1, // Default as a hidden/disabled column.
|
||||||
ImGuiTableColumnFlags_WidthStretch = 1 << 2, // Column will stretch. Preferable with horizontal scrolling disabled (default if table sizing policy is _SizingStretchSame or _SizingStretchProp).
|
ImGuiTableColumnFlags_DefaultSort = 1 << 2, // Default as a sorting column.
|
||||||
ImGuiTableColumnFlags_WidthFixed = 1 << 3, // Column will not stretch. Preferable with horizontal scrolling enabled (default if table sizing policy is _SizingFixedFit and table is resizable).
|
ImGuiTableColumnFlags_WidthStretch = 1 << 3, // Column will stretch. Preferable with horizontal scrolling disabled (default if table sizing policy is _SizingStretchSame or _SizingStretchProp).
|
||||||
ImGuiTableColumnFlags_NoResize = 1 << 4, // Disable manual resizing.
|
ImGuiTableColumnFlags_WidthFixed = 1 << 4, // Column will not stretch. Preferable with horizontal scrolling enabled (default if table sizing policy is _SizingFixedFit and table is resizable).
|
||||||
ImGuiTableColumnFlags_NoReorder = 1 << 5, // Disable manual reordering this column, this will also prevent other columns from crossing over this column.
|
ImGuiTableColumnFlags_NoResize = 1 << 5, // Disable manual resizing.
|
||||||
ImGuiTableColumnFlags_NoHide = 1 << 6, // Disable ability to hide/disable this column.
|
ImGuiTableColumnFlags_NoReorder = 1 << 6, // Disable manual reordering this column, this will also prevent other columns from crossing over this column.
|
||||||
ImGuiTableColumnFlags_NoClip = 1 << 7, // Disable clipping for this column (all NoClip columns will render in a same draw command).
|
ImGuiTableColumnFlags_NoHide = 1 << 7, // Disable ability to hide/disable this column.
|
||||||
ImGuiTableColumnFlags_NoSort = 1 << 8, // Disable ability to sort on this field (even if ImGuiTableFlags_Sortable is set on the table).
|
ImGuiTableColumnFlags_NoClip = 1 << 8, // Disable clipping for this column (all NoClip columns will render in a same draw command).
|
||||||
ImGuiTableColumnFlags_NoSortAscending = 1 << 9, // Disable ability to sort in the ascending direction.
|
ImGuiTableColumnFlags_NoSort = 1 << 9, // Disable ability to sort on this field (even if ImGuiTableFlags_Sortable is set on the table).
|
||||||
ImGuiTableColumnFlags_NoSortDescending = 1 << 10, // Disable ability to sort in the descending direction.
|
ImGuiTableColumnFlags_NoSortAscending = 1 << 10, // Disable ability to sort in the ascending direction.
|
||||||
ImGuiTableColumnFlags_NoHeaderWidth = 1 << 11, // Disable header text width contribution to automatic column width.
|
ImGuiTableColumnFlags_NoSortDescending = 1 << 11, // Disable ability to sort in the descending direction.
|
||||||
ImGuiTableColumnFlags_PreferSortAscending = 1 << 12, // Make the initial sort direction Ascending when first sorting on this column (default).
|
ImGuiTableColumnFlags_NoHeaderLabel = 1 << 12, // TableHeadersRow() will not submit label for this column. Convenient for some small columns. Name will still appear in context menu.
|
||||||
ImGuiTableColumnFlags_PreferSortDescending = 1 << 13, // Make the initial sort direction Descending when first sorting on this column.
|
ImGuiTableColumnFlags_NoHeaderWidth = 1 << 13, // Disable header text width contribution to automatic column width.
|
||||||
ImGuiTableColumnFlags_IndentEnable = 1 << 14, // Use current Indent value when entering cell (default for column 0).
|
ImGuiTableColumnFlags_PreferSortAscending = 1 << 14, // Make the initial sort direction Ascending when first sorting on this column (default).
|
||||||
ImGuiTableColumnFlags_IndentDisable = 1 << 15, // Ignore current Indent value when entering cell (default for columns > 0). Indentation changes _within_ the cell will still be honored.
|
ImGuiTableColumnFlags_PreferSortDescending = 1 << 15, // Make the initial sort direction Descending when first sorting on this column.
|
||||||
|
ImGuiTableColumnFlags_IndentEnable = 1 << 16, // Use current Indent value when entering cell (default for column 0).
|
||||||
|
ImGuiTableColumnFlags_IndentDisable = 1 << 17, // Ignore current Indent value when entering cell (default for columns > 0). Indentation changes _within_ the cell will still be honored.
|
||||||
|
|
||||||
// Output status flags, read-only via TableGetColumnFlags()
|
// Output status flags, read-only via TableGetColumnFlags()
|
||||||
ImGuiTableColumnFlags_IsEnabled = 1 << 20, // Status: is enabled == not hidden by user/api (referred to as "Hide" in _DefaultHide and _NoHide) flags.
|
ImGuiTableColumnFlags_IsEnabled = 1 << 24, // Status: is enabled == not hidden by user/api (referred to as "Hide" in _DefaultHide and _NoHide) flags.
|
||||||
ImGuiTableColumnFlags_IsVisible = 1 << 21, // Status: is visible == is enabled AND not clipped by scrolling.
|
ImGuiTableColumnFlags_IsVisible = 1 << 25, // Status: is visible == is enabled AND not clipped by scrolling.
|
||||||
ImGuiTableColumnFlags_IsSorted = 1 << 22, // Status: is currently part of the sort specs
|
ImGuiTableColumnFlags_IsSorted = 1 << 26, // Status: is currently part of the sort specs
|
||||||
ImGuiTableColumnFlags_IsHovered = 1 << 23, // Status: is hovered by mouse
|
ImGuiTableColumnFlags_IsHovered = 1 << 27, // Status: is hovered by mouse
|
||||||
|
|
||||||
// [Internal] Combinations and masks
|
// [Internal] Combinations and masks
|
||||||
ImGuiTableColumnFlags_WidthMask_ = ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_WidthFixed,
|
ImGuiTableColumnFlags_WidthMask_ = ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_WidthFixed,
|
||||||
@@ -1227,9 +1265,11 @@ enum ImGuiTableBgTarget_
|
|||||||
enum ImGuiFocusedFlags_
|
enum ImGuiFocusedFlags_
|
||||||
{
|
{
|
||||||
ImGuiFocusedFlags_None = 0,
|
ImGuiFocusedFlags_None = 0,
|
||||||
ImGuiFocusedFlags_ChildWindows = 1 << 0, // IsWindowFocused(): Return true if any children of the window is focused
|
ImGuiFocusedFlags_ChildWindows = 1 << 0, // Return true if any children of the window is focused
|
||||||
ImGuiFocusedFlags_RootWindow = 1 << 1, // IsWindowFocused(): Test from root window (top most parent of the current hierarchy)
|
ImGuiFocusedFlags_RootWindow = 1 << 1, // Test from root window (top most parent of the current hierarchy)
|
||||||
ImGuiFocusedFlags_AnyWindow = 1 << 2, // IsWindowFocused(): Return true if any window is focused. Important: If you are trying to tell how to dispatch your low-level inputs, do NOT use this. Use 'io.WantCaptureMouse' instead! Please read the FAQ!
|
ImGuiFocusedFlags_AnyWindow = 1 << 2, // Return true if any window is focused. Important: If you are trying to tell how to dispatch your low-level inputs, do NOT use this. Use 'io.WantCaptureMouse' instead! Please read the FAQ!
|
||||||
|
ImGuiFocusedFlags_NoPopupHierarchy = 1 << 3, // Do not consider popup hierarchy (do not treat popup emitter as parent of popup) (when used with _ChildWindows or _RootWindow)
|
||||||
|
//ImGuiFocusedFlags_DockHierarchy = 1 << 4, // Consider docking hierarchy (treat dockspace host as parent of docked window) (when used with _ChildWindows or _RootWindow)
|
||||||
ImGuiFocusedFlags_RootAndChildWindows = ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows
|
ImGuiFocusedFlags_RootAndChildWindows = ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1242,11 +1282,13 @@ enum ImGuiHoveredFlags_
|
|||||||
ImGuiHoveredFlags_ChildWindows = 1 << 0, // IsWindowHovered() only: Return true if any children of the window is hovered
|
ImGuiHoveredFlags_ChildWindows = 1 << 0, // IsWindowHovered() only: Return true if any children of the window is hovered
|
||||||
ImGuiHoveredFlags_RootWindow = 1 << 1, // IsWindowHovered() only: Test from root window (top most parent of the current hierarchy)
|
ImGuiHoveredFlags_RootWindow = 1 << 1, // IsWindowHovered() only: Test from root window (top most parent of the current hierarchy)
|
||||||
ImGuiHoveredFlags_AnyWindow = 1 << 2, // IsWindowHovered() only: Return true if any window is hovered
|
ImGuiHoveredFlags_AnyWindow = 1 << 2, // IsWindowHovered() only: Return true if any window is hovered
|
||||||
ImGuiHoveredFlags_AllowWhenBlockedByPopup = 1 << 3, // Return true even if a popup window is normally blocking access to this item/window
|
ImGuiHoveredFlags_NoPopupHierarchy = 1 << 3, // IsWindowHovered() only: Do not consider popup hierarchy (do not treat popup emitter as parent of popup) (when used with _ChildWindows or _RootWindow)
|
||||||
//ImGuiHoveredFlags_AllowWhenBlockedByModal = 1 << 4, // Return true even if a modal popup window is normally blocking access to this item/window. FIXME-TODO: Unavailable yet.
|
//ImGuiHoveredFlags_DockHierarchy = 1 << 4, // IsWindowHovered() only: Consider docking hierarchy (treat dockspace host as parent of docked window) (when used with _ChildWindows or _RootWindow)
|
||||||
ImGuiHoveredFlags_AllowWhenBlockedByActiveItem = 1 << 5, // Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns.
|
ImGuiHoveredFlags_AllowWhenBlockedByPopup = 1 << 5, // Return true even if a popup window is normally blocking access to this item/window
|
||||||
ImGuiHoveredFlags_AllowWhenOverlapped = 1 << 6, // Return true even if the position is obstructed or overlapped by another 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_AllowWhenDisabled = 1 << 7, // Return true even if the item is disabled
|
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, // 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
|
||||||
ImGuiHoveredFlags_RectOnly = ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_AllowWhenOverlapped,
|
ImGuiHoveredFlags_RectOnly = ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_AllowWhenOverlapped,
|
||||||
ImGuiHoveredFlags_RootAndChildWindows = ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows
|
ImGuiHoveredFlags_RootAndChildWindows = ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows
|
||||||
};
|
};
|
||||||
@@ -1372,13 +1414,12 @@ enum ImGuiNavInput_
|
|||||||
|
|
||||||
// [Internal] Don't use directly! This is used internally to differentiate keyboard from gamepad inputs for behaviors that require to differentiate them.
|
// [Internal] Don't use directly! This is used internally to differentiate keyboard from gamepad inputs for behaviors that require to differentiate them.
|
||||||
// Keyboard behavior that have no corresponding gamepad mapping (e.g. CTRL+TAB) will be directly reading from io.KeysDown[] instead of io.NavInputs[].
|
// Keyboard behavior that have no corresponding gamepad mapping (e.g. CTRL+TAB) will be directly reading from io.KeysDown[] instead of io.NavInputs[].
|
||||||
ImGuiNavInput_KeyMenu_, // toggle menu // = io.KeyAlt
|
|
||||||
ImGuiNavInput_KeyLeft_, // move left // = Arrow keys
|
ImGuiNavInput_KeyLeft_, // move left // = Arrow keys
|
||||||
ImGuiNavInput_KeyRight_, // move right
|
ImGuiNavInput_KeyRight_, // move right
|
||||||
ImGuiNavInput_KeyUp_, // move up
|
ImGuiNavInput_KeyUp_, // move up
|
||||||
ImGuiNavInput_KeyDown_, // move down
|
ImGuiNavInput_KeyDown_, // move down
|
||||||
ImGuiNavInput_COUNT,
|
ImGuiNavInput_COUNT,
|
||||||
ImGuiNavInput_InternalStart_ = ImGuiNavInput_KeyMenu_
|
ImGuiNavInput_InternalStart_ = ImGuiNavInput_KeyLeft_
|
||||||
};
|
};
|
||||||
|
|
||||||
// Configuration flags stored in io.ConfigFlags. Set by user/application.
|
// Configuration flags stored in io.ConfigFlags. Set by user/application.
|
||||||
@@ -1477,6 +1518,7 @@ enum ImGuiStyleVar_
|
|||||||
{
|
{
|
||||||
// Enum name --------------------- // Member in ImGuiStyle structure (see ImGuiStyle for descriptions)
|
// Enum name --------------------- // Member in ImGuiStyle structure (see ImGuiStyle for descriptions)
|
||||||
ImGuiStyleVar_Alpha, // float Alpha
|
ImGuiStyleVar_Alpha, // float Alpha
|
||||||
|
ImGuiStyleVar_DisabledAlpha, // float DisabledAlpha
|
||||||
ImGuiStyleVar_WindowPadding, // ImVec2 WindowPadding
|
ImGuiStyleVar_WindowPadding, // ImVec2 WindowPadding
|
||||||
ImGuiStyleVar_WindowRounding, // float WindowRounding
|
ImGuiStyleVar_WindowRounding, // float WindowRounding
|
||||||
ImGuiStyleVar_WindowBorderSize, // float WindowBorderSize
|
ImGuiStyleVar_WindowBorderSize, // float WindowBorderSize
|
||||||
@@ -1548,13 +1590,13 @@ enum ImGuiColorEditFlags_
|
|||||||
|
|
||||||
// Defaults Options. You can set application defaults using SetColorEditOptions(). The intent is that you probably don't want to
|
// Defaults Options. You can set application defaults using SetColorEditOptions(). The intent is that you probably don't want to
|
||||||
// override them in most of your calls. Let the user choose via the option menu and/or call SetColorEditOptions() once during startup.
|
// override them in most of your calls. Let the user choose via the option menu and/or call SetColorEditOptions() once during startup.
|
||||||
ImGuiColorEditFlags__OptionsDefault = ImGuiColorEditFlags_Uint8 | ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_PickerHueBar,
|
ImGuiColorEditFlags_DefaultOptions_ = ImGuiColorEditFlags_Uint8 | ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_PickerHueBar,
|
||||||
|
|
||||||
// [Internal] Masks
|
// [Internal] Masks
|
||||||
ImGuiColorEditFlags__DisplayMask = ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_DisplayHSV | ImGuiColorEditFlags_DisplayHex,
|
ImGuiColorEditFlags_DisplayMask_ = ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_DisplayHSV | ImGuiColorEditFlags_DisplayHex,
|
||||||
ImGuiColorEditFlags__DataTypeMask = ImGuiColorEditFlags_Uint8 | ImGuiColorEditFlags_Float,
|
ImGuiColorEditFlags_DataTypeMask_ = ImGuiColorEditFlags_Uint8 | ImGuiColorEditFlags_Float,
|
||||||
ImGuiColorEditFlags__PickerMask = ImGuiColorEditFlags_PickerHueWheel | ImGuiColorEditFlags_PickerHueBar,
|
ImGuiColorEditFlags_PickerMask_ = ImGuiColorEditFlags_PickerHueWheel | ImGuiColorEditFlags_PickerHueBar,
|
||||||
ImGuiColorEditFlags__InputMask = ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_InputHSV
|
ImGuiColorEditFlags_InputMask_ = ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_InputHSV
|
||||||
|
|
||||||
// Obsolete names (will be removed)
|
// Obsolete names (will be removed)
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
@@ -1665,7 +1707,11 @@ struct ImVector
|
|||||||
inline ImVector() { Size = Capacity = 0; Data = NULL; }
|
inline ImVector() { Size = Capacity = 0; Data = NULL; }
|
||||||
inline ImVector(const ImVector<T>& src) { Size = Capacity = 0; Data = NULL; operator=(src); }
|
inline ImVector(const ImVector<T>& src) { Size = Capacity = 0; Data = NULL; operator=(src); }
|
||||||
inline ImVector<T>& operator=(const ImVector<T>& src) { clear(); resize(src.Size); memcpy(Data, src.Data, (size_t)Size * sizeof(T)); return *this; }
|
inline ImVector<T>& operator=(const ImVector<T>& src) { clear(); resize(src.Size); memcpy(Data, src.Data, (size_t)Size * sizeof(T)); return *this; }
|
||||||
inline ~ImVector() { if (Data) IM_FREE(Data); }
|
inline ~ImVector() { if (Data) IM_FREE(Data); } // Important: does not destruct anything
|
||||||
|
|
||||||
|
inline void clear() { if (Data) { Size = Capacity = 0; IM_FREE(Data); Data = NULL; } } // Important: does not destruct anything
|
||||||
|
inline void clear_delete() { for (int n = 0; n < Size; n++) IM_DELETE(Data[n]); clear(); } // Important: never called automatically! always explicit.
|
||||||
|
inline void clear_destruct() { for (int n = 0; n < Size; n++) Data[n].~T(); clear(); } // Important: never called automatically! always explicit.
|
||||||
|
|
||||||
inline bool empty() const { return Size == 0; }
|
inline bool empty() const { return Size == 0; }
|
||||||
inline int size() const { return Size; }
|
inline int size() const { return Size; }
|
||||||
@@ -1675,7 +1721,6 @@ struct ImVector
|
|||||||
inline T& operator[](int i) { IM_ASSERT(i >= 0 && i < Size); return Data[i]; }
|
inline T& operator[](int i) { IM_ASSERT(i >= 0 && i < Size); return Data[i]; }
|
||||||
inline const T& operator[](int i) const { IM_ASSERT(i >= 0 && i < Size); return Data[i]; }
|
inline const T& operator[](int i) const { IM_ASSERT(i >= 0 && i < Size); return Data[i]; }
|
||||||
|
|
||||||
inline void clear() { if (Data) { Size = Capacity = 0; IM_FREE(Data); Data = NULL; } }
|
|
||||||
inline T* begin() { return Data; }
|
inline T* begin() { return Data; }
|
||||||
inline const T* begin() const { return Data; }
|
inline const T* begin() const { return Data; }
|
||||||
inline T* end() { return Data + Size; }
|
inline T* end() { return Data + Size; }
|
||||||
@@ -1720,6 +1765,7 @@ IM_MSVC_RUNTIME_CHECKS_RESTORE
|
|||||||
struct ImGuiStyle
|
struct ImGuiStyle
|
||||||
{
|
{
|
||||||
float Alpha; // Global alpha applies to everything in Dear ImGui.
|
float Alpha; // Global alpha applies to everything in Dear ImGui.
|
||||||
|
float DisabledAlpha; // Additional alpha multiplier applied by BeginDisabled(). Multiply over current value of Alpha.
|
||||||
ImVec2 WindowPadding; // Padding within a window.
|
ImVec2 WindowPadding; // Padding within a window.
|
||||||
float WindowRounding; // Radius of window corners rounding. Set to 0.0f to have rectangular windows. Large values tend to lead to variety of artifacts and are not recommended.
|
float WindowRounding; // Radius of window corners rounding. Set to 0.0f to have rectangular windows. Large values tend to lead to variety of artifacts and are not recommended.
|
||||||
float WindowBorderSize; // Thickness of border around windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly).
|
float WindowBorderSize; // Thickness of border around windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly).
|
||||||
@@ -1782,7 +1828,7 @@ struct ImGuiIO
|
|||||||
ImVec2 DisplaySize; // <unset> // Main display size, in pixels (generally == GetMainViewport()->Size)
|
ImVec2 DisplaySize; // <unset> // Main display size, in pixels (generally == GetMainViewport()->Size)
|
||||||
float DeltaTime; // = 1.0f/60.0f // Time elapsed since last frame, in seconds.
|
float DeltaTime; // = 1.0f/60.0f // Time elapsed since last frame, in seconds.
|
||||||
float IniSavingRate; // = 5.0f // Minimum time between saving positions/sizes to .ini file, in seconds.
|
float IniSavingRate; // = 5.0f // Minimum time between saving positions/sizes to .ini file, in seconds.
|
||||||
const char* IniFilename; // = "imgui.ini" // Path to .ini file. Set NULL to disable automatic .ini loading/saving, if e.g. you want to manually load/save from memory.
|
const char* IniFilename; // = "imgui.ini" // Path to .ini file (important: default "imgui.ini" is relative to current working dir!). Set NULL to disable automatic .ini loading/saving or if you want to manually call LoadIniSettingsXXX() / SaveIniSettingsXXX() functions.
|
||||||
const char* LogFilename; // = "imgui_log.txt"// Path to .log file (default parameter to ImGui::LogToFile when no file is specified).
|
const char* LogFilename; // = "imgui_log.txt"// Path to .log file (default parameter to ImGui::LogToFile when no file is specified).
|
||||||
float MouseDoubleClickTime; // = 0.30f // Time for a double-click, in seconds.
|
float MouseDoubleClickTime; // = 0.30f // Time for a double-click, in seconds.
|
||||||
float MouseDoubleClickMaxDist; // = 6.0f // Distance threshold to stay in to validate a double-click, in pixels.
|
float MouseDoubleClickMaxDist; // = 6.0f // Distance threshold to stay in to validate a double-click, in pixels.
|
||||||
@@ -1849,7 +1895,9 @@ struct ImGuiIO
|
|||||||
IMGUI_API void AddInputCharacter(unsigned int c); // Queue new character input
|
IMGUI_API void AddInputCharacter(unsigned int c); // Queue new character input
|
||||||
IMGUI_API void AddInputCharacterUTF16(ImWchar16 c); // Queue new character input from an UTF-16 character, it can be a surrogate
|
IMGUI_API void AddInputCharacterUTF16(ImWchar16 c); // Queue new character input from an UTF-16 character, it can be a surrogate
|
||||||
IMGUI_API void AddInputCharactersUTF8(const char* str); // Queue new characters input from an UTF-8 string
|
IMGUI_API void AddInputCharactersUTF8(const char* str); // Queue new characters input from an UTF-8 string
|
||||||
IMGUI_API void ClearInputCharacters(); // Clear the text input buffer manually
|
IMGUI_API void AddFocusEvent(bool focused); // Notifies Dear ImGui when hosting platform windows lose or gain input focus
|
||||||
|
IMGUI_API void ClearInputCharacters(); // [Internal] Clear the text input buffer manually
|
||||||
|
IMGUI_API void ClearInputKeys(); // [Internal] Release all keys
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Output - Updated by NewFrame() or EndFrame()/Render()
|
// Output - Updated by NewFrame() or EndFrame()/Render()
|
||||||
@@ -1876,14 +1924,17 @@ struct ImGuiIO
|
|||||||
// [Internal] Dear ImGui will maintain those fields. Forward compatibility not guaranteed!
|
// [Internal] Dear ImGui will maintain those fields. Forward compatibility not guaranteed!
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
|
bool WantCaptureMouseUnlessPopupClose;// Alternative to WantCaptureMouse: (WantCaptureMouse == true && WantCaptureMouseUnlessPopupClose == false) when a click over void is expected to close a popup.
|
||||||
ImGuiKeyModFlags KeyMods; // Key mods flags (same as io.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags), updated by NewFrame()
|
ImGuiKeyModFlags KeyMods; // Key mods flags (same as io.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags), updated by NewFrame()
|
||||||
|
ImGuiKeyModFlags KeyModsPrev; // Previous key mods
|
||||||
ImVec2 MousePosPrev; // Previous mouse position (note that MouseDelta is not necessary == MousePos-MousePosPrev, in case either position is invalid)
|
ImVec2 MousePosPrev; // Previous mouse position (note that MouseDelta is not necessary == MousePos-MousePosPrev, in case either position is invalid)
|
||||||
ImVec2 MouseClickedPos[5]; // Position at time of clicking
|
ImVec2 MouseClickedPos[5]; // Position at time of clicking
|
||||||
double MouseClickedTime[5]; // Time of last click (used to figure out double-click)
|
double MouseClickedTime[5]; // Time of last click (used to figure out double-click)
|
||||||
bool MouseClicked[5]; // Mouse button went from !Down to Down
|
bool MouseClicked[5]; // Mouse button went from !Down to Down
|
||||||
bool MouseDoubleClicked[5]; // Has mouse button been double-clicked?
|
bool MouseDoubleClicked[5]; // Has mouse button been double-clicked?
|
||||||
bool MouseReleased[5]; // Mouse button went from Down to !Down
|
bool MouseReleased[5]; // Mouse button went from Down to !Down
|
||||||
bool MouseDownOwned[5]; // Track if button was clicked inside a dear imgui window. We don't request mouse capture from the application if click started outside ImGui bounds.
|
bool MouseDownOwned[5]; // Track if button was clicked inside a dear imgui window or over void blocked by a popup. We don't request mouse capture from the application if click started outside ImGui bounds.
|
||||||
|
bool MouseDownOwnedUnlessPopupClose[5];//Track if button was clicked inside a dear imgui window.
|
||||||
bool MouseDownWasDoubleClick[5]; // Track if button down was a double-click
|
bool MouseDownWasDoubleClick[5]; // Track if button down was a double-click
|
||||||
float MouseDownDuration[5]; // Duration the mouse button has been down (0.0f == just clicked)
|
float MouseDownDuration[5]; // Duration the mouse button has been down (0.0f == just clicked)
|
||||||
float MouseDownDurationPrev[5]; // Previous time the mouse button has been down
|
float MouseDownDurationPrev[5]; // Previous time the mouse button has been down
|
||||||
@@ -1894,6 +1945,7 @@ struct ImGuiIO
|
|||||||
float NavInputsDownDuration[ImGuiNavInput_COUNT];
|
float NavInputsDownDuration[ImGuiNavInput_COUNT];
|
||||||
float NavInputsDownDurationPrev[ImGuiNavInput_COUNT];
|
float NavInputsDownDurationPrev[ImGuiNavInput_COUNT];
|
||||||
float PenPressure; // Touch/Pen pressure (0.0f to 1.0f, should be >0.0f only when MouseDown[0] == true). Helper storage currently unused by Dear ImGui.
|
float PenPressure; // Touch/Pen pressure (0.0f to 1.0f, should be >0.0f only when MouseDown[0] == true). Helper storage currently unused by Dear ImGui.
|
||||||
|
bool AppFocusLost;
|
||||||
ImWchar16 InputQueueSurrogate; // For AddInputCharacterUTF16
|
ImWchar16 InputQueueSurrogate; // For AddInputCharacterUTF16
|
||||||
ImVector<ImWchar> InputQueueCharacters; // Queue of _characters_ input (obtained by platform backend). Fill using AddInputCharacter() helper.
|
ImVector<ImWchar> InputQueueCharacters; // Queue of _characters_ input (obtained by platform backend). Fill using AddInputCharacter() helper.
|
||||||
|
|
||||||
@@ -2248,13 +2300,6 @@ struct ImDrawCmd
|
|||||||
inline ImTextureID GetTexID() const { return TextureId; }
|
inline ImTextureID GetTexID() const { return TextureId; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Vertex index, default to 16-bit
|
|
||||||
// To allow large meshes with 16-bit indices: set 'io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset' and handle ImDrawCmd::VtxOffset in the renderer backend (recommended).
|
|
||||||
// To use 32-bit indices: override with '#define ImDrawIdx unsigned int' in imconfig.h.
|
|
||||||
#ifndef ImDrawIdx
|
|
||||||
typedef unsigned short ImDrawIdx;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Vertex layout
|
// Vertex layout
|
||||||
#ifndef IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT
|
#ifndef IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT
|
||||||
struct ImDrawVert
|
struct ImDrawVert
|
||||||
@@ -2458,6 +2503,7 @@ struct ImDrawList
|
|||||||
IMGUI_API void _ResetForNewFrame();
|
IMGUI_API void _ResetForNewFrame();
|
||||||
IMGUI_API void _ClearFreeMemory();
|
IMGUI_API void _ClearFreeMemory();
|
||||||
IMGUI_API void _PopUnusedDrawCmd();
|
IMGUI_API void _PopUnusedDrawCmd();
|
||||||
|
IMGUI_API void _TryMergeDrawCmds();
|
||||||
IMGUI_API void _OnChangedClipRect();
|
IMGUI_API void _OnChangedClipRect();
|
||||||
IMGUI_API void _OnChangedTextureID();
|
IMGUI_API void _OnChangedTextureID();
|
||||||
IMGUI_API void _OnChangedVtxOffset();
|
IMGUI_API void _OnChangedVtxOffset();
|
||||||
@@ -2608,7 +2654,7 @@ struct ImFontAtlas
|
|||||||
IMGUI_API bool Build(); // Build pixels data. This is called automatically for you by the GetTexData*** functions.
|
IMGUI_API bool Build(); // Build pixels data. This is called automatically for you by the GetTexData*** functions.
|
||||||
IMGUI_API void GetTexDataAsAlpha8(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel = NULL); // 1 byte per-pixel
|
IMGUI_API void GetTexDataAsAlpha8(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel = NULL); // 1 byte per-pixel
|
||||||
IMGUI_API void GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel = NULL); // 4 bytes-per-pixel
|
IMGUI_API void GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel = NULL); // 4 bytes-per-pixel
|
||||||
bool IsBuilt() const { return Fonts.Size > 0 && (TexPixelsAlpha8 != NULL || TexPixelsRGBA32 != NULL); }
|
bool IsBuilt() const { return Fonts.Size > 0 && TexReady; } // Bit ambiguous: used to detect when user didn't built texture but effectively we should check TexID != 0 except that would be backend dependent...
|
||||||
void SetTexID(ImTextureID id) { TexID = id; }
|
void SetTexID(ImTextureID id) { TexID = id; }
|
||||||
|
|
||||||
//-------------------------------------------
|
//-------------------------------------------
|
||||||
@@ -2658,6 +2704,7 @@ struct ImFontAtlas
|
|||||||
|
|
||||||
// [Internal]
|
// [Internal]
|
||||||
// NB: Access texture data via GetTexData*() calls! Which will setup a default font for you.
|
// NB: Access texture data via GetTexData*() calls! Which will setup a default font for you.
|
||||||
|
bool TexReady; // Set when texture was built matching current font input
|
||||||
bool TexPixelsUseColors; // Tell whether our texture data is known to use colors (rather than just alpha channel), in order to help backend select a format.
|
bool TexPixelsUseColors; // Tell whether our texture data is known to use colors (rather than just alpha channel), in order to help backend select a format.
|
||||||
unsigned char* TexPixelsAlpha8; // 1 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight
|
unsigned char* TexPixelsAlpha8; // 1 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight
|
||||||
unsigned int* TexPixelsRGBA32; // 4 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight * 4
|
unsigned int* TexPixelsRGBA32; // 4 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight * 4
|
||||||
@@ -2680,7 +2727,7 @@ struct ImFontAtlas
|
|||||||
|
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
typedef ImFontAtlasCustomRect CustomRect; // OBSOLETED in 1.72+
|
typedef ImFontAtlasCustomRect CustomRect; // OBSOLETED in 1.72+
|
||||||
typedef ImFontGlyphRangesBuilder GlyphRangesBuilder; // OBSOLETED in 1.67+
|
//typedef ImFontGlyphRangesBuilder GlyphRangesBuilder; // OBSOLETED in 1.67+
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2702,8 +2749,9 @@ struct ImFont
|
|||||||
ImFontAtlas* ContainerAtlas; // 4-8 // out // // What we has been loaded into
|
ImFontAtlas* ContainerAtlas; // 4-8 // out // // What we has been loaded into
|
||||||
const ImFontConfig* ConfigData; // 4-8 // in // // Pointer within ContainerAtlas->ConfigData
|
const ImFontConfig* ConfigData; // 4-8 // in // // Pointer within ContainerAtlas->ConfigData
|
||||||
short ConfigDataCount; // 2 // in // ~ 1 // Number of ImFontConfig involved in creating this font. Bigger than 1 when merging multiple font sources into one ImFont.
|
short ConfigDataCount; // 2 // in // ~ 1 // Number of ImFontConfig involved in creating this font. Bigger than 1 when merging multiple font sources into one ImFont.
|
||||||
ImWchar FallbackChar; // 2 // in // = '?' // Replacement character if a glyph isn't found. Only set via SetFallbackChar()
|
ImWchar FallbackChar; // 2 // out // = FFFD/'?' // Character used if a glyph isn't found.
|
||||||
ImWchar EllipsisChar; // 2 // out // = -1 // Character used for ellipsis rendering.
|
ImWchar EllipsisChar; // 2 // out // = '...' // Character used for ellipsis rendering.
|
||||||
|
ImWchar DotChar; // 2 // out // = '.' // Character used for ellipsis rendering (if a single '...' character isn't found)
|
||||||
bool DirtyLookupTables; // 1 // out //
|
bool DirtyLookupTables; // 1 // out //
|
||||||
float Scale; // 4 // in // = 1.f // Base font scale, multiplied by the per-window font scale which you can adjust with SetWindowFontScale()
|
float Scale; // 4 // in // = 1.f // Base font scale, multiplied by the per-window font scale which you can adjust with SetWindowFontScale()
|
||||||
float Ascent, Descent; // 4+4 // out // // Ascent: distance from top to bottom of e.g. 'A' [0..FontSize]
|
float Ascent, Descent; // 4+4 // out // // Ascent: distance from top to bottom of e.g. 'A' [0..FontSize]
|
||||||
@@ -2733,7 +2781,6 @@ struct ImFont
|
|||||||
IMGUI_API void AddGlyph(const ImFontConfig* src_cfg, ImWchar c, float x0, float y0, float x1, float y1, float u0, float v0, float u1, float v1, float advance_x);
|
IMGUI_API void AddGlyph(const ImFontConfig* src_cfg, ImWchar c, float x0, float y0, float x1, float y1, float u0, float v0, float u1, float v1, float advance_x);
|
||||||
IMGUI_API void AddRemapChar(ImWchar dst, ImWchar src, bool overwrite_dst = true); // Makes 'dst' character/glyph points to 'src' character/glyph. Currently needs to be called AFTER fonts have been built.
|
IMGUI_API void AddRemapChar(ImWchar dst, ImWchar src, bool overwrite_dst = true); // Makes 'dst' character/glyph points to 'src' character/glyph. Currently needs to be called AFTER fonts have been built.
|
||||||
IMGUI_API void SetGlyphVisible(ImWchar c, bool visible);
|
IMGUI_API void SetGlyphVisible(ImWchar c, bool visible);
|
||||||
IMGUI_API void SetFallbackChar(ImWchar c);
|
|
||||||
IMGUI_API bool IsGlyphRangeUnused(unsigned int c_begin, unsigned int c_last);
|
IMGUI_API bool IsGlyphRangeUnused(unsigned int c_begin, unsigned int c_last);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2741,7 +2788,7 @@ struct ImFont
|
|||||||
// [SECTION] Viewports
|
// [SECTION] Viewports
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Flags stored in ImGuiViewport::Flags
|
// Flags stored in ImGuiViewport::Flags, giving indications to the platform backends.
|
||||||
enum ImGuiViewportFlags_
|
enum ImGuiViewportFlags_
|
||||||
{
|
{
|
||||||
ImGuiViewportFlags_None = 0,
|
ImGuiViewportFlags_None = 0,
|
||||||
@@ -2781,6 +2828,8 @@ struct ImGuiViewport
|
|||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
namespace ImGui
|
namespace ImGui
|
||||||
{
|
{
|
||||||
|
// OBSOLETED in 1.85 (from August 2021)
|
||||||
|
static inline float GetWindowContentRegionWidth() { return GetWindowContentRegionMax().x - GetWindowContentRegionMin().x; }
|
||||||
// OBSOLETED in 1.81 (from February 2021)
|
// OBSOLETED in 1.81 (from February 2021)
|
||||||
IMGUI_API bool ListBoxHeader(const char* label, int items_count, int height_in_items = -1); // Helper to calculate size from items_count and height_in_items
|
IMGUI_API bool ListBoxHeader(const char* label, int items_count, int height_in_items = -1); // Helper to calculate size from items_count and height_in_items
|
||||||
static inline bool ListBoxHeader(const char* label, const ImVec2& size = ImVec2(0, 0)) { return BeginListBox(label, size); }
|
static inline bool ListBoxHeader(const char* label, const ImVec2& size = ImVec2(0, 0)) { return BeginListBox(label, size); }
|
||||||
@@ -2810,8 +2859,18 @@ namespace ImGui
|
|||||||
static inline void SetNextTreeNodeOpen(bool open, ImGuiCond cond = 0) { SetNextItemOpen(open, cond); }
|
static inline void SetNextTreeNodeOpen(bool open, ImGuiCond cond = 0) { SetNextItemOpen(open, cond); }
|
||||||
// OBSOLETED in 1.70 (from May 2019)
|
// OBSOLETED in 1.70 (from May 2019)
|
||||||
static inline float GetContentRegionAvailWidth() { return GetContentRegionAvail().x; }
|
static inline float GetContentRegionAvailWidth() { return GetContentRegionAvail().x; }
|
||||||
// OBSOLETED in 1.69 (from Mar 2019)
|
|
||||||
static inline ImDrawList* GetOverlayDrawList() { return GetForegroundDrawList(); }
|
// Some of the older obsolete names along with their replacement (commented out so they are not reported in IDE)
|
||||||
|
//static inline ImDrawList* GetOverlayDrawList() { return GetForegroundDrawList(); } // OBSOLETED in 1.69 (from Mar 2019)
|
||||||
|
//static inline void SetScrollHere(float ratio = 0.5f) { SetScrollHereY(ratio); } // OBSOLETED in 1.66 (from Nov 2018)
|
||||||
|
//static inline bool IsItemDeactivatedAfterChange() { return IsItemDeactivatedAfterEdit(); } // OBSOLETED in 1.63 (from Aug 2018)
|
||||||
|
//static inline bool IsAnyWindowFocused() { return IsWindowFocused(ImGuiFocusedFlags_AnyWindow); } // OBSOLETED in 1.60 (from Apr 2018)
|
||||||
|
//static inline bool IsAnyWindowHovered() { return IsWindowHovered(ImGuiHoveredFlags_AnyWindow); } // OBSOLETED in 1.60 (between Dec 2017 and Apr 2018)
|
||||||
|
//static inline void ShowTestWindow() { return ShowDemoWindow(); } // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017)
|
||||||
|
//static inline bool IsRootWindowFocused() { return IsWindowFocused(ImGuiFocusedFlags_RootWindow); } // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017)
|
||||||
|
//static inline bool IsRootWindowOrAnyChildFocused() { return IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows); } // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017)
|
||||||
|
//static inline void SetNextWindowContentWidth(float w) { SetNextWindowContentSize(ImVec2(w, 0.0f)); } // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017)
|
||||||
|
//static inline float GetItemsLineHeightWithSpacing() { return GetFrameHeightWithSpacing(); } // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017)
|
||||||
}
|
}
|
||||||
|
|
||||||
// OBSOLETED in 1.82 (from Mars 2021): flags for AddRect(), AddRectFilled(), AddImageRounded(), PathRect()
|
// OBSOLETED in 1.82 (from Mars 2021): flags for AddRect(), AddRectFilled(), AddImageRounded(), PathRect()
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.83
|
// dear imgui, v1.85
|
||||||
// (demo code)
|
// (demo code)
|
||||||
|
|
||||||
// Help:
|
// Help:
|
||||||
@@ -54,7 +54,6 @@ Index of this file:
|
|||||||
// - sub section: ShowDemoWindowTables()
|
// - sub section: ShowDemoWindowTables()
|
||||||
// - sub section: ShowDemoWindowMisc()
|
// - sub section: ShowDemoWindowMisc()
|
||||||
// [SECTION] About Window / ShowAboutWindow()
|
// [SECTION] About Window / ShowAboutWindow()
|
||||||
// [SECTION] Font Viewer / ShowFontAtlas()
|
|
||||||
// [SECTION] Style Editor / ShowStyleEditor()
|
// [SECTION] Style Editor / ShowStyleEditor()
|
||||||
// [SECTION] Example App: Main Menu Bar / ShowExampleAppMainMenuBar()
|
// [SECTION] Example App: Main Menu Bar / ShowExampleAppMainMenuBar()
|
||||||
// [SECTION] Example App: Debug Console / ShowExampleAppConsole()
|
// [SECTION] Example App: Debug Console / ShowExampleAppConsole()
|
||||||
@@ -164,9 +163,6 @@ Index of this file:
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//For Custom widget
|
|
||||||
#include "imgui_filebrowser.h"
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// [SECTION] Forward Declarations, Helpers
|
// [SECTION] Forward Declarations, Helpers
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -256,19 +252,11 @@ static void ShowDemoWindowTables();
|
|||||||
static void ShowDemoWindowColumns();
|
static void ShowDemoWindowColumns();
|
||||||
static void ShowDemoWindowMisc();
|
static void ShowDemoWindowMisc();
|
||||||
|
|
||||||
// file browser
|
|
||||||
static bool show_open_dialog = false;
|
|
||||||
static bool show_save_dialog = false;
|
|
||||||
static bool show_select_dialog = false;
|
|
||||||
|
|
||||||
// Demonstrate most Dear ImGui features (this is big function!)
|
// Demonstrate most Dear ImGui features (this is big function!)
|
||||||
// You may execute this function to experiment with the UI and understand what it does.
|
// You may execute this function to experiment with the UI and understand what it does.
|
||||||
// You may then search for keywords in the code when you are interested by a specific feature.
|
// You may then search for keywords in the code when you are interested by a specific feature.
|
||||||
void ImGui::ShowDemoWindow(bool* p_open)
|
void ImGui::ShowDemoWindow(bool* p_open)
|
||||||
{
|
{
|
||||||
//For Demonstrating File Dialog Addon accessible from MainMenu bar (from Examples Menu) or simple Menu bar
|
|
||||||
static imgui_addons::ImGuiFileBrowser file_dialog;
|
|
||||||
|
|
||||||
// Exceptionally add an extra assert here for people confused about initial Dear ImGui setup
|
// Exceptionally add an extra assert here for people confused about initial Dear ImGui setup
|
||||||
// Most ImGui functions would normally just crash if the context is missing.
|
// Most ImGui functions would normally just crash if the context is missing.
|
||||||
IM_ASSERT(ImGui::GetCurrentContext() != NULL && "Missing dear imgui context. Refer to examples app!");
|
IM_ASSERT(ImGui::GetCurrentContext() != NULL && "Missing dear imgui context. Refer to examples app!");
|
||||||
@@ -306,10 +294,12 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
|
|
||||||
// Dear ImGui Apps (accessible from the "Tools" menu)
|
// Dear ImGui Apps (accessible from the "Tools" menu)
|
||||||
static bool show_app_metrics = false;
|
static bool show_app_metrics = false;
|
||||||
|
static bool show_app_stack_tool = false;
|
||||||
static bool show_app_style_editor = false;
|
static bool show_app_style_editor = false;
|
||||||
static bool show_app_about = false;
|
static bool show_app_about = false;
|
||||||
|
|
||||||
if (show_app_metrics) { ImGui::ShowMetricsWindow(&show_app_metrics); }
|
if (show_app_metrics) { ImGui::ShowMetricsWindow(&show_app_metrics); }
|
||||||
|
if (show_app_stack_tool) { ImGui::ShowStackToolWindow(&show_app_stack_tool); }
|
||||||
if (show_app_about) { ImGui::ShowAboutWindow(&show_app_about); }
|
if (show_app_about) { ImGui::ShowAboutWindow(&show_app_about); }
|
||||||
if (show_app_style_editor)
|
if (show_app_style_editor)
|
||||||
{
|
{
|
||||||
@@ -329,6 +319,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
static bool no_nav = false;
|
static bool no_nav = false;
|
||||||
static bool no_background = false;
|
static bool no_background = false;
|
||||||
static bool no_bring_to_front = false;
|
static bool no_bring_to_front = false;
|
||||||
|
static bool unsaved_document = false;
|
||||||
|
|
||||||
ImGuiWindowFlags window_flags = 0;
|
ImGuiWindowFlags window_flags = 0;
|
||||||
if (no_titlebar) window_flags |= ImGuiWindowFlags_NoTitleBar;
|
if (no_titlebar) window_flags |= ImGuiWindowFlags_NoTitleBar;
|
||||||
@@ -340,6 +331,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
if (no_nav) window_flags |= ImGuiWindowFlags_NoNav;
|
if (no_nav) window_flags |= ImGuiWindowFlags_NoNav;
|
||||||
if (no_background) window_flags |= ImGuiWindowFlags_NoBackground;
|
if (no_background) window_flags |= ImGuiWindowFlags_NoBackground;
|
||||||
if (no_bring_to_front) window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus;
|
if (no_bring_to_front) window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus;
|
||||||
|
if (unsaved_document) window_flags |= ImGuiWindowFlags_UnsavedDocument;
|
||||||
if (no_close) p_open = NULL; // Don't pass our bool* to Begin
|
if (no_close) p_open = NULL; // Don't pass our bool* to Begin
|
||||||
|
|
||||||
// We specify a default position/size in case there's no data in the .ini file.
|
// We specify a default position/size in case there's no data in the .ini file.
|
||||||
@@ -389,47 +381,17 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::MenuItem("Documents", NULL, &show_app_documents);
|
ImGui::MenuItem("Documents", NULL, &show_app_documents);
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
|
//if (ImGui::MenuItem("MenuItem")) {} // You can also use MenuItem() inside a menu bar!
|
||||||
if (ImGui::BeginMenu("Tools"))
|
if (ImGui::BeginMenu("Tools"))
|
||||||
{
|
{
|
||||||
|
#ifndef IMGUI_DISABLE_METRICS_WINDOW
|
||||||
ImGui::MenuItem("Metrics/Debugger", NULL, &show_app_metrics);
|
ImGui::MenuItem("Metrics/Debugger", NULL, &show_app_metrics);
|
||||||
|
ImGui::MenuItem("Stack Tool", NULL, &show_app_stack_tool);
|
||||||
|
#endif
|
||||||
ImGui::MenuItem("Style Editor", NULL, &show_app_style_editor);
|
ImGui::MenuItem("Style Editor", NULL, &show_app_style_editor);
|
||||||
ImGui::MenuItem("About Dear ImGui", NULL, &show_app_about);
|
ImGui::MenuItem("About Dear ImGui", NULL, &show_app_about);
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
if(show_open_dialog)
|
|
||||||
{
|
|
||||||
ImGui::OpenPopup("Open File");
|
|
||||||
show_open_dialog = false;
|
|
||||||
}
|
|
||||||
else if (show_save_dialog)
|
|
||||||
{
|
|
||||||
ImGui::OpenPopup("Save File");
|
|
||||||
show_save_dialog = false;
|
|
||||||
}
|
|
||||||
else if (show_select_dialog)
|
|
||||||
{
|
|
||||||
ImGui::OpenPopup("Select Directory##popup");
|
|
||||||
show_select_dialog = false;
|
|
||||||
}
|
|
||||||
//Show an open/save/select file dialog. Last argument provides a list of supported files. Selecting other files will show error. If "*.*" is provided, all files can be opened.
|
|
||||||
if(file_dialog.showFileDialog("Open File", imgui_addons::ImGuiFileBrowser::DialogMode::OPEN, ImVec2(600, 300), ".h,.cpp,.c"))
|
|
||||||
{
|
|
||||||
printf("%s\n", file_dialog.selected_fn.c_str());
|
|
||||||
printf("%s\n", file_dialog.selected_path.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
if(file_dialog.showFileDialog("Select Directory##popup", imgui_addons::ImGuiFileBrowser::DialogMode::SELECT, ImVec2(600, 300)))
|
|
||||||
{
|
|
||||||
printf("%s\n", file_dialog.selected_fn.c_str());
|
|
||||||
printf("%s\n", file_dialog.selected_path.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
if(file_dialog.showFileDialog("Save File", imgui_addons::ImGuiFileBrowser::DialogMode::SAVE, ImVec2(600, 300), ".png,.jpg,.bmp"))
|
|
||||||
{
|
|
||||||
printf("%s\n", file_dialog.selected_fn.c_str());
|
|
||||||
printf("%s\n", file_dialog.ext.c_str());
|
|
||||||
printf("%s\n", file_dialog.selected_path.c_str());
|
|
||||||
}
|
|
||||||
ImGui::EndMenuBar();
|
ImGui::EndMenuBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -502,7 +464,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
{
|
{
|
||||||
HelpMarker(
|
HelpMarker(
|
||||||
"Those flags are set by the backends (imgui_impl_xxx files) to specify their capabilities.\n"
|
"Those flags are set by the backends (imgui_impl_xxx files) to specify their capabilities.\n"
|
||||||
"Here we expose then as read-only fields to avoid breaking interactions with your backend.");
|
"Here we expose them as read-only fields to avoid breaking interactions with your backend.");
|
||||||
|
|
||||||
// Make a local copy to avoid modifying actual backend flags.
|
// Make a local copy to avoid modifying actual backend flags.
|
||||||
ImGuiBackendFlags backend_flags = io.BackendFlags;
|
ImGuiBackendFlags backend_flags = io.BackendFlags;
|
||||||
@@ -555,6 +517,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::TableNextColumn(); ImGui::Checkbox("No nav", &no_nav);
|
ImGui::TableNextColumn(); ImGui::Checkbox("No nav", &no_nav);
|
||||||
ImGui::TableNextColumn(); ImGui::Checkbox("No background", &no_background);
|
ImGui::TableNextColumn(); ImGui::Checkbox("No background", &no_background);
|
||||||
ImGui::TableNextColumn(); ImGui::Checkbox("No bring to front", &no_bring_to_front);
|
ImGui::TableNextColumn(); ImGui::Checkbox("No bring to front", &no_bring_to_front);
|
||||||
|
ImGui::TableNextColumn(); ImGui::Checkbox("Unsaved document", &unsaved_document);
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -576,6 +539,10 @@ static void ShowDemoWindowWidgets()
|
|||||||
if (!ImGui::CollapsingHeader("Widgets"))
|
if (!ImGui::CollapsingHeader("Widgets"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
static bool disable_all = false; // The Checkbox for that is inside the "Disabled" section at the bottom
|
||||||
|
if (disable_all)
|
||||||
|
ImGui::BeginDisabled();
|
||||||
|
|
||||||
if (ImGui::TreeNode("Basic"))
|
if (ImGui::TreeNode("Basic"))
|
||||||
{
|
{
|
||||||
static int clicked = 0;
|
static int clicked = 0;
|
||||||
@@ -1072,8 +1039,8 @@ static void ShowDemoWindowWidgets()
|
|||||||
// stored in the object itself, etc.)
|
// stored in the object itself, etc.)
|
||||||
const char* items[] = { "AAAA", "BBBB", "CCCC", "DDDD", "EEEE", "FFFF", "GGGG", "HHHH", "IIII", "JJJJ", "KKKK", "LLLLLLL", "MMMM", "OOOOOOO" };
|
const char* items[] = { "AAAA", "BBBB", "CCCC", "DDDD", "EEEE", "FFFF", "GGGG", "HHHH", "IIII", "JJJJ", "KKKK", "LLLLLLL", "MMMM", "OOOOOOO" };
|
||||||
static int item_current_idx = 0; // Here we store our selection data as an index.
|
static int item_current_idx = 0; // Here we store our selection data as an index.
|
||||||
const char* combo_label = items[item_current_idx]; // Label to preview before opening the combo (technically it could be anything)
|
const char* combo_preview_value = items[item_current_idx]; // Pass in the preview value visible before opening the combo (it could be anything)
|
||||||
if (ImGui::BeginCombo("combo 1", combo_label, flags))
|
if (ImGui::BeginCombo("combo 1", combo_preview_value, flags))
|
||||||
{
|
{
|
||||||
for (int n = 0; n < IM_ARRAYSIZE(items); n++)
|
for (int n = 0; n < IM_ARRAYSIZE(items); n++)
|
||||||
{
|
{
|
||||||
@@ -1089,10 +1056,12 @@ static void ShowDemoWindowWidgets()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Simplified one-liner Combo() API, using values packed in a single constant string
|
// Simplified one-liner Combo() API, using values packed in a single constant string
|
||||||
|
// This is a convenience for when the selection set is small and known at compile-time.
|
||||||
static int item_current_2 = 0;
|
static int item_current_2 = 0;
|
||||||
ImGui::Combo("combo 2 (one-liner)", &item_current_2, "aaaa\0bbbb\0cccc\0dddd\0eeee\0\0");
|
ImGui::Combo("combo 2 (one-liner)", &item_current_2, "aaaa\0bbbb\0cccc\0dddd\0eeee\0\0");
|
||||||
|
|
||||||
// Simplified one-liner Combo() using an array of const char*
|
// Simplified one-liner Combo() using an array of const char*
|
||||||
|
// This is not very useful (may obsolete): prefer using BeginCombo()/EndCombo() for full control.
|
||||||
static int item_current_3 = -1; // If the selection isn't within 0..count, Combo won't display a preview
|
static int item_current_3 = -1; // If the selection isn't within 0..count, Combo won't display a preview
|
||||||
ImGui::Combo("combo 3 (array)", &item_current_3, items, IM_ARRAYSIZE(items));
|
ImGui::Combo("combo 3 (array)", &item_current_3, items, IM_ARRAYSIZE(items));
|
||||||
|
|
||||||
@@ -1159,7 +1128,7 @@ static void ShowDemoWindowWidgets()
|
|||||||
static bool selection[5] = { false, true, false, false, false };
|
static bool selection[5] = { false, true, false, false, false };
|
||||||
ImGui::Selectable("1. I am selectable", &selection[0]);
|
ImGui::Selectable("1. I am selectable", &selection[0]);
|
||||||
ImGui::Selectable("2. I am selectable", &selection[1]);
|
ImGui::Selectable("2. I am selectable", &selection[1]);
|
||||||
ImGui::Text("3. I am not selectable");
|
ImGui::Text("(I am not selectable)");
|
||||||
ImGui::Selectable("4. I am selectable", &selection[3]);
|
ImGui::Selectable("4. I am selectable", &selection[3]);
|
||||||
if (ImGui::Selectable("5. I am double clickable", selection[4], ImGuiSelectableFlags_AllowDoubleClick))
|
if (ImGui::Selectable("5. I am double clickable", selection[4], ImGuiSelectableFlags_AllowDoubleClick))
|
||||||
if (ImGui::IsMouseDoubleClicked(0))
|
if (ImGui::IsMouseDoubleClicked(0))
|
||||||
@@ -1209,7 +1178,7 @@ static void ShowDemoWindowWidgets()
|
|||||||
{
|
{
|
||||||
static bool selected[10] = {};
|
static bool selected[10] = {};
|
||||||
|
|
||||||
if (ImGui::BeginTable("split1", 3, ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings))
|
if (ImGui::BeginTable("split1", 3, ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings | ImGuiTableFlags_Borders))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
@@ -1220,8 +1189,8 @@ static void ShowDemoWindowWidgets()
|
|||||||
}
|
}
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
ImGui::Separator();
|
ImGui::Spacing();
|
||||||
if (ImGui::BeginTable("split2", 3, ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings))
|
if (ImGui::BeginTable("split2", 3, ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings | ImGuiTableFlags_Borders))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
@@ -1598,16 +1567,17 @@ static void ShowDemoWindowWidgets()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Plot/Graph widgets are not very good.
|
// Plot/Graph widgets are not very good.
|
||||||
// Consider writing your own, or using a third-party one, see:
|
// Consider using a third-party library such as ImPlot: https://github.com/epezent/implot
|
||||||
// - ImPlot https://github.com/epezent/implot
|
// (see others https://github.com/ocornut/imgui/wiki/Useful-Extensions)
|
||||||
// - others https://github.com/ocornut/imgui/wiki/Useful-Extensions
|
|
||||||
if (ImGui::TreeNode("Plots Widgets"))
|
if (ImGui::TreeNode("Plots Widgets"))
|
||||||
{
|
{
|
||||||
static bool animate = true;
|
static bool animate = true;
|
||||||
ImGui::Checkbox("Animate", &animate);
|
ImGui::Checkbox("Animate", &animate);
|
||||||
|
|
||||||
|
// Plot as lines and plot as histogram
|
||||||
static float arr[] = { 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f };
|
static float arr[] = { 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f };
|
||||||
ImGui::PlotLines("Frame Times", arr, IM_ARRAYSIZE(arr));
|
ImGui::PlotLines("Frame Times", arr, IM_ARRAYSIZE(arr));
|
||||||
|
ImGui::PlotHistogram("Histogram", arr, IM_ARRAYSIZE(arr), 0, NULL, 0.0f, 1.0f, ImVec2(0, 80.0f));
|
||||||
|
|
||||||
// Fill an array of contiguous float values to plot
|
// Fill an array of contiguous float values to plot
|
||||||
// Tip: If your float aren't contiguous but part of a structure, you can pass a pointer to your first float
|
// Tip: If your float aren't contiguous but part of a structure, you can pass a pointer to your first float
|
||||||
@@ -1637,7 +1607,6 @@ static void ShowDemoWindowWidgets()
|
|||||||
sprintf(overlay, "avg %f", average);
|
sprintf(overlay, "avg %f", average);
|
||||||
ImGui::PlotLines("Lines", values, IM_ARRAYSIZE(values), values_offset, overlay, -1.0f, 1.0f, ImVec2(0, 80.0f));
|
ImGui::PlotLines("Lines", values, IM_ARRAYSIZE(values), values_offset, overlay, -1.0f, 1.0f, ImVec2(0, 80.0f));
|
||||||
}
|
}
|
||||||
ImGui::PlotHistogram("Histogram", arr, IM_ARRAYSIZE(arr), 0, NULL, 0.0f, 1.0f, ImVec2(0, 80.0f));
|
|
||||||
|
|
||||||
// Use functions to generate output
|
// Use functions to generate output
|
||||||
// FIXME: This is rather awkward because current plot API only pass in indices.
|
// FIXME: This is rather awkward because current plot API only pass in indices.
|
||||||
@@ -2222,24 +2191,28 @@ static void ShowDemoWindowWidgets()
|
|||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::TreeNode("Querying Status (Edited/Active/Focused/Hovered etc.)"))
|
if (ImGui::TreeNode("Querying Item Status (Edited/Active/Hovered etc.)"))
|
||||||
{
|
{
|
||||||
// Select an item type
|
// Select an item type
|
||||||
const char* item_names[] =
|
const char* item_names[] =
|
||||||
{
|
{
|
||||||
"Text", "Button", "Button (w/ repeat)", "Checkbox", "SliderFloat", "InputText", "InputFloat",
|
"Text", "Button", "Button (w/ repeat)", "Checkbox", "SliderFloat", "InputText", "InputFloat",
|
||||||
"InputFloat3", "ColorEdit4", "MenuItem", "TreeNode", "TreeNode (w/ double-click)", "Combo", "ListBox"
|
"InputFloat3", "ColorEdit4", "Selectable", "MenuItem", "TreeNode", "TreeNode (w/ double-click)", "Combo", "ListBox"
|
||||||
};
|
};
|
||||||
static int item_type = 1;
|
static int item_type = 4;
|
||||||
|
static bool item_disabled = false;
|
||||||
ImGui::Combo("Item Type", &item_type, item_names, IM_ARRAYSIZE(item_names), IM_ARRAYSIZE(item_names));
|
ImGui::Combo("Item Type", &item_type, item_names, IM_ARRAYSIZE(item_names), IM_ARRAYSIZE(item_names));
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
HelpMarker("Testing how various types of items are interacting with the IsItemXXX functions. Note that the bool return value of most ImGui function is generally equivalent to calling ImGui::IsItemHovered().");
|
HelpMarker("Testing how various types of items are interacting with the IsItemXXX functions. Note that the bool return value of most ImGui function is generally equivalent to calling ImGui::IsItemHovered().");
|
||||||
|
ImGui::Checkbox("Item Disabled", &item_disabled);
|
||||||
|
|
||||||
// Submit selected item item so we can query their status in the code following it.
|
// Submit selected item item so we can query their status in the code following it.
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
static bool b = false;
|
static bool b = false;
|
||||||
static float col4f[4] = { 1.0f, 0.5, 0.0f, 1.0f };
|
static float col4f[4] = { 1.0f, 0.5, 0.0f, 1.0f };
|
||||||
static char str[16] = {};
|
static char str[16] = {};
|
||||||
|
if (item_disabled)
|
||||||
|
ImGui::BeginDisabled(true);
|
||||||
if (item_type == 0) { ImGui::Text("ITEM: Text"); } // Testing text items with no identifier/interaction
|
if (item_type == 0) { ImGui::Text("ITEM: Text"); } // Testing text items with no identifier/interaction
|
||||||
if (item_type == 1) { ret = ImGui::Button("ITEM: Button"); } // Testing button
|
if (item_type == 1) { ret = ImGui::Button("ITEM: Button"); } // Testing button
|
||||||
if (item_type == 2) { ImGui::PushButtonRepeat(true); ret = ImGui::Button("ITEM: Button"); ImGui::PopButtonRepeat(); } // Testing button (with repeater)
|
if (item_type == 2) { ImGui::PushButtonRepeat(true); ret = ImGui::Button("ITEM: Button"); ImGui::PopButtonRepeat(); } // Testing button (with repeater)
|
||||||
@@ -2249,11 +2222,12 @@ static void ShowDemoWindowWidgets()
|
|||||||
if (item_type == 6) { ret = ImGui::InputFloat("ITEM: InputFloat", col4f, 1.0f); } // Testing +/- buttons on scalar input
|
if (item_type == 6) { ret = ImGui::InputFloat("ITEM: InputFloat", col4f, 1.0f); } // Testing +/- buttons on scalar input
|
||||||
if (item_type == 7) { ret = ImGui::InputFloat3("ITEM: InputFloat3", col4f); } // Testing multi-component items (IsItemXXX flags are reported merged)
|
if (item_type == 7) { ret = ImGui::InputFloat3("ITEM: InputFloat3", col4f); } // Testing multi-component items (IsItemXXX flags are reported merged)
|
||||||
if (item_type == 8) { ret = ImGui::ColorEdit4("ITEM: ColorEdit4", col4f); } // Testing multi-component items (IsItemXXX flags are reported merged)
|
if (item_type == 8) { ret = ImGui::ColorEdit4("ITEM: ColorEdit4", col4f); } // Testing multi-component items (IsItemXXX flags are reported merged)
|
||||||
if (item_type == 9) { ret = ImGui::MenuItem("ITEM: MenuItem"); } // Testing menu item (they use ImGuiButtonFlags_PressedOnRelease button policy)
|
if (item_type == 9) { ret = ImGui::Selectable("ITEM: Selectable"); } // Testing selectable item
|
||||||
if (item_type == 10){ ret = ImGui::TreeNode("ITEM: TreeNode"); if (ret) ImGui::TreePop(); } // Testing tree node
|
if (item_type == 10){ ret = ImGui::MenuItem("ITEM: MenuItem"); } // Testing menu item (they use ImGuiButtonFlags_PressedOnRelease button policy)
|
||||||
if (item_type == 11){ ret = ImGui::TreeNodeEx("ITEM: TreeNode w/ ImGuiTreeNodeFlags_OpenOnDoubleClick", ImGuiTreeNodeFlags_OpenOnDoubleClick | ImGuiTreeNodeFlags_NoTreePushOnOpen); } // Testing tree node with ImGuiButtonFlags_PressedOnDoubleClick button policy.
|
if (item_type == 11){ ret = ImGui::TreeNode("ITEM: TreeNode"); if (ret) ImGui::TreePop(); } // Testing tree node
|
||||||
if (item_type == 12){ const char* items[] = { "Apple", "Banana", "Cherry", "Kiwi" }; static int current = 1; ret = ImGui::Combo("ITEM: Combo", ¤t, items, IM_ARRAYSIZE(items)); }
|
if (item_type == 12){ ret = ImGui::TreeNodeEx("ITEM: TreeNode w/ ImGuiTreeNodeFlags_OpenOnDoubleClick", ImGuiTreeNodeFlags_OpenOnDoubleClick | ImGuiTreeNodeFlags_NoTreePushOnOpen); } // Testing tree node with ImGuiButtonFlags_PressedOnDoubleClick button policy.
|
||||||
if (item_type == 13){ const char* items[] = { "Apple", "Banana", "Cherry", "Kiwi" }; static int current = 1; ret = ImGui::ListBox("ITEM: ListBox", ¤t, items, IM_ARRAYSIZE(items), IM_ARRAYSIZE(items)); }
|
if (item_type == 13){ const char* items[] = { "Apple", "Banana", "Cherry", "Kiwi" }; static int current = 1; ret = ImGui::Combo("ITEM: Combo", ¤t, items, IM_ARRAYSIZE(items)); }
|
||||||
|
if (item_type == 14){ const char* items[] = { "Apple", "Banana", "Cherry", "Kiwi" }; static int current = 1; ret = ImGui::ListBox("ITEM: ListBox", ¤t, items, IM_ARRAYSIZE(items), IM_ARRAYSIZE(items)); }
|
||||||
|
|
||||||
// Display the values of IsItemHovered() and other common item state functions.
|
// Display the values of IsItemHovered() and other common item state functions.
|
||||||
// Note that the ImGuiHoveredFlags_XXX flags can be combined.
|
// Note that the ImGuiHoveredFlags_XXX flags can be combined.
|
||||||
@@ -2266,6 +2240,7 @@ static void ShowDemoWindowWidgets()
|
|||||||
"IsItemHovered(_AllowWhenBlockedByPopup) = %d\n"
|
"IsItemHovered(_AllowWhenBlockedByPopup) = %d\n"
|
||||||
"IsItemHovered(_AllowWhenBlockedByActiveItem) = %d\n"
|
"IsItemHovered(_AllowWhenBlockedByActiveItem) = %d\n"
|
||||||
"IsItemHovered(_AllowWhenOverlapped) = %d\n"
|
"IsItemHovered(_AllowWhenOverlapped) = %d\n"
|
||||||
|
"IsItemHovered(_AllowWhenDisabled) = %d\n"
|
||||||
"IsItemHovered(_RectOnly) = %d\n"
|
"IsItemHovered(_RectOnly) = %d\n"
|
||||||
"IsItemActive() = %d\n"
|
"IsItemActive() = %d\n"
|
||||||
"IsItemEdited() = %d\n"
|
"IsItemEdited() = %d\n"
|
||||||
@@ -2284,6 +2259,7 @@ static void ShowDemoWindowWidgets()
|
|||||||
ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup),
|
ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup),
|
||||||
ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem),
|
ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem),
|
||||||
ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenOverlapped),
|
ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenOverlapped),
|
||||||
|
ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled),
|
||||||
ImGui::IsItemHovered(ImGuiHoveredFlags_RectOnly),
|
ImGui::IsItemHovered(ImGuiHoveredFlags_RectOnly),
|
||||||
ImGui::IsItemActive(),
|
ImGui::IsItemActive(),
|
||||||
ImGui::IsItemEdited(),
|
ImGui::IsItemEdited(),
|
||||||
@@ -2298,43 +2274,66 @@ static void ShowDemoWindowWidgets()
|
|||||||
ImGui::GetItemRectSize().x, ImGui::GetItemRectSize().y
|
ImGui::GetItemRectSize().x, ImGui::GetItemRectSize().y
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (item_disabled)
|
||||||
|
ImGui::EndDisabled();
|
||||||
|
|
||||||
|
char buf[1] = "";
|
||||||
|
ImGui::InputText("unused", buf, IM_ARRAYSIZE(buf), ImGuiInputTextFlags_ReadOnly);
|
||||||
|
ImGui::SameLine();
|
||||||
|
HelpMarker("This widget is only here to be able to tab-out of the widgets above and see e.g. Deactivated() status.");
|
||||||
|
|
||||||
|
ImGui::TreePop();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::TreeNode("Querying Window Status (Focused/Hovered etc.)"))
|
||||||
|
{
|
||||||
static bool embed_all_inside_a_child_window = false;
|
static bool embed_all_inside_a_child_window = false;
|
||||||
ImGui::Checkbox("Embed everything inside a child window (for additional testing)", &embed_all_inside_a_child_window);
|
ImGui::Checkbox("Embed everything inside a child window for testing _RootWindow flag.", &embed_all_inside_a_child_window);
|
||||||
if (embed_all_inside_a_child_window)
|
if (embed_all_inside_a_child_window)
|
||||||
ImGui::BeginChild("outer_child", ImVec2(0, ImGui::GetFontSize() * 20.0f), true);
|
ImGui::BeginChild("outer_child", ImVec2(0, ImGui::GetFontSize() * 20.0f), true);
|
||||||
|
|
||||||
// Testing IsWindowFocused() function with its various flags.
|
// Testing IsWindowFocused() function with its various flags.
|
||||||
// Note that the ImGuiFocusedFlags_XXX flags can be combined.
|
|
||||||
ImGui::BulletText(
|
ImGui::BulletText(
|
||||||
"IsWindowFocused() = %d\n"
|
"IsWindowFocused() = %d\n"
|
||||||
"IsWindowFocused(_ChildWindows) = %d\n"
|
"IsWindowFocused(_ChildWindows) = %d\n"
|
||||||
|
"IsWindowFocused(_ChildWindows|_NoPopupHierarchy) = %d\n"
|
||||||
"IsWindowFocused(_ChildWindows|_RootWindow) = %d\n"
|
"IsWindowFocused(_ChildWindows|_RootWindow) = %d\n"
|
||||||
|
"IsWindowFocused(_ChildWindows|_RootWindow|_NoPopupHierarchy) = %d\n"
|
||||||
"IsWindowFocused(_RootWindow) = %d\n"
|
"IsWindowFocused(_RootWindow) = %d\n"
|
||||||
|
"IsWindowFocused(_RootWindow|_NoPopupHierarchy) = %d\n"
|
||||||
"IsWindowFocused(_AnyWindow) = %d\n",
|
"IsWindowFocused(_AnyWindow) = %d\n",
|
||||||
ImGui::IsWindowFocused(),
|
ImGui::IsWindowFocused(),
|
||||||
ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows),
|
ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows),
|
||||||
|
ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows | ImGuiFocusedFlags_NoPopupHierarchy),
|
||||||
ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows | ImGuiFocusedFlags_RootWindow),
|
ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows | ImGuiFocusedFlags_RootWindow),
|
||||||
|
ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows | ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_NoPopupHierarchy),
|
||||||
ImGui::IsWindowFocused(ImGuiFocusedFlags_RootWindow),
|
ImGui::IsWindowFocused(ImGuiFocusedFlags_RootWindow),
|
||||||
|
ImGui::IsWindowFocused(ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_NoPopupHierarchy),
|
||||||
ImGui::IsWindowFocused(ImGuiFocusedFlags_AnyWindow));
|
ImGui::IsWindowFocused(ImGuiFocusedFlags_AnyWindow));
|
||||||
|
|
||||||
// Testing IsWindowHovered() function with its various flags.
|
// Testing IsWindowHovered() function with its various flags.
|
||||||
// Note that the ImGuiHoveredFlags_XXX flags can be combined.
|
|
||||||
ImGui::BulletText(
|
ImGui::BulletText(
|
||||||
"IsWindowHovered() = %d\n"
|
"IsWindowHovered() = %d\n"
|
||||||
"IsWindowHovered(_AllowWhenBlockedByPopup) = %d\n"
|
"IsWindowHovered(_AllowWhenBlockedByPopup) = %d\n"
|
||||||
"IsWindowHovered(_AllowWhenBlockedByActiveItem) = %d\n"
|
"IsWindowHovered(_AllowWhenBlockedByActiveItem) = %d\n"
|
||||||
"IsWindowHovered(_ChildWindows) = %d\n"
|
"IsWindowHovered(_ChildWindows) = %d\n"
|
||||||
|
"IsWindowHovered(_ChildWindows|_NoPopupHierarchy) = %d\n"
|
||||||
"IsWindowHovered(_ChildWindows|_RootWindow) = %d\n"
|
"IsWindowHovered(_ChildWindows|_RootWindow) = %d\n"
|
||||||
"IsWindowHovered(_ChildWindows|_AllowWhenBlockedByPopup) = %d\n"
|
"IsWindowHovered(_ChildWindows|_RootWindow|_NoPopupHierarchy) = %d\n"
|
||||||
"IsWindowHovered(_RootWindow) = %d\n"
|
"IsWindowHovered(_RootWindow) = %d\n"
|
||||||
|
"IsWindowHovered(_RootWindow|_NoPopupHierarchy) = %d\n"
|
||||||
|
"IsWindowHovered(_ChildWindows|_AllowWhenBlockedByPopup) = %d\n"
|
||||||
"IsWindowHovered(_AnyWindow) = %d\n",
|
"IsWindowHovered(_AnyWindow) = %d\n",
|
||||||
ImGui::IsWindowHovered(),
|
ImGui::IsWindowHovered(),
|
||||||
ImGui::IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup),
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup),
|
||||||
ImGui::IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem),
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem),
|
||||||
ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows),
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows),
|
||||||
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_NoPopupHierarchy),
|
||||||
ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_RootWindow),
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_RootWindow),
|
||||||
ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_AllowWhenBlockedByPopup),
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_NoPopupHierarchy),
|
||||||
ImGui::IsWindowHovered(ImGuiHoveredFlags_RootWindow),
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_RootWindow),
|
||||||
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_NoPopupHierarchy),
|
||||||
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_AllowWhenBlockedByPopup),
|
||||||
ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow));
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow));
|
||||||
|
|
||||||
ImGui::BeginChild("child", ImVec2(0, 50), true);
|
ImGui::BeginChild("child", ImVec2(0, 50), true);
|
||||||
@@ -2343,9 +2342,6 @@ static void ShowDemoWindowWidgets()
|
|||||||
if (embed_all_inside_a_child_window)
|
if (embed_all_inside_a_child_window)
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
|
|
||||||
static char unused_str[] = "This widget is only here to be able to tab-out of the widgets above.";
|
|
||||||
ImGui::InputText("unused", unused_str, IM_ARRAYSIZE(unused_str), ImGuiInputTextFlags_ReadOnly);
|
|
||||||
|
|
||||||
// Calling IsItemHovered() after begin returns the hovered status of the title bar.
|
// Calling IsItemHovered() after begin returns the hovered status of the title bar.
|
||||||
// This is useful in particular if you want to create a context menu associated to the title bar of a window.
|
// This is useful in particular if you want to create a context menu associated to the title bar of a window.
|
||||||
static bool test_window = false;
|
static bool test_window = false;
|
||||||
@@ -2367,6 +2363,18 @@ static void ShowDemoWindowWidgets()
|
|||||||
|
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Demonstrate BeginDisabled/EndDisabled using a checkbox located at the bottom of the section (which is a bit odd:
|
||||||
|
// logically we'd have this checkbox at the top of the section, but we don't want this feature to steal that space)
|
||||||
|
if (disable_all)
|
||||||
|
ImGui::EndDisabled();
|
||||||
|
|
||||||
|
if (ImGui::TreeNode("Disable block"))
|
||||||
|
{
|
||||||
|
ImGui::Checkbox("Disable entire section above", &disable_all);
|
||||||
|
ImGui::SameLine(); HelpMarker("Demonstrate using BeginDisabled()/EndDisabled() across this section.");
|
||||||
|
ImGui::TreePop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ShowDemoWindowLayout()
|
static void ShowDemoWindowLayout()
|
||||||
@@ -2387,7 +2395,7 @@ static void ShowDemoWindowLayout()
|
|||||||
ImGuiWindowFlags window_flags = ImGuiWindowFlags_HorizontalScrollbar;
|
ImGuiWindowFlags window_flags = ImGuiWindowFlags_HorizontalScrollbar;
|
||||||
if (disable_mouse_wheel)
|
if (disable_mouse_wheel)
|
||||||
window_flags |= ImGuiWindowFlags_NoScrollWithMouse;
|
window_flags |= ImGuiWindowFlags_NoScrollWithMouse;
|
||||||
ImGui::BeginChild("ChildL", ImVec2(ImGui::GetWindowContentRegionWidth() * 0.5f, 260), false, window_flags);
|
ImGui::BeginChild("ChildL", ImVec2(ImGui::GetContentRegionAvail().x * 0.5f, 260), false, window_flags);
|
||||||
for (int i = 0; i < 100; i++)
|
for (int i = 0; i < 100; i++)
|
||||||
ImGui::Text("%04d: scrollable region", i);
|
ImGui::Text("%04d: scrollable region", i);
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
@@ -2436,7 +2444,7 @@ static void ShowDemoWindowLayout()
|
|||||||
// You can also call SetNextWindowPos() to position the child window. The parent window will effectively
|
// You can also call SetNextWindowPos() to position the child window. The parent window will effectively
|
||||||
// layout from this position.
|
// layout from this position.
|
||||||
// - Using ImGui::GetItemRectMin/Max() to query the "item" state (because the child window is an item from
|
// - Using ImGui::GetItemRectMin/Max() to query the "item" state (because the child window is an item from
|
||||||
// the POV of the parent window). See 'Demo->Querying Status (Active/Focused/Hovered etc.)' for details.
|
// the POV of the parent window). See 'Demo->Querying Status (Edited/Active/Hovered etc.)' for details.
|
||||||
{
|
{
|
||||||
static int offset_x = 0;
|
static int offset_x = 0;
|
||||||
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8);
|
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8);
|
||||||
@@ -3542,6 +3550,7 @@ static void EditTableSizingFlags(ImGuiTableFlags* p_flags)
|
|||||||
|
|
||||||
static void EditTableColumnsFlags(ImGuiTableColumnFlags* p_flags)
|
static void EditTableColumnsFlags(ImGuiTableColumnFlags* p_flags)
|
||||||
{
|
{
|
||||||
|
ImGui::CheckboxFlags("_Disabled", p_flags, ImGuiTableColumnFlags_Disabled); ImGui::SameLine(); HelpMarker("Master disable flag (also hide from context menu)");
|
||||||
ImGui::CheckboxFlags("_DefaultHide", p_flags, ImGuiTableColumnFlags_DefaultHide);
|
ImGui::CheckboxFlags("_DefaultHide", p_flags, ImGuiTableColumnFlags_DefaultHide);
|
||||||
ImGui::CheckboxFlags("_DefaultSort", p_flags, ImGuiTableColumnFlags_DefaultSort);
|
ImGui::CheckboxFlags("_DefaultSort", p_flags, ImGuiTableColumnFlags_DefaultSort);
|
||||||
if (ImGui::CheckboxFlags("_WidthStretch", p_flags, ImGuiTableColumnFlags_WidthStretch))
|
if (ImGui::CheckboxFlags("_WidthStretch", p_flags, ImGuiTableColumnFlags_WidthStretch))
|
||||||
@@ -3555,6 +3564,7 @@ static void EditTableColumnsFlags(ImGuiTableColumnFlags* p_flags)
|
|||||||
ImGui::CheckboxFlags("_NoSort", p_flags, ImGuiTableColumnFlags_NoSort);
|
ImGui::CheckboxFlags("_NoSort", p_flags, ImGuiTableColumnFlags_NoSort);
|
||||||
ImGui::CheckboxFlags("_NoSortAscending", p_flags, ImGuiTableColumnFlags_NoSortAscending);
|
ImGui::CheckboxFlags("_NoSortAscending", p_flags, ImGuiTableColumnFlags_NoSortAscending);
|
||||||
ImGui::CheckboxFlags("_NoSortDescending", p_flags, ImGuiTableColumnFlags_NoSortDescending);
|
ImGui::CheckboxFlags("_NoSortDescending", p_flags, ImGuiTableColumnFlags_NoSortDescending);
|
||||||
|
ImGui::CheckboxFlags("_NoHeaderLabel", p_flags, ImGuiTableColumnFlags_NoHeaderLabel);
|
||||||
ImGui::CheckboxFlags("_NoHeaderWidth", p_flags, ImGuiTableColumnFlags_NoHeaderWidth);
|
ImGui::CheckboxFlags("_NoHeaderWidth", p_flags, ImGuiTableColumnFlags_NoHeaderWidth);
|
||||||
ImGui::CheckboxFlags("_PreferSortAscending", p_flags, ImGuiTableColumnFlags_PreferSortAscending);
|
ImGui::CheckboxFlags("_PreferSortAscending", p_flags, ImGuiTableColumnFlags_PreferSortAscending);
|
||||||
ImGui::CheckboxFlags("_PreferSortDescending", p_flags, ImGuiTableColumnFlags_PreferSortDescending);
|
ImGui::CheckboxFlags("_PreferSortDescending", p_flags, ImGuiTableColumnFlags_PreferSortDescending);
|
||||||
@@ -5494,6 +5504,7 @@ static void ShowDemoWindowMisc()
|
|||||||
|
|
||||||
// Display ImGuiIO output flags
|
// Display ImGuiIO output flags
|
||||||
ImGui::Text("WantCaptureMouse: %d", io.WantCaptureMouse);
|
ImGui::Text("WantCaptureMouse: %d", io.WantCaptureMouse);
|
||||||
|
ImGui::Text("WantCaptureMouseUnlessPopupClose: %d", io.WantCaptureMouseUnlessPopupClose);
|
||||||
ImGui::Text("WantCaptureKeyboard: %d", io.WantCaptureKeyboard);
|
ImGui::Text("WantCaptureKeyboard: %d", io.WantCaptureKeyboard);
|
||||||
ImGui::Text("WantTextInput: %d", io.WantTextInput);
|
ImGui::Text("WantTextInput: %d", io.WantTextInput);
|
||||||
ImGui::Text("WantSetMousePos: %d", io.WantSetMousePos);
|
ImGui::Text("WantSetMousePos: %d", io.WantSetMousePos);
|
||||||
@@ -5789,15 +5800,15 @@ void ImGui::ShowAboutWindow(bool* p_open)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// [SECTION] Font viewer / ShowFontAtlas()
|
// [SECTION] Style Editor / ShowStyleEditor()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// - ShowFontSelector()
|
// - ShowFontSelector()
|
||||||
// - ShowFont()
|
// - ShowStyleSelector()
|
||||||
// - ShowFontAtlas()
|
// - ShowStyleEditor()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// This isn't worth putting in public API but we want Metrics to use it
|
// Forward declare ShowFontAtlas() which isn't worth putting in public API yet
|
||||||
namespace ImGui { void ShowFontAtlas(ImFontAtlas* atlas); }
|
namespace ImGui { IMGUI_API void ShowFontAtlas(ImFontAtlas* atlas); }
|
||||||
|
|
||||||
// Demo helper function to select among loaded fonts.
|
// Demo helper function to select among loaded fonts.
|
||||||
// Here we use the regular BeginCombo()/EndCombo() api which is more the more flexible one.
|
// Here we use the regular BeginCombo()/EndCombo() api which is more the more flexible one.
|
||||||
@@ -5825,124 +5836,6 @@ void ImGui::ShowFontSelector(const char* label)
|
|||||||
"- If you need to add/remove fonts at runtime (e.g. for DPI change), do it before calling NewFrame().");
|
"- If you need to add/remove fonts at runtime (e.g. for DPI change), do it before calling NewFrame().");
|
||||||
}
|
}
|
||||||
|
|
||||||
// [Internal] Display details for a single font, called by ShowStyleEditor().
|
|
||||||
static void ShowFont(ImFont* font)
|
|
||||||
{
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
|
||||||
ImGuiStyle& style = ImGui::GetStyle();
|
|
||||||
bool font_details_opened = ImGui::TreeNode(font, "Font: \"%s\"\n%.2f px, %d glyphs, %d file(s)",
|
|
||||||
font->ConfigData ? font->ConfigData[0].Name : "", font->FontSize, font->Glyphs.Size, font->ConfigDataCount);
|
|
||||||
ImGui::SameLine(); if (ImGui::SmallButton("Set as default")) { io.FontDefault = font; }
|
|
||||||
if (!font_details_opened)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Display preview text
|
|
||||||
ImGui::PushFont(font);
|
|
||||||
ImGui::Text("The quick brown fox jumps over the lazy dog");
|
|
||||||
ImGui::PopFont();
|
|
||||||
|
|
||||||
// Display details
|
|
||||||
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8);
|
|
||||||
ImGui::DragFloat("Font scale", &font->Scale, 0.005f, 0.3f, 2.0f, "%.1f"); // Scale only this font
|
|
||||||
ImGui::SameLine(); HelpMarker(
|
|
||||||
"Note than the default embedded font is NOT meant to be scaled.\n\n"
|
|
||||||
"Font are currently rendered into bitmaps at a given size at the time of building the atlas. "
|
|
||||||
"You may oversample them to get some flexibility with scaling. "
|
|
||||||
"You can also render at multiple sizes and select which one to use at runtime.\n\n"
|
|
||||||
"(Glimmer of hope: the atlas system will be rewritten in the future to make scaling more flexible.)");
|
|
||||||
ImGui::Text("Ascent: %f, Descent: %f, Height: %f", font->Ascent, font->Descent, font->Ascent - font->Descent);
|
|
||||||
ImGui::Text("Fallback character: '%c' (U+%04X)", font->FallbackChar, font->FallbackChar);
|
|
||||||
ImGui::Text("Ellipsis character: '%c' (U+%04X)", font->EllipsisChar, font->EllipsisChar);
|
|
||||||
const int surface_sqrt = (int)sqrtf((float)font->MetricsTotalSurface);
|
|
||||||
ImGui::Text("Texture Area: about %d px ~%dx%d px", font->MetricsTotalSurface, surface_sqrt, surface_sqrt);
|
|
||||||
for (int config_i = 0; config_i < font->ConfigDataCount; config_i++)
|
|
||||||
if (font->ConfigData)
|
|
||||||
if (const ImFontConfig* cfg = &font->ConfigData[config_i])
|
|
||||||
ImGui::BulletText("Input %d: \'%s\', Oversample: (%d,%d), PixelSnapH: %d, Offset: (%.1f,%.1f)",
|
|
||||||
config_i, cfg->Name, cfg->OversampleH, cfg->OversampleV, cfg->PixelSnapH, cfg->GlyphOffset.x, cfg->GlyphOffset.y);
|
|
||||||
|
|
||||||
// Display all glyphs of the fonts in separate pages of 256 characters
|
|
||||||
if (ImGui::TreeNode("Glyphs", "Glyphs (%d)", font->Glyphs.Size))
|
|
||||||
{
|
|
||||||
const ImU32 glyph_col = ImGui::GetColorU32(ImGuiCol_Text);
|
|
||||||
for (unsigned int base = 0; base <= IM_UNICODE_CODEPOINT_MAX; base += 256)
|
|
||||||
{
|
|
||||||
// Skip ahead if a large bunch of glyphs are not present in the font (test in chunks of 4k)
|
|
||||||
// This is only a small optimization to reduce the number of iterations when IM_UNICODE_MAX_CODEPOINT
|
|
||||||
// is large // (if ImWchar==ImWchar32 we will do at least about 272 queries here)
|
|
||||||
if (!(base & 4095) && font->IsGlyphRangeUnused(base, base + 4095))
|
|
||||||
{
|
|
||||||
base += 4096 - 256;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
int count = 0;
|
|
||||||
for (unsigned int n = 0; n < 256; n++)
|
|
||||||
if (font->FindGlyphNoFallback((ImWchar)(base + n)))
|
|
||||||
count++;
|
|
||||||
if (count <= 0)
|
|
||||||
continue;
|
|
||||||
if (!ImGui::TreeNode((void*)(intptr_t)base, "U+%04X..U+%04X (%d %s)", base, base + 255, count, count > 1 ? "glyphs" : "glyph"))
|
|
||||||
continue;
|
|
||||||
float cell_size = font->FontSize * 1;
|
|
||||||
float cell_spacing = style.ItemSpacing.y;
|
|
||||||
ImVec2 base_pos = ImGui::GetCursorScreenPos();
|
|
||||||
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
|
||||||
for (unsigned int n = 0; n < 256; n++)
|
|
||||||
{
|
|
||||||
// We use ImFont::RenderChar as a shortcut because we don't have UTF-8 conversion functions
|
|
||||||
// available here and thus cannot easily generate a zero-terminated UTF-8 encoded string.
|
|
||||||
ImVec2 cell_p1(base_pos.x + (n % 16) * (cell_size + cell_spacing), base_pos.y + (n / 16) * (cell_size + cell_spacing));
|
|
||||||
ImVec2 cell_p2(cell_p1.x + cell_size, cell_p1.y + cell_size);
|
|
||||||
const ImFontGlyph* glyph = font->FindGlyphNoFallback((ImWchar)(base + n));
|
|
||||||
draw_list->AddRect(cell_p1, cell_p2, glyph ? IM_COL32(255, 255, 255, 100) : IM_COL32(255, 255, 255, 50));
|
|
||||||
if (glyph)
|
|
||||||
font->RenderChar(draw_list, cell_size, cell_p1, glyph_col, (ImWchar)(base + n));
|
|
||||||
if (glyph && ImGui::IsMouseHoveringRect(cell_p1, cell_p2))
|
|
||||||
{
|
|
||||||
ImGui::BeginTooltip();
|
|
||||||
ImGui::Text("Codepoint: U+%04X", base + n);
|
|
||||||
ImGui::Separator();
|
|
||||||
ImGui::Text("Visible: %d", glyph->Visible);
|
|
||||||
ImGui::Text("AdvanceX: %.1f", glyph->AdvanceX);
|
|
||||||
ImGui::Text("Pos: (%.2f,%.2f)->(%.2f,%.2f)", glyph->X0, glyph->Y0, glyph->X1, glyph->Y1);
|
|
||||||
ImGui::Text("UV: (%.3f,%.3f)->(%.3f,%.3f)", glyph->U0, glyph->V0, glyph->U1, glyph->V1);
|
|
||||||
ImGui::EndTooltip();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ImGui::Dummy(ImVec2((cell_size + cell_spacing) * 16, (cell_size + cell_spacing) * 16));
|
|
||||||
ImGui::TreePop();
|
|
||||||
}
|
|
||||||
ImGui::TreePop();
|
|
||||||
}
|
|
||||||
ImGui::TreePop();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImGui::ShowFontAtlas(ImFontAtlas* atlas)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < atlas->Fonts.Size; i++)
|
|
||||||
{
|
|
||||||
ImFont* font = atlas->Fonts[i];
|
|
||||||
ImGui::PushID(font);
|
|
||||||
ShowFont(font);
|
|
||||||
ImGui::PopID();
|
|
||||||
}
|
|
||||||
if (ImGui::TreeNode("Atlas texture", "Atlas texture (%dx%d pixels)", atlas->TexWidth, atlas->TexHeight))
|
|
||||||
{
|
|
||||||
ImVec4 tint_col = ImVec4(1.0f, 1.0f, 1.0f, 1.0f);
|
|
||||||
ImVec4 border_col = ImVec4(1.0f, 1.0f, 1.0f, 0.5f);
|
|
||||||
ImGui::Image(atlas->TexID, ImVec2((float)atlas->TexWidth, (float)atlas->TexHeight), ImVec2(0, 0), ImVec2(1, 1), tint_col, border_col);
|
|
||||||
ImGui::TreePop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// [SECTION] Style Editor / ShowStyleEditor()
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// - ShowStyleSelector()
|
|
||||||
// - ShowStyleEditor()
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Demo helper function to select among default colors. See ShowStyleEditor() for more advanced options.
|
// Demo helper function to select among default colors. See ShowStyleEditor() for more advanced options.
|
||||||
// Here we use the simplified Combo() api that packs items into a single literal string.
|
// Here we use the simplified Combo() api that packs items into a single literal string.
|
||||||
// Useful for quick combo boxes where the choices are known locally.
|
// Useful for quick combo boxes where the choices are known locally.
|
||||||
@@ -6197,6 +6090,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
HelpMarker("When drawing circle primitives with \"num_segments == 0\" tesselation will be calculated automatically.");
|
HelpMarker("When drawing circle primitives with \"num_segments == 0\" tesselation will be calculated automatically.");
|
||||||
|
|
||||||
ImGui::DragFloat("Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f, "%.2f"); // Not exposing zero here so user doesn't "lose" the UI (zero alpha clips all widgets). But application code could have a toggle to switch between zero and non-zero.
|
ImGui::DragFloat("Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f, "%.2f"); // Not exposing zero here so user doesn't "lose" the UI (zero alpha clips all widgets). But application code could have a toggle to switch between zero and non-zero.
|
||||||
|
ImGui::DragFloat("Disabled Alpha", &style.DisabledAlpha, 0.005f, 0.0f, 1.0f, "%.2f"); ImGui::SameLine(); HelpMarker("Additional alpha multiplier for disabled items (multiply over current value of Alpha).");
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
|
|
||||||
ImGui::EndTabItem();
|
ImGui::EndTabItem();
|
||||||
@@ -6246,10 +6140,9 @@ static void ShowExampleAppMainMenuBar()
|
|||||||
// (future version will add explicit flags to BeginMenu() to request processing shortcuts)
|
// (future version will add explicit flags to BeginMenu() to request processing shortcuts)
|
||||||
static void ShowExampleMenuFile()
|
static void ShowExampleMenuFile()
|
||||||
{
|
{
|
||||||
ImGui::MenuItem("(dummy menu)", NULL, false, false);
|
ImGui::MenuItem("(demo menu)", NULL, false, false);
|
||||||
if (ImGui::MenuItem("New")) {}
|
if (ImGui::MenuItem("New")) {}
|
||||||
if (ImGui::MenuItem("Open", "Ctrl+O")) { show_open_dialog = true; }
|
if (ImGui::MenuItem("Open", "Ctrl+O")) {}
|
||||||
if (ImGui::MenuItem("Select Directory")) { show_select_dialog = true; }
|
|
||||||
if (ImGui::BeginMenu("Open Recent"))
|
if (ImGui::BeginMenu("Open Recent"))
|
||||||
{
|
{
|
||||||
ImGui::MenuItem("fish_hat.c");
|
ImGui::MenuItem("fish_hat.c");
|
||||||
@@ -6269,7 +6162,8 @@ static void ShowExampleMenuFile()
|
|||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
if (ImGui::MenuItem("Save", "Ctrl+S")) {}
|
if (ImGui::MenuItem("Save", "Ctrl+S")) {}
|
||||||
if (ImGui::MenuItem("Save As..")) { show_save_dialog = true; }
|
if (ImGui::MenuItem("Save As..")) {}
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
if (ImGui::BeginMenu("Options"))
|
if (ImGui::BeginMenu("Options"))
|
||||||
{
|
{
|
||||||
@@ -6281,13 +6175,12 @@ static void ShowExampleMenuFile()
|
|||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
static float f = 0.5f;
|
static float f = 0.5f;
|
||||||
static int n = 0;
|
static int n = 0;
|
||||||
static bool b = true;
|
|
||||||
ImGui::SliderFloat("Value", &f, 0.0f, 1.0f);
|
ImGui::SliderFloat("Value", &f, 0.0f, 1.0f);
|
||||||
ImGui::InputFloat("Input", &f, 0.1f);
|
ImGui::InputFloat("Input", &f, 0.1f);
|
||||||
ImGui::Combo("Combo", &n, "Yes\0No\0Maybe\0\0");
|
ImGui::Combo("Combo", &n, "Yes\0No\0Maybe\0\0");
|
||||||
ImGui::Checkbox("Check", &b);
|
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::BeginMenu("Colors"))
|
if (ImGui::BeginMenu("Colors"))
|
||||||
{
|
{
|
||||||
float sz = ImGui::GetTextLineHeight();
|
float sz = ImGui::GetTextLineHeight();
|
||||||
@@ -6302,6 +6195,17 @@ static void ShowExampleMenuFile()
|
|||||||
}
|
}
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Here we demonstrate appending again to the "Options" menu (which we already created above)
|
||||||
|
// Of course in this demo it is a little bit silly that this function calls BeginMenu("Options") twice.
|
||||||
|
// In a real code-base using it would make senses to use this feature from very different code locations.
|
||||||
|
if (ImGui::BeginMenu("Options")) // <-- Append!
|
||||||
|
{
|
||||||
|
static bool b = true;
|
||||||
|
ImGui::Checkbox("SomeOption", &b);
|
||||||
|
ImGui::EndMenu();
|
||||||
|
}
|
||||||
|
|
||||||
if (ImGui::BeginMenu("Disabled", false)) // Disabled
|
if (ImGui::BeginMenu("Disabled", false)) // Disabled
|
||||||
{
|
{
|
||||||
IM_ASSERT(0);
|
IM_ASSERT(0);
|
||||||
@@ -6852,6 +6756,7 @@ static void ShowExampleAppLayout(bool* p_open)
|
|||||||
ImGui::BeginChild("left pane", ImVec2(150, 0), true);
|
ImGui::BeginChild("left pane", ImVec2(150, 0), true);
|
||||||
for (int i = 0; i < 100; i++)
|
for (int i = 0; i < 100; i++)
|
||||||
{
|
{
|
||||||
|
// FIXME: Good candidate to use ImGuiSelectableFlags_SelectOnNav
|
||||||
char label[128];
|
char label[128];
|
||||||
sprintf(label, "MyObject %d", i);
|
sprintf(label, "MyObject %d", i);
|
||||||
if (ImGui::Selectable(label, selected == i))
|
if (ImGui::Selectable(label, selected == i))
|
||||||
@@ -7120,12 +7025,12 @@ static void ShowExampleAppConstrainedResize(bool* p_open)
|
|||||||
// + a context-menu to choose which corner of the screen to use.
|
// + a context-menu to choose which corner of the screen to use.
|
||||||
static void ShowExampleAppSimpleOverlay(bool* p_open)
|
static void ShowExampleAppSimpleOverlay(bool* p_open)
|
||||||
{
|
{
|
||||||
const float PAD = 10.0f;
|
|
||||||
static int corner = 0;
|
static int corner = 0;
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav;
|
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav;
|
||||||
if (corner != -1)
|
if (corner != -1)
|
||||||
{
|
{
|
||||||
|
const float PAD = 10.0f;
|
||||||
const ImGuiViewport* viewport = ImGui::GetMainViewport();
|
const ImGuiViewport* viewport = ImGui::GetMainViewport();
|
||||||
ImVec2 work_pos = viewport->WorkPos; // Use work area to avoid menu-bar/task-bar, if any!
|
ImVec2 work_pos = viewport->WorkPos; // Use work area to avoid menu-bar/task-bar, if any!
|
||||||
ImVec2 work_size = viewport->WorkSize;
|
ImVec2 work_size = viewport->WorkSize;
|
||||||
@@ -7625,6 +7530,16 @@ void ShowExampleAppDocuments(bool* p_open)
|
|||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
|
// About the ImGuiWindowFlags_UnsavedDocument / ImGuiTabItemFlags_UnsavedDocument flags.
|
||||||
|
// They have multiple effects:
|
||||||
|
// - Display a dot next to the title.
|
||||||
|
// - Tab is selected when clicking the X close button.
|
||||||
|
// - Closure is not assumed (will wait for user to stop submitting the tab).
|
||||||
|
// Otherwise closure is assumed when pressing the X, so if you keep submitting the tab may reappear at end of tab bar.
|
||||||
|
// We need to assume closure by default otherwise waiting for "lack of submission" on the next frame would leave an empty
|
||||||
|
// hole for one-frame, both in the tab-bar and in tab-contents when closing a tab/window.
|
||||||
|
// The rarely used SetTabItemClosed() function is a way to notify of programmatic closure to avoid the one-frame hole.
|
||||||
|
|
||||||
// Submit Tab Bar and Tabs
|
// Submit Tab Bar and Tabs
|
||||||
{
|
{
|
||||||
ImGuiTabBarFlags tab_bar_flags = (opt_fitting_flags) | (opt_reorderable ? ImGuiTabBarFlags_Reorderable : 0);
|
ImGuiTabBarFlags tab_bar_flags = (opt_fitting_flags) | (opt_reorderable ? ImGuiTabBarFlags_Reorderable : 0);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -280,7 +280,7 @@ namespace imgui_addons
|
|||||||
{
|
{
|
||||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1.0f, 1.0f, 1.0f, 0.01f));
|
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1.0f, 1.0f, 1.0f, 0.01f));
|
||||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 1.0f,1.0f));
|
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 1.0f,1.0f));
|
||||||
ImGui::ArrowButtonEx("##Right", ImGuiDir_Right, ImVec2(frame_height, frame_height), ImGuiButtonFlags_Disabled);
|
ImGui::ArrowButtonEx("##Right", ImGuiDir_Right, ImVec2(frame_height, frame_height), ImGuiItemFlags_Disabled);
|
||||||
ImGui::SameLine(0,0);
|
ImGui::SameLine(0,0);
|
||||||
ImGui::PopStyleColor(2);
|
ImGui::PopStyleColor(2);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.83
|
// dear imgui, v1.85
|
||||||
// (tables and columns code)
|
// (tables and columns code)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -288,12 +288,7 @@ inline ImGuiTableFlags TableFixFlags(ImGuiTableFlags flags, ImGuiWindow* outer_w
|
|||||||
flags |= ImGuiTableFlags_NoSavedSettings;
|
flags |= ImGuiTableFlags_NoSavedSettings;
|
||||||
|
|
||||||
// Inherit _NoSavedSettings from top-level window (child windows always have _NoSavedSettings set)
|
// Inherit _NoSavedSettings from top-level window (child windows always have _NoSavedSettings set)
|
||||||
#ifdef IMGUI_HAS_DOCK
|
if (outer_window->RootWindow->Flags & ImGuiWindowFlags_NoSavedSettings)
|
||||||
ImGuiWindow* window_for_settings = outer_window->RootWindowDockStop;
|
|
||||||
#else
|
|
||||||
ImGuiWindow* window_for_settings = outer_window->RootWindow;
|
|
||||||
#endif
|
|
||||||
if (window_for_settings->Flags & ImGuiWindowFlags_NoSavedSettings)
|
|
||||||
flags |= ImGuiTableFlags_NoSavedSettings;
|
flags |= ImGuiTableFlags_NoSavedSettings;
|
||||||
|
|
||||||
return flags;
|
return flags;
|
||||||
@@ -329,7 +324,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
|||||||
const ImVec2 avail_size = GetContentRegionAvail();
|
const ImVec2 avail_size = GetContentRegionAvail();
|
||||||
ImVec2 actual_outer_size = CalcItemSize(outer_size, ImMax(avail_size.x, 1.0f), use_child_window ? ImMax(avail_size.y, 1.0f) : 0.0f);
|
ImVec2 actual_outer_size = CalcItemSize(outer_size, ImMax(avail_size.x, 1.0f), use_child_window ? ImMax(avail_size.y, 1.0f) : 0.0f);
|
||||||
ImRect outer_rect(outer_window->DC.CursorPos, outer_window->DC.CursorPos + actual_outer_size);
|
ImRect outer_rect(outer_window->DC.CursorPos, outer_window->DC.CursorPos + actual_outer_size);
|
||||||
if (use_child_window && IsClippedEx(outer_rect, 0, false))
|
if (use_child_window && IsClippedEx(outer_rect, 0))
|
||||||
{
|
{
|
||||||
ItemSize(outer_rect);
|
ItemSize(outer_rect);
|
||||||
return false;
|
return false;
|
||||||
@@ -522,7 +517,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
|||||||
*column = ImGuiTableColumn();
|
*column = ImGuiTableColumn();
|
||||||
column->WidthAuto = width_auto;
|
column->WidthAuto = width_auto;
|
||||||
column->IsPreserveWidthAuto = true; // Preserve WidthAuto when reinitializing a live table: not technically necessary but remove a visible flicker
|
column->IsPreserveWidthAuto = true; // Preserve WidthAuto when reinitializing a live table: not technically necessary but remove a visible flicker
|
||||||
column->IsEnabled = column->IsEnabledNextFrame = true;
|
column->IsEnabled = column->IsUserEnabled = column->IsUserEnabledNextFrame = true;
|
||||||
}
|
}
|
||||||
column->DisplayOrder = table->DisplayOrderToIndex[n] = (ImGuiTableColumnIdx)n;
|
column->DisplayOrder = table->DisplayOrderToIndex[n] = (ImGuiTableColumnIdx)n;
|
||||||
}
|
}
|
||||||
@@ -569,6 +564,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
|||||||
// + 0 (for ImGuiTable instance, we are pooling allocations in g.Tables)
|
// + 0 (for ImGuiTable instance, we are pooling allocations in g.Tables)
|
||||||
// + 1 (for table->RawData allocated below)
|
// + 1 (for table->RawData allocated below)
|
||||||
// + 1 (for table->ColumnsNames, if names are used)
|
// + 1 (for table->ColumnsNames, if names are used)
|
||||||
|
// Shared allocations per number of nested tables
|
||||||
// + 1 (for table->Splitter._Channels)
|
// + 1 (for table->Splitter._Channels)
|
||||||
// + 2 * active_channels_count (for ImDrawCmd and ImDrawIdx buffers inside channels)
|
// + 2 * active_channels_count (for ImDrawCmd and ImDrawIdx buffers inside channels)
|
||||||
// Where active_channels_count is variable but often == columns_count or columns_count + 1, see TableSetupDrawChannels() for details.
|
// Where active_channels_count is variable but often == columns_count or columns_count + 1, see TableSetupDrawChannels() for details.
|
||||||
@@ -756,16 +752,18 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
|
|||||||
column->InitStretchWeightOrWidth = -1.0f;
|
column->InitStretchWeightOrWidth = -1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update Enabled state, mark settings/sortspecs dirty
|
// Update Enabled state, mark settings and sort specs dirty
|
||||||
if (!(table->Flags & ImGuiTableFlags_Hideable) || (column->Flags & ImGuiTableColumnFlags_NoHide))
|
if (!(table->Flags & ImGuiTableFlags_Hideable) || (column->Flags & ImGuiTableColumnFlags_NoHide))
|
||||||
column->IsEnabledNextFrame = true;
|
column->IsUserEnabledNextFrame = true;
|
||||||
if (column->IsEnabled != column->IsEnabledNextFrame)
|
if (column->IsUserEnabled != column->IsUserEnabledNextFrame)
|
||||||
{
|
{
|
||||||
column->IsEnabled = column->IsEnabledNextFrame;
|
column->IsUserEnabled = column->IsUserEnabledNextFrame;
|
||||||
table->IsSettingsDirty = true;
|
table->IsSettingsDirty = true;
|
||||||
if (!column->IsEnabled && column->SortOrder != -1)
|
|
||||||
table->IsSortSpecsDirty = true;
|
|
||||||
}
|
}
|
||||||
|
column->IsEnabled = column->IsUserEnabled && (column->Flags & ImGuiTableColumnFlags_Disabled) == 0;
|
||||||
|
|
||||||
|
if (column->SortOrder != -1 && !column->IsEnabled)
|
||||||
|
table->IsSortSpecsDirty = true;
|
||||||
if (column->SortOrder > 0 && !(table->Flags & ImGuiTableFlags_SortMulti))
|
if (column->SortOrder > 0 && !(table->Flags & ImGuiTableFlags_SortMulti))
|
||||||
table->IsSortSpecsDirty = true;
|
table->IsSortSpecsDirty = true;
|
||||||
|
|
||||||
@@ -1164,8 +1162,7 @@ void ImGui::TableUpdateBorders(ImGuiTable* table)
|
|||||||
if ((table->Flags & ImGuiTableFlags_NoBordersInBody) && table->IsUsingHeaders == false)
|
if ((table->Flags & ImGuiTableFlags_NoBordersInBody) && table->IsUsingHeaders == false)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (table->FreezeColumnsCount > 0)
|
if (!column->IsVisibleX && table->LastResizedColumn != column_n)
|
||||||
if (column->MaxX < table->Columns[table->DisplayOrderToIndex[table->FreezeColumnsCount - 1]].MaxX)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ImGuiID column_id = TableGetColumnResizeID(table, column_n, table->InstanceCurrent);
|
ImGuiID column_id = TableGetColumnResizeID(table, column_n, table->InstanceCurrent);
|
||||||
@@ -1174,7 +1171,7 @@ void ImGui::TableUpdateBorders(ImGuiTable* table)
|
|||||||
KeepAliveID(column_id);
|
KeepAliveID(column_id);
|
||||||
|
|
||||||
bool hovered = false, held = false;
|
bool hovered = false, held = false;
|
||||||
bool pressed = ButtonBehavior(hit_rect, column_id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_AllowItemOverlap | ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnDoubleClick);
|
bool pressed = ButtonBehavior(hit_rect, column_id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_AllowItemOverlap | ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnDoubleClick | ImGuiButtonFlags_NoNavFocus);
|
||||||
if (pressed && IsMouseDoubleClicked(0))
|
if (pressed && IsMouseDoubleClicked(0))
|
||||||
{
|
{
|
||||||
TableSetColumnWidthAutoSingle(table, column_n);
|
TableSetColumnWidthAutoSingle(table, column_n);
|
||||||
@@ -1449,7 +1446,7 @@ void ImGui::TableSetupColumn(const char* label, ImGuiTableColumnFlags flags, flo
|
|||||||
|
|
||||||
// Init default visibility/sort state
|
// Init default visibility/sort state
|
||||||
if ((flags & ImGuiTableColumnFlags_DefaultHide) && (table->SettingsLoadedFlags & ImGuiTableFlags_Hideable) == 0)
|
if ((flags & ImGuiTableColumnFlags_DefaultHide) && (table->SettingsLoadedFlags & ImGuiTableFlags_Hideable) == 0)
|
||||||
column->IsEnabled = column->IsEnabledNextFrame = false;
|
column->IsUserEnabled = column->IsUserEnabledNextFrame = false;
|
||||||
if (flags & ImGuiTableColumnFlags_DefaultSort && (table->SettingsLoadedFlags & ImGuiTableFlags_Sortable) == 0)
|
if (flags & ImGuiTableColumnFlags_DefaultSort && (table->SettingsLoadedFlags & ImGuiTableFlags_Sortable) == 0)
|
||||||
{
|
{
|
||||||
column->SortOrder = 0; // Multiple columns using _DefaultSort will be reassigned unique SortOrder values when building the sort specs.
|
column->SortOrder = 0; // Multiple columns using _DefaultSort will be reassigned unique SortOrder values when building the sort specs.
|
||||||
@@ -1476,11 +1473,23 @@ void ImGui::TableSetupScrollFreeze(int columns, int rows)
|
|||||||
IM_ASSERT(columns >= 0 && columns < IMGUI_TABLE_MAX_COLUMNS);
|
IM_ASSERT(columns >= 0 && columns < IMGUI_TABLE_MAX_COLUMNS);
|
||||||
IM_ASSERT(rows >= 0 && rows < 128); // Arbitrary limit
|
IM_ASSERT(rows >= 0 && rows < 128); // Arbitrary limit
|
||||||
|
|
||||||
table->FreezeColumnsRequest = (table->Flags & ImGuiTableFlags_ScrollX) ? (ImGuiTableColumnIdx)columns : 0;
|
table->FreezeColumnsRequest = (table->Flags & ImGuiTableFlags_ScrollX) ? (ImGuiTableColumnIdx)ImMin(columns, table->ColumnsCount) : 0;
|
||||||
table->FreezeColumnsCount = (table->InnerWindow->Scroll.x != 0.0f) ? table->FreezeColumnsRequest : 0;
|
table->FreezeColumnsCount = (table->InnerWindow->Scroll.x != 0.0f) ? table->FreezeColumnsRequest : 0;
|
||||||
table->FreezeRowsRequest = (table->Flags & ImGuiTableFlags_ScrollY) ? (ImGuiTableColumnIdx)rows : 0;
|
table->FreezeRowsRequest = (table->Flags & ImGuiTableFlags_ScrollY) ? (ImGuiTableColumnIdx)rows : 0;
|
||||||
table->FreezeRowsCount = (table->InnerWindow->Scroll.y != 0.0f) ? table->FreezeRowsRequest : 0;
|
table->FreezeRowsCount = (table->InnerWindow->Scroll.y != 0.0f) ? table->FreezeRowsRequest : 0;
|
||||||
table->IsUnfrozenRows = (table->FreezeRowsCount == 0); // Make sure this is set before TableUpdateLayout() so ImGuiListClipper can benefit from it.b
|
table->IsUnfrozenRows = (table->FreezeRowsCount == 0); // Make sure this is set before TableUpdateLayout() so ImGuiListClipper can benefit from it.b
|
||||||
|
|
||||||
|
// Ensure frozen columns are ordered in their section. We still allow multiple frozen columns to be reordered.
|
||||||
|
// FIXME-TABLE: This work for preserving 2143 into 21|43. How about 4321 turning into 21|43? (preserve relative order in each section)
|
||||||
|
for (int column_n = 0; column_n < table->FreezeColumnsRequest; column_n++)
|
||||||
|
{
|
||||||
|
int order_n = table->DisplayOrderToIndex[column_n];
|
||||||
|
if (order_n != column_n && order_n >= table->FreezeColumnsRequest)
|
||||||
|
{
|
||||||
|
ImSwap(table->Columns[table->DisplayOrderToIndex[order_n]].DisplayOrder, table->Columns[table->DisplayOrderToIndex[column_n]].DisplayOrder);
|
||||||
|
ImSwap(table->DisplayOrderToIndex[order_n], table->DisplayOrderToIndex[column_n]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -1489,7 +1498,7 @@ void ImGui::TableSetupScrollFreeze(int columns, int rows)
|
|||||||
// - TableGetColumnCount()
|
// - TableGetColumnCount()
|
||||||
// - TableGetColumnName()
|
// - TableGetColumnName()
|
||||||
// - TableGetColumnName() [Internal]
|
// - TableGetColumnName() [Internal]
|
||||||
// - TableSetColumnEnabled() [Internal]
|
// - TableSetColumnEnabled()
|
||||||
// - TableGetColumnFlags()
|
// - TableGetColumnFlags()
|
||||||
// - TableGetCellBgRect() [Internal]
|
// - TableGetCellBgRect() [Internal]
|
||||||
// - TableGetColumnResizeID() [Internal]
|
// - TableGetColumnResizeID() [Internal]
|
||||||
@@ -1525,10 +1534,12 @@ const char* ImGui::TableGetColumnName(const ImGuiTable* table, int column_n)
|
|||||||
return &table->ColumnsNames.Buf[column->NameOffset];
|
return &table->ColumnsNames.Buf[column->NameOffset];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Request enabling/disabling a column (often perceived as "showing/hiding" from users point of view)
|
// Change user accessible enabled/disabled state of a column (often perceived as "showing/hiding" from users point of view)
|
||||||
// Note that end-user can use the context menu to change this themselves (right-click in headers, or right-click in columns body with ImGuiTableFlags_ContextMenuInBody)
|
// Note that end-user can use the context menu to change this themselves (right-click in headers, or right-click in columns body with ImGuiTableFlags_ContextMenuInBody)
|
||||||
// Request will be applied during next layout, which happens on the first call to TableNextRow() after BeginTable()
|
// - Require table to have the ImGuiTableFlags_Hideable flag because we are manipulating user accessible state.
|
||||||
// For the getter you can use (TableGetColumnFlags() & ImGuiTableColumnFlags_IsEnabled)
|
// - Request will be applied during next layout, which happens on the first call to TableNextRow() after BeginTable().
|
||||||
|
// - For the getter you can test (TableGetColumnFlags() & ImGuiTableColumnFlags_IsEnabled) != 0.
|
||||||
|
// - Alternative: the ImGuiTableColumnFlags_Disabled is an overriding/master disable flag which will also hide the column from context menu.
|
||||||
void ImGui::TableSetColumnEnabled(int column_n, bool enabled)
|
void ImGui::TableSetColumnEnabled(int column_n, bool enabled)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
@@ -1536,11 +1547,12 @@ void ImGui::TableSetColumnEnabled(int column_n, bool enabled)
|
|||||||
IM_ASSERT(table != NULL);
|
IM_ASSERT(table != NULL);
|
||||||
if (!table)
|
if (!table)
|
||||||
return;
|
return;
|
||||||
|
IM_ASSERT(table->Flags & ImGuiTableFlags_Hideable); // See comments above
|
||||||
if (column_n < 0)
|
if (column_n < 0)
|
||||||
column_n = table->CurrentColumn;
|
column_n = table->CurrentColumn;
|
||||||
IM_ASSERT(column_n >= 0 && column_n < table->ColumnsCount);
|
IM_ASSERT(column_n >= 0 && column_n < table->ColumnsCount);
|
||||||
ImGuiTableColumn* column = &table->Columns[column_n];
|
ImGuiTableColumn* column = &table->Columns[column_n];
|
||||||
column->IsEnabledNextFrame = enabled;
|
column->IsUserEnabledNextFrame = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We allow querying for an extra column in order to poll the IsHovered state of the right-most section
|
// We allow querying for an extra column in order to poll the IsHovered state of the right-most section
|
||||||
@@ -1946,8 +1958,9 @@ void ImGui::TableBeginCell(ImGuiTable* table, int column_n)
|
|||||||
window->SkipItems = column->IsSkipItems;
|
window->SkipItems = column->IsSkipItems;
|
||||||
if (column->IsSkipItems)
|
if (column->IsSkipItems)
|
||||||
{
|
{
|
||||||
window->DC.LastItemId = 0;
|
ImGuiContext& g = *GImGui;
|
||||||
window->DC.LastItemStatusFlags = 0;
|
g.LastItemData.ID = 0;
|
||||||
|
g.LastItemData.StatusFlags = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (table->Flags & ImGuiTableFlags_NoClip)
|
if (table->Flags & ImGuiTableFlags_NoClip)
|
||||||
@@ -2013,6 +2026,7 @@ float ImGui::TableGetMaxColumnWidth(const ImGuiTable* table, int column_n)
|
|||||||
if (table->Flags & ImGuiTableFlags_ScrollX)
|
if (table->Flags & ImGuiTableFlags_ScrollX)
|
||||||
{
|
{
|
||||||
// Frozen columns can't reach beyond visible width else scrolling will naturally break.
|
// Frozen columns can't reach beyond visible width else scrolling will naturally break.
|
||||||
|
// (we use DisplayOrder as within a set of multiple frozen column reordering is possible)
|
||||||
if (column->DisplayOrder < table->FreezeColumnsRequest)
|
if (column->DisplayOrder < table->FreezeColumnsRequest)
|
||||||
{
|
{
|
||||||
max_width = (table->InnerClipRect.Max.x - (table->FreezeColumnsRequest - column->DisplayOrder) * min_column_distance) - column->MinX;
|
max_width = (table->InnerClipRect.Max.x - (table->FreezeColumnsRequest - column->DisplayOrder) * min_column_distance) - column->MinX;
|
||||||
@@ -2501,7 +2515,7 @@ void ImGui::TableDrawBorders(ImGuiTable* table)
|
|||||||
const bool is_hovered = (table->HoveredColumnBorder == column_n);
|
const bool is_hovered = (table->HoveredColumnBorder == column_n);
|
||||||
const bool is_resized = (table->ResizedColumn == column_n) && (table->InstanceInteracted == table->InstanceCurrent);
|
const bool is_resized = (table->ResizedColumn == column_n) && (table->InstanceInteracted == table->InstanceCurrent);
|
||||||
const bool is_resizable = (column->Flags & (ImGuiTableColumnFlags_NoResize | ImGuiTableColumnFlags_NoDirectResize_)) == 0;
|
const bool is_resizable = (column->Flags & (ImGuiTableColumnFlags_NoResize | ImGuiTableColumnFlags_NoDirectResize_)) == 0;
|
||||||
const bool is_frozen_separator = (table->FreezeColumnsCount != -1 && table->FreezeColumnsCount == order_n + 1);
|
const bool is_frozen_separator = (table->FreezeColumnsCount == order_n + 1);
|
||||||
if (column->MaxX > table->InnerClipRect.Max.x && !is_resized)
|
if (column->MaxX > table->InnerClipRect.Max.x && !is_resized)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -2597,7 +2611,6 @@ ImGuiTableSortSpecs* ImGui::TableGetSortSpecs()
|
|||||||
if (!table->IsLayoutLocked)
|
if (!table->IsLayoutLocked)
|
||||||
TableUpdateLayout(table);
|
TableUpdateLayout(table);
|
||||||
|
|
||||||
if (table->IsSortSpecsDirty)
|
|
||||||
TableSortSpecsBuild(table);
|
TableSortSpecsBuild(table);
|
||||||
|
|
||||||
return &table->SortSpecs;
|
return &table->SortSpecs;
|
||||||
@@ -2737,14 +2750,18 @@ void ImGui::TableSortSpecsSanitize(ImGuiTable* table)
|
|||||||
|
|
||||||
void ImGui::TableSortSpecsBuild(ImGuiTable* table)
|
void ImGui::TableSortSpecsBuild(ImGuiTable* table)
|
||||||
{
|
{
|
||||||
IM_ASSERT(table->IsSortSpecsDirty);
|
bool dirty = table->IsSortSpecsDirty;
|
||||||
|
if (dirty)
|
||||||
|
{
|
||||||
TableSortSpecsSanitize(table);
|
TableSortSpecsSanitize(table);
|
||||||
|
table->SortSpecsMulti.resize(table->SortSpecsCount <= 1 ? 0 : table->SortSpecsCount);
|
||||||
|
table->SortSpecs.SpecsDirty = true; // Mark as dirty for user
|
||||||
|
table->IsSortSpecsDirty = false; // Mark as not dirty for us
|
||||||
|
}
|
||||||
|
|
||||||
// Write output
|
// Write output
|
||||||
ImGuiTableTempData* temp_data = table->TempData;
|
ImGuiTableColumnSortSpecs* sort_specs = (table->SortSpecsCount == 0) ? NULL : (table->SortSpecsCount == 1) ? &table->SortSpecsSingle : table->SortSpecsMulti.Data;
|
||||||
temp_data->SortSpecsMulti.resize(table->SortSpecsCount <= 1 ? 0 : table->SortSpecsCount);
|
if (dirty && sort_specs != NULL)
|
||||||
ImGuiTableColumnSortSpecs* sort_specs = (table->SortSpecsCount == 0) ? NULL : (table->SortSpecsCount == 1) ? &temp_data->SortSpecsSingle : temp_data->SortSpecsMulti.Data;
|
|
||||||
if (sort_specs != NULL)
|
|
||||||
for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
|
for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
|
||||||
{
|
{
|
||||||
ImGuiTableColumn* column = &table->Columns[column_n];
|
ImGuiTableColumn* column = &table->Columns[column_n];
|
||||||
@@ -2757,10 +2774,9 @@ void ImGui::TableSortSpecsBuild(ImGuiTable* table)
|
|||||||
sort_spec->SortOrder = (ImGuiTableColumnIdx)column->SortOrder;
|
sort_spec->SortOrder = (ImGuiTableColumnIdx)column->SortOrder;
|
||||||
sort_spec->SortDirection = column->SortDirection;
|
sort_spec->SortDirection = column->SortDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
table->SortSpecs.Specs = sort_specs;
|
table->SortSpecs.Specs = sort_specs;
|
||||||
table->SortSpecs.SpecsCount = table->SortSpecsCount;
|
table->SortSpecs.SpecsCount = table->SortSpecsCount;
|
||||||
table->SortSpecs.SpecsDirty = true; // Mark as dirty for user
|
|
||||||
table->IsSortSpecsDirty = false; // Mark as not dirty for us
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@@ -2780,8 +2796,11 @@ float ImGui::TableGetHeaderRowHeight()
|
|||||||
float row_height = GetTextLineHeight();
|
float row_height = GetTextLineHeight();
|
||||||
int columns_count = TableGetColumnCount();
|
int columns_count = TableGetColumnCount();
|
||||||
for (int column_n = 0; column_n < columns_count; column_n++)
|
for (int column_n = 0; column_n < columns_count; column_n++)
|
||||||
if (TableGetColumnFlags(column_n) & ImGuiTableColumnFlags_IsEnabled)
|
{
|
||||||
|
ImGuiTableColumnFlags flags = TableGetColumnFlags(column_n);
|
||||||
|
if ((flags & ImGuiTableColumnFlags_IsEnabled) && !(flags & ImGuiTableColumnFlags_NoHeaderLabel))
|
||||||
row_height = ImMax(row_height, CalcTextSize(TableGetColumnName(column_n)).y);
|
row_height = ImMax(row_height, CalcTextSize(TableGetColumnName(column_n)).y);
|
||||||
|
}
|
||||||
row_height += GetStyle().CellPadding.y * 2.0f;
|
row_height += GetStyle().CellPadding.y * 2.0f;
|
||||||
return row_height;
|
return row_height;
|
||||||
}
|
}
|
||||||
@@ -2818,7 +2837,7 @@ void ImGui::TableHeadersRow()
|
|||||||
// Push an id to allow unnamed labels (generally accidental, but let's behave nicely with them)
|
// Push an id to allow unnamed labels (generally accidental, but let's behave nicely with them)
|
||||||
// - in your own code you may omit the PushID/PopID all-together, provided you know they won't collide
|
// - in your own code you may omit the PushID/PopID all-together, provided you know they won't collide
|
||||||
// - table->InstanceCurrent is only >0 when we use multiple BeginTable/EndTable calls with same identifier.
|
// - table->InstanceCurrent is only >0 when we use multiple BeginTable/EndTable calls with same identifier.
|
||||||
const char* name = TableGetColumnName(column_n);
|
const char* name = (TableGetColumnFlags(column_n) & ImGuiTableColumnFlags_NoHeaderLabel) ? "" : TableGetColumnName(column_n);
|
||||||
PushID(table->InstanceCurrent * table->ColumnsCount + column_n);
|
PushID(table->InstanceCurrent * table->ColumnsCount + column_n);
|
||||||
TableHeader(name);
|
TableHeader(name);
|
||||||
PopID();
|
PopID();
|
||||||
@@ -2900,7 +2919,6 @@ void ImGui::TableHeader(const char* label)
|
|||||||
const ImU32 col = GetColorU32(held ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header);
|
const ImU32 col = GetColorU32(held ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header);
|
||||||
//RenderFrame(bb.Min, bb.Max, col, false, 0.0f);
|
//RenderFrame(bb.Min, bb.Max, col, false, 0.0f);
|
||||||
TableSetBgColor(ImGuiTableBgTarget_CellBg, col, table->CurrentColumn);
|
TableSetBgColor(ImGuiTableBgTarget_CellBg, col, table->CurrentColumn);
|
||||||
RenderNavHighlight(bb, id, ImGuiNavHighlightFlags_TypeThin | ImGuiNavHighlightFlags_NoRounding);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2908,6 +2926,7 @@ void ImGui::TableHeader(const char* label)
|
|||||||
if ((table->RowFlags & ImGuiTableRowFlags_Headers) == 0)
|
if ((table->RowFlags & ImGuiTableRowFlags_Headers) == 0)
|
||||||
TableSetBgColor(ImGuiTableBgTarget_CellBg, GetColorU32(ImGuiCol_TableHeaderBg), table->CurrentColumn);
|
TableSetBgColor(ImGuiTableBgTarget_CellBg, GetColorU32(ImGuiCol_TableHeaderBg), table->CurrentColumn);
|
||||||
}
|
}
|
||||||
|
RenderNavHighlight(bb, id, ImGuiNavHighlightFlags_TypeThin | ImGuiNavHighlightFlags_NoRounding);
|
||||||
if (held)
|
if (held)
|
||||||
table->HeldHeaderColumn = (ImGuiTableColumnIdx)column_n;
|
table->HeldHeaderColumn = (ImGuiTableColumnIdx)column_n;
|
||||||
window->DC.CursorPos.y -= g.Style.ItemSpacing.y * 0.5f;
|
window->DC.CursorPos.y -= g.Style.ItemSpacing.y * 0.5f;
|
||||||
@@ -3073,16 +3092,19 @@ void ImGui::TableDrawContextMenu(ImGuiTable* table)
|
|||||||
for (int other_column_n = 0; other_column_n < table->ColumnsCount; other_column_n++)
|
for (int other_column_n = 0; other_column_n < table->ColumnsCount; other_column_n++)
|
||||||
{
|
{
|
||||||
ImGuiTableColumn* other_column = &table->Columns[other_column_n];
|
ImGuiTableColumn* other_column = &table->Columns[other_column_n];
|
||||||
|
if (other_column->Flags & ImGuiTableColumnFlags_Disabled)
|
||||||
|
continue;
|
||||||
|
|
||||||
const char* name = TableGetColumnName(table, other_column_n);
|
const char* name = TableGetColumnName(table, other_column_n);
|
||||||
if (name == NULL || name[0] == 0)
|
if (name == NULL || name[0] == 0)
|
||||||
name = "<Unknown>";
|
name = "<Unknown>";
|
||||||
|
|
||||||
// Make sure we can't hide the last active column
|
// Make sure we can't hide the last active column
|
||||||
bool menu_item_active = (other_column->Flags & ImGuiTableColumnFlags_NoHide) ? false : true;
|
bool menu_item_active = (other_column->Flags & ImGuiTableColumnFlags_NoHide) ? false : true;
|
||||||
if (other_column->IsEnabled && table->ColumnsEnabledCount <= 1)
|
if (other_column->IsUserEnabled && table->ColumnsEnabledCount <= 1)
|
||||||
menu_item_active = false;
|
menu_item_active = false;
|
||||||
if (MenuItem(name, NULL, other_column->IsEnabled, menu_item_active))
|
if (MenuItem(name, NULL, other_column->IsUserEnabled, menu_item_active))
|
||||||
other_column->IsEnabledNextFrame = !other_column->IsEnabled;
|
other_column->IsUserEnabledNextFrame = !other_column->IsUserEnabled;
|
||||||
}
|
}
|
||||||
PopItemFlag();
|
PopItemFlag();
|
||||||
}
|
}
|
||||||
@@ -3207,7 +3229,7 @@ void ImGui::TableSaveSettings(ImGuiTable* table)
|
|||||||
column_settings->DisplayOrder = column->DisplayOrder;
|
column_settings->DisplayOrder = column->DisplayOrder;
|
||||||
column_settings->SortOrder = column->SortOrder;
|
column_settings->SortOrder = column->SortOrder;
|
||||||
column_settings->SortDirection = column->SortDirection;
|
column_settings->SortDirection = column->SortDirection;
|
||||||
column_settings->IsEnabled = column->IsEnabled;
|
column_settings->IsEnabled = column->IsUserEnabled;
|
||||||
column_settings->IsStretch = (column->Flags & ImGuiTableColumnFlags_WidthStretch) ? 1 : 0;
|
column_settings->IsStretch = (column->Flags & ImGuiTableColumnFlags_WidthStretch) ? 1 : 0;
|
||||||
if ((column->Flags & ImGuiTableColumnFlags_WidthStretch) == 0)
|
if ((column->Flags & ImGuiTableColumnFlags_WidthStretch) == 0)
|
||||||
save_ref_scale = true;
|
save_ref_scale = true;
|
||||||
@@ -3221,7 +3243,7 @@ void ImGui::TableSaveSettings(ImGuiTable* table)
|
|||||||
settings->SaveFlags |= ImGuiTableFlags_Reorderable;
|
settings->SaveFlags |= ImGuiTableFlags_Reorderable;
|
||||||
if (column->SortOrder != -1)
|
if (column->SortOrder != -1)
|
||||||
settings->SaveFlags |= ImGuiTableFlags_Sortable;
|
settings->SaveFlags |= ImGuiTableFlags_Sortable;
|
||||||
if (column->IsEnabled != ((column->Flags & ImGuiTableColumnFlags_DefaultHide) == 0))
|
if (column->IsUserEnabled != ((column->Flags & ImGuiTableColumnFlags_DefaultHide) == 0))
|
||||||
settings->SaveFlags |= ImGuiTableFlags_Hideable;
|
settings->SaveFlags |= ImGuiTableFlags_Hideable;
|
||||||
}
|
}
|
||||||
settings->SaveFlags &= table->Flags;
|
settings->SaveFlags &= table->Flags;
|
||||||
@@ -3279,7 +3301,7 @@ void ImGui::TableLoadSettings(ImGuiTable* table)
|
|||||||
else
|
else
|
||||||
column->DisplayOrder = (ImGuiTableColumnIdx)column_n;
|
column->DisplayOrder = (ImGuiTableColumnIdx)column_n;
|
||||||
display_order_mask |= (ImU64)1 << column->DisplayOrder;
|
display_order_mask |= (ImU64)1 << column->DisplayOrder;
|
||||||
column->IsEnabled = column->IsEnabledNextFrame = column_settings->IsEnabled;
|
column->IsUserEnabled = column->IsUserEnabledNextFrame = column_settings->IsEnabled;
|
||||||
column->SortOrder = column_settings->SortOrder;
|
column->SortOrder = column_settings->SortOrder;
|
||||||
column->SortDirection = column_settings->SortDirection;
|
column->SortDirection = column_settings->SortDirection;
|
||||||
}
|
}
|
||||||
@@ -3298,8 +3320,9 @@ void ImGui::TableLoadSettings(ImGuiTable* table)
|
|||||||
static void TableSettingsHandler_ClearAll(ImGuiContext* ctx, ImGuiSettingsHandler*)
|
static void TableSettingsHandler_ClearAll(ImGuiContext* ctx, ImGuiSettingsHandler*)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *ctx;
|
ImGuiContext& g = *ctx;
|
||||||
for (int i = 0; i != g.Tables.GetSize(); i++)
|
for (int i = 0; i != g.Tables.GetMapSize(); i++)
|
||||||
g.Tables.GetByIndex(i)->SettingsOffset = -1;
|
if (ImGuiTable* table = g.Tables.TryGetMapData(i))
|
||||||
|
table->SettingsOffset = -1;
|
||||||
g.SettingsTables.clear();
|
g.SettingsTables.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3307,9 +3330,9 @@ static void TableSettingsHandler_ClearAll(ImGuiContext* ctx, ImGuiSettingsHandle
|
|||||||
static void TableSettingsHandler_ApplyAll(ImGuiContext* ctx, ImGuiSettingsHandler*)
|
static void TableSettingsHandler_ApplyAll(ImGuiContext* ctx, ImGuiSettingsHandler*)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *ctx;
|
ImGuiContext& g = *ctx;
|
||||||
for (int i = 0; i != g.Tables.GetSize(); i++)
|
for (int i = 0; i != g.Tables.GetMapSize(); i++)
|
||||||
|
if (ImGuiTable* table = g.Tables.TryGetMapData(i))
|
||||||
{
|
{
|
||||||
ImGuiTable* table = g.Tables.GetByIndex(i);
|
|
||||||
table->IsSettingsRequestLoad = true;
|
table->IsSettingsRequestLoad = true;
|
||||||
table->SettingsOffset = -1;
|
table->SettingsOffset = -1;
|
||||||
}
|
}
|
||||||
@@ -3442,7 +3465,8 @@ void ImGui::TableGcCompactTransientBuffers(ImGuiTable* table)
|
|||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
IM_ASSERT(table->MemoryCompacted == false);
|
IM_ASSERT(table->MemoryCompacted == false);
|
||||||
table->SortSpecs.Specs = NULL;
|
table->SortSpecs.Specs = NULL;
|
||||||
table->IsSortSpecsDirty = true;
|
table->SortSpecsMulti.clear();
|
||||||
|
table->IsSortSpecsDirty = true; // FIXME: shouldn't have to leak into user performing a sort
|
||||||
table->ColumnsNames.clear();
|
table->ColumnsNames.clear();
|
||||||
table->MemoryCompacted = true;
|
table->MemoryCompacted = true;
|
||||||
for (int n = 0; n < table->ColumnsCount; n++)
|
for (int n = 0; n < table->ColumnsCount; n++)
|
||||||
@@ -3453,7 +3477,6 @@ void ImGui::TableGcCompactTransientBuffers(ImGuiTable* table)
|
|||||||
void ImGui::TableGcCompactTransientBuffers(ImGuiTableTempData* temp_data)
|
void ImGui::TableGcCompactTransientBuffers(ImGuiTableTempData* temp_data)
|
||||||
{
|
{
|
||||||
temp_data->DrawSplitter.ClearFreeMemory();
|
temp_data->DrawSplitter.ClearFreeMemory();
|
||||||
temp_data->SortSpecsMulti.clear();
|
|
||||||
temp_data->LastTimeActive = -1.0f;
|
temp_data->LastTimeActive = -1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3966,7 +3989,7 @@ void ImGui::EndColumns()
|
|||||||
const float column_hit_hw = COLUMNS_HIT_RECT_HALF_WIDTH;
|
const float column_hit_hw = COLUMNS_HIT_RECT_HALF_WIDTH;
|
||||||
const ImRect column_hit_rect(ImVec2(x - column_hit_hw, y1), ImVec2(x + column_hit_hw, y2));
|
const ImRect column_hit_rect(ImVec2(x - column_hit_hw, y1), ImVec2(x + column_hit_hw, y2));
|
||||||
KeepAliveID(column_id);
|
KeepAliveID(column_id);
|
||||||
if (IsClippedEx(column_hit_rect, column_id, false))
|
if (IsClippedEx(column_hit_rect, column_id)) // FIXME: Can be removed or replaced with a lower-level test
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bool hovered = false, held = false;
|
bool hovered = false, held = false;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -716,9 +716,11 @@ static int stb_textedit_paste_internal(STB_TEXTEDIT_STRING *str, STB_TexteditSta
|
|||||||
state->has_preferred_x = 0;
|
state->has_preferred_x = 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
// remove the undo since we didn't actually insert the characters
|
// [DEAR IMGUI]
|
||||||
if (state->undostate.undo_point)
|
//// remove the undo since we didn't actually insert the characters
|
||||||
--state->undostate.undo_point;
|
//if (state->undostate.undo_point)
|
||||||
|
// --state->undostate.undo_point;
|
||||||
|
// note: paste failure will leave deleted selection, may be restored with an undo (see https://github.com/nothings/stb/issues/734 for details)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user