Added IMGUI_DISABLE compile-time definition to make all headers and sources empty.
diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt
index 8ea4737..fb8c0fc 100644
--- a/docs/CHANGELOG.txt
+++ b/docs/CHANGELOG.txt
@@ -95,6 +95,7 @@
- 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 f0d5c90..9f102d7 100644
--- a/docs/TODO.txt
+++ b/docs/TODO.txt
@@ -80,6 +80,7 @@
- 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 6724e40..09bfd16 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 4f2993b..d1bf263 100644
--- a/imgui.cpp
+++ b/imgui.cpp
@@ -791,6 +791,8 @@
#endif
#include "imgui.h"
+#ifndef IMGUI_DISABLE
+
#ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
@@ -10282,3 +10284,5 @@
#endif
//-----------------------------------------------------------------------------
+
+#endif // #ifndef IMGUI_DISABLE
diff --git a/imgui.h b/imgui.h
index 4cbe196..75a4578 100644
--- a/imgui.h
+++ b/imgui.h
@@ -45,6 +45,8 @@
#include "imconfig.h"
#endif
+#ifndef IMGUI_DISABLE
+
//-----------------------------------------------------------------------------
// Header mess
//-----------------------------------------------------------------------------
@@ -2275,3 +2277,5 @@
#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 54b3a9f..6fef81c 100644
--- a/imgui_demo.cpp
+++ b/imgui_demo.cpp
@@ -65,6 +65,8 @@
#endif
#include "imgui.h"
+#ifndef IMGUI_DISABLE
+
#include <ctype.h> // toupper
#include <limits.h> // INT_MIN, INT_MAX
#include <math.h> // sqrtf, powf, cosf, sinf, floorf, ceilf
@@ -4866,3 +4868,5 @@
void ImGui::ShowStyleEditor(ImGuiStyle*) {}
#endif
+
+#endif // #ifndef IMGUI_DISABLE
diff --git a/imgui_draw.cpp b/imgui_draw.cpp
index b457b53..41a7aff 100644
--- a/imgui_draw.cpp
+++ b/imgui_draw.cpp
@@ -27,6 +27,8 @@
#endif
#include "imgui.h"
+#ifndef IMGUI_DISABLE
+
#ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
@@ -3458,3 +3460,5 @@
{
return proggy_clean_ttf_compressed_data_base85;
}
+
+#endif // #ifndef IMGUI_DISABLE
diff --git a/imgui_internal.h b/imgui_internal.h
index 85dcce2..47af16f 100644
--- a/imgui_internal.h
+++ b/imgui_internal.h
@@ -22,6 +22,7 @@
*/
#pragma once
+#ifndef IMGUI_DISABLE
//-----------------------------------------------------------------------------
// Header mess
@@ -1912,3 +1913,5 @@
#ifdef _MSC_VER
#pragma warning (pop)
#endif
+
+#endif // #ifndef IMGUI_DISABLE
diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp
index 5faa31b..c550960 100644
--- a/imgui_widgets.cpp
+++ b/imgui_widgets.cpp
@@ -33,6 +33,8 @@
#endif
#include "imgui.h"
+#ifndef IMGUI_DISABLE
+
#ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
@@ -7704,3 +7706,5 @@
}
//-------------------------------------------------------------------------
+
+#endif // #ifndef IMGUI_DISABLE