mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-06 04:58:47 +02:00
Merge branch 'master' into docking
# Conflicts: # docs/CHANGELOG.txt # examples/imgui_impl_opengl3.cpp # imgui_widgets.cpp
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.68
|
||||
// dear imgui, v1.69 WIP
|
||||
// (internal structures/api)
|
||||
|
||||
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
|
||||
@ -100,7 +100,7 @@ typedef int ImGuiDragFlags; // -> enum ImGuiDragFlags_ // Flags:
|
||||
// STB libraries includes
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
namespace ImGuiStb
|
||||
namespace ImStb
|
||||
{
|
||||
|
||||
#undef STB_TEXTEDIT_STRING
|
||||
@ -110,7 +110,7 @@ namespace ImGuiStb
|
||||
#define STB_TEXTEDIT_GETWIDTH_NEWLINE -1.0f
|
||||
#include "imstb_textedit.h"
|
||||
|
||||
} // namespace ImGuiStb
|
||||
} // namespace ImStb
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Context pointer
|
||||
@ -283,7 +283,8 @@ struct IMGUI_API ImPool
|
||||
T* GetByIndex(ImPoolIdx n) { return &Data[n]; }
|
||||
ImPoolIdx GetIndex(const T* p) const { IM_ASSERT(p >= Data.Data && p < Data.Data + Data.Size); return (ImPoolIdx)(p - Data.Data); }
|
||||
T* GetOrAddByKey(ImGuiID key) { int* p_idx = Map.GetIntRef(key, -1); if (*p_idx != -1) return &Data[*p_idx]; *p_idx = FreeIdx; return Add(); }
|
||||
void Clear() { for (int n = 0; n < Map.Data.Size; n++) { int idx = Map.Data[n].val_i; if (idx != -1) Data[idx].~T(); } Map.Clear(); Data.clear(); FreeIdx = 0; }
|
||||
bool Contains(const T* p) const { return (p >= Data.Data && p < Data.Data + Data.Size); }
|
||||
void Clear() { for (int n = 0; n < Map.Data.Size; n++) { int idx = Map.Data[n].val_i; if (idx != -1) Data[idx].~T(); } Map.Clear(); Data.clear(); FreeIdx = 0; }
|
||||
T* Add() { int idx = FreeIdx; if (idx == Data.Size) { Data.resize(Data.Size + 1); FreeIdx++; } else { FreeIdx = *(int*)&Data[idx]; } IM_PLACEMENT_NEW(&Data[idx]) T(); return &Data[idx]; }
|
||||
void Remove(ImGuiID key, const T* p) { Remove(key, GetIndex(p)); }
|
||||
void Remove(ImGuiID key, ImPoolIdx idx) { Data[idx].~T(); *(int*)&Data[idx] = FreeIdx; FreeIdx = idx; Map.SetInt(key, -1); }
|
||||
@ -576,16 +577,16 @@ struct IMGUI_API ImGuiMenuColumns
|
||||
struct IMGUI_API ImGuiInputTextState
|
||||
{
|
||||
ImGuiID ID; // widget id owning the text state
|
||||
int CurLenW, CurLenA; // we need to maintain our buffer length in both UTF-8 and wchar format.
|
||||
ImVector<ImWchar> TextW; // edit buffer, we need to persist but can't guarantee the persistence of the user-provided buffer. so we copy into own buffer.
|
||||
ImVector<char> InitialText; // backup of end-user buffer at the time of focus (in UTF-8, unaltered)
|
||||
ImVector<char> TempBuffer; // temporary buffer for callback and other other operations. size=capacity.
|
||||
int CurLenA, CurLenW; // we need to maintain our buffer length in both UTF-8 and wchar format.
|
||||
ImVector<char> TextA; // temporary UTF8 buffer for callbacks and other operations. this is not updated in every code-path! size=capacity.
|
||||
ImVector<char> InitialTextA; // backup of end-user buffer at the time of focus (in UTF-8, unaltered)
|
||||
int BufCapacityA; // end-user buffer capacity
|
||||
float ScrollX;
|
||||
ImGuiStb::STB_TexteditState StbState;
|
||||
float CursorAnim;
|
||||
bool CursorFollow;
|
||||
bool SelectedAllMouseLock;
|
||||
float ScrollX; // horizontal scrolling/offset
|
||||
ImStb::STB_TexteditState Stb; // state for stb_textedit.h
|
||||
float CursorAnim; // timer for cursor blink, reset on every user action so the cursor reappears immediately
|
||||
bool CursorFollow; // set when we want scrolling to follow the current cursor position (not always!)
|
||||
bool SelectedAllMouseLock; // after a double-click to select all, we ignore further mouse drags to update selection
|
||||
|
||||
// Temporarily set when active
|
||||
ImGuiInputTextFlags UserFlags;
|
||||
@ -593,11 +594,12 @@ struct IMGUI_API ImGuiInputTextState
|
||||
void* UserCallbackData;
|
||||
|
||||
ImGuiInputTextState() { memset(this, 0, sizeof(*this)); }
|
||||
void ClearFreeMemory() { TextW.clear(); TextA.clear(); InitialTextA.clear(); }
|
||||
void CursorAnimReset() { CursorAnim = -0.30f; } // After a user-input the cursor stays on for a while without blinking
|
||||
void CursorClamp() { StbState.cursor = ImMin(StbState.cursor, CurLenW); StbState.select_start = ImMin(StbState.select_start, CurLenW); StbState.select_end = ImMin(StbState.select_end, CurLenW); }
|
||||
bool HasSelection() const { return StbState.select_start != StbState.select_end; }
|
||||
void ClearSelection() { StbState.select_start = StbState.select_end = StbState.cursor; }
|
||||
void SelectAll() { StbState.select_start = 0; StbState.cursor = StbState.select_end = CurLenW; StbState.has_preferred_x = 0; }
|
||||
void CursorClamp() { Stb.cursor = ImMin(Stb.cursor, CurLenW); Stb.select_start = ImMin(Stb.select_start, CurLenW); Stb.select_end = ImMin(Stb.select_end, CurLenW); }
|
||||
bool HasSelection() const { return Stb.select_start != Stb.select_end; }
|
||||
void ClearSelection() { Stb.select_start = Stb.select_end = Stb.cursor; }
|
||||
void SelectAll() { Stb.select_start = 0; Stb.cursor = Stb.select_end = CurLenW; Stb.has_preferred_x = 0; }
|
||||
void OnKeyPressed(int key); // Cannot be inline because we call in code in stb_textedit.h implementation
|
||||
};
|
||||
|
||||
@ -811,8 +813,17 @@ struct ImGuiNextWindowData
|
||||
|
||||
struct ImGuiTabBarSortItem
|
||||
{
|
||||
int Index;
|
||||
float Width;
|
||||
int Index;
|
||||
float Width;
|
||||
};
|
||||
|
||||
struct ImGuiTabBarRef
|
||||
{
|
||||
ImGuiTabBar* Ptr; // Either field can be set, not both. Dock node tab bars are loose while BeginTabBar() ones are in a pool.
|
||||
int IndexInMainPool;
|
||||
|
||||
ImGuiTabBarRef(ImGuiTabBar* ptr) { Ptr = ptr; IndexInMainPool = -1; }
|
||||
ImGuiTabBarRef(int index_in_main_pool) { Ptr = NULL; IndexInMainPool = index_in_main_pool; }
|
||||
};
|
||||
|
||||
enum ImGuiDockNodeFlagsPrivate_
|
||||
@ -1016,8 +1027,9 @@ struct ImGuiContext
|
||||
unsigned char DragDropPayloadBufLocal[8]; // Local buffer for small payloads
|
||||
|
||||
// Tab bars
|
||||
ImPool<ImGuiTabBar> TabBars;
|
||||
ImVector<ImGuiTabBar*> CurrentTabBar;
|
||||
ImPool<ImGuiTabBar> TabBars;
|
||||
ImGuiTabBar* CurrentTabBar;
|
||||
ImVector<ImGuiTabBarRef> CurrentTabBarStack;
|
||||
ImVector<ImGuiTabBarSortItem> TabSortByWidthBuffer;
|
||||
|
||||
// Widget state
|
||||
@ -1413,7 +1425,7 @@ struct ImGuiItemHoveredDataBackup
|
||||
|
||||
enum ImGuiTabBarFlagsPrivate_
|
||||
{
|
||||
ImGuiTabBarFlags_DockNode = 1 << 20, // Part of a dock node
|
||||
ImGuiTabBarFlags_DockNode = 1 << 20, // Part of a dock node [we don't use this in the master branch but it facilitate branch syncing to keep this around]
|
||||
ImGuiTabBarFlags_IsFocused = 1 << 21,
|
||||
ImGuiTabBarFlags_SaveSettings = 1 << 22 // FIXME: Settings are handled by the docking system, this only request the tab bar to mark settings dirty when reordering tabs
|
||||
};
|
||||
@ -1678,8 +1690,8 @@ namespace ImGui
|
||||
IMGUI_API bool CloseButton(ImGuiID id, const ImVec2& pos, float radius);
|
||||
IMGUI_API bool CollapseButton(ImGuiID id, const ImVec2& pos, ImGuiDockNode* dock_node);
|
||||
IMGUI_API bool ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags);
|
||||
IMGUI_API void Scrollbar(ImGuiLayoutType direction);
|
||||
IMGUI_API ImGuiID GetScrollbarID(ImGuiLayoutType direction);
|
||||
IMGUI_API void Scrollbar(ImGuiAxis axis);
|
||||
IMGUI_API ImGuiID GetScrollbarID(ImGuiWindow* window, ImGuiAxis axis);
|
||||
IMGUI_API void VerticalSeparator(); // Vertical separator, for menu bars (use current line height). Not exposed because it is misleading and it doesn't have an effect on regular layout.
|
||||
|
||||
// Widgets low-level behaviors
|
||||
|
Reference in New Issue
Block a user