mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
Merge remote-tracking branch 'origin' into 2016-07-navigation
This commit is contained in:
31
imgui.cpp
31
imgui.cpp
@ -345,7 +345,7 @@
|
||||
- Elements that are not clickable, such as Text() items don't need an ID.
|
||||
|
||||
- Interactive widgets require state to be carried over multiple frames (most typically ImGui often needs to remember what is the "active" widget).
|
||||
to do so they need an unique ID. unique ID are typically derived from a string label, an integer index or a pointer.
|
||||
to do so they need a unique ID. unique ID are typically derived from a string label, an integer index or a pointer.
|
||||
|
||||
Button("OK"); // Label = "OK", ID = hash of "OK"
|
||||
Button("Cancel"); // Label = "Cancel", ID = hash of "Cancel"
|
||||
@ -527,8 +527,9 @@
|
||||
!- main: make it so that a frame with no window registered won't refocus every window on subsequent frames (~bump LastFrameActive of all windows).
|
||||
- main: IsItemHovered() make it more consistent for various type of widgets, widgets with multiple components, etc. also effectively IsHovered() region sometimes differs from hot region, e.g tree nodes
|
||||
- main: IsItemHovered() info stored in a stack? so that 'if TreeNode() { Text; TreePop; } if IsHovered' return the hover state of the TreeNode?
|
||||
- input text: clean up the mess caused by converting UTF-8 <> wchar. the code is rather inefficient right now.
|
||||
- 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: flag to disable live update of the user buffer (also applies to float/int text input)
|
||||
- input text: resize behavior - field could stretch when being edited? hover tooltip shows more text?
|
||||
- input text: add ImGuiInputTextFlags_EnterToApply? (off #218)
|
||||
@ -568,7 +569,7 @@
|
||||
!- popups/menus: clarify usage of popups id, how MenuItem/Selectable closing parent popups affects the ID, etc. this is quite fishy needs improvement! (#331, #402)
|
||||
- popups: add variant using global identifier similar to Begin/End (#402)
|
||||
- popups: border options. richer api like BeginChild() perhaps? (#197)
|
||||
- tooltip: tooltip that doesn't fit in entire screen seems to lose their "last prefered button" and may teleport when moving mouse
|
||||
- tooltip: tooltip that doesn't fit in entire screen seems to lose their "last preferred button" and may teleport when moving mouse
|
||||
- menus: local shortcuts, global shortcuts (#456, #126)
|
||||
- menus: menubars: some sort of priority / effect of main menu-bar on desktop size?
|
||||
- menus: calling BeginMenu() twice with a same name doesn't seem to append nicely
|
||||
@ -3022,10 +3023,13 @@ void ImGui::Shutdown()
|
||||
}
|
||||
g.Windows.clear();
|
||||
g.WindowsSortBuffer.clear();
|
||||
g.CurrentWindow = NULL;
|
||||
g.CurrentWindowStack.clear();
|
||||
g.NavWindow = NULL;
|
||||
g.HoveredWindow = NULL;
|
||||
g.HoveredRootWindow = NULL;
|
||||
g.ActiveIdWindow = NULL;
|
||||
g.MovedWindow = NULL;
|
||||
for (int i = 0; i < g.Settings.Size; i++)
|
||||
ImGui::MemFree(g.Settings[i].Name);
|
||||
g.Settings.clear();
|
||||
@ -3034,6 +3038,8 @@ void ImGui::Shutdown()
|
||||
g.FontStack.clear();
|
||||
g.OpenPopupStack.clear();
|
||||
g.CurrentPopupStack.clear();
|
||||
g.SetNextWindowSizeConstraintCallback = NULL;
|
||||
g.SetNextWindowSizeConstraintCallbackUserData = NULL;
|
||||
for (int i = 0; i < IM_ARRAYSIZE(g.RenderDrawLists); i++)
|
||||
g.RenderDrawLists[i].clear();
|
||||
g.OverlayDrawList.ClearFreeMemory();
|
||||
@ -3226,9 +3232,9 @@ static void AddDrawListToRenderList(ImVector<ImDrawList*>& out_render_list, ImDr
|
||||
}
|
||||
|
||||
// Draw list sanity check. Detect mismatch between PrimReserve() calls and incrementing _VtxCurrentIdx, _VtxWritePtr etc.
|
||||
IM_ASSERT(draw_list->_VtxWritePtr == draw_list->VtxBuffer.Data + draw_list->VtxBuffer.Size);
|
||||
IM_ASSERT(draw_list->_IdxWritePtr == draw_list->IdxBuffer.Data + draw_list->IdxBuffer.Size);
|
||||
IM_ASSERT((int)draw_list->_VtxCurrentIdx == draw_list->VtxBuffer.Size);
|
||||
IM_ASSERT(draw_list->VtxBuffer.Size == 0 || draw_list->_VtxWritePtr == draw_list->VtxBuffer.Data + draw_list->VtxBuffer.Size);
|
||||
IM_ASSERT(draw_list->IdxBuffer.Size == 0 || draw_list->_IdxWritePtr == draw_list->IdxBuffer.Data + draw_list->IdxBuffer.Size);
|
||||
IM_ASSERT((int)draw_list->_VtxCurrentIdx == draw_list->VtxBuffer.Size);
|
||||
|
||||
// Check that draw_list doesn't use more vertices than indexable (default ImDrawIdx = 2 bytes = 64K vertices)
|
||||
// If this assert triggers because you are drawing lots of stuff manually, A) workaround by calling BeginChild()/EndChild() to put your draw commands in multiple draw lists, B) #define ImDrawIdx to a 'unsigned int' in imconfig.h and render accordingly.
|
||||
@ -4097,8 +4103,7 @@ void ImGui::EndTooltip()
|
||||
static bool IsPopupOpen(ImGuiID id)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
const bool is_open = g.OpenPopupStack.Size > g.CurrentPopupStack.Size && g.OpenPopupStack[g.CurrentPopupStack.Size].PopupId == id;
|
||||
return is_open;
|
||||
return g.OpenPopupStack.Size > g.CurrentPopupStack.Size && g.OpenPopupStack[g.CurrentPopupStack.Size].PopupId == id;
|
||||
}
|
||||
|
||||
// Mark popup as open (toggle toward open state).
|
||||
@ -6985,7 +6990,7 @@ void ImGui::TreeAdvanceToLabelPos()
|
||||
g.CurrentWindow->DC.CursorPos.x += GetTreeNodeToLabelSpacing();
|
||||
}
|
||||
|
||||
// Horizontal distance preceeding label when using TreeNode() or Bullet()
|
||||
// Horizontal distance preceding label when using TreeNode() or Bullet()
|
||||
float ImGui::GetTreeNodeToLabelSpacing()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
@ -10138,6 +10143,7 @@ void ImGui::BeginGroup()
|
||||
group_data.BackupCursorPos = window->DC.CursorPos;
|
||||
group_data.BackupCursorMaxPos = window->DC.CursorMaxPos;
|
||||
group_data.BackupIndentX = window->DC.IndentX;
|
||||
group_data.BackupGroupOffsetX = window->DC.GroupOffsetX;
|
||||
group_data.BackupCurrentLineHeight = window->DC.CurrentLineHeight;
|
||||
group_data.BackupCurrentLineTextBaseOffset = window->DC.CurrentLineTextBaseOffset;
|
||||
group_data.BackupLogLinePosY = window->DC.LogLinePosY;
|
||||
@ -10168,7 +10174,7 @@ void ImGui::EndGroup()
|
||||
window->DC.CurrentLineHeight = group_data.BackupCurrentLineHeight;
|
||||
window->DC.CurrentLineTextBaseOffset = group_data.BackupCurrentLineTextBaseOffset;
|
||||
window->DC.IndentX = group_data.BackupIndentX;
|
||||
window->DC.GroupOffsetX = window->DC.IndentX;
|
||||
window->DC.GroupOffsetX = group_data.BackupGroupOffsetX;
|
||||
window->DC.LogLinePosY = window->DC.CursorPos.y - 9999.0f;
|
||||
|
||||
if (group_data.AdvanceCursor)
|
||||
@ -10416,7 +10422,7 @@ void ImGui::Columns(int columns_count, const char* id, bool border)
|
||||
const ImGuiID column_id = window->DC.ColumnsSetId + ImGuiID(column_index);
|
||||
KeepAliveID(column_id);
|
||||
const float default_t = column_index / (float)window->DC.ColumnsCount;
|
||||
const float t = window->DC.StateStorage->GetFloat(column_id, default_t); // Cheaply store our floating point value inside the integer (could store an union into the map?)
|
||||
const float t = window->DC.StateStorage->GetFloat(column_id, default_t); // Cheaply store our floating point value inside the integer (could store a union into the map?)
|
||||
window->DC.ColumnsData[column_index].OffsetNorm = t;
|
||||
}
|
||||
window->DrawList->ChannelsSplit(window->DC.ColumnsCount);
|
||||
@ -10528,7 +10534,7 @@ void ImGui::ValueColor(const char* prefix, ImU32 v)
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// PLATFORM DEPENDANT HELPERS
|
||||
// PLATFORM DEPENDENT HELPERS
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if defined(_WIN32) && !defined(_WINDOWS_) && (!defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS) || !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS))
|
||||
@ -10721,6 +10727,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
||||
if (!ImGui::TreeNode(window, "%s '%s', %d @ 0x%p", label, window->Name, window->Active || window->WasActive, window))
|
||||
return;
|
||||
NodeDrawList(window->DrawList, "DrawList");
|
||||
ImGui::BulletText("Pos: (%.1f,%.1f)", window->Pos.x, window->Pos.y);
|
||||
ImGui::BulletText("Size: (%.1f,%.1f), SizeContents (%.1f,%.1f)", window->Size.x, window->Size.y, window->SizeContents.x, window->SizeContents.y);
|
||||
ImGui::BulletText("Scroll: (%.2f,%.2f)", window->Scroll.x, window->Scroll.y);
|
||||
ImGui::BulletText("NavLastId: 0x%08x, NavLayerActiveFlags: %02X", window->NavLastId, window->DC.NavLayerActiveFlags);
|
||||
|
Reference in New Issue
Block a user