mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-22 07:36:35 +00:00
Merge branch 'viewport' into docking
# Conflicts: # imgui_demo.cpp
This commit is contained in:
commit
9b09c7597f
@ -7114,7 +7114,7 @@ void ImGui::ClosePopupsOverWindow(ImGuiWindow* ref_window)
|
|||||||
int n = 0;
|
int n = 0;
|
||||||
if (ref_window)
|
if (ref_window)
|
||||||
{
|
{
|
||||||
for (n = 0; n < g.OpenPopupStack.Size; n++)
|
for (; n < g.OpenPopupStack.Size; n++)
|
||||||
{
|
{
|
||||||
ImGuiPopupRef& popup = g.OpenPopupStack[n];
|
ImGuiPopupRef& popup = g.OpenPopupStack[n];
|
||||||
if (!popup.Window)
|
if (!popup.Window)
|
||||||
@ -7131,7 +7131,7 @@ void ImGui::ClosePopupsOverWindow(ImGuiWindow* ref_window)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (n < g.OpenPopupStack.Size) // This test is not required but it allows to set a convenient breakpoint on the block below
|
if (n < g.OpenPopupStack.Size) // This test is not required but it allows to set a convenient breakpoint on the statement below
|
||||||
ClosePopupToLevel(n);
|
ClosePopupToLevel(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -13491,7 +13491,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
ImGui::Text("NavDisableHighlight: %d, NavDisableMouseHover: %d", g.NavDisableHighlight, g.NavDisableMouseHover);
|
ImGui::Text("NavDisableHighlight: %d, NavDisableMouseHover: %d", g.NavDisableHighlight, g.NavDisableMouseHover);
|
||||||
ImGui::Text("NavWindowingTarget: '%s'", g.NavWindowingTarget ? g.NavWindowingTarget->Name : "NULL");
|
ImGui::Text("NavWindowingTarget: '%s'", g.NavWindowingTarget ? g.NavWindowingTarget->Name : "NULL");
|
||||||
ImGui::Text("DragDrop: %d, SourceId = 0x%08X, Payload \"%s\" (%d bytes)", g.DragDropActive, g.DragDropPayload.SourceId, g.DragDropPayload.DataType, g.DragDropPayload.DataSize);
|
ImGui::Text("DragDrop: %d, SourceId = 0x%08X, Payload \"%s\" (%d bytes)", g.DragDropActive, g.DragDropPayload.SourceId, g.DragDropPayload.DataType, g.DragDropPayload.DataSize);
|
||||||
ImGui::Text("MouseViewport: 0x%08X (UserHovered 0x%08X, LastHovered 0x%08X)", g.MouseViewport->ID, g.IO.MouseHoveredViewport, g.MouseLastHoveredViewport->ID);
|
ImGui::Text("MouseViewport: 0x%08X (UserHovered 0x%08X, LastHovered 0x%08X)", g.MouseViewport->ID, g.IO.MouseHoveredViewport, g.MouseLastHoveredViewport ? g.MouseLastHoveredViewport->ID : 0);
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
25
imgui.h
25
imgui.h
@ -233,9 +233,12 @@ namespace ImGui
|
|||||||
// Windows
|
// Windows
|
||||||
// - Begin() = push window to the stack and start appending to it. End() = pop window from the stack.
|
// - Begin() = push window to the stack and start appending to it. End() = pop window from the stack.
|
||||||
// - You may append multiple times to the same window during the same frame.
|
// - You may append multiple times to the same window during the same frame.
|
||||||
// - Passing 'bool* p_open != NULL' shows a window-closing widget in the upper-right corner of the window, which clicking will set the boolean to false when clicked.
|
// - Passing 'bool* p_open != NULL' shows a window-closing widget in the upper-right corner of the window,
|
||||||
// - Begin() return false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting anything to the window.
|
// which clicking will set the boolean to false when clicked.
|
||||||
// Always call a matching End() for each Begin() call, regardless of its return value [this is due to legacy reason and is inconsistent with most other functions such as BeginMenu/EndMenu, BeginPopup/EndPopup, etc. where the EndXXX call should only be called if the corresponding BeginXXX function returned true.]
|
// - Begin() return false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting
|
||||||
|
// anything to the window. Always call a matching End() for each Begin() call, regardless of its return value!
|
||||||
|
// [this is due to legacy reason and is inconsistent with most other functions such as BeginMenu/EndMenu, BeginPopup/EndPopup, etc. where the EndXXX call should only be called if the corresponding BeginXXX function returned true.]
|
||||||
|
// - Note that the bottom of window stack always contains a window called "Debug".
|
||||||
IMGUI_API bool Begin(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0);
|
IMGUI_API bool Begin(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0);
|
||||||
IMGUI_API void End();
|
IMGUI_API void End();
|
||||||
|
|
||||||
@ -249,6 +252,7 @@ namespace ImGui
|
|||||||
IMGUI_API void EndChild();
|
IMGUI_API void EndChild();
|
||||||
|
|
||||||
// Windows Utilities
|
// Windows Utilities
|
||||||
|
// "current window" = the window we are appending into while inside a Begin()/End() block. "next window" = next window we will Begin() into.
|
||||||
IMGUI_API bool IsWindowAppearing();
|
IMGUI_API bool IsWindowAppearing();
|
||||||
IMGUI_API bool IsWindowCollapsed();
|
IMGUI_API bool IsWindowCollapsed();
|
||||||
IMGUI_API bool IsWindowFocused(ImGuiFocusedFlags flags=0); // is current window focused? or its root/child, depending on flags. see flags for options.
|
IMGUI_API bool IsWindowFocused(ImGuiFocusedFlags flags=0); // is current window focused? or its root/child, depending on flags. see flags for options.
|
||||||
@ -499,7 +503,7 @@ namespace ImGui
|
|||||||
IMGUI_API void PlotHistogram(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0), int stride = sizeof(float));
|
IMGUI_API void PlotHistogram(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0), int stride = sizeof(float));
|
||||||
IMGUI_API void PlotHistogram(const char* label, float(*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0));
|
IMGUI_API void PlotHistogram(const char* label, float(*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0));
|
||||||
|
|
||||||
// Widgets: Value() Helpers. Output single value in "name: value" format (tip: freely declare more in your code to handle your types. you can add functions to the ImGui namespace)
|
// Widgets: Value() Helpers. Simple shortcut to calling Text() with a format string. Output single value in "name: value" format (tip: freely declare more in your code to handle your types. you can add functions to the ImGui namespace)
|
||||||
IMGUI_API void Value(const char* prefix, bool b);
|
IMGUI_API void Value(const char* prefix, bool b);
|
||||||
IMGUI_API void Value(const char* prefix, int v);
|
IMGUI_API void Value(const char* prefix, int v);
|
||||||
IMGUI_API void Value(const char* prefix, unsigned int v);
|
IMGUI_API void Value(const char* prefix, unsigned int v);
|
||||||
@ -588,12 +592,13 @@ namespace ImGui
|
|||||||
IMGUI_API void PopClipRect();
|
IMGUI_API void PopClipRect();
|
||||||
|
|
||||||
// Focus, Activation
|
// Focus, Activation
|
||||||
// (Prefer using "SetItemDefaultFocus()" over "if (IsWindowAppearing()) SetScrollHereY()" when applicable to signify "this is the default item")
|
// Prefer using "SetItemDefaultFocus()" over "if (IsWindowAppearing()) SetScrollHereY()" when applicable to signify "this is the default item"
|
||||||
IMGUI_API void SetItemDefaultFocus(); // make last item the default focused item of a window.
|
IMGUI_API void SetItemDefaultFocus(); // make last item the default focused item of a window.
|
||||||
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 -1 to access previous 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 -1 to access previous widget.
|
||||||
|
|
||||||
// Item/Widgets Utilities
|
// Item/Widgets Utilities
|
||||||
// See Demo Window under "Widgets->Querying Status" for an interactive visualization of many of those functions.
|
// Most of the functions are referring to the last/previous item we submitted.
|
||||||
|
// See Demo Window under "Widgets->Querying Status" for an interactive visualization of most of those functions.
|
||||||
IMGUI_API bool IsItemHovered(ImGuiHoveredFlags flags = 0); // is the last item hovered? (and usable, aka not blocked by a popup, etc.). See ImGuiHoveredFlags for more options.
|
IMGUI_API bool IsItemHovered(ImGuiHoveredFlags flags = 0); // is the last item hovered? (and usable, aka not blocked by a popup, etc.). See ImGuiHoveredFlags for more options.
|
||||||
IMGUI_API bool IsItemActive(); // is the last item active? (e.g. button being held, text field being edited. This will continuously return true while holding mouse button on an item. Items that don't interact will always return false)
|
IMGUI_API bool IsItemActive(); // is the last item active? (e.g. button being held, text field being edited. This will continuously return true while holding mouse button on an item. Items that don't interact will always return false)
|
||||||
IMGUI_API bool IsItemFocused(); // is the last item focused for keyboard/gamepad navigation?
|
IMGUI_API bool IsItemFocused(); // is the last item focused for keyboard/gamepad navigation?
|
||||||
@ -613,8 +618,8 @@ namespace ImGui
|
|||||||
// Miscellaneous Utilities
|
// Miscellaneous Utilities
|
||||||
IMGUI_API bool IsRectVisible(const ImVec2& size); // test if rectangle (of given size, starting from cursor position) is visible / not clipped.
|
IMGUI_API bool IsRectVisible(const ImVec2& size); // test if rectangle (of given size, starting from cursor position) is visible / not clipped.
|
||||||
IMGUI_API bool IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max); // test if rectangle (in screen space) is visible / not clipped. to perform coarse clipping on user's side.
|
IMGUI_API bool IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max); // test if rectangle (in screen space) is visible / not clipped. to perform coarse clipping on user's side.
|
||||||
IMGUI_API double GetTime();
|
IMGUI_API double GetTime(); // get global imgui time. incremented by io.DeltaTime every frame.
|
||||||
IMGUI_API int GetFrameCount();
|
IMGUI_API int GetFrameCount(); // get global imgui frame count. incremented by 1 every frame.
|
||||||
IMGUI_API ImDrawList* GetOverlayDrawList(); // get overlay draw list for the viewport associated to the current window. this draw list will be the last rendered. useful to quickly draw overlays shapes/text.
|
IMGUI_API ImDrawList* GetOverlayDrawList(); // get overlay draw list for the viewport associated to the current window. this draw list will be the last rendered. useful to quickly draw overlays shapes/text.
|
||||||
IMGUI_API ImDrawList* GetOverlayDrawList(ImGuiViewport* viewport); // get overlay draw list for the given viewport.
|
IMGUI_API ImDrawList* GetOverlayDrawList(ImGuiViewport* viewport); // get overlay draw list for the given viewport.
|
||||||
IMGUI_API ImDrawListSharedData* GetDrawListSharedData(); // you may use this when creating your own ImDrawList instances
|
IMGUI_API ImDrawListSharedData* GetDrawListSharedData(); // you may use this when creating your own ImDrawList instances
|
||||||
@ -652,8 +657,8 @@ namespace ImGui
|
|||||||
IMGUI_API void ResetMouseDragDelta(int button = 0); //
|
IMGUI_API void ResetMouseDragDelta(int button = 0); //
|
||||||
IMGUI_API ImGuiMouseCursor GetMouseCursor(); // get desired cursor type, reset in ImGui::NewFrame(), this is updated during the frame. valid before Render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you
|
IMGUI_API ImGuiMouseCursor GetMouseCursor(); // get desired cursor type, reset in ImGui::NewFrame(), this is updated during the frame. valid before Render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you
|
||||||
IMGUI_API void SetMouseCursor(ImGuiMouseCursor type); // set desired cursor type
|
IMGUI_API void SetMouseCursor(ImGuiMouseCursor type); // set desired cursor type
|
||||||
IMGUI_API void CaptureKeyboardFromApp(bool capture = true); // manually override io.WantCaptureKeyboard flag next frame (said flag is entirely left for your application to handle). e.g. force capture keyboard when your widget is being hovered.
|
IMGUI_API void CaptureKeyboardFromApp(bool want_capture_keyboard_value = true); // attention: misleading name! manually override io.WantCaptureKeyboard flag next frame (said flag is entirely left for your application to handle). e.g. force capture keyboard when your widget is being hovered. This is equivalent to setting "io.WantCaptureKeyboard = want_capture_keyboard_value"; after the next NewFrame() call.
|
||||||
IMGUI_API void CaptureMouseFromApp(bool capture = true); // manually override io.WantCaptureMouse flag next frame (said flag is entirely left for your application to handle).
|
IMGUI_API void CaptureMouseFromApp(bool want_capture_mouse_value = true); // attention: misleading name! manually override io.WantCaptureMouse flag next frame (said flag is entirely left for your application to handle). This is equivalent to setting "io.WantCaptureMouse = want_capture_mouse_value;" after the next NewFrame() call.
|
||||||
|
|
||||||
// Clipboard Utilities (also see the LogToClipboard() function to capture or output text data to the clipboard)
|
// Clipboard Utilities (also see the LogToClipboard() function to capture or output text data to the clipboard)
|
||||||
IMGUI_API const char* GetClipboardText();
|
IMGUI_API const char* GetClipboardText();
|
||||||
|
@ -3497,7 +3497,7 @@ static void ShowExampleAppLog(bool* p_open)
|
|||||||
static void ShowExampleAppLayout(bool* p_open)
|
static void ShowExampleAppLayout(bool* p_open)
|
||||||
{
|
{
|
||||||
ImGui::SetNextWindowSize(ImVec2(500, 440), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(500, 440), ImGuiCond_FirstUseEver);
|
||||||
if (ImGui::Begin("Example: Layout", p_open, ImGuiWindowFlags_MenuBar))
|
if (ImGui::Begin("Example: Simple layout", p_open, ImGuiWindowFlags_MenuBar))
|
||||||
{
|
{
|
||||||
if (ImGui::BeginMenuBar())
|
if (ImGui::BeginMenuBar())
|
||||||
{
|
{
|
||||||
@ -3774,7 +3774,7 @@ static void ShowExampleAppSimpleOverlay(bool* p_open)
|
|||||||
ImGui::SetNextWindowViewport(viewport->ID);
|
ImGui::SetNextWindowViewport(viewport->ID);
|
||||||
}
|
}
|
||||||
ImGui::SetNextWindowBgAlpha(0.3f); // Transparent background
|
ImGui::SetNextWindowBgAlpha(0.3f); // Transparent background
|
||||||
if (ImGui::Begin("Example: Simple Overlay", p_open, (corner != -1 ? ImGuiWindowFlags_NoMove : 0) | ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav))
|
if (ImGui::Begin("Example: Simple overlay", p_open, (corner != -1 ? ImGuiWindowFlags_NoMove : 0) | ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav))
|
||||||
{
|
{
|
||||||
ImGui::Text("Simple overlay\n" "in the corner of the screen.\n" "(right-click to change position)");
|
ImGui::Text("Simple overlay\n" "in the corner of the screen.\n" "(right-click to change position)");
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
Loading…
Reference in New Issue
Block a user