|
@@ -54,6 +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 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;
|
|
@@ -158,7 +159,7 @@ namespace ImGui
|
|
|
IMGUI_API void SetScrollY(float scroll_y); // set scrolling amount [0..GetScrollMaxY()]
|
|
IMGUI_API void SetScrollY(float scroll_y); // set scrolling amount [0..GetScrollMaxY()]
|
|
|
IMGUI_API void SetScrollHere(float center_y_ratio = 0.5f); // adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom.
|
|
IMGUI_API void SetScrollHere(float center_y_ratio = 0.5f); // adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom.
|
|
|
IMGUI_API void SetScrollFromPosY(float pos_y, float center_y_ratio = 0.5f); // adjust scrolling amount to make given position valid. use GetCursorPos() or GetCursorStartPos()+offset to get valid positions.
|
|
IMGUI_API void SetScrollFromPosY(float pos_y, float center_y_ratio = 0.5f); // adjust scrolling amount to make given position valid. use GetCursorPos() or GetCursorStartPos()+offset to get valid positions.
|
|
|
- IMGUI_API void SetKeyboardFocusHere(int offset = 0); // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget
|
|
|
|
|
|
|
+ IMGUI_API void SetKeyboardFocusHere(int offset = 0); // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget. Use negative 'offset' to access previous widgets.
|
|
|
IMGUI_API void SetStateStorage(ImGuiStorage* tree); // replace tree state storage with our own (if you want to manipulate it yourself, typically clear subsection of it)
|
|
IMGUI_API void SetStateStorage(ImGuiStorage* tree); // replace tree state storage with our own (if you want to manipulate it yourself, typically clear subsection of it)
|
|
|
IMGUI_API ImGuiStorage* GetStateStorage();
|
|
IMGUI_API ImGuiStorage* GetStateStorage();
|
|
|
|
|
|
|
@@ -442,11 +443,12 @@ namespace ImGui
|
|
|
IMGUI_API const char* GetClipboardText();
|
|
IMGUI_API const char* GetClipboardText();
|
|
|
IMGUI_API void SetClipboardText(const char* text);
|
|
IMGUI_API void SetClipboardText(const char* text);
|
|
|
|
|
|
|
|
- // Internal state/context access - if you want to use multiple ImGui context, or share context between modules (e.g. DLL), or allocate the memory yourself
|
|
|
|
|
|
|
+ // 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 void* GetInternalState();
|
|
|
|
|
- IMGUI_API size_t GetInternalStateSize();
|
|
|
|
|
- IMGUI_API void SetInternalState(void* state, bool construct = false);
|
|
|
|
|
|
|
+ IMGUI_API ImGuiContext* CreateContext(void* (*malloc_fn)(size_t) = NULL, void (*free_fn)(void*) = NULL);
|
|
|
|
|
+ IMGUI_API void DestroyContext(ImGuiContext* ctx);
|
|
|
|
|
+ IMGUI_API ImGuiContext* GetCurrentContext();
|
|
|
|
|
+ IMGUI_API void SetCurrentContext(ImGuiContext* ctx);
|
|
|
|
|
|
|
|
// Obsolete (will be removed)
|
|
// Obsolete (will be removed)
|
|
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
@@ -950,7 +952,7 @@ struct ImGuiTextBuffer
|
|
|
IMGUI_API void appendv(const char* fmt, va_list args);
|
|
IMGUI_API void appendv(const char* fmt, va_list args);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-// Helper: Key->value storage
|
|
|
|
|
|
|
+// Helper: Simple Key->value storage
|
|
|
// - Store collapse state for a tree (Int 0/1)
|
|
// - Store collapse state for a tree (Int 0/1)
|
|
|
// - Store color edit options (Int using values in ImGuiColorEditMode enum).
|
|
// - Store color edit options (Int using values in ImGuiColorEditMode enum).
|
|
|
// - Custom user storage for temporary values.
|
|
// - Custom user storage for temporary values.
|
|
@@ -958,6 +960,7 @@ struct ImGuiTextBuffer
|
|
|
// Declare your own storage if:
|
|
// Declare your own storage if:
|
|
|
// - You want to manipulate the open/close state of a particular sub-tree in your interface (tree node uses Int 0/1 to store their state).
|
|
// - You want to manipulate the open/close state of a particular sub-tree in your interface (tree node uses Int 0/1 to store their state).
|
|
|
// - You want to store custom debug data easily without adding or editing structures in your code.
|
|
// - You want to store custom debug data easily without adding or editing structures in your code.
|
|
|
|
|
+// Types are NOT stored, so it is up to you to make sure your Key don't collide with different types.
|
|
|
struct ImGuiStorage
|
|
struct ImGuiStorage
|
|
|
{
|
|
{
|
|
|
struct Pair
|
|
struct Pair
|
|
@@ -972,10 +975,12 @@ struct ImGuiStorage
|
|
|
|
|
|
|
|
// - Get***() functions find pair, never add/allocate. Pairs are sorted so a query is O(log N)
|
|
// - Get***() functions find pair, never add/allocate. Pairs are sorted so a query is O(log N)
|
|
|
// - Set***() functions find pair, insertion on demand if missing.
|
|
// - Set***() functions find pair, insertion on demand if missing.
|
|
|
- // - Sorted insertion is costly but should amortize. A typical frame shouldn't need to insert any new pair.
|
|
|
|
|
|
|
+ // - Sorted insertion is costly, paid once. A typical frame shouldn't need to insert any new pair.
|
|
|
IMGUI_API void Clear();
|
|
IMGUI_API void Clear();
|
|
|
IMGUI_API int GetInt(ImGuiID key, int default_val = 0) const;
|
|
IMGUI_API int GetInt(ImGuiID key, int default_val = 0) const;
|
|
|
IMGUI_API void SetInt(ImGuiID key, int val);
|
|
IMGUI_API void SetInt(ImGuiID key, int val);
|
|
|
|
|
+ IMGUI_API bool GetBool(ImGuiID key, bool default_val = false) const;
|
|
|
|
|
+ IMGUI_API void SetBool(ImGuiID key, bool val);
|
|
|
IMGUI_API float GetFloat(ImGuiID key, float default_val = 0.0f) const;
|
|
IMGUI_API float GetFloat(ImGuiID key, float default_val = 0.0f) const;
|
|
|
IMGUI_API void SetFloat(ImGuiID key, float val);
|
|
IMGUI_API void SetFloat(ImGuiID key, float val);
|
|
|
IMGUI_API void* GetVoidPtr(ImGuiID key) const; // default_val is NULL
|
|
IMGUI_API void* GetVoidPtr(ImGuiID key) const; // default_val is NULL
|
|
@@ -987,7 +992,8 @@ struct ImGuiStorage
|
|
|
// float* pvar = ImGui::GetFloatRef(key); ImGui::SliderFloat("var", pvar, 0, 100.0f); some_var += *pvar;
|
|
// float* pvar = ImGui::GetFloatRef(key); ImGui::SliderFloat("var", pvar, 0, 100.0f); some_var += *pvar;
|
|
|
// - You can also use this to quickly create temporary editable values during a session of using Edit&Continue, without restarting your application.
|
|
// - You can also use this to quickly create temporary editable values during a session of using Edit&Continue, without restarting your application.
|
|
|
IMGUI_API int* GetIntRef(ImGuiID key, int default_val = 0);
|
|
IMGUI_API int* GetIntRef(ImGuiID key, int default_val = 0);
|
|
|
- IMGUI_API float* GetFloatRef(ImGuiID key, float default_val = 0);
|
|
|
|
|
|
|
+ IMGUI_API bool* GetBoolRef(ImGuiID key, bool default_val = false);
|
|
|
|
|
+ IMGUI_API float* GetFloatRef(ImGuiID key, float default_val = 0.0f);
|
|
|
IMGUI_API void** GetVoidPtrRef(ImGuiID key, void* default_val = NULL);
|
|
IMGUI_API void** GetVoidPtrRef(ImGuiID key, void* default_val = NULL);
|
|
|
|
|
|
|
|
// Use on your own storage if you know only integer are being stored (open/close all tree nodes)
|
|
// Use on your own storage if you know only integer are being stored (open/close all tree nodes)
|