mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-29 02:56:35 +00:00
Factorized some code (+ declared as static function without namespace, a pattern with the Nav branch has started to use)
This commit is contained in:
parent
50f5be9266
commit
e7922b3fa0
23
imgui.cpp
23
imgui.cpp
@ -659,6 +659,11 @@ static inline void DataTypeFormatString(ImGuiDataType data_type, void* data
|
||||
static void DataTypeApplyOp(ImGuiDataType data_type, int op, void* value1, const void* value2);
|
||||
static bool DataTypeApplyOpFromText(const char* buf, const char* initial_value_buf, ImGuiDataType data_type, void* data_ptr, const char* scalar_format);
|
||||
|
||||
namespace ImGui
|
||||
{
|
||||
static void FocusPreviousWindow();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Platform dependent default implementations
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -2434,12 +2439,7 @@ void ImGui::NewFrame()
|
||||
|
||||
// Closing the focused window restore focus to the first active root window in descending z-order
|
||||
if (g.NavWindow && !g.NavWindow->WasActive)
|
||||
for (int i = g.Windows.Size-1; i >= 0; i--)
|
||||
if (g.Windows[i]->WasActive && !(g.Windows[i]->Flags & ImGuiWindowFlags_ChildWindow))
|
||||
{
|
||||
FocusWindow(g.Windows[i]);
|
||||
break;
|
||||
}
|
||||
FocusPreviousWindow();
|
||||
|
||||
// No window should be open at the beginning of the frame.
|
||||
// But in order to allow the user to call NewFrame() multiple times without calling Render(), we are doing an explicit clear.
|
||||
@ -4833,6 +4833,17 @@ void ImGui::FocusWindow(ImGuiWindow* window)
|
||||
g.Windows.push_back(window);
|
||||
}
|
||||
|
||||
void ImGui::FocusPreviousWindow()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
for (int i = g.Windows.Size - 1; i >= 0; i--)
|
||||
if (g.Windows[i]->WasActive && !(g.Windows[i]->Flags & ImGuiWindowFlags_ChildWindow))
|
||||
{
|
||||
FocusWindow(g.Windows[i]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void ImGui::PushItemWidth(float item_width)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
|
Loading…
Reference in New Issue
Block a user