mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-19 06:26:35 +00:00
Merge branch 'master' into docking
# Conflicts: # imgui.cpp # imgui.h
This commit is contained in:
commit
7b53551032
@ -108,7 +108,9 @@ Breaking Changes:
|
|||||||
|
|
||||||
- Added imgui_tables.cpp file! Manually constructed project files will need the new file added!
|
- Added imgui_tables.cpp file! Manually constructed project files will need the new file added!
|
||||||
- Backends: moved all backends files (imgui_impl_XXXX.cpp, imgui_impl_XXXX.h) from examples/ to backends/. (#3513)
|
- Backends: moved all backends files (imgui_impl_XXXX.cpp, imgui_impl_XXXX.h) from examples/ to backends/. (#3513)
|
||||||
- Removed redirecting functions/enums names that were marked obsolete in 1.60 (April 2017):
|
- Renamed ImDrawList::AddBezierCurve() to ImDrawList::AddBezierCubic(). Kept inline redirection function (will obsolete).
|
||||||
|
- Renamed ImDrawList::PathBezierCurveTo() to ImDrawList::PathBezierCubicCurveTo(). Kept inline redirection function (will obsolete).
|
||||||
|
- Removed redirecting functions/enums names that were marked obsolete in 1.60 (April 2018):
|
||||||
- io.RenderDrawListsFn pointer -> use ImGui::GetDrawData() value and call the render function of your backend
|
- io.RenderDrawListsFn pointer -> use ImGui::GetDrawData() value and call the render function of your backend
|
||||||
- ImGui::IsAnyWindowFocused() -> use ImGui::IsWindowFocused(ImGuiFocusedFlags_AnyWindow)
|
- ImGui::IsAnyWindowFocused() -> use ImGui::IsWindowFocused(ImGuiFocusedFlags_AnyWindow)
|
||||||
- ImGui::IsAnyWindowHovered() -> use ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow)
|
- ImGui::IsAnyWindowHovered() -> use ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow)
|
||||||
@ -117,6 +119,11 @@ Breaking Changes:
|
|||||||
- Removed redirecting functions/enums names that were marked obsolete in 1.61 (May 2018):
|
- Removed redirecting functions/enums names that were marked obsolete in 1.61 (May 2018):
|
||||||
- InputFloat (... int decimal_precision ...) -> use InputFloat (... const char* format ...) with format = "%.Xf" where X was value for decimal_precision.
|
- InputFloat (... int decimal_precision ...) -> use InputFloat (... const char* format ...) with format = "%.Xf" where X was value for decimal_precision.
|
||||||
- same for InputFloat2()/InputFloat3()/InputFloat4() variants taking a `int decimal_precision` parameter.
|
- same for InputFloat2()/InputFloat3()/InputFloat4() variants taking a `int decimal_precision` parameter.
|
||||||
|
- Removed redirecting functions/enums names that were marked obsolete in 1.63 (August 2018):
|
||||||
|
- ImGui::IsItemDeactivatedAfterChange() -> use ImGui::IsItemDeactivatedAfterEdit().
|
||||||
|
- ImGuiCol_ModalWindowDarkening -> use ImGuiCol_ModalWindowDimBg
|
||||||
|
- ImGuiInputTextCallback -> use ImGuiTextEditCallback
|
||||||
|
- ImGuiInputTextCallbackData -> use ImGuiTextEditCallbackData
|
||||||
- If you were still using the old names, while you are cleaning up, considering enabling
|
- If you were still using the old names, while you are cleaning up, considering enabling
|
||||||
IMGUI_DISABLE_OBSOLETE_FUNCTIONS in imconfig.h even temporarily to have a pass at finding
|
IMGUI_DISABLE_OBSOLETE_FUNCTIONS in imconfig.h even temporarily to have a pass at finding
|
||||||
and removing up old API calls, if any remaining.
|
and removing up old API calls, if any remaining.
|
||||||
@ -148,6 +155,7 @@ Other Changes:
|
|||||||
- Drag and Drop: Fix drag and drop to tie same-size drop targets by choosen the later one. Fixes dragging
|
- Drag and Drop: Fix drag and drop to tie same-size drop targets by choosen the later one. Fixes dragging
|
||||||
into a full-window-sized dockspace inside a zero-padded window. (#3519, #2717) [@Black-Cat]
|
into a full-window-sized dockspace inside a zero-padded window. (#3519, #2717) [@Black-Cat]
|
||||||
- Checkbox: Added CheckboxFlags() helper with int* type.
|
- Checkbox: Added CheckboxFlags() helper with int* type.
|
||||||
|
- Clipper: Fixed incorrect end-list positioning when using ImGuiListClipper with 1 item (bug in 1.79). (#3663) [@nyorain]
|
||||||
- InputText: Fixed updating cursor/selection position when a callback altered the buffer in a way
|
- InputText: Fixed updating cursor/selection position when a callback altered the buffer in a way
|
||||||
where the byte count is unchanged but the decoded character count changes. (#3587) [@gqw]
|
where the byte count is unchanged but the decoded character count changes. (#3587) [@gqw]
|
||||||
- InputText: Fixed swiching from single to multi-line while preserving same ID.
|
- InputText: Fixed swiching from single to multi-line while preserving same ID.
|
||||||
@ -156,6 +164,8 @@ Other Changes:
|
|||||||
feedback and control of keyboard/gamepad navigation highlight and mouse hover disable flag. (#787, #2048)
|
feedback and control of keyboard/gamepad navigation highlight and mouse hover disable flag. (#787, #2048)
|
||||||
- Metrics: Fixed mishandling of ImDrawCmd::VtxOffset in wireframe mesh renderer.
|
- Metrics: Fixed mishandling of ImDrawCmd::VtxOffset in wireframe mesh renderer.
|
||||||
- Metrics: Rebranded as "Dear ImGui Metrics/Debugger" to clarify its purpose.
|
- Metrics: Rebranded as "Dear ImGui Metrics/Debugger" to clarify its purpose.
|
||||||
|
- ImDrawList: Added ImDrawList::AddQuadBezierCurve(), ImDrawList::PathQuadBezierCurveTo() quadratic bezier
|
||||||
|
helpers. (#3127, #3664, #3665) [@aiekick]
|
||||||
- Fonts: Updated GetGlyphRangesJapanese() to include a larger 2999 ideograms selection of Joyo/Jinmeiyo
|
- Fonts: Updated GetGlyphRangesJapanese() to include a larger 2999 ideograms selection of Joyo/Jinmeiyo
|
||||||
kanjis, from the previous 1946 ideograms selection. This will consume a some more memory but be generally
|
kanjis, from the previous 1946 ideograms selection. This will consume a some more memory but be generally
|
||||||
much more fitting for Japanese display, until we switch to a more dynamic atlas. (#3627) [@vaiorabbit]
|
much more fitting for Japanese display, until we switch to a more dynamic atlas. (#3627) [@vaiorabbit]
|
||||||
@ -190,6 +200,8 @@ Other Changes:
|
|||||||
VERSION 1.79 (Released 2020-10-08)
|
VERSION 1.79 (Released 2020-10-08)
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.79
|
||||||
|
|
||||||
Breaking Changes:
|
Breaking Changes:
|
||||||
|
|
||||||
- Fonts: Removed ImFont::DisplayOffset in favor of ImFontConfig::GlyphOffset. DisplayOffset was applied
|
- Fonts: Removed ImFont::DisplayOffset in favor of ImFontConfig::GlyphOffset. DisplayOffset was applied
|
||||||
@ -282,6 +294,8 @@ Other Changes:
|
|||||||
VERSION 1.78 (Released 2020-08-18)
|
VERSION 1.78 (Released 2020-08-18)
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.78
|
||||||
|
|
||||||
Breaking Changes:
|
Breaking Changes:
|
||||||
|
|
||||||
- Obsoleted use of the trailing 'float power=1.0f' parameter for those functions: [@Shironekoben, @ocornut]
|
- Obsoleted use of the trailing 'float power=1.0f' parameter for those functions: [@Shironekoben, @ocornut]
|
||||||
|
49
imgui.cpp
49
imgui.cpp
@ -126,7 +126,7 @@ CODE
|
|||||||
- You can apply arithmetic operators +,*,/ on numerical values. Use +- to subtract (because - would set a negative value!)
|
- You can apply arithmetic operators +,*,/ on numerical values. Use +- to subtract (because - would set a negative value!)
|
||||||
- Controls are automatically adjusted for OSX to match standard OSX text editing operations.
|
- Controls are automatically adjusted for OSX to match standard OSX text editing operations.
|
||||||
- General Keyboard controls: enable with ImGuiConfigFlags_NavEnableKeyboard.
|
- General Keyboard controls: enable with ImGuiConfigFlags_NavEnableKeyboard.
|
||||||
- General Gamepad controls: enable with ImGuiConfigFlags_NavEnableGamepad. See suggested mappings in imgui.h ImGuiNavInput_ + download PNG/PSD at http://goo.gl/9LgVZW
|
- General Gamepad controls: enable with ImGuiConfigFlags_NavEnableGamepad. See suggested mappings in imgui.h ImGuiNavInput_ + download PNG/PSD at http://dearimgui.org/controls_sheets
|
||||||
|
|
||||||
|
|
||||||
PROGRAMMER GUIDE
|
PROGRAMMER GUIDE
|
||||||
@ -158,18 +158,20 @@ CODE
|
|||||||
HOW TO UPDATE TO A NEWER VERSION OF DEAR IMGUI
|
HOW TO UPDATE TO A NEWER VERSION OF DEAR IMGUI
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
- Overwrite all the sources files except for imconfig.h (if you have made modification to your copy of imconfig.h)
|
- Overwrite all the sources files except for imconfig.h (if you have made modification to your copy of imconfig.h)
|
||||||
- Or maintain your own branch where you have imconfig.h modified.
|
- Or maintain your own branch where you have imconfig.h modified as a top-most commit which you can regularly rebase over master.
|
||||||
|
- You can also use '#define IMGUI_USER_CONFIG "my_config_file.h" to redirect configuration to your own file.
|
||||||
- Read the "API BREAKING CHANGES" section (below). This is where we list occasional API breaking changes.
|
- Read the "API BREAKING CHANGES" section (below). This is where we list occasional API breaking changes.
|
||||||
If a function/type has been renamed / or marked obsolete, try to fix the name in your code before it is permanently removed
|
If a function/type has been renamed / or marked obsolete, try to fix the name in your code before it is permanently removed
|
||||||
from the public API. If you have a problem with a missing function/symbols, search for its name in the code, there will
|
from the public API. If you have a problem with a missing function/symbols, search for its name in the code, there will
|
||||||
likely be a comment about it. Please report any issue to the GitHub page!
|
likely be a comment about it. Please report any issue to the GitHub page!
|
||||||
- Try to keep your copy of dear imgui reasonably up to date.
|
- To find out usage of old API, you can add '#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS' in your configuration file.
|
||||||
|
- Try to keep your copy of Dear ImGui reasonably up to date.
|
||||||
|
|
||||||
|
|
||||||
GETTING STARTED WITH INTEGRATING DEAR IMGUI IN YOUR CODE/ENGINE
|
GETTING STARTED WITH INTEGRATING DEAR IMGUI IN YOUR CODE/ENGINE
|
||||||
---------------------------------------------------------------
|
---------------------------------------------------------------
|
||||||
- Run and study the examples and demo in imgui_demo.cpp to get acquainted with the library.
|
- Run and study the examples and demo in imgui_demo.cpp to get acquainted with the library.
|
||||||
- In the majority of cases you should be able to use unmodified backends files available in the examples/ folder.
|
- In the majority of cases you should be able to use unmodified backends files available in the backends/ folder.
|
||||||
- Add the Dear ImGui source files + selected backend source files to your projects or using your preferred build system.
|
- Add the Dear ImGui source files + selected backend source files to your projects or using your preferred build system.
|
||||||
It is recommended you build and statically link the .cpp files as part of your project and NOT as shared library (DLL).
|
It is recommended you build and statically link the .cpp files as part of your project and NOT as shared library (DLL).
|
||||||
- You can later customize the imconfig.h file to tweak some compile-time behavior, such as integrating Dear ImGui types with your own maths types.
|
- You can later customize the imconfig.h file to tweak some compile-time behavior, such as integrating Dear ImGui types with your own maths types.
|
||||||
@ -350,7 +352,7 @@ CODE
|
|||||||
0.0f= not held. 1.0f= fully held. Pass intermediate 0.0f..1.0f values for analog triggers/sticks.
|
0.0f= not held. 1.0f= fully held. Pass intermediate 0.0f..1.0f values for analog triggers/sticks.
|
||||||
- We uses a simple >0.0f test for activation testing, and won't attempt to test for a dead-zone.
|
- We uses a simple >0.0f test for activation testing, and won't attempt to test for a dead-zone.
|
||||||
Your code will probably need to transform your raw inputs (such as e.g. remapping your 0.2..0.9 raw input range to 0.0..1.0 imgui range, etc.).
|
Your code will probably need to transform your raw inputs (such as e.g. remapping your 0.2..0.9 raw input range to 0.0..1.0 imgui range, etc.).
|
||||||
- You can download PNG/PSD files depicting the gamepad controls for common controllers at: http://goo.gl/9LgVZW.
|
- You can download PNG/PSD files depicting the gamepad controls for common controllers at: http://dearimgui.org/controls_sheets
|
||||||
- If you need to share inputs between your game and the imgui parts, the easiest approach is to go all-or-nothing, with a buttons combo
|
- If you need to share inputs between your game and the imgui parts, the easiest approach is to go all-or-nothing, with a buttons combo
|
||||||
to toggle the target. Please reach out if you think the game vs navigation input sharing could be improved.
|
to toggle the target. Please reach out if you think the game vs navigation input sharing could be improved.
|
||||||
- Mouse:
|
- Mouse:
|
||||||
@ -382,6 +384,12 @@ CODE
|
|||||||
- 2020/XX/XX (1.XX) - Moved IME support functions from io.ImeSetInputScreenPosFn, io.ImeWindowHandle to the PlatformIO api.
|
- 2020/XX/XX (1.XX) - Moved IME support functions from io.ImeSetInputScreenPosFn, io.ImeWindowHandle to the PlatformIO api.
|
||||||
|
|
||||||
|
|
||||||
|
- 2020/12/21 (1.80) - removed redirecting functions/enums that were marked obsolete in 1.63 (August 2018):
|
||||||
|
- ImGui::IsItemDeactivatedAfterChange() -> use ImGui::IsItemDeactivatedAfterEdit().
|
||||||
|
- ImGuiCol_ModalWindowDarkening -> use ImGuiCol_ModalWindowDimBg
|
||||||
|
- ImGuiInputTextCallback -> use ImGuiTextEditCallback
|
||||||
|
- ImGuiInputTextCallbackData -> use ImGuiTextEditCallbackData
|
||||||
|
- 2020/12/21 (1.80) - renamed ImDrawList::AddBezierCurve() to AddBezierCubic(), and PathBezierCurveTo() to PathBezierCubicCurveTo(). Kept inline redirection function (will obsolete).
|
||||||
- 2020/12/04 (1.80) - added imgui_tables.cpp file! Manually constructed project files will need the new file added!
|
- 2020/12/04 (1.80) - added imgui_tables.cpp file! Manually constructed project files will need the new file added!
|
||||||
- 2020/11/18 (1.80) - renamed undocumented/internals ImGuiColumnsFlags_* to ImGuiOldColumnFlags_* in prevision of incoming Tables API.
|
- 2020/11/18 (1.80) - renamed undocumented/internals ImGuiColumnsFlags_* to ImGuiOldColumnFlags_* in prevision of incoming Tables API.
|
||||||
- 2020/11/03 (1.80) - renamed io.ConfigWindowsMemoryCompactTimer to io.ConfigMemoryCompactTimer as the feature will apply to other data structures
|
- 2020/11/03 (1.80) - renamed io.ConfigWindowsMemoryCompactTimer to io.ConfigMemoryCompactTimer as the feature will apply to other data structures
|
||||||
@ -1157,7 +1165,7 @@ void ImGuiIO::ClearInputCharacters()
|
|||||||
// [SECTION] MISC HELPERS/UTILITIES (Geometry functions)
|
// [SECTION] MISC HELPERS/UTILITIES (Geometry functions)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ImVec2 ImBezierClosestPoint(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, const ImVec2& p, int num_segments)
|
ImVec2 ImBezierCubicClosestPoint(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, const ImVec2& p, int num_segments)
|
||||||
{
|
{
|
||||||
IM_ASSERT(num_segments > 0); // Use ImBezierClosestPointCasteljau()
|
IM_ASSERT(num_segments > 0); // Use ImBezierClosestPointCasteljau()
|
||||||
ImVec2 p_last = p1;
|
ImVec2 p_last = p1;
|
||||||
@ -1166,7 +1174,7 @@ ImVec2 ImBezierClosestPoint(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3
|
|||||||
float t_step = 1.0f / (float)num_segments;
|
float t_step = 1.0f / (float)num_segments;
|
||||||
for (int i_step = 1; i_step <= num_segments; i_step++)
|
for (int i_step = 1; i_step <= num_segments; i_step++)
|
||||||
{
|
{
|
||||||
ImVec2 p_current = ImBezierCalc(p1, p2, p3, p4, t_step * i_step);
|
ImVec2 p_current = ImBezierCubicCalc(p1, p2, p3, p4, t_step * i_step);
|
||||||
ImVec2 p_line = ImLineClosestPoint(p_last, p_current, p);
|
ImVec2 p_line = ImLineClosestPoint(p_last, p_current, p);
|
||||||
float dist2 = ImLengthSqr(p - p_line);
|
float dist2 = ImLengthSqr(p - p_line);
|
||||||
if (dist2 < p_closest_dist2)
|
if (dist2 < p_closest_dist2)
|
||||||
@ -1180,7 +1188,7 @@ ImVec2 ImBezierClosestPoint(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Closely mimics PathBezierToCasteljau() in imgui_draw.cpp
|
// Closely mimics PathBezierToCasteljau() in imgui_draw.cpp
|
||||||
static void BezierClosestPointCasteljauStep(const ImVec2& p, ImVec2& p_closest, ImVec2& p_last, float& p_closest_dist2, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, float tess_tol, int level)
|
static void ImBezierCubicClosestPointCasteljauStep(const ImVec2& p, ImVec2& p_closest, ImVec2& p_last, float& p_closest_dist2, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, float tess_tol, int level)
|
||||||
{
|
{
|
||||||
float dx = x4 - x1;
|
float dx = x4 - x1;
|
||||||
float dy = y4 - y1;
|
float dy = y4 - y1;
|
||||||
@ -1208,20 +1216,20 @@ static void BezierClosestPointCasteljauStep(const ImVec2& p, ImVec2& p_closest,
|
|||||||
float x123 = (x12 + x23)*0.5f, y123 = (y12 + y23)*0.5f;
|
float x123 = (x12 + x23)*0.5f, y123 = (y12 + y23)*0.5f;
|
||||||
float x234 = (x23 + x34)*0.5f, y234 = (y23 + y34)*0.5f;
|
float x234 = (x23 + x34)*0.5f, y234 = (y23 + y34)*0.5f;
|
||||||
float x1234 = (x123 + x234)*0.5f, y1234 = (y123 + y234)*0.5f;
|
float x1234 = (x123 + x234)*0.5f, y1234 = (y123 + y234)*0.5f;
|
||||||
BezierClosestPointCasteljauStep(p, p_closest, p_last, p_closest_dist2, x1, y1, x12, y12, x123, y123, x1234, y1234, tess_tol, level + 1);
|
ImBezierCubicClosestPointCasteljauStep(p, p_closest, p_last, p_closest_dist2, x1, y1, x12, y12, x123, y123, x1234, y1234, tess_tol, level + 1);
|
||||||
BezierClosestPointCasteljauStep(p, p_closest, p_last, p_closest_dist2, x1234, y1234, x234, y234, x34, y34, x4, y4, tess_tol, level + 1);
|
ImBezierCubicClosestPointCasteljauStep(p, p_closest, p_last, p_closest_dist2, x1234, y1234, x234, y234, x34, y34, x4, y4, tess_tol, level + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// tess_tol is generally the same value you would find in ImGui::GetStyle().CurveTessellationTol
|
// tess_tol is generally the same value you would find in ImGui::GetStyle().CurveTessellationTol
|
||||||
// Because those ImXXX functions are lower-level than ImGui:: we cannot access this value automatically.
|
// Because those ImXXX functions are lower-level than ImGui:: we cannot access this value automatically.
|
||||||
ImVec2 ImBezierClosestPointCasteljau(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, const ImVec2& p, float tess_tol)
|
ImVec2 ImBezierCubicClosestPointCasteljau(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, const ImVec2& p, float tess_tol)
|
||||||
{
|
{
|
||||||
IM_ASSERT(tess_tol > 0.0f);
|
IM_ASSERT(tess_tol > 0.0f);
|
||||||
ImVec2 p_last = p1;
|
ImVec2 p_last = p1;
|
||||||
ImVec2 p_closest;
|
ImVec2 p_closest;
|
||||||
float p_closest_dist2 = FLT_MAX;
|
float p_closest_dist2 = FLT_MAX;
|
||||||
BezierClosestPointCasteljauStep(p, p_closest, p_last, p_closest_dist2, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, p4.x, p4.y, tess_tol, 0);
|
ImBezierCubicClosestPointCasteljauStep(p, p_closest, p_last, p_closest_dist2, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, p4.x, p4.y, tess_tol, 0);
|
||||||
return p_closest;
|
return p_closest;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2303,8 +2311,8 @@ bool ImGuiListClipper::Step()
|
|||||||
if (table && table->IsInsideRow)
|
if (table && table->IsInsideRow)
|
||||||
ImGui::TableEndRow(table);
|
ImGui::TableEndRow(table);
|
||||||
|
|
||||||
// Reached end of list
|
// No items
|
||||||
if (DisplayEnd >= ItemsCount || GetSkipItemForListClipping())
|
if (ItemsCount == 0 || GetSkipItemForListClipping())
|
||||||
{
|
{
|
||||||
End();
|
End();
|
||||||
return false;
|
return false;
|
||||||
@ -2357,6 +2365,13 @@ bool ImGuiListClipper::Step()
|
|||||||
StepNo = 2;
|
StepNo = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reached end of list
|
||||||
|
if (DisplayEnd >= ItemsCount)
|
||||||
|
{
|
||||||
|
End();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Step 2: calculate the actual range of elements to display, and position the cursor before the first element
|
// Step 2: calculate the actual range of elements to display, and position the cursor before the first element
|
||||||
if (StepNo == 2)
|
if (StepNo == 2)
|
||||||
{
|
{
|
||||||
@ -5062,6 +5077,7 @@ bool ImGui::IsItemEdited()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Allow last item to be overlapped by a subsequent item. Both may be activated during the same frame before the later one takes priority.
|
// Allow last item to be overlapped by a subsequent item. Both may be activated during the same frame before the later one takes priority.
|
||||||
|
// FIXME: Although this is exposed, its interaction and ideal idiom with using ImGuiButtonFlags_AllowItemOverlap flag are extremely confusing, need rework.
|
||||||
void ImGui::SetItemAllowOverlap()
|
void ImGui::SetItemAllowOverlap()
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
@ -15704,8 +15720,8 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
// Debugging enums
|
// Debugging enums
|
||||||
enum { WRT_OuterRect, WRT_OuterRectClipped, WRT_InnerRect, WRT_InnerClipRect, WRT_WorkRect, WRT_Content, WRT_ContentRegionRect, WRT_Count }; // Windows Rect Type
|
enum { WRT_OuterRect, WRT_OuterRectClipped, WRT_InnerRect, WRT_InnerClipRect, WRT_WorkRect, WRT_Content, WRT_ContentRegionRect, WRT_Count }; // Windows Rect Type
|
||||||
const char* wrt_rects_names[WRT_Count] = { "OuterRect", "OuterRectClipped", "InnerRect", "InnerClipRect", "WorkRect", "Content", "ContentRegionRect" };
|
const char* wrt_rects_names[WRT_Count] = { "OuterRect", "OuterRectClipped", "InnerRect", "InnerClipRect", "WorkRect", "Content", "ContentRegionRect" };
|
||||||
enum { TRT_OuterRect, TRT_WorkRect, TRT_HostClipRect, TRT_InnerClipRect, TRT_BackgroundClipRect, TRT_ColumnsRect, TRT_ColumnsClipRect, TRT_ColumnsContentHeadersUsed, TRT_ColumnsContentHeadersIdeal, TRT_ColumnsContentFrozen, TRT_ColumnsContentUnfrozen, TRT_Count }; // Tables Rect Type
|
enum { TRT_OuterRect, TRT_InnerRect, TRT_WorkRect, TRT_HostClipRect, TRT_InnerClipRect, TRT_BackgroundClipRect, TRT_ColumnsRect, TRT_ColumnsClipRect, TRT_ColumnsContentHeadersUsed, TRT_ColumnsContentHeadersIdeal, TRT_ColumnsContentFrozen, TRT_ColumnsContentUnfrozen, TRT_Count }; // Tables Rect Type
|
||||||
const char* trt_rects_names[TRT_Count] = { "OuterRect", "WorkRect", "HostClipRect", "InnerClipRect", "BackgroundClipRect", "ColumnsRect", "ColumnsClipRect", "ColumnsContentHeadersUsed", "ColumnsContentHeadersIdeal", "ColumnsContentFrozen", "ColumnsContentUnfrozen" };
|
const char* trt_rects_names[TRT_Count] = { "OuterRect", "InnerRect", "WorkRect", "HostClipRect", "InnerClipRect", "BackgroundClipRect", "ColumnsRect", "ColumnsClipRect", "ColumnsContentHeadersUsed", "ColumnsContentHeadersIdeal", "ColumnsContentFrozen", "ColumnsContentUnfrozen" };
|
||||||
if (cfg->ShowWindowsRectsType < 0)
|
if (cfg->ShowWindowsRectsType < 0)
|
||||||
cfg->ShowWindowsRectsType = WRT_WorkRect;
|
cfg->ShowWindowsRectsType = WRT_WorkRect;
|
||||||
if (cfg->ShowTablesRectsType < 0)
|
if (cfg->ShowTablesRectsType < 0)
|
||||||
@ -15716,6 +15732,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
static ImRect GetTableRect(ImGuiTable* table, int rect_type, int n)
|
static ImRect GetTableRect(ImGuiTable* table, int rect_type, int n)
|
||||||
{
|
{
|
||||||
if (rect_type == TRT_OuterRect) { return table->OuterRect; }
|
if (rect_type == TRT_OuterRect) { return table->OuterRect; }
|
||||||
|
else if (rect_type == TRT_InnerRect) { return table->InnerRect; }
|
||||||
else if (rect_type == TRT_WorkRect) { return table->WorkRect; }
|
else if (rect_type == TRT_WorkRect) { return table->WorkRect; }
|
||||||
else if (rect_type == TRT_HostClipRect) { return table->HostClipRect; }
|
else if (rect_type == TRT_HostClipRect) { return table->HostClipRect; }
|
||||||
else if (rect_type == TRT_InnerClipRect) { return table->InnerClipRect; }
|
else if (rect_type == TRT_InnerClipRect) { return table->InnerClipRect; }
|
||||||
|
184
imgui.h
184
imgui.h
@ -19,26 +19,25 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Index of this file:
|
Index of this file:
|
||||||
// Header mess
|
// [SECTION] Header mess
|
||||||
// Forward declarations and basic types
|
// [SECTION] Forward declarations and basic types
|
||||||
// ImGui API (Dear ImGui end-user API)
|
// [SECTION] Dear ImGui end-user API functions
|
||||||
// Flags & Enumerations
|
// [SECTION] Flags & Enumerations
|
||||||
// Memory allocations macros
|
// [SECTION] Helpers: Memory allocations macros, ImVector<>
|
||||||
// ImVector<>
|
// [SECTION] ImGuiStyle
|
||||||
// ImGuiStyle
|
// [SECTION] ImGuiIO
|
||||||
// ImGuiIO
|
// [SECTION] Misc data structures (ImGuiInputTextCallbackData, ImGuiSizeCallbackData, ImGuiWindowClass, ImGuiPayload, ImGuiTableSortSpecs, ImGuiTableColumnSortSpecs)
|
||||||
// Misc data structures (ImGuiInputTextCallbackData, ImGuiSizeCallbackData, ImGuiWindowClass, ImGuiPayload, ImGuiTableSortSpecs, ImGuiTableColumnSortSpecs)
|
// [SECTION] Obsolete functions
|
||||||
// Obsolete functions
|
// [SECTION] Helpers (ImGuiOnceUponAFrame, ImGuiTextFilter, ImGuiTextBuffer, ImGuiStorage, ImGuiListClipper, ImColor)
|
||||||
// Helpers (ImGuiOnceUponAFrame, ImGuiTextFilter, ImGuiTextBuffer, ImGuiStorage, ImGuiListClipper, ImColor)
|
// [SECTION] Drawing API (ImDrawCallback, ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListSplitter, ImDrawListFlags, ImDrawList, ImDrawData)
|
||||||
// Draw List API (ImDrawCallback, ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListSplitter, ImDrawListFlags, ImDrawList, ImDrawData)
|
// [SECTION] Font API (ImFontConfig, ImFontGlyph, ImFontGlyphRangesBuilder, ImFontAtlasFlags, ImFontAtlas, ImFont)
|
||||||
// Font API (ImFontConfig, ImFontGlyph, ImFontGlyphRangesBuilder, ImFontAtlasFlags, ImFontAtlas, ImFont)
|
// [SECTION] Platform interface for multi-viewport support (ImGuiPlatformIO, ImGuiPlatformMonitor, ImGuiViewportFlags, ImGuiViewport)
|
||||||
// Platform interface for multi-viewport support (ImGuiPlatformIO, ImGuiPlatformMonitor, ImGuiViewportFlags, ImGuiViewport)
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// Configuration file with compile-time options (edit imconfig.h or #define IMGUI_USER_CONFIG to your own filename)
|
// Configuration file with compile-time options (edit imconfig.h or '#define IMGUI_USER_CONFIG "myfilename.h" from your build system')
|
||||||
#ifdef IMGUI_USER_CONFIG
|
#ifdef IMGUI_USER_CONFIG
|
||||||
#include IMGUI_USER_CONFIG
|
#include IMGUI_USER_CONFIG
|
||||||
#endif
|
#endif
|
||||||
@ -49,7 +48,7 @@ Index of this file:
|
|||||||
#ifndef IMGUI_DISABLE
|
#ifndef IMGUI_DISABLE
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Header mess
|
// [SECTION] Header mess
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Includes
|
// Includes
|
||||||
@ -61,7 +60,7 @@ 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.80 WIP"
|
#define IMGUI_VERSION "1.80 WIP"
|
||||||
#define IMGUI_VERSION_NUM 17906
|
#define IMGUI_VERSION_NUM 17907
|
||||||
#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
|
||||||
#define IMGUI_HAS_VIEWPORT // Viewport WIP branch
|
#define IMGUI_HAS_VIEWPORT // Viewport WIP branch
|
||||||
@ -89,11 +88,13 @@ Index of this file:
|
|||||||
#else
|
#else
|
||||||
#define IM_OFFSETOF(_TYPE,_MEMBER) ((size_t)&(((_TYPE*)0)->_MEMBER)) // Offset of _MEMBER within _TYPE. Old style macro.
|
#define IM_OFFSETOF(_TYPE,_MEMBER) ((size_t)&(((_TYPE*)0)->_MEMBER)) // Offset of _MEMBER within _TYPE. Old style macro.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// 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(__clang__)
|
||||||
#define IM_FMTARGS(FMT) __attribute__((format(printf, FMT, FMT+1))) // Apply printf-style warnings to our formatting functions.
|
#define IM_FMTARGS(FMT) __attribute__((format(printf, FMT, FMT+1)))
|
||||||
#define IM_FMTLIST(FMT) __attribute__((format(printf, FMT, 0)))
|
#define IM_FMTLIST(FMT) __attribute__((format(printf, FMT, 0)))
|
||||||
#elif !defined(IMGUI_USE_STB_SPRINTF) && defined(__GNUC__) && defined(__MINGW32__)
|
#elif !defined(IMGUI_USE_STB_SPRINTF) && defined(__GNUC__) && defined(__MINGW32__)
|
||||||
#define IM_FMTARGS(FMT) __attribute__((format(gnu_printf, FMT, FMT+1))) // Apply printf-style warnings to our formatting functions.
|
#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)))
|
||||||
#else
|
#else
|
||||||
#define IM_FMTARGS(FMT)
|
#define IM_FMTARGS(FMT)
|
||||||
@ -114,7 +115,7 @@ Index of this file:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Forward declarations and basic types
|
// [SECTION] Forward declarations and basic types
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
@ -195,10 +196,10 @@ typedef int ImGuiWindowFlags; // -> enum ImGuiWindowFlags_ // Flags: f
|
|||||||
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.
|
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.
|
||||||
#endif
|
#endif
|
||||||
typedef unsigned int ImGuiID; // A unique ID used by widgets, typically hashed from a stack of string.
|
typedef unsigned int ImGuiID; // A unique ID used by widgets, typically hashed from a stack of string.
|
||||||
typedef int (*ImGuiInputTextCallback)(ImGuiInputTextCallbackData* data);
|
typedef int (*ImGuiInputTextCallback)(ImGuiInputTextCallbackData* data); // Callback function for ImGui::InputText()
|
||||||
typedef void (*ImGuiSizeCallback)(ImGuiSizeCallbackData* data);
|
typedef void (*ImGuiSizeCallback)(ImGuiSizeCallbackData* data); // Callback function for ImGui::SetNextWindowSizeConstraints()
|
||||||
|
|
||||||
// Decoded character types
|
// 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)
|
// (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 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.
|
typedef unsigned int ImWchar32; // A single decoded U32 character/code point. We encode them as multi bytes UTF-8 when used in strings.
|
||||||
@ -252,8 +253,8 @@ struct ImVec4
|
|||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// ImGui: Dear ImGui end-user API
|
// [SECTION] Dear ImGui end-user API functions
|
||||||
// (This is a namespace. You can add extra ImGui:: functions in your own separate file. Please don't modify imgui source files!)
|
// (Note that ImGui:: being a namespace, you can add extra ImGui:: functions in your own separate file. Please don't modify imgui source files!)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace ImGui
|
namespace ImGui
|
||||||
@ -275,19 +276,19 @@ namespace ImGui
|
|||||||
IMGUI_API ImDrawData* GetDrawData(); // valid after Render() and until the next call to NewFrame(). this is what you have to render.
|
IMGUI_API ImDrawData* GetDrawData(); // valid after Render() and until the next call to NewFrame(). this is what you have to render.
|
||||||
|
|
||||||
// Demo, Debug, Information
|
// Demo, Debug, Information
|
||||||
IMGUI_API void ShowDemoWindow(bool* p_open = NULL); // create Demo window (previously called ShowTestWindow). demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application!
|
IMGUI_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 ShowAboutWindow(bool* p_open = NULL); // create About window. display Dear ImGui version, credits and build/system information.
|
|
||||||
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 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.
|
||||||
IMGUI_API void ShowFontSelector(const char* label); // add font selector block (not a window), essentially a combo listing the loaded fonts.
|
IMGUI_API void ShowFontSelector(const char* label); // add font selector block (not a window), essentially a combo listing the loaded fonts.
|
||||||
IMGUI_API void ShowUserGuide(); // add basic help/info block (not a window): how to manipulate ImGui as a end-user (mouse/keyboard controls).
|
IMGUI_API void ShowUserGuide(); // add basic help/info block (not a window): how to manipulate ImGui as a end-user (mouse/keyboard controls).
|
||||||
IMGUI_API const char* GetVersion(); // get the compiled version string e.g. "1.23" (essentially the compiled value for IMGUI_VERSION)
|
IMGUI_API const char* GetVersion(); // get the compiled version string e.g. "1.80 WIP" (essentially the value for IMGUI_VERSION from the compiled version of imgui.cpp)
|
||||||
|
|
||||||
// Styles
|
// Styles
|
||||||
IMGUI_API void StyleColorsDark(ImGuiStyle* dst = NULL); // new, recommended style (default)
|
IMGUI_API void StyleColorsDark(ImGuiStyle* dst = NULL); // new, recommended style (default)
|
||||||
IMGUI_API void StyleColorsClassic(ImGuiStyle* dst = NULL); // classic imgui style
|
|
||||||
IMGUI_API void StyleColorsLight(ImGuiStyle* dst = NULL); // best used with borders and a custom, thicker font
|
IMGUI_API void StyleColorsLight(ImGuiStyle* dst = NULL); // best used with borders and a custom, thicker font
|
||||||
|
IMGUI_API void StyleColorsClassic(ImGuiStyle* dst = NULL); // classic imgui style
|
||||||
|
|
||||||
// Windows
|
// Windows
|
||||||
// - Begin() = push window to the stack and start appending to it. End() = pop window from the stack.
|
// - Begin() = push window to the stack and start appending to it. End() = pop window from the stack.
|
||||||
@ -350,9 +351,10 @@ namespace ImGui
|
|||||||
IMGUI_API void SetWindowFocus(const char* name); // set named window to be focused / top-most. use NULL to remove focus.
|
IMGUI_API void SetWindowFocus(const char* name); // set named window to be focused / top-most. use NULL to remove focus.
|
||||||
|
|
||||||
// Content region
|
// Content region
|
||||||
// - Those functions are bound to be redesigned soon (they are confusing, incomplete and return values in local window coordinates which increases confusion)
|
// - Retrieve available space from a given point. GetContentRegionAvail() is frequently useful.
|
||||||
IMGUI_API ImVec2 GetContentRegionMax(); // current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates
|
// - 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 GetWindowContentRegionMin(); // content boundaries min (roughly (0,0)-Scroll), in window coordinates
|
IMGUI_API ImVec2 GetWindowContentRegionMin(); // content boundaries min (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 (roughly (0,0)+Size-Scroll) where Size can be override with SetNextWindowContentSize(), in window coordinates
|
||||||
IMGUI_API float GetWindowContentRegionWidth(); //
|
IMGUI_API float GetWindowContentRegionWidth(); //
|
||||||
@ -360,10 +362,10 @@ namespace ImGui
|
|||||||
// Windows Scrolling
|
// Windows Scrolling
|
||||||
IMGUI_API float GetScrollX(); // get scrolling amount [0 .. GetScrollMaxX()]
|
IMGUI_API float GetScrollX(); // get scrolling amount [0 .. GetScrollMaxX()]
|
||||||
IMGUI_API float GetScrollY(); // get scrolling amount [0 .. GetScrollMaxY()]
|
IMGUI_API float GetScrollY(); // get scrolling amount [0 .. GetScrollMaxY()]
|
||||||
IMGUI_API float GetScrollMaxX(); // get maximum scrolling amount ~~ ContentSize.x - WindowSize.x
|
|
||||||
IMGUI_API float GetScrollMaxY(); // get maximum scrolling amount ~~ ContentSize.y - WindowSize.y
|
|
||||||
IMGUI_API void SetScrollX(float scroll_x); // set scrolling amount [0 .. GetScrollMaxX()]
|
IMGUI_API void SetScrollX(float scroll_x); // set scrolling amount [0 .. GetScrollMaxX()]
|
||||||
IMGUI_API void SetScrollY(float scroll_y); // set scrolling amount [0 .. GetScrollMaxY()]
|
IMGUI_API void SetScrollY(float scroll_y); // set scrolling amount [0 .. GetScrollMaxY()]
|
||||||
|
IMGUI_API float GetScrollMaxX(); // get maximum scrolling amount ~~ ContentSize.x - WindowSize.x - DecorationsSize.x
|
||||||
|
IMGUI_API float GetScrollMaxY(); // get maximum scrolling amount ~~ ContentSize.y - WindowSize.y - DecorationsSize.y
|
||||||
IMGUI_API void SetScrollHereX(float center_x_ratio = 0.5f); // adjust scrolling amount to make current cursor position visible. center_x_ratio=0.0: left, 0.5: center, 1.0: right. When using to make a "default/current item" visible, consider using SetItemDefaultFocus() instead.
|
IMGUI_API void SetScrollHereX(float center_x_ratio = 0.5f); // adjust scrolling amount to make current cursor position visible. center_x_ratio=0.0: left, 0.5: center, 1.0: right. When using to make a "default/current item" visible, consider using SetItemDefaultFocus() instead.
|
||||||
IMGUI_API void SetScrollHereY(float center_y_ratio = 0.5f); // adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom. When using to make a "default/current item" visible, consider using SetItemDefaultFocus() instead.
|
IMGUI_API void SetScrollHereY(float center_y_ratio = 0.5f); // adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom. When using to make a "default/current item" visible, consider using SetItemDefaultFocus() instead.
|
||||||
IMGUI_API void SetScrollFromPosX(float local_x, float center_x_ratio = 0.5f); // adjust scrolling amount to make given position visible. Generally GetCursorStartPos() + offset to compute a valid position.
|
IMGUI_API void SetScrollFromPosX(float local_x, float center_x_ratio = 0.5f); // adjust scrolling amount to make given position visible. Generally GetCursorStartPos() + offset to compute a valid position.
|
||||||
@ -372,23 +374,16 @@ namespace ImGui
|
|||||||
// Parameters stacks (shared)
|
// Parameters stacks (shared)
|
||||||
IMGUI_API void PushFont(ImFont* font); // use NULL as a shortcut to push default font
|
IMGUI_API void PushFont(ImFont* font); // use NULL as a shortcut to push default font
|
||||||
IMGUI_API void PopFont();
|
IMGUI_API void PopFont();
|
||||||
IMGUI_API void PushStyleColor(ImGuiCol idx, ImU32 col);
|
IMGUI_API void PushStyleColor(ImGuiCol idx, ImU32 col); // modify a style color. always use this if you modify the style after NewFrame().
|
||||||
IMGUI_API void PushStyleColor(ImGuiCol idx, const ImVec4& col);
|
IMGUI_API void PushStyleColor(ImGuiCol idx, const ImVec4& col);
|
||||||
IMGUI_API void PopStyleColor(int count = 1);
|
IMGUI_API void PopStyleColor(int count = 1);
|
||||||
IMGUI_API void PushStyleVar(ImGuiStyleVar idx, float val);
|
IMGUI_API void PushStyleVar(ImGuiStyleVar idx, float val); // modify a style float variable. always use this if you modify the style after NewFrame().
|
||||||
IMGUI_API void PushStyleVar(ImGuiStyleVar idx, const ImVec2& val);
|
IMGUI_API void PushStyleVar(ImGuiStyleVar idx, const ImVec2& val); // modify a style ImVec2 variable. always use this if you modify the style after NewFrame().
|
||||||
IMGUI_API void PopStyleVar(int count = 1);
|
IMGUI_API void PopStyleVar(int count = 1);
|
||||||
IMGUI_API void PushAllowKeyboardFocus(bool allow_keyboard_focus); // allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets
|
IMGUI_API void PushAllowKeyboardFocus(bool allow_keyboard_focus); // allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets
|
||||||
IMGUI_API void PopAllowKeyboardFocus();
|
IMGUI_API void PopAllowKeyboardFocus();
|
||||||
IMGUI_API void PushButtonRepeat(bool repeat); // in 'repeat' mode, Button*() functions return repeated true in a typematic manner (using io.KeyRepeatDelay/io.KeyRepeatRate setting). Note that you can call IsItemActive() after any Button() to tell if the button is held in the current frame.
|
IMGUI_API void PushButtonRepeat(bool repeat); // in 'repeat' mode, Button*() functions return repeated true in a typematic manner (using io.KeyRepeatDelay/io.KeyRepeatRate setting). Note that you can call IsItemActive() after any Button() to tell if the button is held in the current frame.
|
||||||
IMGUI_API void PopButtonRepeat();
|
IMGUI_API void PopButtonRepeat();
|
||||||
IMGUI_API const ImVec4& GetStyleColorVec4(ImGuiCol idx); // retrieve style color as stored in ImGuiStyle structure. use to feed back into PushStyleColor(), otherwise use GetColorU32() to get style color with style alpha baked in.
|
|
||||||
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 ImVec2 GetFontTexUvWhitePixel(); // get UV coordinate for a while pixel, useful to draw custom shapes via the ImDrawList API
|
|
||||||
IMGUI_API ImU32 GetColorU32(ImGuiCol idx, float alpha_mul = 1.0f); // retrieve given style color with style alpha applied and optional extra alpha multiplier
|
|
||||||
IMGUI_API ImU32 GetColorU32(const ImVec4& col); // retrieve given color with style alpha applied
|
|
||||||
IMGUI_API ImU32 GetColorU32(ImU32 col); // retrieve given color with style alpha applied
|
|
||||||
|
|
||||||
// Parameters stacks (current window)
|
// Parameters stacks (current window)
|
||||||
IMGUI_API void PushItemWidth(float item_width); // push width of items for common large "item+label" widgets. >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -FLT_MIN always align width to the right side). 0.0f = default to ~2/3 of windows width,
|
IMGUI_API void PushItemWidth(float item_width); // push width of items for common large "item+label" widgets. >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -FLT_MIN always align width to the right side). 0.0f = default to ~2/3 of windows width,
|
||||||
@ -398,6 +393,15 @@ namespace ImGui
|
|||||||
IMGUI_API void PushTextWrapPos(float wrap_local_pos_x = 0.0f); // push word-wrapping position for Text*() commands. < 0.0f: no wrapping; 0.0f: wrap to end of window (or column); > 0.0f: wrap at 'wrap_pos_x' position in window local space
|
IMGUI_API void PushTextWrapPos(float wrap_local_pos_x = 0.0f); // push word-wrapping position for Text*() commands. < 0.0f: no wrapping; 0.0f: wrap to end of window (or column); > 0.0f: wrap at 'wrap_pos_x' position in window local space
|
||||||
IMGUI_API void PopTextWrapPos();
|
IMGUI_API void PopTextWrapPos();
|
||||||
|
|
||||||
|
// Style read access
|
||||||
|
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 ImVec2 GetFontTexUvWhitePixel(); // get UV coordinate for a while pixel, useful to draw custom shapes via the ImDrawList API
|
||||||
|
IMGUI_API ImU32 GetColorU32(ImGuiCol idx, float alpha_mul = 1.0f); // retrieve given style color with style alpha applied and optional extra alpha multiplier, packed as a 32-bit value suitable for ImDrawList
|
||||||
|
IMGUI_API ImU32 GetColorU32(const ImVec4& col); // retrieve given color with style alpha applied, packed as a 32-bit value suitable for ImDrawList
|
||||||
|
IMGUI_API ImU32 GetColorU32(ImU32 col); // retrieve given color with style alpha applied, packed as a 32-bit value suitable for ImDrawList
|
||||||
|
IMGUI_API const ImVec4& GetStyleColorVec4(ImGuiCol idx); // retrieve style color as stored in ImGuiStyle structure. use to feed back into PushStyleColor(), otherwise use GetColorU32() to get style color with style alpha baked in.
|
||||||
|
|
||||||
// Cursor / Layout
|
// Cursor / Layout
|
||||||
// - By "cursor" we mean the current output position.
|
// - By "cursor" we mean the current output position.
|
||||||
// - The typical widget behavior is to output themselves at the current cursor position, then move the cursor one line down.
|
// - The typical widget behavior is to output themselves at the current cursor position, then move the cursor one line down.
|
||||||
@ -474,7 +478,7 @@ namespace ImGui
|
|||||||
IMGUI_API bool CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value);
|
IMGUI_API bool CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value);
|
||||||
IMGUI_API bool RadioButton(const char* label, bool active); // use with e.g. if (RadioButton("one", my_value==1)) { my_value = 1; }
|
IMGUI_API bool RadioButton(const char* label, bool active); // use with e.g. if (RadioButton("one", my_value==1)) { my_value = 1; }
|
||||||
IMGUI_API bool RadioButton(const char* label, int* v, int v_button); // shortcut to handle the above pattern when value is an integer
|
IMGUI_API bool RadioButton(const char* label, int* v, int v_button); // shortcut to handle the above pattern when value is an integer
|
||||||
IMGUI_API void ProgressBar(float fraction, const ImVec2& size_arg = ImVec2(-1, 0), const char* overlay = NULL);
|
IMGUI_API void ProgressBar(float fraction, const ImVec2& size_arg = ImVec2(-FLT_MIN, 0), const char* overlay = NULL);
|
||||||
IMGUI_API void Bullet(); // draw a small circle + keep the cursor on the same line. advance cursor x position by GetTreeNodeToLabelSpacing(), same distance that TreeNode() uses
|
IMGUI_API void Bullet(); // draw a small circle + keep the cursor on the same line. advance cursor x position by GetTreeNodeToLabelSpacing(), same distance that TreeNode() uses
|
||||||
|
|
||||||
// Widgets: Combo Box
|
// Widgets: Combo Box
|
||||||
@ -620,7 +624,7 @@ namespace ImGui
|
|||||||
IMGUI_API bool MenuItem(const char* label, const char* shortcut, bool* p_selected, bool enabled = true); // return true when activated + toggle (*p_selected) if p_selected != NULL
|
IMGUI_API bool MenuItem(const char* label, const char* shortcut, bool* p_selected, bool enabled = true); // return true when activated + toggle (*p_selected) if p_selected != NULL
|
||||||
|
|
||||||
// Tooltips
|
// Tooltips
|
||||||
// - Tooltip are windows following the mouse which do not take focus away.
|
// - Tooltip are windows following the mouse. They do not take focus away.
|
||||||
IMGUI_API void BeginTooltip(); // begin/append a tooltip window. to create full-featured tooltip (with any kind of items).
|
IMGUI_API void BeginTooltip(); // begin/append a tooltip window. to create full-featured tooltip (with any kind of items).
|
||||||
IMGUI_API void EndTooltip();
|
IMGUI_API void EndTooltip();
|
||||||
IMGUI_API void SetTooltip(const char* fmt, ...) IM_FMTARGS(1); // set a text-only tooltip, typically use with ImGui::IsItemHovered(). override any previous call to SetTooltip().
|
IMGUI_API void SetTooltip(const char* fmt, ...) IM_FMTARGS(1); // set a text-only tooltip, typically use with ImGui::IsItemHovered(). override any previous call to SetTooltip().
|
||||||
@ -691,7 +695,7 @@ namespace ImGui
|
|||||||
// TableNextRow() -> Text("Hello 0") // Not OK! Missing TableSetColumnIndex() or TableNextColumn()! Text will not appear!
|
// TableNextRow() -> Text("Hello 0") // Not OK! Missing TableSetColumnIndex() or TableNextColumn()! Text will not appear!
|
||||||
// ----------------------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------------------
|
||||||
// - 5. Call EndTable()
|
// - 5. Call EndTable()
|
||||||
IMGUI_API bool BeginTable(const char* str_id, int columns_count, ImGuiTableFlags flags = 0, const ImVec2& outer_size = ImVec2(0, 0), float inner_width = 0.0f);
|
IMGUI_API bool BeginTable(const char* str_id, int columns_count, ImGuiTableFlags flags = 0, const ImVec2& outer_size = ImVec2(-FLT_MIN, 0), float inner_width = 0.0f);
|
||||||
IMGUI_API void EndTable(); // only call EndTable() if BeginTable() returns true!
|
IMGUI_API void EndTable(); // only call EndTable() if BeginTable() returns true!
|
||||||
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.
|
||||||
@ -766,7 +770,6 @@ namespace ImGui
|
|||||||
IMGUI_API void LogText(const char* fmt, ...) IM_FMTARGS(1); // pass text data straight to log (without being displayed)
|
IMGUI_API void LogText(const char* fmt, ...) IM_FMTARGS(1); // pass text data straight to log (without being displayed)
|
||||||
|
|
||||||
// Drag and Drop
|
// Drag and Drop
|
||||||
// - [BETA API] API may evolve!
|
|
||||||
// - If you stop calling BeginDragDropSource() the payload is preserved however it won't have a preview tooltip (we currently display a fallback "..." tooltip as replacement)
|
// - If you stop calling BeginDragDropSource() the payload is preserved however it won't have a preview tooltip (we currently display a fallback "..." tooltip as replacement)
|
||||||
IMGUI_API bool BeginDragDropSource(ImGuiDragDropFlags flags = 0); // call when the current item is active. If this return true, you can call SetDragDropPayload() + EndDragDropSource()
|
IMGUI_API bool BeginDragDropSource(ImGuiDragDropFlags flags = 0); // call when the current item is active. If this return true, you can call SetDragDropPayload() + EndDragDropSource()
|
||||||
IMGUI_API bool SetDragDropPayload(const char* type, const void* data, size_t sz, ImGuiCond cond = 0); // type is a user defined string of maximum 32 characters. Strings starting with '_' are reserved for dear imgui internal types. Data is copied and held by imgui.
|
IMGUI_API bool SetDragDropPayload(const char* type, const void* data, size_t sz, ImGuiCond cond = 0); // type is a user defined string of maximum 32 characters. Strings starting with '_' are reserved for dear imgui internal types. Data is copied and held by imgui.
|
||||||
@ -777,6 +780,7 @@ namespace ImGui
|
|||||||
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.
|
||||||
|
|
||||||
// Clipping
|
// Clipping
|
||||||
|
// - 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);
|
||||||
IMGUI_API void PopClipRect();
|
IMGUI_API void PopClipRect();
|
||||||
|
|
||||||
@ -899,7 +903,7 @@ namespace ImGui
|
|||||||
} // namespace ImGui
|
} // namespace ImGui
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Flags & Enumerations
|
// [SECTION] Flags & Enumerations
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Flags for ImGui::Begin()
|
// Flags for ImGui::Begin()
|
||||||
@ -1081,8 +1085,8 @@ enum ImGuiTabItemFlags_
|
|||||||
// When ScrollX is off:
|
// When ScrollX is off:
|
||||||
// - Table defaults to ImGuiTableFlags_ColumnsWidthStretch -> all Columns defaults to ImGuiTableColumnFlags_WidthStretch.
|
// - Table defaults to ImGuiTableFlags_ColumnsWidthStretch -> all Columns defaults to ImGuiTableColumnFlags_WidthStretch.
|
||||||
// - Columns sizing policy allowed: Stretch (default) or Fixed/Auto.
|
// - Columns sizing policy allowed: Stretch (default) or Fixed/Auto.
|
||||||
// - Stretch Columns will share the width available in table.
|
// - Fixed Columns will generally obtain their requested width (unless the Table cannot fit them all).
|
||||||
// - Fixed Columns will generally obtain their requested width unless the Table cannot fit them all.
|
// - Stretch Columns will share the remaining width.
|
||||||
// When ScrollX is on:
|
// When ScrollX is on:
|
||||||
// - Table defaults to ImGuiTableFlags_ColumnsWidthFixed -> all Columns defaults to ImGuiTableColumnFlags_WidthFixed.
|
// - Table defaults to ImGuiTableFlags_ColumnsWidthFixed -> all Columns defaults to ImGuiTableColumnFlags_WidthFixed.
|
||||||
// - Columns sizing policy allowed: Fixed/Auto mostly!
|
// - Columns sizing policy allowed: Fixed/Auto mostly!
|
||||||
@ -1090,7 +1094,7 @@ enum ImGuiTabItemFlags_
|
|||||||
// - Using Stretch columns OFTEN DOES NOT MAKE SENSE if ScrollX is on, UNLESS you have specified a value for 'inner_width' in BeginTable().
|
// - Using Stretch columns OFTEN DOES NOT MAKE SENSE if ScrollX is on, UNLESS you have specified a value for 'inner_width' in BeginTable().
|
||||||
// - Mixing up columns with different sizing policy is possible BUT can be tricky and has some side-effects and restrictions.
|
// - Mixing up columns with different sizing policy is possible BUT can be tricky and has some side-effects and restrictions.
|
||||||
// (their visible order and the scrolling state have subtle but necessary effects on how they can be manually resized).
|
// (their visible order and the scrolling state have subtle but necessary effects on how they can be manually resized).
|
||||||
// The typical use of mixing sizing policies is to have ScrollX disabled, one or two Stretch Column and many Fixed Columns.
|
// The typical use of mixing sizing policies is to have ScrollX disabled, first Fixed columns and then one or two TRAILING Stretch columns.
|
||||||
enum ImGuiTableFlags_
|
enum ImGuiTableFlags_
|
||||||
{
|
{
|
||||||
// Features
|
// Features
|
||||||
@ -1118,21 +1122,21 @@ enum ImGuiTableFlags_
|
|||||||
ImGuiTableFlags_ColumnsWidthStretch = 1 << 13, // Default if ScrollX is off. Columns will default to use _WidthStretch. Read description above for more details.
|
ImGuiTableFlags_ColumnsWidthStretch = 1 << 13, // Default if ScrollX is off. Columns will default to use _WidthStretch. Read description above for more details.
|
||||||
ImGuiTableFlags_ColumnsWidthFixed = 1 << 14, // Default if ScrollX is on. Columns will default to use _WidthFixed or _WidthAutoResize policy (if Resizable is off). Read description above for more details.
|
ImGuiTableFlags_ColumnsWidthFixed = 1 << 14, // Default if ScrollX is on. Columns will default to use _WidthFixed or _WidthAutoResize policy (if Resizable is off). Read description above for more details.
|
||||||
ImGuiTableFlags_SameWidths = 1 << 15, // Make all columns the same widths which is useful with Fixed columns policy (but granted by default with Stretch policy + no resize). Implicitly enable ImGuiTableFlags_NoKeepColumnsVisible and disable ImGuiTableFlags_Resizable.
|
ImGuiTableFlags_SameWidths = 1 << 15, // Make all columns the same widths which is useful with Fixed columns policy (but granted by default with Stretch policy + no resize). Implicitly enable ImGuiTableFlags_NoKeepColumnsVisible and disable ImGuiTableFlags_Resizable.
|
||||||
ImGuiTableFlags_NoHeadersWidth = 1 << 16, // Disable headers' contribution to automatic width calculation.
|
ImGuiTableFlags_NoHostExtendY = 1 << 16, // Disable extending table past the limit set by outer_size.y. Only meaningful when neither ScrollX nor ScrollY are set (data below the limit will be clipped and not visible)
|
||||||
ImGuiTableFlags_NoHostExtendY = 1 << 17, // Disable extending past the limit set by outer_size.y, only meaningful when neither of ScrollX|ScrollY are set (data below the limit will be clipped and not visible)
|
ImGuiTableFlags_NoKeepColumnsVisible = 1 << 17, // Disable keeping column always minimally visible when ScrollX is off and table gets too small. Not recommended if columns are resizable.
|
||||||
ImGuiTableFlags_NoKeepColumnsVisible = 1 << 18, // Disable keeping column always minimally visible when ScrollX is off and table gets too small.
|
ImGuiTableFlags_PreciseWidths = 1 << 18, // Disable distributing remainder width to stretched columns (width allocation on a 100-wide table with 3 columns: Without this flag: 33,33,34. With this flag: 33,33,33). With larger number of columns, resizing will appear to be less smooth.
|
||||||
ImGuiTableFlags_PreciseWidths = 1 << 19, // Disable distributing remainder width to stretched columns (width allocation on a 100-wide table with 3 columns: Without this flag: 33,33,34. With this flag: 33,33,33). With larger number of columns, resizing will appear to be less smooth.
|
// Clipping
|
||||||
ImGuiTableFlags_NoClip = 1 << 20, // Disable clipping rectangle for every individual columns (reduce draw command count, items will be able to overflow into other columns). Generally incompatible with TableSetupScrollFreeze().
|
ImGuiTableFlags_NoClip = 1 << 19, // Disable clipping rectangle for every individual columns (reduce draw command count, items will be able to overflow into other columns). Generally incompatible with TableSetupScrollFreeze().
|
||||||
// Padding
|
// Padding
|
||||||
ImGuiTableFlags_PadOuterX = 1 << 21, // Default if BordersOuterV is on. Enable outer-most padding.
|
ImGuiTableFlags_PadOuterX = 1 << 20, // Default if BordersOuterV is on. Enable outer-most padding.
|
||||||
ImGuiTableFlags_NoPadOuterX = 1 << 22, // Default if BordersOuterV is off. Disable outer-most padding.
|
ImGuiTableFlags_NoPadOuterX = 1 << 21, // Default if BordersOuterV is off. Disable outer-most padding.
|
||||||
ImGuiTableFlags_NoPadInnerX = 1 << 23, // Disable inner padding between columns (double inner padding if BordersOuterV is on, single inner padding if BordersOuterV is off).
|
ImGuiTableFlags_NoPadInnerX = 1 << 22, // Disable inner padding between columns (double inner padding if BordersOuterV is on, single inner padding if BordersOuterV is off).
|
||||||
// Scrolling
|
// Scrolling
|
||||||
ImGuiTableFlags_ScrollX = 1 << 24, // Enable horizontal scrolling. Require 'outer_size' parameter of BeginTable() to specify the container size. Changes default sizing policy. Because this create a child window, ScrollY is currently generally recommended when using ScrollX.
|
ImGuiTableFlags_ScrollX = 1 << 23, // Enable horizontal scrolling. Require 'outer_size' parameter of BeginTable() to specify the container size. Changes default sizing policy. Because this create a child window, ScrollY is currently generally recommended when using ScrollX.
|
||||||
ImGuiTableFlags_ScrollY = 1 << 25, // Enable vertical scrolling. Require 'outer_size' parameter of BeginTable() to specify the container size.
|
ImGuiTableFlags_ScrollY = 1 << 24, // Enable vertical scrolling. Require 'outer_size' parameter of BeginTable() to specify the container size.
|
||||||
// Sorting
|
// Sorting
|
||||||
ImGuiTableFlags_SortMulti = 1 << 26, // Hold shift when clicking headers to sort on multiple column. TableGetSortSpecs() may return specs where (SpecsCount > 1).
|
ImGuiTableFlags_SortMulti = 1 << 25, // Hold shift when clicking headers to sort on multiple column. TableGetSortSpecs() may return specs where (SpecsCount > 1).
|
||||||
ImGuiTableFlags_SortTristate = 1 << 27 // Allow no sorting, disable default sorting. TableGetSortSpecs() may return specs where (SpecsCount == 0).
|
ImGuiTableFlags_SortTristate = 1 << 26 // Allow no sorting, disable default sorting. TableGetSortSpecs() may return specs where (SpecsCount == 0).
|
||||||
};
|
};
|
||||||
|
|
||||||
// Flags for ImGui::TableSetupColumn()
|
// Flags for ImGui::TableSetupColumn()
|
||||||
@ -1336,7 +1340,7 @@ enum ImGuiKeyModFlags_
|
|||||||
// Gamepad/Keyboard navigation
|
// Gamepad/Keyboard navigation
|
||||||
// Keyboard: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable. NewFrame() will automatically fill io.NavInputs[] based on your io.KeysDown[] + io.KeyMap[] arrays.
|
// Keyboard: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable. NewFrame() will automatically fill io.NavInputs[] based on your io.KeysDown[] + io.KeyMap[] arrays.
|
||||||
// Gamepad: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad to enable. Backend: set ImGuiBackendFlags_HasGamepad and fill the io.NavInputs[] fields before calling NewFrame(). Note that io.NavInputs[] is cleared by EndFrame().
|
// Gamepad: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad to enable. Backend: set ImGuiBackendFlags_HasGamepad and fill the io.NavInputs[] fields before calling NewFrame(). Note that io.NavInputs[] is cleared by EndFrame().
|
||||||
// Read instructions in imgui.cpp for more details. Download PNG/PSD at http://goo.gl/9LgVZW.
|
// Read instructions in imgui.cpp for more details. Download PNG/PSD at http://dearimgui.org/controls_sheets.
|
||||||
enum ImGuiNavInput_
|
enum ImGuiNavInput_
|
||||||
{
|
{
|
||||||
// Gamepad Mapping
|
// Gamepad Mapping
|
||||||
@ -1467,11 +1471,6 @@ enum ImGuiCol_
|
|||||||
ImGuiCol_NavWindowingDimBg, // Darken/colorize entire screen behind the CTRL+TAB window list, when active
|
ImGuiCol_NavWindowingDimBg, // Darken/colorize entire screen behind the CTRL+TAB window list, when active
|
||||||
ImGuiCol_ModalWindowDimBg, // Darken/colorize entire screen behind a modal window, when one is active
|
ImGuiCol_ModalWindowDimBg, // Darken/colorize entire screen behind a modal window, when one is active
|
||||||
ImGuiCol_COUNT
|
ImGuiCol_COUNT
|
||||||
|
|
||||||
// Obsolete names (will be removed)
|
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
||||||
, ImGuiCol_ModalWindowDarkening = ImGuiCol_ModalWindowDimBg // [renamed in 1.63]
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Enumeration for PushStyleVar() / PopStyleVar() to temporarily modify the ImGuiStyle structure.
|
// Enumeration for PushStyleVar() / PopStyleVar() to temporarily modify the ImGuiStyle structure.
|
||||||
@ -1627,7 +1626,10 @@ enum ImGuiCond_
|
|||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Helpers: Memory allocations macros
|
// [SECTION] Helpers: Memory allocations macros, ImVector<>
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
// IM_MALLOC(), IM_FREE(), IM_NEW(), IM_PLACEMENT_NEW(), IM_DELETE()
|
// IM_MALLOC(), IM_FREE(), IM_NEW(), IM_PLACEMENT_NEW(), IM_DELETE()
|
||||||
// We call C++ constructor on own allocated memory via the placement "new(ptr) Type()" syntax.
|
// We call C++ constructor on own allocated memory via the placement "new(ptr) Type()" syntax.
|
||||||
// Defining a custom placement new() with a custom parameter allows us to bypass including <new> which on some platforms complains when user has disabled exceptions.
|
// Defining a custom placement new() with a custom parameter allows us to bypass including <new> which on some platforms complains when user has disabled exceptions.
|
||||||
@ -1643,7 +1645,7 @@ inline void operator delete(void*, ImNewWrapper, void*) {} // This is only re
|
|||||||
template<typename T> void IM_DELETE(T* p) { if (p) { p->~T(); ImGui::MemFree(p); } }
|
template<typename T> void IM_DELETE(T* p) { if (p) { p->~T(); ImGui::MemFree(p); } }
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Helper: ImVector<>
|
// ImVector<>
|
||||||
// Lightweight std::vector<>-like class to avoid dragging dependencies (also, some implementations of STL with debug enabled are absurdly slow, we bypass it so our code runs fast in debug).
|
// Lightweight std::vector<>-like class to avoid dragging dependencies (also, some implementations of STL with debug enabled are absurdly slow, we bypass it so our code runs fast in debug).
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// - You generally do NOT need to care or use this ever. But we need to make it available in imgui.h because some of our public structures are relying on it.
|
// - You generally do NOT need to care or use this ever. But we need to make it available in imgui.h because some of our public structures are relying on it.
|
||||||
@ -1713,7 +1715,8 @@ struct ImVector
|
|||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// ImGuiStyle
|
// [SECTION] ImGuiStyle
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
// You may modify the ImGui::GetStyle() main instance during initialization and before NewFrame().
|
// You may modify the ImGui::GetStyle() main instance during initialization and before NewFrame().
|
||||||
// During the frame, use ImGui::PushStyleVar(ImGuiStyleVar_XXXX)/PopStyleVar() to alter the main style values,
|
// During the frame, use ImGui::PushStyleVar(ImGuiStyleVar_XXXX)/PopStyleVar() to alter the main style values,
|
||||||
// and ImGui::PushStyleColor(ImGuiCol_XXX)/PopStyleColor() for colors.
|
// and ImGui::PushStyleColor(ImGuiCol_XXX)/PopStyleColor() for colors.
|
||||||
@ -1767,7 +1770,8 @@ struct ImGuiStyle
|
|||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// ImGuiIO
|
// [SECTION] ImGuiIO
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
// Communicate most settings and inputs/outputs to Dear ImGui using this structure.
|
// Communicate most settings and inputs/outputs to Dear ImGui using this structure.
|
||||||
// Access via ImGui::GetIO(). Read 'Programmer guide' section in .cpp file for general usage.
|
// Access via ImGui::GetIO(). Read 'Programmer guide' section in .cpp file for general usage.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -1813,8 +1817,8 @@ struct ImGuiIO
|
|||||||
|
|
||||||
// Miscellaneous options
|
// Miscellaneous options
|
||||||
bool MouseDrawCursor; // = false // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor). Cannot be easily renamed to 'io.ConfigXXX' because this is frequently used by backend implementations.
|
bool MouseDrawCursor; // = false // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor). Cannot be easily renamed to 'io.ConfigXXX' because this is frequently used by backend implementations.
|
||||||
bool ConfigMacOSXBehaviors; // = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl (was called io.OptMacOSXBehaviors prior to 1.63)
|
bool ConfigMacOSXBehaviors; // = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl.
|
||||||
bool ConfigInputTextCursorBlink; // = true // Set to false to disable blinking cursor, for users who consider it distracting. (was called: io.OptCursorBlink prior to 1.63)
|
bool ConfigInputTextCursorBlink; // = true // Set to false to disable blinking cursor, for users who consider it distracting.
|
||||||
bool ConfigWindowsResizeFromEdges; // = true // Enable resizing of windows from their edges and from the lower-left corner. This requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback. (This used to be a per-window ImGuiWindowFlags_ResizeFromAnySide flag)
|
bool ConfigWindowsResizeFromEdges; // = true // Enable resizing of windows from their edges and from the lower-left corner. This requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback. (This used to be a per-window ImGuiWindowFlags_ResizeFromAnySide flag)
|
||||||
bool ConfigWindowsMoveFromTitleBarOnly; // = false // [BETA] Set to true to only allow moving windows when clicked+dragged from the title bar. Windows without a title bar are not affected.
|
bool ConfigWindowsMoveFromTitleBarOnly; // = false // [BETA] Set to true to only allow moving windows when clicked+dragged from the title bar. Windows without a title bar are not affected.
|
||||||
float ConfigMemoryCompactTimer; // = 60.0f // [BETA] Free transient windows/tables memory buffers when unused for given amount of time. Set to -1.0f to disable.
|
float ConfigMemoryCompactTimer; // = 60.0f // [BETA] Free transient windows/tables memory buffers when unused for given amount of time. Set to -1.0f to disable.
|
||||||
@ -1909,7 +1913,7 @@ struct ImGuiIO
|
|||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Misc data structures
|
// [SECTION] Misc data structures
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Shared state of InputText(), passed as an argument to your callback when a ImGuiInputTextFlags_Callback* flag is used.
|
// Shared state of InputText(), passed as an argument to your callback when a ImGuiInputTextFlags_Callback* flag is used.
|
||||||
@ -2028,7 +2032,8 @@ struct ImGuiTableSortSpecs
|
|||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Obsolete functions (Will be removed! Read 'API BREAKING CHANGES' section in imgui.cpp for details)
|
// [SECTION] Obsolete functions
|
||||||
|
// (Will be removed! Read 'API BREAKING CHANGES' section in imgui.cpp for details)
|
||||||
// Please keep your copy of dear imgui up to date! Occasionally set '#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS' in imconfig.h to stay ahead.
|
// Please keep your copy of dear imgui up to date! Occasionally set '#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS' in imconfig.h to stay ahead.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -2064,15 +2069,11 @@ namespace ImGui
|
|||||||
static inline ImDrawList* GetOverlayDrawList() { return GetForegroundDrawList(); }
|
static inline ImDrawList* GetOverlayDrawList() { return GetForegroundDrawList(); }
|
||||||
// OBSOLETED in 1.66 (from Sep 2018)
|
// OBSOLETED in 1.66 (from Sep 2018)
|
||||||
static inline void SetScrollHere(float center_ratio=0.5f){ SetScrollHereY(center_ratio); }
|
static inline void SetScrollHere(float center_ratio=0.5f){ SetScrollHereY(center_ratio); }
|
||||||
// OBSOLETED in 1.63 (between Aug 2018 and Sept 2018)
|
|
||||||
static inline bool IsItemDeactivatedAfterChange() { return IsItemDeactivatedAfterEdit(); }
|
|
||||||
}
|
}
|
||||||
typedef ImGuiInputTextCallback ImGuiTextEditCallback; // OBSOLETED in 1.63 (from Aug 2018): made the names consistent
|
|
||||||
typedef ImGuiInputTextCallbackData ImGuiTextEditCallbackData;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Helpers
|
// [SECTION] Helpers (ImGuiOnceUponAFrame, ImGuiTextFilter, ImGuiTextBuffer, ImGuiStorage, ImGuiListClipper, ImColor)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Helper: Unicode defines
|
// Helper: Unicode defines
|
||||||
@ -2274,7 +2275,7 @@ struct ImColor
|
|||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Draw List API (ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListSplitter, ImDrawListFlags, ImDrawList, ImDrawData)
|
// [SECTION] Drawing API (ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListSplitter, ImDrawListFlags, ImDrawList, ImDrawData)
|
||||||
// Hold a series of drawing commands. The user provides a renderer for ImDrawData which essentially contains an array of ImDrawList.
|
// Hold a series of drawing commands. The user provides a renderer for ImDrawData which essentially contains an array of ImDrawList.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -2461,7 +2462,8 @@ struct ImDrawList
|
|||||||
IMGUI_API void AddText(const ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL, float wrap_width = 0.0f, const ImVec4* cpu_fine_clip_rect = NULL);
|
IMGUI_API void AddText(const ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL, float wrap_width = 0.0f, const ImVec4* cpu_fine_clip_rect = NULL);
|
||||||
IMGUI_API void AddPolyline(const ImVec2* points, int num_points, ImU32 col, bool closed, float thickness);
|
IMGUI_API void AddPolyline(const ImVec2* points, int num_points, ImU32 col, bool closed, float thickness);
|
||||||
IMGUI_API void AddConvexPolyFilled(const ImVec2* points, int num_points, ImU32 col); // Note: Anti-aliased filling requires points to be in clockwise order.
|
IMGUI_API void AddConvexPolyFilled(const ImVec2* points, int num_points, ImU32 col); // Note: Anti-aliased filling requires points to be in clockwise order.
|
||||||
IMGUI_API void AddBezierCurve(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col, float thickness, int num_segments = 0);
|
IMGUI_API void AddBezierCubic(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col, float thickness, int num_segments = 0); // Cubic Bezier (4 control points)
|
||||||
|
IMGUI_API void AddBezierQuadratic(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, ImU32 col, float thickness, int num_segments = 0); // Quadratic Bezier (3 control points)
|
||||||
|
|
||||||
// Image primitives
|
// Image primitives
|
||||||
// - Read FAQ to understand what ImTextureID is.
|
// - Read FAQ to understand what ImTextureID is.
|
||||||
@ -2479,7 +2481,8 @@ struct ImDrawList
|
|||||||
inline void PathStroke(ImU32 col, bool closed, float thickness = 1.0f) { AddPolyline(_Path.Data, _Path.Size, col, closed, thickness); _Path.Size = 0; }
|
inline void PathStroke(ImU32 col, bool closed, float thickness = 1.0f) { AddPolyline(_Path.Data, _Path.Size, col, closed, thickness); _Path.Size = 0; }
|
||||||
IMGUI_API void PathArcTo(const ImVec2& center, float radius, float a_min, float a_max, int num_segments = 10);
|
IMGUI_API void PathArcTo(const ImVec2& center, float radius, float a_min, float a_max, int num_segments = 10);
|
||||||
IMGUI_API void PathArcToFast(const ImVec2& center, float radius, int a_min_of_12, int a_max_of_12); // Use precomputed angles for a 12 steps circle
|
IMGUI_API void PathArcToFast(const ImVec2& center, float radius, int a_min_of_12, int a_max_of_12); // Use precomputed angles for a 12 steps circle
|
||||||
IMGUI_API void PathBezierCurveTo(const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, int num_segments = 0);
|
IMGUI_API void PathBezierCubicCurveTo(const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, int num_segments = 0); // Cubic Bezier (4 control points)
|
||||||
|
IMGUI_API void PathBezierQuadraticCurveTo(const ImVec2& p2, const ImVec2& p3, int num_segments = 0); // Quadratic Bezier (3 control points)
|
||||||
IMGUI_API void PathRect(const ImVec2& rect_min, const ImVec2& rect_max, float rounding = 0.0f, ImDrawCornerFlags rounding_corners = ImDrawCornerFlags_All);
|
IMGUI_API void PathRect(const ImVec2& rect_min, const ImVec2& rect_max, float rounding = 0.0f, ImDrawCornerFlags rounding_corners = ImDrawCornerFlags_All);
|
||||||
|
|
||||||
// Advanced
|
// Advanced
|
||||||
@ -2509,6 +2512,11 @@ struct ImDrawList
|
|||||||
inline void PrimWriteIdx(ImDrawIdx idx) { *_IdxWritePtr = idx; _IdxWritePtr++; }
|
inline void PrimWriteIdx(ImDrawIdx idx) { *_IdxWritePtr = idx; _IdxWritePtr++; }
|
||||||
inline void PrimVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { PrimWriteIdx((ImDrawIdx)_VtxCurrentIdx); PrimWriteVtx(pos, uv, col); } // Write vertex with unique index
|
inline void PrimVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { PrimWriteIdx((ImDrawIdx)_VtxCurrentIdx); PrimWriteVtx(pos, uv, col); } // Write vertex with unique index
|
||||||
|
|
||||||
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
|
inline void AddBezierCurve(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col, float thickness, int num_segments = 0) { AddBezierCubic(p1, p2, p3, p4, col, thickness, num_segments); }
|
||||||
|
inline void PathBezierCurveTo(const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, int num_segments = 0) { PathBezierCubicCurveTo(p2, p3, p4, num_segments); }
|
||||||
|
#endif
|
||||||
|
|
||||||
// [Internal helpers]
|
// [Internal helpers]
|
||||||
IMGUI_API void _ResetForNewFrame();
|
IMGUI_API void _ResetForNewFrame();
|
||||||
IMGUI_API void _ClearFreeMemory();
|
IMGUI_API void _ClearFreeMemory();
|
||||||
@ -2542,7 +2550,7 @@ struct ImDrawData
|
|||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Font API (ImFontConfig, ImFontGlyph, ImFontAtlasFlags, ImFontAtlas, ImFontGlyphRangesBuilder, ImFont)
|
// [SECTION] Font API (ImFontConfig, ImFontGlyph, ImFontAtlasFlags, ImFontAtlas, ImFontGlyphRangesBuilder, ImFont)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
struct ImFontConfig
|
struct ImFontConfig
|
||||||
@ -2785,9 +2793,9 @@ struct ImFont
|
|||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// [BETA] Platform interface for multi-viewport support
|
// [SECTION] Platform interface for multi-viewport support
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// (Optional) This is completely optional, for advanced users!
|
// [BETA] (Optional) This is completely optional, for advanced users!
|
||||||
// If you are new to Dear ImGui and trying to integrate it into your engine, you can probably ignore this for now.
|
// If you are new to Dear ImGui and trying to integrate it into your engine, you can probably ignore this for now.
|
||||||
//
|
//
|
||||||
// This feature allows you to seamlessly drag Dear ImGui windows outside of your application viewport.
|
// This feature allows you to seamlessly drag Dear ImGui windows outside of your application viewport.
|
||||||
|
202
imgui_demo.cpp
202
imgui_demo.cpp
@ -3656,8 +3656,10 @@ static void ShowDemoWindowTables()
|
|||||||
"Fixed-width columns generally makes more sense if you want to use horizontal scrolling.\n\n"
|
"Fixed-width columns generally makes more sense if you want to use horizontal scrolling.\n\n"
|
||||||
"Double-click a column border to auto-fit the column to its contents.");
|
"Double-click a column border to auto-fit the column to its contents.");
|
||||||
static ImGuiTableFlags flags = ImGuiTableFlags_Resizable | ImGuiTableFlags_ColumnsWidthFixed | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV | ImGuiTableFlags_ContextMenuInBody;
|
static ImGuiTableFlags flags = ImGuiTableFlags_Resizable | ImGuiTableFlags_ColumnsWidthFixed | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV | ImGuiTableFlags_ContextMenuInBody;
|
||||||
//ImGui::CheckboxFlags("ImGuiTableFlags_ScrollX", &flags, ImGuiTableFlags_ScrollX); // FIXME-TABLE: Explain or fix the effect of enable Scroll on outer_size
|
static bool use_all_width = true;
|
||||||
if (ImGui::BeginTable("##table1", 3, flags))
|
ImGui::Checkbox("Use all width", &use_all_width);
|
||||||
|
|
||||||
|
if (ImGui::BeginTable("##table1", 3, flags, ImVec2(use_all_width ? -FLT_MIN : 0.0f, 0.0f)))
|
||||||
{
|
{
|
||||||
for (int row = 0; row < 5; row++)
|
for (int row = 0; row < 5; row++)
|
||||||
{
|
{
|
||||||
@ -3725,7 +3727,7 @@ static void ShowDemoWindowTables()
|
|||||||
if (ImGui::TreeNode("Reorderable, hideable, with headers"))
|
if (ImGui::TreeNode("Reorderable, hideable, with headers"))
|
||||||
{
|
{
|
||||||
HelpMarker("Click and drag column headers to reorder columns.\n\nYou can also right-click on a header to open a context menu.");
|
HelpMarker("Click and drag column headers to reorder columns.\n\nYou can also right-click on a header to open a context menu.");
|
||||||
static ImGuiTableFlags flags = ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV | ImGuiTableFlags_NoBordersInBody;
|
static ImGuiTableFlags flags = ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV;
|
||||||
PushStyleCompact();
|
PushStyleCompact();
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_Resizable", &flags, ImGuiTableFlags_Resizable);
|
ImGui::CheckboxFlags("ImGuiTableFlags_Resizable", &flags, ImGuiTableFlags_Resizable);
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_Reorderable", &flags, ImGuiTableFlags_Reorderable);
|
ImGui::CheckboxFlags("ImGuiTableFlags_Reorderable", &flags, ImGuiTableFlags_Reorderable);
|
||||||
@ -3754,7 +3756,8 @@ static void ShowDemoWindowTables()
|
|||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::BeginTable("##table2", 3, flags | ImGuiTableFlags_ColumnsWidthFixed))
|
// Use outer_size.x == 0.0f instead of default to make the table as tight as possible (only valid when no scrolling and no stretch column)
|
||||||
|
if (ImGui::BeginTable("##table2", 3, flags | ImGuiTableFlags_ColumnsWidthFixed, ImVec2(0.0f, 0.0f)))
|
||||||
{
|
{
|
||||||
ImGui::TableSetupColumn("One");
|
ImGui::TableSetupColumn("One");
|
||||||
ImGui::TableSetupColumn("Two");
|
ImGui::TableSetupColumn("Two");
|
||||||
@ -3778,8 +3781,8 @@ static void ShowDemoWindowTables()
|
|||||||
ImGui::SetNextItemOpen(open_action != 0);
|
ImGui::SetNextItemOpen(open_action != 0);
|
||||||
if (ImGui::TreeNode("Padding"))
|
if (ImGui::TreeNode("Padding"))
|
||||||
{
|
{
|
||||||
static ImGuiTableFlags flags = ImGuiTableFlags_BordersV;
|
// First example: showcase use of padding flags and effect of BorderOuterV/BorderInnerV on X padding.
|
||||||
|
// We don't expose BorderOuterH/BorderInnerH here because they have no effect on X padding.
|
||||||
HelpMarker(
|
HelpMarker(
|
||||||
"We often want outer padding activated when any using features which makes the edges of a column visible:\n"
|
"We often want outer padding activated when any using features which makes the edges of a column visible:\n"
|
||||||
"e.g.:\n"
|
"e.g.:\n"
|
||||||
@ -3788,20 +3791,21 @@ static void ShowDemoWindowTables()
|
|||||||
"Because of this, activating BorderOuterV sets the default to PadOuterX. Using PadOuterX or NoPadOuterX you can override the default.\n\n"
|
"Because of this, activating BorderOuterV sets the default to PadOuterX. Using PadOuterX or NoPadOuterX you can override the default.\n\n"
|
||||||
"Actual padding values are using style.CellPadding.");
|
"Actual padding values are using style.CellPadding.");
|
||||||
|
|
||||||
|
static ImGuiTableFlags flags1 = ImGuiTableFlags_BordersV;
|
||||||
PushStyleCompact();
|
PushStyleCompact();
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_PadOuterX", &flags, ImGuiTableFlags_PadOuterX);
|
ImGui::CheckboxFlags("ImGuiTableFlags_PadOuterX", &flags1, ImGuiTableFlags_PadOuterX);
|
||||||
ImGui::SameLine(); HelpMarker("Enable outer-most padding (default if ImGuiTableFlags_BordersOuterV is set)");
|
ImGui::SameLine(); HelpMarker("Enable outer-most padding (default if ImGuiTableFlags_BordersOuterV is set)");
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_NoPadOuterX", &flags, ImGuiTableFlags_NoPadOuterX);
|
ImGui::CheckboxFlags("ImGuiTableFlags_NoPadOuterX", &flags1, ImGuiTableFlags_NoPadOuterX);
|
||||||
ImGui::SameLine(); HelpMarker("Disable outer-most padding (default if ImGuiTableFlags_BordersOuterV is not set)");
|
ImGui::SameLine(); HelpMarker("Disable outer-most padding (default if ImGuiTableFlags_BordersOuterV is not set)");
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_NoPadInnerX", &flags, ImGuiTableFlags_NoPadInnerX);
|
ImGui::CheckboxFlags("ImGuiTableFlags_NoPadInnerX", &flags1, ImGuiTableFlags_NoPadInnerX);
|
||||||
ImGui::SameLine(); HelpMarker("Disable inner padding between columns (double inner padding if BordersOuterV is on, single inner padding if BordersOuterV is off)");
|
ImGui::SameLine(); HelpMarker("Disable inner padding between columns (double inner padding if BordersOuterV is on, single inner padding if BordersOuterV is off)");
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersOuterV", &flags, ImGuiTableFlags_BordersOuterV);
|
ImGui::CheckboxFlags("ImGuiTableFlags_BordersOuterV", &flags1, ImGuiTableFlags_BordersOuterV);
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersInnerV", &flags, ImGuiTableFlags_BordersInnerV);
|
ImGui::CheckboxFlags("ImGuiTableFlags_BordersInnerV", &flags1, ImGuiTableFlags_BordersInnerV);
|
||||||
static bool show_headers = false;
|
static bool show_headers = false;
|
||||||
ImGui::Checkbox("show_headers", &show_headers);
|
ImGui::Checkbox("show_headers", &show_headers);
|
||||||
PopStyleCompact();
|
PopStyleCompact();
|
||||||
|
|
||||||
if (ImGui::BeginTable("##table1", 3, flags))
|
if (ImGui::BeginTable("##table1", 3, flags1))
|
||||||
{
|
{
|
||||||
if (show_headers)
|
if (show_headers)
|
||||||
{
|
{
|
||||||
@ -3834,6 +3838,49 @@ static void ShowDemoWindowTables()
|
|||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Second example: set style.CellPadding to (0.0) or a custom value.
|
||||||
|
// FIXME-TABLE: Vertical border effectively not displayed the same way as horizontal one...
|
||||||
|
HelpMarker("Setting style.CellPadding to (0,0) or a custom value.");
|
||||||
|
static ImGuiTableFlags flags2 = ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg;
|
||||||
|
static ImVec2 cell_padding(0.0f, 0.0f);
|
||||||
|
static bool show_widget_frame_bg = false;
|
||||||
|
|
||||||
|
PushStyleCompact();
|
||||||
|
ImGui::CheckboxFlags("ImGuiTableFlags_Borders", &flags2, ImGuiTableFlags_Borders);
|
||||||
|
ImGui::CheckboxFlags("ImGuiTableFlags_BordersH", &flags2, ImGuiTableFlags_BordersH);
|
||||||
|
ImGui::CheckboxFlags("ImGuiTableFlags_BordersV", &flags2, ImGuiTableFlags_BordersV);
|
||||||
|
ImGui::CheckboxFlags("ImGuiTableFlags_BordersInner", &flags2, ImGuiTableFlags_BordersInner);
|
||||||
|
ImGui::CheckboxFlags("ImGuiTableFlags_BordersOuter", &flags2, ImGuiTableFlags_BordersOuter);
|
||||||
|
ImGui::CheckboxFlags("ImGuiTableFlags_RowBg", &flags2, ImGuiTableFlags_RowBg);
|
||||||
|
ImGui::CheckboxFlags("ImGuiTableFlags_Resizable", &flags2, ImGuiTableFlags_Resizable);
|
||||||
|
ImGui::Checkbox("show_widget_frame_bg", &show_widget_frame_bg);
|
||||||
|
ImGui::SliderFloat2("CellPadding", &cell_padding.x, 0.0f, 10.0f, "%.0f");
|
||||||
|
PopStyleCompact();
|
||||||
|
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cell_padding);
|
||||||
|
if (ImGui::BeginTable("##table2", 3, flags2))
|
||||||
|
{
|
||||||
|
static char text_bufs[3 * 5][16]; // Mini text storage for 3x5 cells
|
||||||
|
static bool init = true;
|
||||||
|
if (!show_widget_frame_bg)
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_FrameBg, 0);
|
||||||
|
for (int cell = 0; cell < 3 * 5; cell++)
|
||||||
|
{
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
if (init)
|
||||||
|
strcpy(text_bufs[cell], "edit me");
|
||||||
|
ImGui::SetNextItemWidth(-FLT_MIN);
|
||||||
|
ImGui::PushID(cell);
|
||||||
|
ImGui::InputText("##cell", text_bufs[cell], IM_ARRAYSIZE(text_bufs[cell]));
|
||||||
|
ImGui::PopID();
|
||||||
|
}
|
||||||
|
if (!show_widget_frame_bg)
|
||||||
|
ImGui::PopStyleColor();
|
||||||
|
init = false;
|
||||||
|
ImGui::EndTable();
|
||||||
|
}
|
||||||
|
ImGui::PopStyleVar();
|
||||||
|
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3884,7 +3931,7 @@ static void ShowDemoWindowTables()
|
|||||||
|
|
||||||
// When using ScrollX or ScrollY we need to specify a size for our table container!
|
// When using ScrollX or ScrollY we need to specify a size for our table container!
|
||||||
// Otherwise by default the table will fit all available space, like a BeginChild() call.
|
// Otherwise by default the table will fit all available space, like a BeginChild() call.
|
||||||
ImVec2 size = ImVec2(0, TEXT_BASE_HEIGHT * 8);
|
ImVec2 size = ImVec2(-FLT_MIN, TEXT_BASE_HEIGHT * 8);
|
||||||
if (ImGui::BeginTable("##table1", 3, flags, size))
|
if (ImGui::BeginTable("##table1", 3, flags, size))
|
||||||
{
|
{
|
||||||
ImGui::TableSetupScrollFreeze(0, 1); // Make top row always visible
|
ImGui::TableSetupScrollFreeze(0, 1); // Make top row always visible
|
||||||
@ -3937,7 +3984,7 @@ static void ShowDemoWindowTables()
|
|||||||
|
|
||||||
// When using ScrollX or ScrollY we need to specify a size for our table container!
|
// When using ScrollX or ScrollY we need to specify a size for our table container!
|
||||||
// Otherwise by default the table will fit all available space, like a BeginChild() call.
|
// Otherwise by default the table will fit all available space, like a BeginChild() call.
|
||||||
ImVec2 outer_size = ImVec2(0, TEXT_BASE_HEIGHT * 8);
|
ImVec2 outer_size = ImVec2(-FLT_MIN, TEXT_BASE_HEIGHT * 8);
|
||||||
if (ImGui::BeginTable("##table1", 7, flags, outer_size))
|
if (ImGui::BeginTable("##table1", 7, flags, outer_size))
|
||||||
{
|
{
|
||||||
ImGui::TableSetupScrollFreeze(freeze_cols, freeze_rows);
|
ImGui::TableSetupScrollFreeze(freeze_cols, freeze_rows);
|
||||||
@ -4011,7 +4058,7 @@ static void ShowDemoWindowTables()
|
|||||||
= ImGuiTableFlags_ColumnsWidthFixed | ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY
|
= ImGuiTableFlags_ColumnsWidthFixed | ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY
|
||||||
| ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV
|
| ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV
|
||||||
| ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_Sortable;
|
| ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_Sortable;
|
||||||
ImVec2 size = ImVec2(0, TEXT_BASE_HEIGHT * 9);
|
ImVec2 size = ImVec2(-FLT_MIN, TEXT_BASE_HEIGHT * 9);
|
||||||
if (ImGui::BeginTable("##table", column_count, flags, size))
|
if (ImGui::BeginTable("##table", column_count, flags, size))
|
||||||
{
|
{
|
||||||
for (int column = 0; column < column_count; column++)
|
for (int column = 0; column < column_count; column++)
|
||||||
@ -4043,7 +4090,7 @@ static void ShowDemoWindowTables()
|
|||||||
{
|
{
|
||||||
HelpMarker("This demonstrate embedding a table into another table cell.");
|
HelpMarker("This demonstrate embedding a table into another table cell.");
|
||||||
|
|
||||||
if (ImGui::BeginTable("recurse1", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable))
|
if (ImGui::BeginTable("recurse1", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable))
|
||||||
{
|
{
|
||||||
ImGui::TableSetupColumn("A0");
|
ImGui::TableSetupColumn("A0");
|
||||||
ImGui::TableSetupColumn("A1");
|
ImGui::TableSetupColumn("A1");
|
||||||
@ -4053,7 +4100,7 @@ static void ShowDemoWindowTables()
|
|||||||
ImGui::Text("A0 Cell 0");
|
ImGui::Text("A0 Cell 0");
|
||||||
{
|
{
|
||||||
float rows_height = TEXT_BASE_HEIGHT * 2;
|
float rows_height = TEXT_BASE_HEIGHT * 2;
|
||||||
if (ImGui::BeginTable("recurse2", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable))
|
if (ImGui::BeginTable("recurse2", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable))
|
||||||
{
|
{
|
||||||
ImGui::TableSetupColumn("B0");
|
ImGui::TableSetupColumn("B0");
|
||||||
ImGui::TableSetupColumn("B1");
|
ImGui::TableSetupColumn("B1");
|
||||||
@ -4119,7 +4166,7 @@ static void ShowDemoWindowTables()
|
|||||||
ImGui::CheckboxFlags("ImGuiTableFlags_NoClip", &flags, ImGuiTableFlags_NoClip);
|
ImGui::CheckboxFlags("ImGuiTableFlags_NoClip", &flags, ImGuiTableFlags_NoClip);
|
||||||
PopStyleCompact();
|
PopStyleCompact();
|
||||||
|
|
||||||
ImVec2 outer_size(0, TEXT_BASE_HEIGHT * 7);
|
ImVec2 outer_size(-FLT_MIN, TEXT_BASE_HEIGHT * 7);
|
||||||
if (ImGui::BeginTable("##nways", column_count, flags, outer_size))
|
if (ImGui::BeginTable("##nways", column_count, flags, outer_size))
|
||||||
{
|
{
|
||||||
for (int cell = 0; cell < 10 * column_count; cell++)
|
for (int cell = 0; cell < 10 * column_count; cell++)
|
||||||
@ -4215,50 +4262,6 @@ static void ShowDemoWindowTables()
|
|||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (open_action != -1)
|
|
||||||
ImGui::SetNextItemOpen(open_action != 0);
|
|
||||||
if (ImGui::TreeNode("Compact table"))
|
|
||||||
{
|
|
||||||
// FIXME-TABLE: Vertical border not displayed the same way as horizontal one...
|
|
||||||
HelpMarker("Setting style.CellPadding to (0,0).");
|
|
||||||
static ImGuiTableFlags flags = ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg;
|
|
||||||
static bool no_widget_frame = false;
|
|
||||||
|
|
||||||
PushStyleCompact();
|
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersOuter", &flags, ImGuiTableFlags_BordersOuter);
|
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersH", &flags, ImGuiTableFlags_BordersH);
|
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_BordersV", &flags, ImGuiTableFlags_BordersV);
|
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_RowBg", &flags, ImGuiTableFlags_RowBg);
|
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_Resizable", &flags, ImGuiTableFlags_Resizable);
|
|
||||||
ImGui::Checkbox("no_widget_frame", &no_widget_frame);
|
|
||||||
PopStyleCompact();
|
|
||||||
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2(0, 0));
|
|
||||||
if (ImGui::BeginTable("##3ways", 3, flags))
|
|
||||||
{
|
|
||||||
for (int row = 0; row < 10; row++)
|
|
||||||
{
|
|
||||||
static char text_buf[32] = "";
|
|
||||||
ImGui::TableNextRow();
|
|
||||||
for (int column = 0; column < 3; column++)
|
|
||||||
{
|
|
||||||
ImGui::TableSetColumnIndex(column);
|
|
||||||
ImGui::SetNextItemWidth(-FLT_MIN);
|
|
||||||
ImGui::PushID(row * 3 + column);
|
|
||||||
if (no_widget_frame)
|
|
||||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, 0);
|
|
||||||
ImGui::InputText("##cell", text_buf, IM_ARRAYSIZE(text_buf));
|
|
||||||
if (no_widget_frame)
|
|
||||||
ImGui::PopStyleColor();
|
|
||||||
ImGui::PopID();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ImGui::EndTable();
|
|
||||||
}
|
|
||||||
ImGui::PopStyleVar();
|
|
||||||
ImGui::TreePop();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (open_action != -1)
|
if (open_action != -1)
|
||||||
ImGui::SetNextItemOpen(open_action != 0);
|
ImGui::SetNextItemOpen(open_action != 0);
|
||||||
if (ImGui::TreeNode("Row height"))
|
if (ImGui::TreeNode("Row height"))
|
||||||
@ -4278,11 +4281,37 @@ static void ShowDemoWindowTables()
|
|||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (open_action != -1)
|
if (open_action != -1)
|
||||||
ImGui::SetNextItemOpen(open_action != 0);
|
ImGui::SetNextItemOpen(open_action != 0);
|
||||||
if (ImGui::TreeNode("Outer size"))
|
if (ImGui::TreeNode("Outer size"))
|
||||||
{
|
{
|
||||||
|
// Showcasing use of outer_size.x == 0.0f and ImGuiTableFlags_NoHostExtendY
|
||||||
|
// The default value of outer_size.x is -FLT_MIN which right-align tables.
|
||||||
|
// Using outer_size.x == 0.0f on a table with no scrolling and no stretch column we can make them tighter.
|
||||||
|
ImGui::Text("Using auto/all width, using NoHostExtendY:");
|
||||||
|
static ImGuiTableFlags flags = ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_ContextMenuInBody | ImGuiTableFlags_RowBg | ImGuiTableFlags_ColumnsWidthFixed;
|
||||||
|
static bool use_all_width = false;
|
||||||
|
ImGui::Checkbox("Use all width", &use_all_width);
|
||||||
|
ImGui::CheckboxFlags("ImGuiTableFlags_NoHostExtendY", &flags, ImGuiTableFlags_NoHostExtendY);
|
||||||
|
if (ImGui::BeginTable("##table3", 3, flags, ImVec2(use_all_width ? -FLT_MIN : 0.0f, TEXT_BASE_HEIGHT * 5.5f)))
|
||||||
|
{
|
||||||
|
for (int row = 0; row < 10; row++)
|
||||||
|
{
|
||||||
|
ImGui::TableNextRow();
|
||||||
|
for (int column = 0; column < 3; column++)
|
||||||
|
{
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
ImGui::Text("Cell %d,%d", column, row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndTable();
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Text("Hello!");
|
||||||
|
|
||||||
|
ImGui::Spacing();
|
||||||
|
|
||||||
|
ImGui::Text("Using explicit size:");
|
||||||
if (ImGui::BeginTable("##table1", 3, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg, ImVec2(TEXT_BASE_WIDTH * 30, 0.0f)))
|
if (ImGui::BeginTable("##table1", 3, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg, ImVec2(TEXT_BASE_WIDTH * 30, 0.0f)))
|
||||||
{
|
{
|
||||||
for (int row = 0; row < 5; row++)
|
for (int row = 0; row < 5; row++)
|
||||||
@ -4310,6 +4339,7 @@ static void ShowDemoWindowTables()
|
|||||||
}
|
}
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4520,7 +4550,7 @@ static void ShowDemoWindowTables()
|
|||||||
for (int column = 0; column < COLUMNS_COUNT; column++)
|
for (int column = 0; column < COLUMNS_COUNT; column++)
|
||||||
{
|
{
|
||||||
ImGui::TableSetColumnIndex(column);
|
ImGui::TableSetColumnIndex(column);
|
||||||
ImGui::Text("Cell %d,%d", 0, row);
|
ImGui::Text("Cell %d,%d", column, row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
@ -4659,7 +4689,7 @@ static void ShowDemoWindowTables()
|
|||||||
ImGui::CheckboxFlags("ImGuiTableFlags_SortTristate", &flags, ImGuiTableFlags_SortTristate);
|
ImGui::CheckboxFlags("ImGuiTableFlags_SortTristate", &flags, ImGuiTableFlags_SortTristate);
|
||||||
ImGui::SameLine(); HelpMarker("When sorting is enabled: allow no sorting, disable default sorting. TableGetSortSpecs() may return specs where (SpecsCount == 0).");
|
ImGui::SameLine(); HelpMarker("When sorting is enabled: allow no sorting, disable default sorting. TableGetSortSpecs() may return specs where (SpecsCount == 0).");
|
||||||
|
|
||||||
if (ImGui::BeginTable("##table", 4, flags, ImVec2(0, TEXT_BASE_HEIGHT * 15), 0.0f))
|
if (ImGui::BeginTable("##table", 4, flags, ImVec2(-FLT_MIN, TEXT_BASE_HEIGHT * 15), 0.0f))
|
||||||
{
|
{
|
||||||
// Declare columns
|
// Declare columns
|
||||||
// We use the "user_id" parameter of TableSetupColumn() to specify a user id that will be stored in the sort specifications.
|
// We use the "user_id" parameter of TableSetupColumn() to specify a user id that will be stored in the sort specifications.
|
||||||
@ -4724,12 +4754,12 @@ static void ShowDemoWindowTables()
|
|||||||
| ImGuiTableFlags_ColumnsWidthFixed;
|
| ImGuiTableFlags_ColumnsWidthFixed;
|
||||||
|
|
||||||
enum ContentsType { CT_Text, CT_Button, CT_SmallButton, CT_FillButton, CT_Selectable, CT_SelectableSpanRow };
|
enum ContentsType { CT_Text, CT_Button, CT_SmallButton, CT_FillButton, CT_Selectable, CT_SelectableSpanRow };
|
||||||
static int contents_type = CT_Button;
|
static int contents_type = CT_SelectableSpanRow;
|
||||||
const char* contents_type_names[] = { "Text", "Button", "SmallButton", "FillButton", "Selectable", "Selectable (span row)" };
|
const char* contents_type_names[] = { "Text", "Button", "SmallButton", "FillButton", "Selectable", "Selectable (span row)" };
|
||||||
static int freeze_cols = 1;
|
static int freeze_cols = 1;
|
||||||
static int freeze_rows = 1;
|
static int freeze_rows = 1;
|
||||||
static int items_count = IM_ARRAYSIZE(template_items_names);
|
static int items_count = IM_ARRAYSIZE(template_items_names) * 2;
|
||||||
static ImVec2 outer_size_value = ImVec2(0, TEXT_BASE_HEIGHT * 12);
|
static ImVec2 outer_size_value = ImVec2(-FLT_MIN, TEXT_BASE_HEIGHT * 12);
|
||||||
static float row_min_height = 0.0f; // Auto
|
static float row_min_height = 0.0f; // Auto
|
||||||
static float inner_width_with_scroll = 0.0f; // Auto-extend
|
static float inner_width_with_scroll = 0.0f; // Auto-extend
|
||||||
static bool outer_size_enabled = true;
|
static bool outer_size_enabled = true;
|
||||||
@ -4776,7 +4806,6 @@ static void ShowDemoWindowTables()
|
|||||||
if (ImGui::CheckboxFlags("ImGuiTableFlags_ColumnsWidthFixed", &flags, ImGuiTableFlags_ColumnsWidthFixed))
|
if (ImGui::CheckboxFlags("ImGuiTableFlags_ColumnsWidthFixed", &flags, ImGuiTableFlags_ColumnsWidthFixed))
|
||||||
flags &= ~ImGuiTableFlags_ColumnsWidthStretch; // Can't specify both sizing polices so we clear the other
|
flags &= ~ImGuiTableFlags_ColumnsWidthStretch; // Can't specify both sizing polices so we clear the other
|
||||||
ImGui::SameLine(); HelpMarker("[Default if ScrollX is on]\nEnlarge as needed: enable scrollbar if ScrollX is enabled, otherwise extend parent window's contents rectangle. Only Fixed columns allowed. Stretched columns will calculate their width assuming no scrolling.");
|
ImGui::SameLine(); HelpMarker("[Default if ScrollX is on]\nEnlarge as needed: enable scrollbar if ScrollX is enabled, otherwise extend parent window's contents rectangle. Only Fixed columns allowed. Stretched columns will calculate their width assuming no scrolling.");
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_NoHeadersWidth", &flags, ImGuiTableFlags_NoHeadersWidth);
|
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_NoHostExtendY", &flags, ImGuiTableFlags_NoHostExtendY);
|
ImGui::CheckboxFlags("ImGuiTableFlags_NoHostExtendY", &flags, ImGuiTableFlags_NoHostExtendY);
|
||||||
ImGui::CheckboxFlags("ImGuiTableFlags_NoKeepColumnsVisible", &flags, ImGuiTableFlags_NoKeepColumnsVisible);
|
ImGui::CheckboxFlags("ImGuiTableFlags_NoKeepColumnsVisible", &flags, ImGuiTableFlags_NoKeepColumnsVisible);
|
||||||
ImGui::SameLine(); HelpMarker("Only available if ScrollX is disabled.");
|
ImGui::SameLine(); HelpMarker("Only available if ScrollX is disabled.");
|
||||||
@ -4826,7 +4855,11 @@ static void ShowDemoWindowTables()
|
|||||||
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
|
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
|
||||||
ImGui::Checkbox("outer_size", &outer_size_enabled);
|
ImGui::Checkbox("outer_size", &outer_size_enabled);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
HelpMarker("If scrolling is disabled (ScrollX and ScrollY not set), the table is output directly in the parent window. OuterSize.y then becomes the minimum size for the table, which will extend vertically if there are more rows (unless NoHostExtendV is set).");
|
HelpMarker("If scrolling is disabled (ScrollX and ScrollY not set):\n"
|
||||||
|
"- The table is output directly in the parent window.\n"
|
||||||
|
"- OuterSize.x < 0.0f will right-align the table.\n"
|
||||||
|
"- OuterSize.x = 0.0f will narrow fit the table unless there are any Stretch column.\n"
|
||||||
|
"- OuterSize.y then becomes the minimum size for the table, which will extend vertically if there are more rows (unless NoHostExtendY is set).");
|
||||||
|
|
||||||
// From a user point of view we will tend to use 'inner_width' differently depending on whether our table is embedding scrolling.
|
// From a user point of view we will tend to use 'inner_width' differently depending on whether our table is embedding scrolling.
|
||||||
// To facilitate experimentation we expose two values and will select the right one depending on active flags.
|
// To facilitate experimentation we expose two values and will select the right one depending on active flags.
|
||||||
@ -4876,7 +4909,7 @@ static void ShowDemoWindowTables()
|
|||||||
ImGui::TableSetupColumn("ID", ImGuiTableColumnFlags_DefaultSort | ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_NoHide, -1.0f, MyItemColumnID_ID);
|
ImGui::TableSetupColumn("ID", ImGuiTableColumnFlags_DefaultSort | ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_NoHide, -1.0f, MyItemColumnID_ID);
|
||||||
ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthFixed, -1.0f, MyItemColumnID_Name);
|
ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthFixed, -1.0f, MyItemColumnID_Name);
|
||||||
ImGui::TableSetupColumn("Action", ImGuiTableColumnFlags_NoSort | ImGuiTableColumnFlags_WidthFixed, -1.0f, MyItemColumnID_Action);
|
ImGui::TableSetupColumn("Action", ImGuiTableColumnFlags_NoSort | ImGuiTableColumnFlags_WidthFixed, -1.0f, MyItemColumnID_Action);
|
||||||
ImGui::TableSetupColumn("Quantity (Long Label)", ImGuiTableColumnFlags_PreferSortDescending | ImGuiTableColumnFlags_WidthStretch, 1.0f, MyItemColumnID_Quantity);// , ImGuiTableColumnFlags_WidthAutoResize);
|
ImGui::TableSetupColumn("Quantity", ImGuiTableColumnFlags_PreferSortDescending, 1.0f, MyItemColumnID_Quantity);
|
||||||
ImGui::TableSetupColumn("Description", ImGuiTableColumnFlags_WidthStretch, 1.0f, MyItemColumnID_Description);
|
ImGui::TableSetupColumn("Description", ImGuiTableColumnFlags_WidthStretch, 1.0f, MyItemColumnID_Description);
|
||||||
ImGui::TableSetupColumn("Hidden", ImGuiTableColumnFlags_DefaultHide | ImGuiTableColumnFlags_NoSort);
|
ImGui::TableSetupColumn("Hidden", ImGuiTableColumnFlags_DefaultHide | ImGuiTableColumnFlags_NoSort);
|
||||||
ImGui::TableSetupScrollFreeze(freeze_cols, freeze_rows);
|
ImGui::TableSetupScrollFreeze(freeze_cols, freeze_rows);
|
||||||
@ -5566,13 +5599,13 @@ void ImGui::ShowAboutWindow(bool* p_open)
|
|||||||
bool ImGui::ShowStyleSelector(const char* label)
|
bool ImGui::ShowStyleSelector(const char* label)
|
||||||
{
|
{
|
||||||
static int style_idx = -1;
|
static int style_idx = -1;
|
||||||
if (ImGui::Combo(label, &style_idx, "Classic\0Dark\0Light\0"))
|
if (ImGui::Combo(label, &style_idx, "Dark\0Light\0Classic\0"))
|
||||||
{
|
{
|
||||||
switch (style_idx)
|
switch (style_idx)
|
||||||
{
|
{
|
||||||
case 0: ImGui::StyleColorsClassic(); break;
|
case 0: ImGui::StyleColorsDark(); break;
|
||||||
case 1: ImGui::StyleColorsDark(); break;
|
case 1: ImGui::StyleColorsLight(); break;
|
||||||
case 2: ImGui::StyleColorsLight(); break;
|
case 2: ImGui::StyleColorsClassic(); break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -6981,14 +7014,18 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
|||||||
static int ngon_sides = 6;
|
static int ngon_sides = 6;
|
||||||
static bool circle_segments_override = false;
|
static bool circle_segments_override = false;
|
||||||
static int circle_segments_override_v = 12;
|
static int circle_segments_override_v = 12;
|
||||||
|
static bool curve_segments_override = false;
|
||||||
|
static int curve_segments_override_v = 8;
|
||||||
static ImVec4 colf = ImVec4(1.0f, 1.0f, 0.4f, 1.0f);
|
static ImVec4 colf = ImVec4(1.0f, 1.0f, 0.4f, 1.0f);
|
||||||
ImGui::DragFloat("Size", &sz, 0.2f, 2.0f, 72.0f, "%.0f");
|
ImGui::DragFloat("Size", &sz, 0.2f, 2.0f, 72.0f, "%.0f");
|
||||||
ImGui::DragFloat("Thickness", &thickness, 0.05f, 1.0f, 8.0f, "%.02f");
|
ImGui::DragFloat("Thickness", &thickness, 0.05f, 1.0f, 8.0f, "%.02f");
|
||||||
ImGui::SliderInt("N-gon sides", &ngon_sides, 3, 12);
|
ImGui::SliderInt("N-gon sides", &ngon_sides, 3, 12);
|
||||||
ImGui::Checkbox("##circlesegmentoverride", &circle_segments_override);
|
ImGui::Checkbox("##circlesegmentoverride", &circle_segments_override);
|
||||||
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
|
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
|
||||||
if (ImGui::SliderInt("Circle segments", &circle_segments_override_v, 3, 40))
|
circle_segments_override |= ImGui::SliderInt("Circle segments override", &circle_segments_override_v, 3, 40);
|
||||||
circle_segments_override = true;
|
ImGui::Checkbox("##curvessegmentoverride", &curve_segments_override);
|
||||||
|
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
|
||||||
|
curve_segments_override |= ImGui::SliderInt("Curves segments override", &curve_segments_override_v, 3, 40);
|
||||||
ImGui::ColorEdit4("Color", &colf.x);
|
ImGui::ColorEdit4("Color", &colf.x);
|
||||||
|
|
||||||
const ImVec2 p = ImGui::GetCursorScreenPos();
|
const ImVec2 p = ImGui::GetCursorScreenPos();
|
||||||
@ -6998,6 +7035,7 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
|||||||
const ImDrawCornerFlags corners_all = ImDrawCornerFlags_All;
|
const ImDrawCornerFlags corners_all = ImDrawCornerFlags_All;
|
||||||
const ImDrawCornerFlags corners_tl_br = ImDrawCornerFlags_TopLeft | ImDrawCornerFlags_BotRight;
|
const ImDrawCornerFlags corners_tl_br = ImDrawCornerFlags_TopLeft | ImDrawCornerFlags_BotRight;
|
||||||
const int circle_segments = circle_segments_override ? circle_segments_override_v : 0;
|
const int circle_segments = circle_segments_override ? circle_segments_override_v : 0;
|
||||||
|
const int curve_segments = curve_segments_override ? curve_segments_override_v : 0;
|
||||||
float x = p.x + 4.0f;
|
float x = p.x + 4.0f;
|
||||||
float y = p.y + 4.0f;
|
float y = p.y + 4.0f;
|
||||||
for (int n = 0; n < 2; n++)
|
for (int n = 0; n < 2; n++)
|
||||||
@ -7014,7 +7052,15 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
|||||||
draw_list->AddLine(ImVec2(x, y), ImVec2(x + sz, y), col, th); x += sz + spacing; // Horizontal line (note: drawing a filled rectangle will be faster!)
|
draw_list->AddLine(ImVec2(x, y), ImVec2(x + sz, y), col, th); x += sz + spacing; // Horizontal line (note: drawing a filled rectangle will be faster!)
|
||||||
draw_list->AddLine(ImVec2(x, y), ImVec2(x, y + sz), col, th); x += spacing; // Vertical line (note: drawing a filled rectangle will be faster!)
|
draw_list->AddLine(ImVec2(x, y), ImVec2(x, y + sz), col, th); x += spacing; // Vertical line (note: drawing a filled rectangle will be faster!)
|
||||||
draw_list->AddLine(ImVec2(x, y), ImVec2(x + sz, y + sz), col, th); x += sz + spacing; // Diagonal line
|
draw_list->AddLine(ImVec2(x, y), ImVec2(x + sz, y + sz), col, th); x += sz + spacing; // Diagonal line
|
||||||
draw_list->AddBezierCurve(ImVec2(x, y), ImVec2(x + sz*1.3f, y + sz*0.3f), ImVec2(x + sz - sz*1.3f, y + sz - sz*0.3f), ImVec2(x + sz, y + sz), col, th);
|
|
||||||
|
// Quadratic Bezier Curve (3 control points)
|
||||||
|
ImVec2 cp3[3] = { ImVec2(x, y + sz * 0.6f), ImVec2(x + sz * 0.5f, y - sz * 0.4f), ImVec2(x + sz, y + sz) };
|
||||||
|
draw_list->AddBezierQuadratic(cp3[0], cp3[1], cp3[2], col, th, curve_segments); x += sz + spacing;
|
||||||
|
|
||||||
|
// Cubic Bezier Curve (4 control points)
|
||||||
|
ImVec2 cp4[4] = { ImVec2(x, y), ImVec2(x + sz * 1.3f, y + sz * 0.3f), ImVec2(x + sz - sz * 1.3f, y + sz - sz * 0.3f), ImVec2(x + sz, y + sz) };
|
||||||
|
draw_list->AddBezierCubic(cp4[0], cp4[1], cp4[2], cp4[3], col, th, curve_segments);
|
||||||
|
|
||||||
x = p.x + 4;
|
x = p.x + 4;
|
||||||
y += sz + spacing;
|
y += sz + spacing;
|
||||||
}
|
}
|
||||||
|
@ -1056,7 +1056,7 @@ void ImDrawList::PathArcTo(const ImVec2& center, float radius, float a_min, floa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImVec2 ImBezierCalc(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, float t)
|
ImVec2 ImBezierCubicCalc(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, float t)
|
||||||
{
|
{
|
||||||
float u = 1.0f - t;
|
float u = 1.0f - t;
|
||||||
float w1 = u * u * u;
|
float w1 = u * u * u;
|
||||||
@ -1066,13 +1066,22 @@ ImVec2 ImBezierCalc(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const
|
|||||||
return ImVec2(w1 * p1.x + w2 * p2.x + w3 * p3.x + w4 * p4.x, w1 * p1.y + w2 * p2.y + w3 * p3.y + w4 * p4.y);
|
return ImVec2(w1 * p1.x + w2 * p2.x + w3 * p3.x + w4 * p4.x, w1 * p1.y + w2 * p2.y + w3 * p3.y + w4 * p4.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Closely mimics BezierClosestPointCasteljauStep() in imgui.cpp
|
ImVec2 ImBezierQuadraticCalc(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, float t)
|
||||||
static void PathBezierToCasteljau(ImVector<ImVec2>* path, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, float tess_tol, int level)
|
{
|
||||||
|
float u = 1.0f - t;
|
||||||
|
float w1 = u * u;
|
||||||
|
float w2 = 2 * u * t;
|
||||||
|
float w3 = t * t;
|
||||||
|
return ImVec2(w1 * p1.x + w2 * p2.x + w3 * p3.x, w1 * p1.y + w2 * p2.y + w3 * p3.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Closely mimics ImBezierCubicClosestPointCasteljau() in imgui.cpp
|
||||||
|
static void PathBezierCubicCurveToCasteljau(ImVector<ImVec2>* path, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, float tess_tol, int level)
|
||||||
{
|
{
|
||||||
float dx = x4 - x1;
|
float dx = x4 - x1;
|
||||||
float dy = y4 - y1;
|
float dy = y4 - y1;
|
||||||
float d2 = ((x2 - x4) * dy - (y2 - y4) * dx);
|
float d2 = (x2 - x4) * dy - (y2 - y4) * dx;
|
||||||
float d3 = ((x3 - x4) * dy - (y3 - y4) * dx);
|
float d3 = (x3 - x4) * dy - (y3 - y4) * dx;
|
||||||
d2 = (d2 >= 0) ? d2 : -d2;
|
d2 = (d2 >= 0) ? d2 : -d2;
|
||||||
d3 = (d3 >= 0) ? d3 : -d3;
|
d3 = (d3 >= 0) ? d3 : -d3;
|
||||||
if ((d2 + d3) * (d2 + d3) < tess_tol * (dx * dx + dy * dy))
|
if ((d2 + d3) * (d2 + d3) < tess_tol * (dx * dx + dy * dy))
|
||||||
@ -1087,23 +1096,56 @@ static void PathBezierToCasteljau(ImVector<ImVec2>* path, float x1, float y1, fl
|
|||||||
float x123 = (x12 + x23) * 0.5f, y123 = (y12 + y23) * 0.5f;
|
float x123 = (x12 + x23) * 0.5f, y123 = (y12 + y23) * 0.5f;
|
||||||
float x234 = (x23 + x34) * 0.5f, y234 = (y23 + y34) * 0.5f;
|
float x234 = (x23 + x34) * 0.5f, y234 = (y23 + y34) * 0.5f;
|
||||||
float x1234 = (x123 + x234) * 0.5f, y1234 = (y123 + y234) * 0.5f;
|
float x1234 = (x123 + x234) * 0.5f, y1234 = (y123 + y234) * 0.5f;
|
||||||
PathBezierToCasteljau(path, x1, y1, x12, y12, x123, y123, x1234, y1234, tess_tol, level + 1);
|
PathBezierCubicCurveToCasteljau(path, x1, y1, x12, y12, x123, y123, x1234, y1234, tess_tol, level + 1);
|
||||||
PathBezierToCasteljau(path, x1234, y1234, x234, y234, x34, y34, x4, y4, tess_tol, level + 1);
|
PathBezierCubicCurveToCasteljau(path, x1234, y1234, x234, y234, x34, y34, x4, y4, tess_tol, level + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImDrawList::PathBezierCurveTo(const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, int num_segments)
|
static void PathBezierQuadraticCurveToCasteljau(ImVector<ImVec2>* path, float x1, float y1, float x2, float y2, float x3, float y3, float tess_tol, int level)
|
||||||
|
{
|
||||||
|
float dx = x3 - x1, dy = y3 - y1;
|
||||||
|
float det = (x2 - x3) * dy - (y2 - y3) * dx;
|
||||||
|
if (det * det * 4.0f < tess_tol * (dx * dx + dy * dy))
|
||||||
|
{
|
||||||
|
path->push_back(ImVec2(x3, y3));
|
||||||
|
}
|
||||||
|
else if (level < 10)
|
||||||
|
{
|
||||||
|
float x12 = (x1 + x2) * 0.5f, y12 = (y1 + y2) * 0.5f;
|
||||||
|
float x23 = (x2 + x3) * 0.5f, y23 = (y2 + y3) * 0.5f;
|
||||||
|
float x123 = (x12 + x23) * 0.5f, y123 = (y12 + y23) * 0.5f;
|
||||||
|
PathBezierQuadraticCurveToCasteljau(path, x1, y1, x12, y12, x123, y123, tess_tol, level + 1);
|
||||||
|
PathBezierQuadraticCurveToCasteljau(path, x123, y123, x23, y23, x3, y3, tess_tol, level + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImDrawList::PathBezierCubicCurveTo(const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, int num_segments)
|
||||||
{
|
{
|
||||||
ImVec2 p1 = _Path.back();
|
ImVec2 p1 = _Path.back();
|
||||||
if (num_segments == 0)
|
if (num_segments == 0)
|
||||||
{
|
{
|
||||||
PathBezierToCasteljau(&_Path, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, p4.x, p4.y, _Data->CurveTessellationTol, 0); // Auto-tessellated
|
PathBezierCubicCurveToCasteljau(&_Path, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, p4.x, p4.y, _Data->CurveTessellationTol, 0); // Auto-tessellated
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float t_step = 1.0f / (float)num_segments;
|
float t_step = 1.0f / (float)num_segments;
|
||||||
for (int i_step = 1; i_step <= num_segments; i_step++)
|
for (int i_step = 1; i_step <= num_segments; i_step++)
|
||||||
_Path.push_back(ImBezierCalc(p1, p2, p3, p4, t_step * i_step));
|
_Path.push_back(ImBezierCubicCalc(p1, p2, p3, p4, t_step * i_step));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImDrawList::PathBezierQuadraticCurveTo(const ImVec2& p2, const ImVec2& p3, int num_segments)
|
||||||
|
{
|
||||||
|
ImVec2 p1 = _Path.back();
|
||||||
|
if (num_segments == 0)
|
||||||
|
{
|
||||||
|
PathBezierQuadraticCurveToCasteljau(&_Path, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, _Data->CurveTessellationTol, 0);// Auto-tessellated
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float t_step = 1.0f / (float)num_segments;
|
||||||
|
for (int i_step = 1; i_step <= num_segments; i_step++)
|
||||||
|
_Path.push_back(ImBezierQuadraticCalc(p1, p2, p3, t_step * i_step));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1317,13 +1359,24 @@ void ImDrawList::AddNgonFilled(const ImVec2& center, float radius, ImU32 col, in
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cubic Bezier takes 4 controls points
|
// Cubic Bezier takes 4 controls points
|
||||||
void ImDrawList::AddBezierCurve(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col, float thickness, int num_segments)
|
void ImDrawList::AddBezierCubic(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col, float thickness, int num_segments)
|
||||||
{
|
{
|
||||||
if ((col & IM_COL32_A_MASK) == 0)
|
if ((col & IM_COL32_A_MASK) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PathLineTo(p1);
|
PathLineTo(p1);
|
||||||
PathBezierCurveTo(p2, p3, p4, num_segments);
|
PathBezierCubicCurveTo(p2, p3, p4, num_segments);
|
||||||
|
PathStroke(col, false, thickness);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Quadratic Bezier takes 3 controls points
|
||||||
|
void ImDrawList::AddBezierQuadratic(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, ImU32 col, float thickness, int num_segments)
|
||||||
|
{
|
||||||
|
if ((col & IM_COL32_A_MASK) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
PathLineTo(p1);
|
||||||
|
PathBezierQuadraticCurveTo(p2, p3, num_segments);
|
||||||
PathStroke(col, false, thickness);
|
PathStroke(col, false, thickness);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,9 +408,10 @@ static inline float ImLinearSweep(float current, float target, float speed)
|
|||||||
static inline ImVec2 ImMul(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x * rhs.x, lhs.y * rhs.y); }
|
static inline ImVec2 ImMul(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x * rhs.x, lhs.y * rhs.y); }
|
||||||
|
|
||||||
// Helpers: Geometry
|
// Helpers: Geometry
|
||||||
IMGUI_API ImVec2 ImBezierCalc(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, float t); // Cubic Bezier
|
IMGUI_API ImVec2 ImBezierCubicCalc(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, float t);
|
||||||
IMGUI_API ImVec2 ImBezierClosestPoint(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, const ImVec2& p, int num_segments); // For curves with explicit number of segments
|
IMGUI_API ImVec2 ImBezierCubicClosestPoint(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, const ImVec2& p, int num_segments); // For curves with explicit number of segments
|
||||||
IMGUI_API ImVec2 ImBezierClosestPointCasteljau(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, const ImVec2& p, float tess_tol);// For auto-tessellated curves you can use tess_tol = style.CurveTessellationTol
|
IMGUI_API ImVec2 ImBezierCubicClosestPointCasteljau(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, const ImVec2& p, float tess_tol);// For auto-tessellated curves you can use tess_tol = style.CurveTessellationTol
|
||||||
|
IMGUI_API ImVec2 ImBezierQuadraticCalc(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, float t);
|
||||||
IMGUI_API ImVec2 ImLineClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& p);
|
IMGUI_API ImVec2 ImLineClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& p);
|
||||||
IMGUI_API bool ImTriangleContainsPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p);
|
IMGUI_API bool ImTriangleContainsPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p);
|
||||||
IMGUI_API ImVec2 ImTriangleClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p);
|
IMGUI_API ImVec2 ImTriangleClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p);
|
||||||
@ -2222,16 +2223,19 @@ struct ImGuiTable
|
|||||||
float ColumnsTotalWidth; // Sum of current column width
|
float ColumnsTotalWidth; // Sum of current column width
|
||||||
float ColumnsAutoFitWidth; // Sum of ideal column width in order nothing to be clipped, used for auto-fitting and content width submission in outer window
|
float ColumnsAutoFitWidth; // Sum of ideal column width in order nothing to be clipped, used for auto-fitting and content width submission in outer window
|
||||||
float ResizedColumnNextWidth;
|
float ResizedColumnNextWidth;
|
||||||
|
float ResizeLockMinContentsX2; // Lock minimum contents width while resizing down in order to not create feedback loops. But we allow growing the table.
|
||||||
float RefScale; // Reference scale to be able to rescale columns on font/dpi changes.
|
float RefScale; // Reference scale to be able to rescale columns on font/dpi changes.
|
||||||
ImRect OuterRect; // Note: OuterRect.Max.y is often FLT_MAX until EndTable(), unless a height has been specified in BeginTable().
|
ImRect OuterRect; // Note: for non-scrolling table, OuterRect.Max.y is often FLT_MAX until EndTable(), unless a height has been specified in BeginTable().
|
||||||
|
ImRect InnerRect; // InnerRect but without decoration. As with OuterRect, for non-scrolling tables, InnerRect.Max.y is
|
||||||
ImRect WorkRect;
|
ImRect WorkRect;
|
||||||
ImRect InnerClipRect;
|
ImRect InnerClipRect;
|
||||||
ImRect BgClipRect; // We use this to cpu-clip cell background color fill
|
ImRect BgClipRect; // We use this to cpu-clip cell background color fill
|
||||||
ImRect BgClipRectForDrawCmd;
|
ImRect Bg0ClipRectForDrawCmd; // Actual ImDrawCmd clip rect for BG0/1 channel. This tends to be == OuterWindow->ClipRect at BeginTable() because output in BG0/BG1 is cpu-clipped
|
||||||
|
ImRect Bg2ClipRectForDrawCmd; // Actual ImDrawCmd clip rect for BG2 channel. This tends to be a correct, tight-fit, because output to BG2 are done by widgets relying on regular ClipRect.
|
||||||
ImRect HostClipRect; // This is used to check if we can eventually merge our columns draw calls into the current draw call of the current window.
|
ImRect HostClipRect; // This is used to check if we can eventually merge our columns draw calls into the current draw call of the current window.
|
||||||
ImRect HostBackupWorkRect; // Backup of InnerWindow->WorkRect at the end of BeginTable()
|
ImRect HostBackupWorkRect; // Backup of InnerWindow->WorkRect at the end of BeginTable()
|
||||||
ImRect HostBackupParentWorkRect; // Backup of InnerWindow->ParentWorkRect at the end of BeginTable()
|
ImRect HostBackupParentWorkRect; // Backup of InnerWindow->ParentWorkRect at the end of BeginTable()
|
||||||
ImRect HostBackupClipRect; // Backup of InnerWindow->ClipRect during PushTableBackground()/PopTableBackground()
|
ImRect HostBackupInnerClipRect; // Backup of InnerWindow->ClipRect during PushTableBackground()/PopTableBackground()
|
||||||
ImVec2 HostBackupPrevLineSize; // Backup of InnerWindow->DC.PrevLineSize at the end of BeginTable()
|
ImVec2 HostBackupPrevLineSize; // Backup of InnerWindow->DC.PrevLineSize at the end of BeginTable()
|
||||||
ImVec2 HostBackupCurrLineSize; // Backup of InnerWindow->DC.CurrLineSize at the end of BeginTable()
|
ImVec2 HostBackupCurrLineSize; // Backup of InnerWindow->DC.CurrLineSize at the end of BeginTable()
|
||||||
ImVec2 HostBackupCursorMaxPos; // Backup of InnerWindow->DC.CursorMaxPos at the end of BeginTable()
|
ImVec2 HostBackupCursorMaxPos; // Backup of InnerWindow->DC.CursorMaxPos at the end of BeginTable()
|
||||||
@ -2257,8 +2261,9 @@ struct ImGuiTable
|
|||||||
ImGuiTableColumnIdx HeldHeaderColumn; // Index of column header being held.
|
ImGuiTableColumnIdx HeldHeaderColumn; // Index of column header being held.
|
||||||
ImGuiTableColumnIdx ReorderColumn; // Index of column being reordered. (not cleared)
|
ImGuiTableColumnIdx ReorderColumn; // Index of column being reordered. (not cleared)
|
||||||
ImGuiTableColumnIdx ReorderColumnDir; // -1 or +1
|
ImGuiTableColumnIdx ReorderColumnDir; // -1 or +1
|
||||||
|
ImGuiTableColumnIdx LeftMostStretchedColumn; // Index of left-most stretched column.
|
||||||
|
ImGuiTableColumnIdx RightMostStretchedColumn; // Index of right-most stretched column.
|
||||||
ImGuiTableColumnIdx RightMostEnabledColumn; // Index of right-most non-hidden column.
|
ImGuiTableColumnIdx RightMostEnabledColumn; // Index of right-most non-hidden column.
|
||||||
ImGuiTableColumnIdx LeftMostStretchedColumnDisplayOrder; // Display order of left-most stretched column.
|
|
||||||
ImGuiTableColumnIdx ContextPopupColumn; // Column right-clicked on, of -1 if opening context menu from a neutral/empty spot
|
ImGuiTableColumnIdx ContextPopupColumn; // Column right-clicked on, of -1 if opening context menu from a neutral/empty spot
|
||||||
ImGuiTableColumnIdx FreezeRowsRequest; // Requested frozen rows count
|
ImGuiTableColumnIdx FreezeRowsRequest; // Requested frozen rows count
|
||||||
ImGuiTableColumnIdx FreezeRowsCount; // Actual frozen row count (== FreezeRowsRequest, or == 0 when no scrolling offset)
|
ImGuiTableColumnIdx FreezeRowsCount; // Actual frozen row count (== FreezeRowsRequest, or == 0 when no scrolling offset)
|
||||||
@ -2266,8 +2271,8 @@ struct ImGuiTable
|
|||||||
ImGuiTableColumnIdx FreezeColumnsCount; // Actual frozen columns count (== FreezeColumnsRequest, or == 0 when no scrolling offset)
|
ImGuiTableColumnIdx FreezeColumnsCount; // Actual frozen columns count (== FreezeColumnsRequest, or == 0 when no scrolling offset)
|
||||||
ImGuiTableColumnIdx RowCellDataCurrent; // Index of current RowCellData[] entry in current row
|
ImGuiTableColumnIdx RowCellDataCurrent; // Index of current RowCellData[] entry in current row
|
||||||
ImGuiTableDrawChannelIdx DummyDrawChannel; // Redirect non-visible columns here.
|
ImGuiTableDrawChannelIdx DummyDrawChannel; // Redirect non-visible columns here.
|
||||||
ImGuiTableDrawChannelIdx Bg1DrawChannelCurrent; // For Selectable() and other widgets drawing accross columns after the freezing line. Index within DrawSplitter.Channels[]
|
ImGuiTableDrawChannelIdx Bg2DrawChannelCurrent; // For Selectable() and other widgets drawing accross columns after the freezing line. Index within DrawSplitter.Channels[]
|
||||||
ImGuiTableDrawChannelIdx Bg1DrawChannelUnfrozen;
|
ImGuiTableDrawChannelIdx Bg2DrawChannelUnfrozen;
|
||||||
bool IsLayoutLocked; // Set by TableUpdateLayout() which is called when beginning the first row.
|
bool IsLayoutLocked; // Set by TableUpdateLayout() which is called when beginning the first row.
|
||||||
bool IsInsideRow; // Set when inside TableBeginRow()/TableEndRow().
|
bool IsInsideRow; // Set when inside TableBeginRow()/TableEndRow().
|
||||||
bool IsInitializing;
|
bool IsInitializing;
|
||||||
@ -2280,6 +2285,7 @@ struct ImGuiTable
|
|||||||
bool IsResetAllRequest;
|
bool IsResetAllRequest;
|
||||||
bool IsResetDisplayOrderRequest;
|
bool IsResetDisplayOrderRequest;
|
||||||
bool IsUnfrozen; // Set when we got past the frozen row.
|
bool IsUnfrozen; // Set when we got past the frozen row.
|
||||||
|
bool IsOuterRectAutoFitX; // Set when outer_size.x == 0.0f in BeginTable(), scrolling is disabled, and there are stretch columns.
|
||||||
bool MemoryCompacted;
|
bool MemoryCompacted;
|
||||||
bool HostSkipItems; // Backup of InnerWindow->SkipItem at the end of BeginTable(), because we will overwrite InnerWindow->SkipItem on a per-column basis
|
bool HostSkipItems; // Backup of InnerWindow->SkipItem at the end of BeginTable(), because we will overwrite InnerWindow->SkipItem on a per-column basis
|
||||||
|
|
||||||
@ -2583,6 +2589,7 @@ namespace ImGui
|
|||||||
IMGUI_API const char* TableGetColumnName(const ImGuiTable* table, int column_n);
|
IMGUI_API const char* TableGetColumnName(const ImGuiTable* table, int column_n);
|
||||||
IMGUI_API ImGuiID TableGetColumnResizeID(const ImGuiTable* table, int column_n, int instance_no = 0);
|
IMGUI_API ImGuiID TableGetColumnResizeID(const ImGuiTable* table, int column_n, int instance_no = 0);
|
||||||
IMGUI_API float TableGetMinColumnWidth();
|
IMGUI_API float TableGetMinColumnWidth();
|
||||||
|
IMGUI_API float TableGetMaxColumnWidth(const ImGuiTable* table, int column_n);
|
||||||
IMGUI_API void TableSetColumnWidthAutoSingle(ImGuiTable* table, int column_n);
|
IMGUI_API void TableSetColumnWidthAutoSingle(ImGuiTable* table, int column_n);
|
||||||
IMGUI_API void TableSetColumnWidthAutoAll(ImGuiTable* table);
|
IMGUI_API void TableSetColumnWidthAutoAll(ImGuiTable* table);
|
||||||
IMGUI_API void TableRemove(ImGuiTable* table);
|
IMGUI_API void TableRemove(ImGuiTable* table);
|
||||||
|
486
imgui_tables.cpp
486
imgui_tables.cpp
File diff suppressed because it is too large
Load Diff
@ -7756,7 +7756,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
|
|||||||
g.ActiveIdWindow = docked_window;
|
g.ActiveIdWindow = docked_window;
|
||||||
|
|
||||||
// Allow the close button to overlap unless we are dragging (in which case we don't want any overlapping tabs to be hovered)
|
// Allow the close button to overlap unless we are dragging (in which case we don't want any overlapping tabs to be hovered)
|
||||||
if (!held)
|
if (g.ActiveId != id)
|
||||||
SetItemAllowOverlap();
|
SetItemAllowOverlap();
|
||||||
|
|
||||||
// Drag and drop a single floating window node moves it
|
// Drag and drop a single floating window node moves it
|
||||||
|
Loading…
Reference in New Issue
Block a user