1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-09-24 03:28:33 +02:00

Renamed ImGuiState -> ImGuiContext (#586, #269)

This commit is contained in:
ocornut 2016-05-07 19:55:51 +02:00
parent 8b428e8c74
commit 7b9c0a5c3f
3 changed files with 170 additions and 170 deletions

320
imgui.cpp

File diff suppressed because it is too large Load Diff

10
imgui.h
View File

@ -54,7 +54,7 @@ struct ImGuiTextFilter; // Parse and apply text filters. In format "
struct ImGuiTextBuffer; // Text buffer for logging/accumulating text struct ImGuiTextBuffer; // Text buffer for logging/accumulating text
struct ImGuiTextEditCallbackData; // Shared state of ImGui::InputText() when using custom callbacks (advanced) struct ImGuiTextEditCallbackData; // Shared state of ImGui::InputText() when using custom callbacks (advanced)
struct ImGuiListClipper; // Helper to manually clip large list of items struct ImGuiListClipper; // Helper to manually clip large list of items
struct ImGuiState; // ImGui context (opaque) struct ImGuiContext; // ImGui context (opaque)
// Enumerations (declared as int for compatibility and to not pollute the top of this file) // Enumerations (declared as int for compatibility and to not pollute the top of this file)
typedef unsigned int ImU32; typedef unsigned int ImU32;
@ -445,10 +445,10 @@ namespace ImGui
// Internal context access - if you want to use multiple context, share context between modules (e.g. DLL). There is a default context created and active by default. // Internal context access - if you want to use multiple context, share context between modules (e.g. DLL). There is a default context created and active by default.
IMGUI_API const char* GetVersion(); IMGUI_API const char* GetVersion();
IMGUI_API ImGuiState* CreateContext(void* (*malloc_fn)(size_t) = NULL, void (*free_fn)(void*) = NULL); IMGUI_API ImGuiContext* CreateContext(void* (*malloc_fn)(size_t) = NULL, void (*free_fn)(void*) = NULL);
IMGUI_API void DestroyContext(ImGuiState* ctx); IMGUI_API void DestroyContext(ImGuiContext* ctx);
IMGUI_API ImGuiState* GetCurrentContext(); IMGUI_API ImGuiContext* GetCurrentContext();
IMGUI_API void SetCurrentContext(ImGuiState* ctx); IMGUI_API void SetCurrentContext(ImGuiContext* ctx);
// Obsolete (will be removed) // Obsolete (will be removed)
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS

View File

@ -70,7 +70,7 @@ namespace ImGuiStb
// Context // Context
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
extern IMGUI_API ImGuiState* GImGui; // current implicit ImGui context pointer extern IMGUI_API ImGuiContext* GImGui; // current implicit ImGui context pointer
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Helpers // Helpers
@ -344,7 +344,7 @@ struct ImGuiPopupRef
}; };
// Main state for ImGui // Main state for ImGui
struct ImGuiState struct ImGuiContext
{ {
bool Initialized; bool Initialized;
ImGuiIO IO; ImGuiIO IO;
@ -436,7 +436,7 @@ struct ImGuiState
int CaptureKeyboardNextFrame; int CaptureKeyboardNextFrame;
char TempBuffer[1024*3+1]; // temporary text buffer char TempBuffer[1024*3+1]; // temporary text buffer
ImGuiState() ImGuiContext()
{ {
Initialized = false; Initialized = false;
Font = NULL; Font = NULL;
@ -672,8 +672,8 @@ namespace ImGui
// If this ever crash because g.CurrentWindow is NULL it means that either // If this ever crash because g.CurrentWindow is NULL it means that either
// - ImGui::NewFrame() has never been called, which is illegal. // - ImGui::NewFrame() has never been called, which is illegal.
// - You are calling ImGui functions after ImGui::Render() and before the next ImGui::NewFrame(), which is also illegal. // - You are calling ImGui functions after ImGui::Render() and before the next ImGui::NewFrame(), which is also illegal.
inline ImGuiWindow* GetCurrentWindowRead() { ImGuiState& g = *GImGui; return g.CurrentWindow; } inline ImGuiWindow* GetCurrentWindowRead() { ImGuiContext& g = *GImGui; return g.CurrentWindow; }
inline ImGuiWindow* GetCurrentWindow() { ImGuiState& g = *GImGui; g.CurrentWindow->Accessed = true; return g.CurrentWindow; } inline ImGuiWindow* GetCurrentWindow() { ImGuiContext& g = *GImGui; g.CurrentWindow->Accessed = true; return g.CurrentWindow; }
IMGUI_API ImGuiWindow* GetParentWindow(); IMGUI_API ImGuiWindow* GetParentWindow();
IMGUI_API ImGuiWindow* FindWindowByName(const char* name); IMGUI_API ImGuiWindow* FindWindowByName(const char* name);
IMGUI_API void FocusWindow(ImGuiWindow* window); IMGUI_API void FocusWindow(ImGuiWindow* window);