mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-06 13:08:47 +02:00
Internal: Log/Capture: Rework to add an internal LogToBuffer() function which is useful for writing automated tests. Clarified logging state by adding an enum.
This commit is contained in:
@ -384,6 +384,15 @@ enum ImGuiLayoutType_
|
||||
ImGuiLayoutType_Vertical = 1
|
||||
};
|
||||
|
||||
enum ImGuiLogType
|
||||
{
|
||||
ImGuiLogType_None = 0,
|
||||
ImGuiLogType_TTY,
|
||||
ImGuiLogType_File,
|
||||
ImGuiLogType_Buffer,
|
||||
ImGuiLogType_Clipboard
|
||||
};
|
||||
|
||||
// X/Y enums are fixed to 0/1 so they may be used to index ImVec2
|
||||
enum ImGuiAxis
|
||||
{
|
||||
@ -928,8 +937,9 @@ struct ImGuiContext
|
||||
|
||||
// Logging
|
||||
bool LogEnabled;
|
||||
ImGuiLogType LogType;
|
||||
FILE* LogFile; // If != NULL log to stdout/ file
|
||||
ImGuiTextBuffer LogClipboard; // Accumulation buffer when log to clipboard. This is pointer so our GImGui static constructor doesn't call heap allocators.
|
||||
ImGuiTextBuffer LogBuffer; // Accumulation buffer when log to clipboard. This is pointer so our GImGui static constructor doesn't call heap allocators.
|
||||
int LogStartDepth;
|
||||
int LogAutoExpandMaxDepth;
|
||||
|
||||
@ -1041,6 +1051,7 @@ struct ImGuiContext
|
||||
SettingsDirtyTimer = 0.0f;
|
||||
|
||||
LogEnabled = false;
|
||||
LogType = ImGuiLogType_None;
|
||||
LogFile = NULL;
|
||||
LogStartDepth = 0;
|
||||
LogAutoExpandMaxDepth = 2;
|
||||
@ -1396,6 +1407,9 @@ namespace ImGui
|
||||
IMGUI_API void PushItemFlag(ImGuiItemFlags option, bool enabled);
|
||||
IMGUI_API void PopItemFlag();
|
||||
|
||||
// Logging/Capture
|
||||
IMGUI_API void LogToBuffer(int max_depth = -1); // Start logging to internal buffer
|
||||
|
||||
// Popups, Modals, Tooltips
|
||||
IMGUI_API void OpenPopupEx(ImGuiID id);
|
||||
IMGUI_API void ClosePopupToLevel(int remaining, bool apply_focus_to_window_under);
|
||||
|
Reference in New Issue
Block a user