diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 8ea4737f..fb8c0fc5 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -95,6 +95,7 @@ Other Changes: - Columns: ImDrawList::Channels* functions now work inside columns. Added extra comments to suggest using user-owned ImDrawListSplitter instead of ImDrawList functions. [@rokups] - Misc: Added ImGuiMouseCursor_NotAllowed enum so it can be used by more shared widgets. [@rokups] +- Misc: Added IMGUI_DISABLE compile-time definition to make all headers and sources empty. - Misc: Disable format checks when using stb_printf, to allow using extra formats. Made IMGUI_USE_STB_SPRINTF a properly documented imconfig.h flag. (#2954) [@loicmolinari] - Misc: Added misc/single_file/imgui_single_file.h, We use this to validate compiling all *.cpp diff --git a/docs/TODO.txt b/docs/TODO.txt index f0d5c90b..9f102d7f 100644 --- a/docs/TODO.txt +++ b/docs/TODO.txt @@ -80,6 +80,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i - input text: clean up the mess caused by converting UTF-8 <> wchar. the code is rather inefficient right now and super fragile. - input text: reorganize event handling, allow CharFilter to modify buffers, allow multiple events? (#541) - input text: expose CursorPos in char filter event (#816) + - input text: try usage idiom of using InputText with data only exposed through get/set accessors, without extraneous copy/alloc. (#3009) - input text: access public fields via a non-callback API e.g. InputTextGetState("xxx") that may return NULL if not active. - input text: flag to disable live update of the user buffer (also applies to float/int text input) (#701) - input text: hover tooltip could show unclamped text diff --git a/imconfig.h b/imconfig.h index 6724e40f..09bfd16c 100644 --- a/imconfig.h +++ b/imconfig.h @@ -14,6 +14,7 @@ #pragma once //---- Define assertion handler. Defaults to calling assert(). +// If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement. //#define IM_ASSERT(_EXPR) MyAssert(_EXPR) //#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts @@ -25,10 +26,11 @@ //---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names. //#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS -//---- Don't implement demo windows functionality (ShowDemoWindow()/ShowStyleEditor()/ShowUserGuide() methods will be empty) -// It is very strongly recommended to NOT disable the demo windows during development. Please read the comments in imgui_demo.cpp. -//#define IMGUI_DISABLE_DEMO_WINDOWS -//#define IMGUI_DISABLE_METRICS_WINDOW +//---- Disable all of Dear ImGui or don't implement standard windows. +// It is very strongly recommended to NOT disable the demo windows during development. Please read comments in imgui_demo.cpp. +//#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty. +//#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. Not recommended. +//#define IMGUI_DISABLE_METRICS_WINDOW // Disable debug/metrics window: ShowMetricsWindow() will be empty. //---- Don't implement some functions to reduce linkage requirements. //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. diff --git a/imgui.cpp b/imgui.cpp index 4f2993b4..d1bf2639 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -791,6 +791,8 @@ CODE #endif #include "imgui.h" +#ifndef IMGUI_DISABLE + #ifndef IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS #endif @@ -10282,3 +10284,5 @@ void ImGui::ShowMetricsWindow(bool*) { } #endif //----------------------------------------------------------------------------- + +#endif // #ifndef IMGUI_DISABLE diff --git a/imgui.h b/imgui.h index 4cbe196e..75a4578b 100644 --- a/imgui.h +++ b/imgui.h @@ -45,6 +45,8 @@ Index of this file: #include "imconfig.h" #endif +#ifndef IMGUI_DISABLE + //----------------------------------------------------------------------------- // Header mess //----------------------------------------------------------------------------- @@ -2275,3 +2277,5 @@ struct ImFont #ifdef IMGUI_INCLUDE_IMGUI_USER_H #include "imgui_user.h" #endif + +#endif // #ifndef IMGUI_DISABLE diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 54b3a9f6..6fef81c4 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -65,6 +65,8 @@ Index of this file: #endif #include "imgui.h" +#ifndef IMGUI_DISABLE + #include // toupper #include // INT_MIN, INT_MAX #include // sqrtf, powf, cosf, sinf, floorf, ceilf @@ -4866,3 +4868,5 @@ void ImGui::ShowUserGuide() {} void ImGui::ShowStyleEditor(ImGuiStyle*) {} #endif + +#endif // #ifndef IMGUI_DISABLE diff --git a/imgui_draw.cpp b/imgui_draw.cpp index b457b532..41a7aff8 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -27,6 +27,8 @@ Index of this file: #endif #include "imgui.h" +#ifndef IMGUI_DISABLE + #ifndef IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS #endif @@ -3458,3 +3460,5 @@ static const char* GetDefaultCompressedFontDataTTFBase85() { return proggy_clean_ttf_compressed_data_base85; } + +#endif // #ifndef IMGUI_DISABLE diff --git a/imgui_internal.h b/imgui_internal.h index 85dcce20..47af16fb 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -22,6 +22,7 @@ Index of this file: */ #pragma once +#ifndef IMGUI_DISABLE //----------------------------------------------------------------------------- // Header mess @@ -1912,3 +1913,5 @@ extern void ImGuiTestEngineHook_Log(ImGuiContext* ctx, const cha #ifdef _MSC_VER #pragma warning (pop) #endif + +#endif // #ifndef IMGUI_DISABLE diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 5faa31b2..c5509601 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -33,6 +33,8 @@ Index of this file: #endif #include "imgui.h" +#ifndef IMGUI_DISABLE + #ifndef IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS #endif @@ -7704,3 +7706,5 @@ void ImGui::Columns(int columns_count, const char* id, bool border) } //------------------------------------------------------------------------- + +#endif // #ifndef IMGUI_DISABLE