Each backend becomes its own module that imports 'imgui' and includes
its header and source in the purview. Do the same preparation as for
the core:
- Skip system, platform and graphics API includes under
IMGUI_CXX_MODULE, because the module includes them in its global
module fragment.
- Skip the forward declarations of platform types (GLFWwindow,
SDL_Window, ID3D11Device...). Declared in the purview, they would be
new types attached to the backend module instead of the real ones.
For the same reason, sdl2 drops the elaborated
'struct _SDL_GameController'.
- Wrap each header's API in IMGUI_EXPORT_BEGIN/END.
- win32: export ImGui_ImplWin32_WndProcHandler() under IMGUI_CXX_MODULE.
The header keeps it commented out to avoid pulling in <windows.h>,
but a module user can't forward-declare it themselves.
- glfw: skip the local GetIO(ImGuiContext*) declaration, because
'imgui' exports it.
imgui.cppm builds Dear ImGui as a named module that exports the same
API as imgui.h. The global module fragment includes imgui_macros.h and
the C system headers, then the purview imports std.compat and #includes
imgui.h. The .cpp files and imgui_internal.h go in 'module :private;',
so internals stay hidden and the whole library is one translation unit.
Exports are marked in imgui.h rather than listed separately, so they
can't drift from the header:
- IMGUI_EXPORT prefixes the ImGui namespace.
- IMGUI_EXPORT_BEGIN/END wrap runs of global declarations, leaving out
the out-of-line member definitions, which can't be exported.
All three expand to nothing outside the module. ImHashData() and the
GetIO(ImGuiContext*) overload live in imgui_internal.h but backends
need them, so imgui.cppm exports them explicitly.
NavUpdateAnyRequestFlag() loses its 'inline' forward declaration. Clang
rejects a static inline function that is declared before its definition
inside 'module :private;'. The definition is unchanged, so the
optimiser can still inline it.
imgui.cppm compiles the core sources inside its module purview. System
headers #included there would attach their declarations to the module,
which is ill-formed and clashes with the same declarations in the
global module or in 'import std;'. The module includes them in its
global module fragment instead, so under IMGUI_CXX_MODULE the sources
skip their own includes. Header builds are unchanged.
For the same reason:
- imstb_rectpack.h and imstb_truetype.h skip their extern "C" blocks,
which would attach their declarations to the global module.
- imgui_draw.cpp defines STBTT_cos/acos/memcpy/memset, so stb_truetype
doesn't include <math.h> and <string.h> itself.
Macros can't be exported from a C++20 module, and they ignore scope
and type in any case. Add typed constexpr equivalents for the values
people commonly use: version, payload types, unicode limits, colour
packing, IM_COUNTOF() and IMGUI_CHECKVERSION(). Each is defined from
its macro, so the two always agree, including when imconfig.h
overrides them.
They need C++17 inline variables, so they sit behind
IMGUI_HAS_CONSTEXPR and C++11 builds are unaffected.
C++20 modules don't export macros, so users of 'import imgui;' need
another way to get IMGUI_VERSION, IM_COL32() and friends. Gather the
version, the imconfig.h include and every public macro into a
standalone header. imgui.h includes it, so header users see no change.
imgui_internal.h now includes imgui.h unconditionally, because a
defined IMGUI_VERSION no longer implies that imgui.h was included.
imgui.h's #pragma once already prevents double inclusion.
Because SortOrder save is gated, it doesn't guarantee every column gets an .ini entry. Amend 1d7b37dc9b.
We set ImGuiTableFlags_Reorderable but technically any other field would work, tho ImGuiTableFlags_Reorderable makes more sense.
The reasoning is to (1) keep things consistent with DrawWithHint() without polluting the new function with width. (2) keep things consistent with other items.
- With MixedValue+LiveEdit: a single edit that ends up with same output reports as edited.
- Standardize path sin TempInputscalar(), InputScalar(), InputTextEx().
- Refer to changes in imgui_test_suite, in particular "widgets_datatype_1", "widgets_status_liveedit_off",