mirror of
https://github.com/ocornut/imgui.git
synced 2026-06-02 03:00:39 +08:00
Merge branch 'master' into docking
# Conflicts: # imgui.cpp # imgui_demo.cpp
This commit is contained in:
+17
-2
@@ -42,10 +42,14 @@ HOW TO UPDATE?
|
||||
|
||||
Breaking changes:
|
||||
|
||||
- Clipper: Renamed IncludeRangeByIndices(), also called ForceDisplayRangeByIndices()
|
||||
before 1.89.6, to IncludeItemsByIndex(). Kept inline redirection function. (#6424, #3841)
|
||||
|
||||
Other changes:
|
||||
|
||||
- Tables: Made it possible to use SameLine(0,0) after TableNextColumn() or
|
||||
TableSetColumnIndex() in order to reuse line height from previous cell. (#3740)
|
||||
TableSetColumnIndex() in order to reuse line pos/height from previous cell. (#3740)
|
||||
- Tables: Made it possible to change style.CellPadding.y between rows. (#3740)
|
||||
- Nav, TreeNode: Pressing Left with ImGuiTreeNodeFlags_NavLeftJumpsBackHere now goes
|
||||
through proper navigation logic: honor scrolling and selection. (#1079, #1131)
|
||||
- Sliders: Fixed an integer overflow and div-by-zero in SliderInt() when
|
||||
@@ -55,8 +59,14 @@ Other changes:
|
||||
setting large values. (#6749)
|
||||
- InputFloat, SliderFloat, DragFloat: always turn both '.' and ',' into the current decimal
|
||||
point character when using Decimal/Scientific character filter. (#6719, #2278) [@adamsepp]
|
||||
- ColorEdit, ColorPicker: Manipulating options popup don't mark item as edited. (#6722)
|
||||
(Note that they may still be marked as Active/Hovered.)
|
||||
- Clipper: Added IncludeItemByIndex() helper to include a single item. (#6424, #3841)
|
||||
- Clipper: Fixed a bug if attempt to force-include a range which matches an already
|
||||
included range, clipper would end earlier. (#3841)
|
||||
- ImDrawData: Fixed an issue where TotalVtxCount/TotalIdxCount does not match the sum
|
||||
of individual ImDrawList's buffer sizes when a dimming/modal background is rendered. (#6716)
|
||||
- ImDrawList: Automatically calling ChannelsMerge() if not done after a split.
|
||||
- ImDrawList: Fixed OOB access in _CalcCircleAutoSegmentCount when passing excessively
|
||||
large radius to AddCircle(). (#6657, #5317) [@EggsyCRO, @jdpatdiscord]
|
||||
- IO: Exposed io.PlatformLocaleDecimalPoint to configure decimal point ('.' or ',') for
|
||||
@@ -68,10 +78,15 @@ Other changes:
|
||||
- Misc: Made multiple calls to Render() during the same frame early out faster.
|
||||
- Debug Tools: Metrics: Fixed "Drawlists" section and per-viewport equivalent
|
||||
appearing empty (regression in 1.89.8).
|
||||
- Demo: Demonstrate out-of-order rendering using ImDrawListSplitter.
|
||||
- Demo: Reorganized "Examples" menu.
|
||||
- Demo: Tables: Demonstrate using SameLine() between cells. (#3740)
|
||||
- Demo: Tables: Demonstrate altering CellPadding.y between rows. (#3740)
|
||||
- Demo: Custom Rendering: Demonstrate out-of-order rendering using ImDrawListSplitter.
|
||||
- Backends: SDL2,SDL3: added ImGui_ImplSDL2_InitForOther()/ImGui_ImplSDL3_InitForOther()
|
||||
for consistency (matching GLFW backend) and as most initialization paths don't actually
|
||||
need to care about rendering backend.
|
||||
- Examples: Emscripten+WebGPU: Fixed WGPUInstance creation process + use preferred
|
||||
framebuffer format. (#6640, #6748) [@smileorigin]
|
||||
|
||||
Docking+Viewports Branch:
|
||||
|
||||
|
||||
+7
-3
@@ -39,9 +39,11 @@ Dear ImGui is particularly suited to integration in game engines (for tooling),
|
||||
|
||||
### Usage
|
||||
|
||||
**The core of Dear ImGui is self-contained within a few platform-agnostic files** which you can easily compile in your application/engine. They are all the files in the root folder of the repository (imgui*.cpp, imgui*.h). **No specific build process is required**. You can add the .cpp files into your existing project. See [Getting Started](https://github.com/ocornut/imgui/wiki/Getting-Started).
|
||||
**The core of Dear ImGui is self-contained within a few platform-agnostic files** which you can easily compile in your application/engine. They are all the files in the root folder of the repository (imgui*.cpp, imgui*.h). **No specific build process is required**. You can add the .cpp files into your existing project.
|
||||
|
||||
**Backends for a variety of graphics API and rendering platforms** are provided in the [backends/](https://github.com/ocornut/imgui/tree/master/backends) folder, along with example applications in the [examples/](https://github.com/ocornut/imgui/tree/master/examples) folder. See the [Integration](#integration) section of this document for details. You may also create your own backend. Anywhere where you can render textured triangles, you can render Dear ImGui.
|
||||
**Backends for a variety of graphics API and rendering platforms** are provided in the [backends/](https://github.com/ocornut/imgui/tree/master/backends) folder, along with example applications in the [examples/](https://github.com/ocornut/imgui/tree/master/examples) folder. You may also create your own backend. Anywhere where you can render textured triangles, you can render Dear ImGui.
|
||||
|
||||
See the [Getting Started](https://github.com/ocornut/imgui/wiki/Getting-Started) guide and [Integration](#integration) section of this document for more details.
|
||||
|
||||
After Dear ImGui is set up in your application, you can use it from \_anywhere\_ in your program loop:
|
||||
```cpp
|
||||
@@ -114,9 +116,11 @@ The demo applications are not DPI aware so expect some blurriness on a 4K screen
|
||||
|
||||
### Integration
|
||||
|
||||
See the [Getting Started](https://github.com/ocornut/imgui/wiki/Getting-Started) guide for details.
|
||||
|
||||
On most platforms and when using C++, **you should be able to use a combination of the [imgui_impl_xxxx](https://github.com/ocornut/imgui/tree/master/backends) backends without modification** (e.g. `imgui_impl_win32.cpp` + `imgui_impl_dx11.cpp`). If your engine supports multiple platforms, consider using more imgui_impl_xxxx files instead of rewriting them: this will be less work for you, and you can get Dear ImGui running immediately. You can _later_ decide to rewrite a custom backend using your custom engine functions if you wish so.
|
||||
|
||||
See [Getting Started](https://github.com/ocornut/imgui/wiki/Getting-Started). Integrating Dear ImGui within your custom engine is a matter of 1) wiring mouse/keyboard/gamepad inputs 2) uploading a texture to your GPU/render engine 3) providing a render function that can bind textures and render textured triangles, which is essentially what Backends are doing. The [examples/](https://github.com/ocornut/imgui/tree/master/examples) folder is populated with applications doing just that: setting up a window and using backends. If you follow [Getting Started](https://github.com/ocornut/imgui/wiki/Getting-Started) it should in theory takes you less than an hour to integrate Dear ImGui. **Make sure to spend time reading the [FAQ](https://www.dearimgui.com/faq), comments, and the examples applications!**
|
||||
Integrating Dear ImGui within your custom engine is a matter of 1) wiring mouse/keyboard/gamepad inputs 2) uploading a texture to your GPU/render engine 3) providing a render function that can bind textures and render textured triangles, which is essentially what Backends are doing. The [examples/](https://github.com/ocornut/imgui/tree/master/examples) folder is populated with applications doing just that: setting up a window and using backends. If you follow the [Getting Started](https://github.com/ocornut/imgui/wiki/Getting-Started) guide it should in theory takes you less than an hour to integrate Dear ImGui. **Make sure to spend time reading the [FAQ](https://www.dearimgui.com/faq), comments, and the examples applications!**
|
||||
|
||||
Officially maintained backends/bindings (in repository):
|
||||
- Renderers: DirectX9, DirectX10, DirectX11, DirectX12, Metal, OpenGL/ES/ES2, SDL_Renderer, Vulkan, WebGPU.
|
||||
|
||||
@@ -15,11 +15,12 @@
|
||||
#include <webgpu/webgpu_cpp.h>
|
||||
|
||||
// Global WebGPU required states
|
||||
static WGPUDevice wgpu_device = nullptr;
|
||||
static WGPUSurface wgpu_surface = nullptr;
|
||||
static WGPUSwapChain wgpu_swap_chain = nullptr;
|
||||
static int wgpu_swap_chain_width = 0;
|
||||
static int wgpu_swap_chain_height = 0;
|
||||
static WGPUDevice wgpu_device = nullptr;
|
||||
static WGPUSurface wgpu_surface = nullptr;
|
||||
static WGPUTextureFormat wgpu_preferred_fmt = WGPUTextureFormat_RGBA8Unorm;
|
||||
static WGPUSwapChain wgpu_swap_chain = nullptr;
|
||||
static int wgpu_swap_chain_width = 0;
|
||||
static int wgpu_swap_chain_height = 0;
|
||||
|
||||
// Forward declarations
|
||||
static void MainLoopStep(void* window);
|
||||
@@ -71,7 +72,7 @@ int main(int, char**)
|
||||
|
||||
// Setup Platform/Renderer backends
|
||||
ImGui_ImplGlfw_InitForOther(window, true);
|
||||
ImGui_ImplWGPU_Init(wgpu_device, 3, WGPUTextureFormat_RGBA8Unorm, WGPUTextureFormat_Undefined);
|
||||
ImGui_ImplWGPU_Init(wgpu_device, 3, wgpu_preferred_fmt, WGPUTextureFormat_Undefined);
|
||||
|
||||
// Load Fonts
|
||||
// - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
|
||||
@@ -118,9 +119,11 @@ static bool InitWGPU()
|
||||
wgpu::SurfaceDescriptor surface_desc = {};
|
||||
surface_desc.nextInChain = &html_surface_desc;
|
||||
|
||||
// Use 'null' instance
|
||||
wgpu::Instance instance = {};
|
||||
wgpu_surface = instance.CreateSurface(&surface_desc).Release();
|
||||
wgpu::Instance instance = wgpuCreateInstance(nullptr);
|
||||
wgpu::Surface surface = instance.CreateSurface(&surface_desc);
|
||||
wgpu::Adapter adapter = {};
|
||||
wgpu_preferred_fmt = (WGPUTextureFormat)surface.GetPreferredFormat(adapter);
|
||||
wgpu_surface = surface.Release();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -144,7 +147,7 @@ static void MainLoopStep(void* window)
|
||||
wgpu_swap_chain_height = height;
|
||||
WGPUSwapChainDescriptor swap_chain_desc = {};
|
||||
swap_chain_desc.usage = WGPUTextureUsage_RenderAttachment;
|
||||
swap_chain_desc.format = WGPUTextureFormat_RGBA8Unorm;
|
||||
swap_chain_desc.format = wgpu_preferred_fmt;
|
||||
swap_chain_desc.width = width;
|
||||
swap_chain_desc.height = height;
|
||||
swap_chain_desc.presentMode = WGPUPresentMode_Fifo;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.89.9 WIP
|
||||
// dear imgui, v1.89.9
|
||||
// (headers)
|
||||
|
||||
// Help:
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
// Library Version
|
||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
|
||||
#define IMGUI_VERSION "1.89.9 WIP"
|
||||
#define IMGUI_VERSION_NUM 18983
|
||||
#define IMGUI_VERSION "1.89.9"
|
||||
#define IMGUI_VERSION_NUM 18990
|
||||
#define IMGUI_HAS_TABLE
|
||||
#define IMGUI_HAS_VIEWPORT // Viewport WIP branch
|
||||
#define IMGUI_HAS_DOCK // Docking WIP branch
|
||||
@@ -1977,7 +1977,7 @@ struct ImGuiStyle
|
||||
float FrameBorderSize; // Thickness of border around frames. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly).
|
||||
ImVec2 ItemSpacing; // Horizontal and vertical spacing between widgets/lines.
|
||||
ImVec2 ItemInnerSpacing; // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label).
|
||||
ImVec2 CellPadding; // Padding within a table cell
|
||||
ImVec2 CellPadding; // Padding within a table cell. CellPadding.y may be altered between different rows.
|
||||
ImVec2 TouchExtraPadding; // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!
|
||||
float IndentSpacing; // Horizontal indentation when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2).
|
||||
float ColumnsMinSpacing; // Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1).
|
||||
@@ -2518,12 +2518,14 @@ struct ImGuiListClipper
|
||||
IMGUI_API void End(); // Automatically called on the last call of Step() that returns false.
|
||||
IMGUI_API bool Step(); // Call until it returns false. The DisplayStart/DisplayEnd fields will be set and you can process/draw those items.
|
||||
|
||||
// Call IncludeRangeByIndices() *BEFORE* first call to Step() if you need a range of items to not be clipped, regardless of their visibility.
|
||||
// Call IncludeItemByIndex() or IncludeItemsByIndex() *BEFORE* first call to Step() if you need a range of items to not be clipped, regardless of their visibility.
|
||||
// (Due to alignment / padding of certain items it is possible that an extra item may be included on either end of the display range).
|
||||
IMGUI_API void IncludeRangeByIndices(int item_begin, int item_end); // item_end is exclusive e.g. use (42, 42+1) to make item 42 never clipped.
|
||||
inline void IncludeItemByIndex(int item_index) { IncludeItemsByIndex(item_index, item_index + 1); }
|
||||
IMGUI_API void IncludeItemsByIndex(int item_begin, int item_end); // item_end is exclusive e.g. use (42, 42+1) to make item 42 never clipped.
|
||||
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
inline void ForceDisplayRangeByIndices(int item_begin, int item_end) { IncludeRangeByIndices(item_begin, item_end); } // [renamed in 1.89.6]
|
||||
inline void IncludeRangeByIndices(int item_begin, int item_end) { IncludeItemsByIndex(item_begin, item_end); } // [renamed in 1.89.9]
|
||||
inline void ForceDisplayRangeByIndices(int item_begin, int item_end) { IncludeItemsByIndex(item_begin, item_end); } // [renamed in 1.89.6]
|
||||
//inline ImGuiListClipper(int items_count, float items_height = -1.0f) { memset(this, 0, sizeof(*this)); ItemsCount = -1; Begin(items_count, items_height); } // [removed in 1.79]
|
||||
#endif
|
||||
};
|
||||
|
||||
+126
-110
@@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.89.9 WIP
|
||||
// dear imgui, v1.89.9
|
||||
// (demo code)
|
||||
|
||||
// Help:
|
||||
@@ -188,20 +188,20 @@ Index of this file:
|
||||
#if !defined(IMGUI_DISABLE_DEMO_WINDOWS)
|
||||
|
||||
// Forward Declarations
|
||||
static void ShowExampleAppDockSpace(bool* p_open);
|
||||
static void ShowExampleAppDocuments(bool* p_open);
|
||||
static void ShowExampleAppMainMenuBar();
|
||||
static void ShowExampleAppConsole(bool* p_open);
|
||||
static void ShowExampleAppCustomRendering(bool* p_open);
|
||||
static void ShowExampleAppDockSpace(bool* p_open);
|
||||
static void ShowExampleAppDocuments(bool* p_open);
|
||||
static void ShowExampleAppLog(bool* p_open);
|
||||
static void ShowExampleAppLayout(bool* p_open);
|
||||
static void ShowExampleAppPropertyEditor(bool* p_open);
|
||||
static void ShowExampleAppLongText(bool* p_open);
|
||||
static void ShowExampleAppSimpleOverlay(bool* p_open);
|
||||
static void ShowExampleAppAutoResize(bool* p_open);
|
||||
static void ShowExampleAppConstrainedResize(bool* p_open);
|
||||
static void ShowExampleAppSimpleOverlay(bool* p_open);
|
||||
static void ShowExampleAppFullscreen(bool* p_open);
|
||||
static void ShowExampleAppLongText(bool* p_open);
|
||||
static void ShowExampleAppWindowTitles(bool* p_open);
|
||||
static void ShowExampleAppCustomRendering(bool* p_open);
|
||||
static void ShowExampleMenuFile();
|
||||
|
||||
// We split the contents of the big ShowDemoWindow() function into smaller functions
|
||||
@@ -267,61 +267,61 @@ void* GImGuiDemoMarkerCallbackUserData = NULL;
|
||||
void ImGui::ShowDemoWindow(bool* p_open)
|
||||
{
|
||||
// Exceptionally add an extra assert here for people confused about initial Dear ImGui setup
|
||||
// Most functions would normally just crash if the context is missing.
|
||||
IM_ASSERT(ImGui::GetCurrentContext() != NULL && "Missing dear imgui context. Refer to examples app!");
|
||||
// Most functions would normally just assert/crash if the context is missing.
|
||||
IM_ASSERT(ImGui::GetCurrentContext() != NULL && "Missing Dear ImGui context. Refer to examples app!");
|
||||
|
||||
// Examples Apps (accessible from the "Examples" menu)
|
||||
static bool show_app_main_menu_bar = false;
|
||||
static bool show_app_console = false;
|
||||
static bool show_app_custom_rendering = false;
|
||||
static bool show_app_dockspace = false;
|
||||
static bool show_app_documents = false;
|
||||
static bool show_app_console = false;
|
||||
static bool show_app_log = false;
|
||||
static bool show_app_layout = false;
|
||||
static bool show_app_property_editor = false;
|
||||
static bool show_app_long_text = false;
|
||||
static bool show_app_simple_overlay = false;
|
||||
static bool show_app_auto_resize = false;
|
||||
static bool show_app_constrained_resize = false;
|
||||
static bool show_app_simple_overlay = false;
|
||||
static bool show_app_fullscreen = false;
|
||||
static bool show_app_long_text = false;
|
||||
static bool show_app_window_titles = false;
|
||||
static bool show_app_custom_rendering = false;
|
||||
|
||||
if (show_app_main_menu_bar) ShowExampleAppMainMenuBar();
|
||||
if (show_app_dockspace) ShowExampleAppDockSpace(&show_app_dockspace); // Process the Docking app first, as explicit DockSpace() nodes needs to be submitted early (read comments near the DockSpace function)
|
||||
if (show_app_documents) ShowExampleAppDocuments(&show_app_documents); // Process the Document app next, as it may also use a DockSpace()
|
||||
if (show_app_console) ShowExampleAppConsole(&show_app_console);
|
||||
if (show_app_custom_rendering) ShowExampleAppCustomRendering(&show_app_custom_rendering);
|
||||
if (show_app_log) ShowExampleAppLog(&show_app_log);
|
||||
if (show_app_layout) ShowExampleAppLayout(&show_app_layout);
|
||||
if (show_app_property_editor) ShowExampleAppPropertyEditor(&show_app_property_editor);
|
||||
if (show_app_long_text) ShowExampleAppLongText(&show_app_long_text);
|
||||
if (show_app_simple_overlay) ShowExampleAppSimpleOverlay(&show_app_simple_overlay);
|
||||
if (show_app_auto_resize) ShowExampleAppAutoResize(&show_app_auto_resize);
|
||||
if (show_app_constrained_resize) ShowExampleAppConstrainedResize(&show_app_constrained_resize);
|
||||
if (show_app_simple_overlay) ShowExampleAppSimpleOverlay(&show_app_simple_overlay);
|
||||
if (show_app_fullscreen) ShowExampleAppFullscreen(&show_app_fullscreen);
|
||||
if (show_app_long_text) ShowExampleAppLongText(&show_app_long_text);
|
||||
if (show_app_window_titles) ShowExampleAppWindowTitles(&show_app_window_titles);
|
||||
if (show_app_custom_rendering) ShowExampleAppCustomRendering(&show_app_custom_rendering);
|
||||
|
||||
// Dear ImGui Tools/Apps (accessible from the "Tools" menu)
|
||||
static bool show_app_metrics = false;
|
||||
static bool show_app_debug_log = false;
|
||||
static bool show_app_stack_tool = false;
|
||||
static bool show_app_about = false;
|
||||
static bool show_app_style_editor = false;
|
||||
// Dear ImGui Tools (accessible from the "Tools" menu)
|
||||
static bool show_tool_metrics = false;
|
||||
static bool show_tool_debug_log = false;
|
||||
static bool show_tool_stack_tool = false;
|
||||
static bool show_tool_style_editor = false;
|
||||
static bool show_tool_about = false;
|
||||
|
||||
if (show_app_metrics)
|
||||
ImGui::ShowMetricsWindow(&show_app_metrics);
|
||||
if (show_app_debug_log)
|
||||
ImGui::ShowDebugLogWindow(&show_app_debug_log);
|
||||
if (show_app_stack_tool)
|
||||
ImGui::ShowStackToolWindow(&show_app_stack_tool);
|
||||
if (show_app_about)
|
||||
ImGui::ShowAboutWindow(&show_app_about);
|
||||
if (show_app_style_editor)
|
||||
if (show_tool_metrics)
|
||||
ImGui::ShowMetricsWindow(&show_tool_metrics);
|
||||
if (show_tool_debug_log)
|
||||
ImGui::ShowDebugLogWindow(&show_tool_debug_log);
|
||||
if (show_tool_stack_tool)
|
||||
ImGui::ShowStackToolWindow(&show_tool_stack_tool);
|
||||
if (show_tool_style_editor)
|
||||
{
|
||||
ImGui::Begin("Dear ImGui Style Editor", &show_app_style_editor);
|
||||
ImGui::Begin("Dear ImGui Style Editor", &show_tool_style_editor);
|
||||
ImGui::ShowStyleEditor();
|
||||
ImGui::End();
|
||||
}
|
||||
if (show_tool_about)
|
||||
ImGui::ShowAboutWindow(&show_tool_about);
|
||||
|
||||
// Demonstrate the various window flags. Typically you would just use the default!
|
||||
static bool no_titlebar = false;
|
||||
@@ -384,19 +384,24 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
{
|
||||
IMGUI_DEMO_MARKER("Menu/Examples");
|
||||
ImGui::MenuItem("Main menu bar", NULL, &show_app_main_menu_bar);
|
||||
|
||||
ImGui::SeparatorText("Mini apps");
|
||||
ImGui::MenuItem("Console", NULL, &show_app_console);
|
||||
ImGui::MenuItem("Log", NULL, &show_app_log);
|
||||
ImGui::MenuItem("Simple layout", NULL, &show_app_layout);
|
||||
ImGui::MenuItem("Property editor", NULL, &show_app_property_editor);
|
||||
ImGui::MenuItem("Long text display", NULL, &show_app_long_text);
|
||||
ImGui::MenuItem("Auto-resizing window", NULL, &show_app_auto_resize);
|
||||
ImGui::MenuItem("Constrained-resizing window", NULL, &show_app_constrained_resize);
|
||||
ImGui::MenuItem("Simple overlay", NULL, &show_app_simple_overlay);
|
||||
ImGui::MenuItem("Fullscreen window", NULL, &show_app_fullscreen);
|
||||
ImGui::MenuItem("Manipulating window titles", NULL, &show_app_window_titles);
|
||||
ImGui::MenuItem("Custom rendering", NULL, &show_app_custom_rendering);
|
||||
ImGui::MenuItem("Dockspace", NULL, &show_app_dockspace);
|
||||
ImGui::MenuItem("Documents", NULL, &show_app_documents);
|
||||
ImGui::MenuItem("Log", NULL, &show_app_log);
|
||||
ImGui::MenuItem("Property editor", NULL, &show_app_property_editor);
|
||||
ImGui::MenuItem("Simple layout", NULL, &show_app_layout);
|
||||
ImGui::MenuItem("Simple overlay", NULL, &show_app_simple_overlay);
|
||||
|
||||
ImGui::SeparatorText("Concepts");
|
||||
ImGui::MenuItem("Auto-resizing window", NULL, &show_app_auto_resize);
|
||||
ImGui::MenuItem("Constrained-resizing window", NULL, &show_app_constrained_resize);
|
||||
ImGui::MenuItem("Fullscreen window", NULL, &show_app_fullscreen);
|
||||
ImGui::MenuItem("Long text display", NULL, &show_app_long_text);
|
||||
ImGui::MenuItem("Manipulating window titles", NULL, &show_app_window_titles);
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
//if (ImGui::MenuItem("MenuItem")) {} // You can also use MenuItem() inside a menu bar!
|
||||
@@ -408,11 +413,11 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
#else
|
||||
const bool has_debug_tools = false;
|
||||
#endif
|
||||
ImGui::MenuItem("Metrics/Debugger", NULL, &show_app_metrics, has_debug_tools);
|
||||
ImGui::MenuItem("Debug Log", NULL, &show_app_debug_log, has_debug_tools);
|
||||
ImGui::MenuItem("Stack Tool", NULL, &show_app_stack_tool, has_debug_tools);
|
||||
ImGui::MenuItem("Style Editor", NULL, &show_app_style_editor);
|
||||
ImGui::MenuItem("About Dear ImGui", NULL, &show_app_about);
|
||||
ImGui::MenuItem("Metrics/Debugger", NULL, &show_tool_metrics, has_debug_tools);
|
||||
ImGui::MenuItem("Debug Log", NULL, &show_tool_debug_log, has_debug_tools);
|
||||
ImGui::MenuItem("Stack Tool", NULL, &show_tool_stack_tool, has_debug_tools);
|
||||
ImGui::MenuItem("Style Editor", NULL, &show_tool_style_editor);
|
||||
ImGui::MenuItem("About Dear ImGui", NULL, &show_tool_about);
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
ImGui::EndMenuBar();
|
||||
@@ -3854,6 +3859,14 @@ struct MyItem
|
||||
// very often by the sorting algorithm it would be a little wasteful.
|
||||
static const ImGuiTableSortSpecs* s_current_sort_specs;
|
||||
|
||||
static void SortWithSortSpecs(ImGuiTableSortSpecs* sort_specs, MyItem* items, int items_count)
|
||||
{
|
||||
s_current_sort_specs = sort_specs; // Store in variable accessible by the sort function.
|
||||
if (items_count > 1)
|
||||
qsort(items, (size_t)items_count, sizeof(items[0]), MyItem::CompareWithSortSpecs);
|
||||
s_current_sort_specs = NULL;
|
||||
}
|
||||
|
||||
// Compare function to be used by qsort()
|
||||
static int IMGUI_CDECL CompareWithSortSpecs(const void* lhs, const void* rhs)
|
||||
{
|
||||
@@ -4851,7 +4864,7 @@ static void ShowDemoWindowTables()
|
||||
HelpMarker("You can pass a 'min_row_height' to TableNextRow().\n\nRows are padded with 'style.CellPadding.y' on top and bottom, so effectively the minimum row height will always be >= 'style.CellPadding.y * 2.0f'.\n\nWe cannot honor a _maximum_ row height as that would require a unique clipping rectangle per row.");
|
||||
if (ImGui::BeginTable("table_row_height", 1, ImGuiTableFlags_Borders))
|
||||
{
|
||||
for (int row = 0; row < 10; row++)
|
||||
for (int row = 0; row < 8; row++)
|
||||
{
|
||||
float min_row_height = (float)(int)(TEXT_BASE_HEIGHT * 0.30f * row);
|
||||
ImGui::TableNextRow(ImGuiTableRowFlags_None, min_row_height);
|
||||
@@ -4882,6 +4895,23 @@ static void ShowDemoWindowTables()
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
HelpMarker("Showcase altering CellPadding.y between rows. Note that CellPadding.x is locked for the entire table.");
|
||||
if (ImGui::BeginTable("table_changing_cellpadding_y", 1, ImGuiTableFlags_Borders))
|
||||
{
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
for (int row = 0; row < 8; row++)
|
||||
{
|
||||
if ((row % 3) == 2)
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2(style.CellPadding.x, 20.0f));
|
||||
ImGui::TableNextRow(ImGuiTableRowFlags_None);
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("CellPadding.y = %.2f", style.CellPadding.y);
|
||||
if ((row % 3) == 2)
|
||||
ImGui::PopStyleVar();;
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
@@ -5373,14 +5403,11 @@ static void ShowDemoWindowTables()
|
||||
ImGui::TableHeadersRow();
|
||||
|
||||
// Sort our data if sort specs have been changed!
|
||||
if (ImGuiTableSortSpecs* sorts_specs = ImGui::TableGetSortSpecs())
|
||||
if (sorts_specs->SpecsDirty)
|
||||
if (ImGuiTableSortSpecs* sort_specs = ImGui::TableGetSortSpecs())
|
||||
if (sort_specs->SpecsDirty)
|
||||
{
|
||||
MyItem::s_current_sort_specs = sorts_specs; // Store in variable accessible by the sort function.
|
||||
if (items.Size > 1)
|
||||
qsort(&items[0], (size_t)items.Size, sizeof(items[0]), MyItem::CompareWithSortSpecs);
|
||||
MyItem::s_current_sort_specs = NULL;
|
||||
sorts_specs->SpecsDirty = false;
|
||||
MyItem::SortWithSortSpecs(sort_specs, items.Data, items.Size);
|
||||
sort_specs->SpecsDirty = false;
|
||||
}
|
||||
|
||||
// Demonstrate using clipper for large vertical lists
|
||||
@@ -5588,15 +5615,13 @@ static void ShowDemoWindowTables()
|
||||
ImGui::TableSetupScrollFreeze(freeze_cols, freeze_rows);
|
||||
|
||||
// Sort our data if sort specs have been changed!
|
||||
ImGuiTableSortSpecs* sorts_specs = ImGui::TableGetSortSpecs();
|
||||
if (sorts_specs && sorts_specs->SpecsDirty)
|
||||
ImGuiTableSortSpecs* sort_specs = ImGui::TableGetSortSpecs();
|
||||
if (sort_specs && sort_specs->SpecsDirty)
|
||||
items_need_sort = true;
|
||||
if (sorts_specs && items_need_sort && items.Size > 1)
|
||||
if (sort_specs && items_need_sort && items.Size > 1)
|
||||
{
|
||||
MyItem::s_current_sort_specs = sorts_specs; // Store in variable accessible by the sort function.
|
||||
qsort(&items[0], (size_t)items.Size, sizeof(items[0]), MyItem::CompareWithSortSpecs);
|
||||
MyItem::s_current_sort_specs = NULL;
|
||||
sorts_specs->SpecsDirty = false;
|
||||
MyItem::SortWithSortSpecs(sort_specs, items.Data, items.Size);
|
||||
sort_specs->SpecsDirty = false;
|
||||
}
|
||||
items_need_sort = false;
|
||||
|
||||
@@ -6325,9 +6350,8 @@ void ImGui::ShowFontSelector(const char* label)
|
||||
ImFont* font_current = ImGui::GetFont();
|
||||
if (ImGui::BeginCombo(label, font_current->GetDebugName()))
|
||||
{
|
||||
for (int n = 0; n < io.Fonts->Fonts.Size; n++)
|
||||
for (ImFont* font : io.Fonts->Fonts)
|
||||
{
|
||||
ImFont* font = io.Fonts->Fonts[n];
|
||||
ImGui::PushID((void*)font);
|
||||
if (ImGui::Selectable(font->GetDebugName(), font == font_current))
|
||||
io.FontDefault = font;
|
||||
@@ -6938,9 +6962,8 @@ struct ExampleAppConsole
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(4, 1)); // Tighten spacing
|
||||
if (copy_to_clipboard)
|
||||
ImGui::LogToClipboard();
|
||||
for (int i = 0; i < Items.Size; i++)
|
||||
for (const char* item : Items)
|
||||
{
|
||||
const char* item = Items[i];
|
||||
if (!Filter.PassFilter(item))
|
||||
continue;
|
||||
|
||||
@@ -7429,6 +7452,7 @@ static void ShowPlaceholderObject(const char* prefix, int uid)
|
||||
}
|
||||
|
||||
// Demonstrate create a simple property editor.
|
||||
// This demo is a bit lackluster nowadays, would be nice to improve.
|
||||
static void ShowExampleAppPropertyEditor(bool* p_open)
|
||||
{
|
||||
ImGui::SetNextWindowSize(ImVec2(430, 450), ImGuiCond_FirstUseEver);
|
||||
@@ -7437,23 +7461,24 @@ static void ShowExampleAppPropertyEditor(bool* p_open)
|
||||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
IMGUI_DEMO_MARKER("Examples/Property Editor");
|
||||
|
||||
IMGUI_DEMO_MARKER("Examples/Property Editor");
|
||||
HelpMarker(
|
||||
"This example shows how you may implement a property editor using two columns.\n"
|
||||
"All objects/fields data are dummies here.\n"
|
||||
"Remember that in many simple cases, you can use ImGui::SameLine(xxx) to position\n"
|
||||
"your cursor horizontally instead of using the Columns() API.");
|
||||
"All objects/fields data are dummies here.\n");
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2, 2));
|
||||
if (ImGui::BeginTable("split", 2, ImGuiTableFlags_BordersOuter | ImGuiTableFlags_Resizable))
|
||||
if (ImGui::BeginTable("##split", 2, ImGuiTableFlags_BordersOuter | ImGuiTableFlags_Resizable | ImGuiTableFlags_ScrollY))
|
||||
{
|
||||
ImGui::TableSetupScrollFreeze(0, 1);
|
||||
ImGui::TableSetupColumn("Object");
|
||||
ImGui::TableSetupColumn("Contents");
|
||||
ImGui::TableHeadersRow();
|
||||
|
||||
// Iterate placeholder objects (all the same data)
|
||||
for (int obj_i = 0; obj_i < 4; obj_i++)
|
||||
{
|
||||
ShowPlaceholderObject("Object", obj_i);
|
||||
//ImGui::Separator();
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
@@ -8255,12 +8280,11 @@ struct ExampleAppDocuments
|
||||
// Note that this completely optional, and only affect tab bars with the ImGuiTabBarFlags_Reorderable flag.
|
||||
static void NotifyOfDocumentsClosedElsewhere(ExampleAppDocuments& app)
|
||||
{
|
||||
for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)
|
||||
for (MyDocument& doc : app.Documents)
|
||||
{
|
||||
MyDocument* doc = &app.Documents[doc_n];
|
||||
if (!doc->Open && doc->OpenPrev)
|
||||
ImGui::SetTabItemClosed(doc->Name);
|
||||
doc->OpenPrev = doc->Open;
|
||||
if (!doc.Open && doc.OpenPrev)
|
||||
ImGui::SetTabItemClosed(doc.Name);
|
||||
doc.OpenPrev = doc.Open;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8299,23 +8323,19 @@ void ShowExampleAppDocuments(bool* p_open)
|
||||
if (ImGui::BeginMenu("File"))
|
||||
{
|
||||
int open_count = 0;
|
||||
for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)
|
||||
open_count += app.Documents[doc_n].Open ? 1 : 0;
|
||||
for (MyDocument& doc : app.Documents)
|
||||
open_count += doc.Open ? 1 : 0;
|
||||
|
||||
if (ImGui::BeginMenu("Open", open_count < app.Documents.Size))
|
||||
{
|
||||
for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)
|
||||
{
|
||||
MyDocument* doc = &app.Documents[doc_n];
|
||||
if (!doc->Open)
|
||||
if (ImGui::MenuItem(doc->Name))
|
||||
doc->DoOpen();
|
||||
}
|
||||
for (MyDocument& doc : app.Documents)
|
||||
if (!doc.Open && ImGui::MenuItem(doc.Name))
|
||||
doc.DoOpen();
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
if (ImGui::MenuItem("Close All Documents", NULL, false, open_count > 0))
|
||||
for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)
|
||||
app.Documents[doc_n].DoQueueClose();
|
||||
for (MyDocument& doc : app.Documents)
|
||||
doc.DoQueueClose();
|
||||
if (ImGui::MenuItem("Exit", "Ctrl+F4") && p_open)
|
||||
*p_open = false;
|
||||
ImGui::EndMenu();
|
||||
@@ -8326,13 +8346,13 @@ void ShowExampleAppDocuments(bool* p_open)
|
||||
// [Debug] List documents with one checkbox for each
|
||||
for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)
|
||||
{
|
||||
MyDocument* doc = &app.Documents[doc_n];
|
||||
MyDocument& doc = app.Documents[doc_n];
|
||||
if (doc_n > 0)
|
||||
ImGui::SameLine();
|
||||
ImGui::PushID(doc);
|
||||
if (ImGui::Checkbox(doc->Name, &doc->Open))
|
||||
if (!doc->Open)
|
||||
doc->DoForceClose();
|
||||
ImGui::PushID(&doc);
|
||||
if (ImGui::Checkbox(doc.Name, &doc.Open))
|
||||
if (!doc.Open)
|
||||
doc.DoForceClose();
|
||||
ImGui::PopID();
|
||||
}
|
||||
ImGui::PushItemWidth(ImGui::GetFontSize() * 12);
|
||||
@@ -8368,26 +8388,25 @@ void ShowExampleAppDocuments(bool* p_open)
|
||||
//if (ImGui::GetIO().KeyCtrl) ImGui::SetTabItemSelected(docs[1].Name); // [DEBUG] Test SetTabItemSelected(), probably not very useful as-is anyway..
|
||||
|
||||
// Submit Tabs
|
||||
for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)
|
||||
for (MyDocument& doc : app.Documents)
|
||||
{
|
||||
MyDocument* doc = &app.Documents[doc_n];
|
||||
if (!doc->Open)
|
||||
if (!doc.Open)
|
||||
continue;
|
||||
|
||||
ImGuiTabItemFlags tab_flags = (doc->Dirty ? ImGuiTabItemFlags_UnsavedDocument : 0);
|
||||
bool visible = ImGui::BeginTabItem(doc->Name, &doc->Open, tab_flags);
|
||||
ImGuiTabItemFlags tab_flags = (doc.Dirty ? ImGuiTabItemFlags_UnsavedDocument : 0);
|
||||
bool visible = ImGui::BeginTabItem(doc.Name, &doc.Open, tab_flags);
|
||||
|
||||
// Cancel attempt to close when unsaved add to save queue so we can display a popup.
|
||||
if (!doc->Open && doc->Dirty)
|
||||
if (!doc.Open && doc.Dirty)
|
||||
{
|
||||
doc->Open = true;
|
||||
doc->DoQueueClose();
|
||||
doc.Open = true;
|
||||
doc.DoQueueClose();
|
||||
}
|
||||
|
||||
MyDocument::DisplayContextMenu(doc);
|
||||
MyDocument::DisplayContextMenu(&doc);
|
||||
if (visible)
|
||||
{
|
||||
MyDocument::DisplayContents(doc);
|
||||
MyDocument::DisplayContents(&doc);
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
@@ -8448,15 +8467,12 @@ void ShowExampleAppDocuments(bool* p_open)
|
||||
if (close_queue.empty())
|
||||
{
|
||||
// Close queue is locked once we started a popup
|
||||
for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)
|
||||
{
|
||||
MyDocument* doc = &app.Documents[doc_n];
|
||||
if (doc->WantClose)
|
||||
for (MyDocument& doc : app.Documents)
|
||||
if (doc.WantClose)
|
||||
{
|
||||
doc->WantClose = false;
|
||||
close_queue.push_back(doc);
|
||||
doc.WantClose = false;
|
||||
close_queue.push_back(&doc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Display closing confirmation UI
|
||||
|
||||
+21
-25
@@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.89.9 WIP
|
||||
// dear imgui, v1.89.9
|
||||
// (drawing and font code)
|
||||
|
||||
/*
|
||||
@@ -1355,10 +1355,12 @@ static inline ImDrawFlags FixRectCornerFlags(ImDrawFlags flags)
|
||||
|
||||
void ImDrawList::PathRect(const ImVec2& a, const ImVec2& b, float rounding, ImDrawFlags flags)
|
||||
{
|
||||
flags = FixRectCornerFlags(flags);
|
||||
rounding = ImMin(rounding, ImFabs(b.x - a.x) * ( ((flags & ImDrawFlags_RoundCornersTop) == ImDrawFlags_RoundCornersTop) || ((flags & ImDrawFlags_RoundCornersBottom) == ImDrawFlags_RoundCornersBottom) ? 0.5f : 1.0f ) - 1.0f);
|
||||
rounding = ImMin(rounding, ImFabs(b.y - a.y) * ( ((flags & ImDrawFlags_RoundCornersLeft) == ImDrawFlags_RoundCornersLeft) || ((flags & ImDrawFlags_RoundCornersRight) == ImDrawFlags_RoundCornersRight) ? 0.5f : 1.0f ) - 1.0f);
|
||||
|
||||
if (rounding >= 0.5f)
|
||||
{
|
||||
flags = FixRectCornerFlags(flags);
|
||||
rounding = ImMin(rounding, ImFabs(b.x - a.x) * (((flags & ImDrawFlags_RoundCornersTop) == ImDrawFlags_RoundCornersTop) || ((flags & ImDrawFlags_RoundCornersBottom) == ImDrawFlags_RoundCornersBottom) ? 0.5f : 1.0f) - 1.0f);
|
||||
rounding = ImMin(rounding, ImFabs(b.y - a.y) * (((flags & ImDrawFlags_RoundCornersLeft) == ImDrawFlags_RoundCornersLeft) || ((flags & ImDrawFlags_RoundCornersRight) == ImDrawFlags_RoundCornersRight) ? 0.5f : 1.0f) - 1.0f);
|
||||
}
|
||||
if (rounding < 0.5f || (flags & ImDrawFlags_RoundCornersMask_) == ImDrawFlags_RoundCornersNone)
|
||||
{
|
||||
PathLineTo(a);
|
||||
@@ -1896,15 +1898,9 @@ void ImDrawData::DeIndexAllBuffers()
|
||||
// or if there is a difference between your window resolution and framebuffer resolution.
|
||||
void ImDrawData::ScaleClipRects(const ImVec2& fb_scale)
|
||||
{
|
||||
for (int i = 0; i < CmdListsCount; i++)
|
||||
{
|
||||
ImDrawList* cmd_list = CmdLists[i];
|
||||
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||
{
|
||||
ImDrawCmd* cmd = &cmd_list->CmdBuffer[cmd_i];
|
||||
cmd->ClipRect = ImVec4(cmd->ClipRect.x * fb_scale.x, cmd->ClipRect.y * fb_scale.y, cmd->ClipRect.z * fb_scale.x, cmd->ClipRect.w * fb_scale.y);
|
||||
}
|
||||
}
|
||||
for (ImDrawList* draw_list : CmdLists)
|
||||
for (ImDrawCmd& cmd : draw_list->CmdBuffer)
|
||||
cmd.ClipRect = ImVec4(cmd.ClipRect.x * fb_scale.x, cmd.ClipRect.y * fb_scale.y, cmd.ClipRect.z * fb_scale.x, cmd.ClipRect.w * fb_scale.y);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -2045,19 +2041,19 @@ ImFontAtlas::~ImFontAtlas()
|
||||
void ImFontAtlas::ClearInputData()
|
||||
{
|
||||
IM_ASSERT(!Locked && "Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()!");
|
||||
for (int i = 0; i < ConfigData.Size; i++)
|
||||
if (ConfigData[i].FontData && ConfigData[i].FontDataOwnedByAtlas)
|
||||
for (ImFontConfig& font_cfg : ConfigData)
|
||||
if (font_cfg.FontData && font_cfg.FontDataOwnedByAtlas)
|
||||
{
|
||||
IM_FREE(ConfigData[i].FontData);
|
||||
ConfigData[i].FontData = NULL;
|
||||
IM_FREE(font_cfg.FontData);
|
||||
font_cfg.FontData = NULL;
|
||||
}
|
||||
|
||||
// When clearing this we lose access to the font name and other information used to build the font.
|
||||
for (int i = 0; i < Fonts.Size; i++)
|
||||
if (Fonts[i]->ConfigData >= ConfigData.Data && Fonts[i]->ConfigData < ConfigData.Data + ConfigData.Size)
|
||||
for (ImFont* font : Fonts)
|
||||
if (font->ConfigData >= ConfigData.Data && font->ConfigData < ConfigData.Data + ConfigData.Size)
|
||||
{
|
||||
Fonts[i]->ConfigData = NULL;
|
||||
Fonts[i]->ConfigDataCount = 0;
|
||||
font->ConfigData = NULL;
|
||||
font->ConfigDataCount = 0;
|
||||
}
|
||||
ConfigData.clear();
|
||||
CustomRects.clear();
|
||||
@@ -2862,9 +2858,9 @@ void ImFontAtlasBuildFinish(ImFontAtlas* atlas)
|
||||
}
|
||||
|
||||
// Build all fonts lookup tables
|
||||
for (int i = 0; i < atlas->Fonts.Size; i++)
|
||||
if (atlas->Fonts[i]->DirtyLookupTables)
|
||||
atlas->Fonts[i]->BuildLookupTable();
|
||||
for (ImFont* font : atlas->Fonts)
|
||||
if (font->DirtyLookupTables)
|
||||
font->BuildLookupTable();
|
||||
|
||||
atlas->TexReady = true;
|
||||
}
|
||||
|
||||
+7
-5
@@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.89.9 WIP
|
||||
// dear imgui, v1.89.9
|
||||
// (internal structures/api)
|
||||
|
||||
// You may use this file to debug, understand or extend Dear ImGui features but we don't provide any guarantee of forward compatibility.
|
||||
@@ -895,7 +895,7 @@ enum ImGuiComboFlagsPrivate_
|
||||
enum ImGuiSliderFlagsPrivate_
|
||||
{
|
||||
ImGuiSliderFlags_Vertical = 1 << 20, // Should this slider be orientated vertically?
|
||||
ImGuiSliderFlags_ReadOnly = 1 << 21,
|
||||
ImGuiSliderFlags_ReadOnly = 1 << 21, // Consider using g.NextItemData.ItemFlags |= ImGuiItemFlags_ReadOnly instead.
|
||||
};
|
||||
|
||||
// Extend ImGuiSelectableFlags_
|
||||
@@ -2209,6 +2209,7 @@ struct ImGuiContext
|
||||
float ScrollbarClickDeltaToGrabCenter; // Distance between mouse and center of grab box, normalized in parent space. Use storage?
|
||||
float DisabledAlphaBackup; // Backup for style.Alpha for BeginDisabled()
|
||||
short DisabledStackSize;
|
||||
short LockMarkEdited;
|
||||
short TooltipOverrideCount;
|
||||
ImVector<char> ClipboardHandlerData; // If no custom clipboard handler is defined
|
||||
ImVector<ImGuiID> MenusIdSubmittedThisFrame; // A list of menu IDs that were rendered at least once
|
||||
@@ -2417,6 +2418,7 @@ struct ImGuiContext
|
||||
ScrollbarClickDeltaToGrabCenter = 0.0f;
|
||||
DisabledAlphaBackup = 0.0f;
|
||||
DisabledStackSize = 0;
|
||||
LockMarkEdited = 0;
|
||||
TooltipOverrideCount = 0;
|
||||
|
||||
PlatformImeData.InputPos = ImVec2(0.0f, 0.0f);
|
||||
@@ -2855,6 +2857,7 @@ struct IMGUI_API ImGuiTable
|
||||
float RowPosY1;
|
||||
float RowPosY2;
|
||||
float RowMinHeight; // Height submitted to TableNextRow()
|
||||
float RowCellPaddingY; // Top and bottom padding. Reloaded during row change.
|
||||
float RowTextBaseline;
|
||||
float RowIndentOffsetX;
|
||||
ImGuiTableRowFlags RowFlags : 16; // Current row flags, see ImGuiTableRowFlags_
|
||||
@@ -2868,9 +2871,8 @@ struct IMGUI_API ImGuiTable
|
||||
float HostIndentX;
|
||||
float MinColumnWidth;
|
||||
float OuterPaddingX;
|
||||
float CellPaddingX; // Padding from each borders
|
||||
float CellPaddingY;
|
||||
float CellSpacingX1; // Spacing between non-bordered cells
|
||||
float CellPaddingX; // Padding from each borders. Locked in BeginTable()/Layout.
|
||||
float CellSpacingX1; // Spacing between non-bordered cells. Locked in BeginTable()/Layout.
|
||||
float CellSpacingX2;
|
||||
float InnerWidth; // User value passed to BeginTable(), see comments at the top of BeginTable() for details.
|
||||
float ColumnsGivenWidth; // Sum of current column width
|
||||
|
||||
+14
-10
@@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.89.9 WIP
|
||||
// dear imgui, v1.89.9
|
||||
// (tables and columns code)
|
||||
|
||||
/*
|
||||
@@ -452,7 +452,6 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
||||
table->CellSpacingX1 = inner_spacing_explicit + inner_spacing_for_border;
|
||||
table->CellSpacingX2 = inner_spacing_explicit;
|
||||
table->CellPaddingX = inner_padding_explicit;
|
||||
table->CellPaddingY = g.Style.CellPadding.y;
|
||||
|
||||
const float outer_padding_for_border = (flags & ImGuiTableFlags_BordersOuterV) ? TABLE_BORDER_SIZE : 0.0f;
|
||||
const float outer_padding_explicit = pad_outer_x ? g.Style.CellPadding.x : 0.0f;
|
||||
@@ -469,6 +468,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
||||
|
||||
table->RowPosY1 = table->RowPosY2 = table->WorkRect.Min.y; // This is needed somehow
|
||||
table->RowTextBaseline = 0.0f; // This will be cleared again by TableBeginRow()
|
||||
table->RowCellPaddingY = 0.0f;
|
||||
table->FreezeRowsRequest = table->FreezeRowsCount = 0; // This will be setup by TableSetupScrollFreeze(), if any
|
||||
table->FreezeColumnsRequest = table->FreezeColumnsCount = 0;
|
||||
table->IsUnfrozenRows = true;
|
||||
@@ -1745,19 +1745,20 @@ void ImGui::TableNextRow(ImGuiTableRowFlags row_flags, float row_min_height)
|
||||
|
||||
table->LastRowFlags = table->RowFlags;
|
||||
table->RowFlags = row_flags;
|
||||
table->RowCellPaddingY = g.Style.CellPadding.y;
|
||||
table->RowMinHeight = row_min_height;
|
||||
TableBeginRow(table);
|
||||
|
||||
// We honor min_row_height requested by user, but cannot guarantee per-row maximum height,
|
||||
// because that would essentially require a unique clipping rectangle per-cell.
|
||||
table->RowPosY2 += table->CellPaddingY * 2.0f;
|
||||
table->RowPosY2 += table->RowCellPaddingY * 2.0f;
|
||||
table->RowPosY2 = ImMax(table->RowPosY2, table->RowPosY1 + row_min_height);
|
||||
|
||||
// Disable output until user calls TableNextColumn()
|
||||
table->InnerWindow->SkipItems = true;
|
||||
}
|
||||
|
||||
// [Internal] Called by TableNextRow()
|
||||
// [Internal] Only called by TableNextRow()
|
||||
void ImGui::TableBeginRow(ImGuiTable* table)
|
||||
{
|
||||
ImGuiWindow* window = table->InnerWindow;
|
||||
@@ -1778,7 +1779,9 @@ void ImGui::TableBeginRow(ImGuiTable* table)
|
||||
table->RowPosY1 = table->RowPosY2 = next_y1;
|
||||
table->RowTextBaseline = 0.0f;
|
||||
table->RowIndentOffsetX = window->DC.Indent.x - table->HostIndentX; // Lock indent
|
||||
|
||||
window->DC.PrevLineTextBaseOffset = 0.0f;
|
||||
window->DC.CursorPosPrevLine = ImVec2(window->DC.CursorPos.x, window->DC.CursorPos.y + table->RowCellPaddingY); // This allows users to call SameLine() to share LineSize between columns.
|
||||
window->DC.PrevLineSize = window->DC.CurrLineSize = ImVec2(0.0f, 0.0f); // This allows users to call SameLine() to share LineSize between columns, and to call it from first column too.
|
||||
window->DC.IsSameLine = window->DC.IsSetPos = false;
|
||||
window->DC.CursorMaxPos.y = next_y1;
|
||||
@@ -2013,10 +2016,10 @@ void ImGui::TableBeginCell(ImGuiTable* table, int column_n)
|
||||
start_x += table->RowIndentOffsetX; // ~~ += window.DC.Indent.x - table->HostIndentX, except we locked it for the row.
|
||||
|
||||
window->DC.CursorPos.x = start_x;
|
||||
window->DC.CursorPos.y = table->RowPosY1 + table->CellPaddingY;
|
||||
window->DC.CursorPos.y = table->RowPosY1 + table->RowCellPaddingY;
|
||||
window->DC.CursorMaxPos.x = window->DC.CursorPos.x;
|
||||
window->DC.ColumnsOffset.x = start_x - window->Pos.x - window->DC.Indent.x; // FIXME-WORKRECT
|
||||
window->DC.CursorPosPrevLine = window->DC.CursorPos; // This allows users to call SameLine() to share LineSize between columns.
|
||||
window->DC.CursorPosPrevLine.x = window->DC.CursorPos.x; // PrevLine.y is preserved. This allows users to call SameLine() to share LineSize between columns.
|
||||
window->DC.CurrLineTextBaseOffset = table->RowTextBaseline;
|
||||
window->DC.NavLayerCurrent = (ImGuiNavLayer)column->NavLayerCurrent;
|
||||
|
||||
@@ -2071,7 +2074,7 @@ void ImGui::TableEndCell(ImGuiTable* table)
|
||||
p_max_pos_x = table->IsUnfrozenRows ? &column->ContentMaxXUnfrozen : &column->ContentMaxXFrozen;
|
||||
*p_max_pos_x = ImMax(*p_max_pos_x, window->DC.CursorMaxPos.x);
|
||||
if (column->IsEnabled)
|
||||
table->RowPosY2 = ImMax(table->RowPosY2, window->DC.CursorMaxPos.y + table->CellPaddingY);
|
||||
table->RowPosY2 = ImMax(table->RowPosY2, window->DC.CursorMaxPos.y + table->RowCellPaddingY);
|
||||
column->ItemWidth = window->DC.ItemWidth;
|
||||
|
||||
// Propagate text baseline for the entire row
|
||||
@@ -2673,8 +2676,9 @@ void ImGui::TableDrawBorders(ImGuiTable* table)
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
// Return NULL if no sort specs (most often when ImGuiTableFlags_Sortable is not set)
|
||||
// You can sort your data again when 'SpecsChanged == true'. It will be true with sorting specs have changed since
|
||||
// last call, or the first time.
|
||||
// When 'sort_specs->SpecsDirty == true' you should sort your data. It will be true when sorting specs have
|
||||
// changed since last call, or the first time. Make sure to set 'SpecsDirty = false' after sorting,
|
||||
// else you may wastefully sort your data every frame!
|
||||
// Lifetime: don't hold on this pointer over multiple frames or past any subsequent call to BeginTable()!
|
||||
ImGuiTableSortSpecs* ImGui::TableGetSortSpecs()
|
||||
{
|
||||
@@ -2952,7 +2956,7 @@ void ImGui::TableHeader(const char* label)
|
||||
// If we already got a row height, there's use that.
|
||||
// FIXME-TABLE: Padding problem if the correct outer-padding CellBgRect strays off our ClipRect?
|
||||
ImRect cell_r = TableGetCellBgRect(table, column_n);
|
||||
float label_height = ImMax(label_size.y, table->RowMinHeight - table->CellPaddingY * 2.0f);
|
||||
float label_height = ImMax(label_size.y, table->RowMinHeight - table->RowCellPaddingY * 2.0f);
|
||||
|
||||
// Calculate ideal size for sort order arrow
|
||||
float w_arrow = 0.0f;
|
||||
|
||||
+11
-7
@@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.89.9 WIP
|
||||
// dear imgui, v1.89.9
|
||||
// (widgets code)
|
||||
|
||||
/*
|
||||
@@ -2904,6 +2904,10 @@ bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_typ
|
||||
}
|
||||
}
|
||||
|
||||
if (set_new_value)
|
||||
if ((g.LastItemData.InFlags & ImGuiItemFlags_ReadOnly) || (flags & ImGuiSliderFlags_ReadOnly))
|
||||
set_new_value = false;
|
||||
|
||||
if (set_new_value)
|
||||
{
|
||||
TYPE v_new = ScaleValueFromRatioT<TYPE, SIGNEDTYPE, FLOATTYPE>(data_type, clicked_t, v_min, v_max, is_logarithmic, logarithmic_zero_epsilon, zero_deadzone_halfsize);
|
||||
@@ -2949,11 +2953,6 @@ bool ImGui::SliderBehavior(const ImRect& bb, ImGuiID id, ImGuiDataType data_type
|
||||
// Read imgui.cpp "API BREAKING CHANGES" section for 1.78 if you hit this assert.
|
||||
IM_ASSERT((flags == 1 || (flags & ImGuiSliderFlags_InvalidMask_) == 0) && "Invalid ImGuiSliderFlags flag! Has the 'float power' argument been mistakenly cast to flags? Call function with ImGuiSliderFlags_Logarithmic flags instead.");
|
||||
|
||||
// Those are the things we can do easily outside the SliderBehaviorT<> template, saves code generation.
|
||||
ImGuiContext& g = *GImGui;
|
||||
if ((g.LastItemData.InFlags & ImGuiItemFlags_ReadOnly) || (flags & ImGuiSliderFlags_ReadOnly))
|
||||
return false;
|
||||
|
||||
switch (data_type)
|
||||
{
|
||||
case ImGuiDataType_S8: { ImS32 v32 = (ImS32)*(ImS8*)p_v; bool r = SliderBehaviorT<ImS32, ImS32, float>(bb, id, ImGuiDataType_S32, &v32, *(const ImS8*)p_min, *(const ImS8*)p_max, format, flags, out_grab_bb); if (r) *(ImS8*)p_v = (ImS8)v32; return r; }
|
||||
@@ -5891,6 +5890,7 @@ void ImGui::ColorEditOptionsPopup(const float* col, ImGuiColorEditFlags flags)
|
||||
if ((!allow_opt_inputs && !allow_opt_datatype) || !BeginPopup("context"))
|
||||
return;
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.LockMarkEdited++;
|
||||
ImGuiColorEditFlags opts = g.ColorEditOptions;
|
||||
if (allow_opt_inputs)
|
||||
{
|
||||
@@ -5933,6 +5933,7 @@ void ImGui::ColorEditOptionsPopup(const float* col, ImGuiColorEditFlags flags)
|
||||
|
||||
g.ColorEditOptions = opts;
|
||||
EndPopup();
|
||||
g.LockMarkEdited--;
|
||||
}
|
||||
|
||||
void ImGui::ColorPickerOptionsPopup(const float* ref_col, ImGuiColorEditFlags flags)
|
||||
@@ -5942,6 +5943,7 @@ void ImGui::ColorPickerOptionsPopup(const float* ref_col, ImGuiColorEditFlags fl
|
||||
if ((!allow_opt_picker && !allow_opt_alpha_bar) || !BeginPopup("context"))
|
||||
return;
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.LockMarkEdited++;
|
||||
if (allow_opt_picker)
|
||||
{
|
||||
ImVec2 picker_size(g.FontSize * 8, ImMax(g.FontSize * 8 - (GetFrameHeight() + g.Style.ItemInnerSpacing.x), 1.0f)); // FIXME: Picker size copied from main picker function
|
||||
@@ -5971,6 +5973,7 @@ void ImGui::ColorPickerOptionsPopup(const float* ref_col, ImGuiColorEditFlags fl
|
||||
CheckboxFlags("Alpha Bar", &g.ColorEditOptions, ImGuiColorEditFlags_AlphaBar);
|
||||
}
|
||||
EndPopup();
|
||||
g.LockMarkEdited--;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
@@ -6570,7 +6573,8 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
||||
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header);
|
||||
RenderFrame(bb.Min, bb.Max, col, false, 0.0f);
|
||||
}
|
||||
RenderNavHighlight(bb, id, ImGuiNavHighlightFlags_TypeThin | ImGuiNavHighlightFlags_NoRounding);
|
||||
if (g.NavId == id)
|
||||
RenderNavHighlight(bb, id, ImGuiNavHighlightFlags_TypeThin | ImGuiNavHighlightFlags_NoRounding);
|
||||
|
||||
if (span_all_columns && window->DC.CurrentColumns)
|
||||
PopColumnsBackground();
|
||||
|
||||
Reference in New Issue
Block a user