mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
Merge branch 'master' into drag_and_drop
# Conflicts: # imgui.cpp # imgui.h # imgui_internal.h
This commit is contained in:
@ -1289,7 +1289,7 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
ImGui::SliderInt("Lines", &lines, 1, 15);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2.0f, 1.0f));
|
||||
ImGui::BeginChild("scrolling", ImVec2(0, ImGui::GetItemsLineHeightWithSpacing()*7 + 30), true, ImGuiWindowFlags_HorizontalScrollbar);
|
||||
ImGui::BeginChild("scrolling", ImVec2(0, ImGui::GetFrameHeightWithSpacing()*7 + 30), true, ImGuiWindowFlags_HorizontalScrollbar);
|
||||
for (int line = 0; line < lines; line++)
|
||||
{
|
||||
// Display random stuff (for the sake of this trivial demo we are using basic Button+SameLine. If you want to create your own time line for a real application you may be better off
|
||||
@ -1721,7 +1721,7 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGui::Checkbox("io.MouseDrawCursor", &io.MouseDrawCursor);
|
||||
ImGui::SameLine(); ShowHelpMarker("Request ImGui to render a mouse cursor for you in software. Note that a mouse cursor rendered via regular GPU rendering will feel more laggy than hardware cursor, but will be more in sync with your other visuals.");
|
||||
ImGui::SameLine(); ShowHelpMarker("Request ImGui to render a mouse cursor for you in software. Note that a mouse cursor rendered via your application GPU rendering path will feel more laggy than hardware cursor, but will be more in sync with your other visuals.\n\nSome desktop applications may use both kinds of cursors (e.g. enable software cursor only when resizing/dragging something).");
|
||||
|
||||
ImGui::Text("WantCaptureMouse: %d", io.WantCaptureMouse);
|
||||
ImGui::Text("WantCaptureKeyboard: %d", io.WantCaptureKeyboard);
|
||||
@ -1798,18 +1798,38 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
if (ImGui::TreeNode("Hovering"))
|
||||
if (ImGui::TreeNode("Focused & Hovered Test"))
|
||||
{
|
||||
static bool embed_all_inside_a_child_window = false;
|
||||
ImGui::Checkbox("Embed everything inside a child window (for additional testing)", &embed_all_inside_a_child_window);
|
||||
if (embed_all_inside_a_child_window)
|
||||
ImGui::BeginChild("embeddingchild", ImVec2(0, ImGui::GetFontSize() * 25), true);
|
||||
|
||||
// Testing IsWindowFocused() function with its various flags (note that the flags can be combined)
|
||||
ImGui::BulletText(
|
||||
"IsWindowFocused() = %d\n"
|
||||
"IsWindowFocused(_ChildWindows) = %d\n"
|
||||
"IsWindowFocused(_ChildWindows|_RootWindow) = %d\n"
|
||||
"IsWindowFocused(_RootWindow) = %d\n",
|
||||
ImGui::IsWindowFocused(),
|
||||
ImGui::IsWindowFocused(ImGuiHoveredFlags_ChildWindows),
|
||||
ImGui::IsWindowFocused(ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_RootWindow),
|
||||
ImGui::IsWindowFocused(ImGuiHoveredFlags_RootWindow));
|
||||
|
||||
// Testing IsWindowHovered() function with its various flags (note that the flags can be combined)
|
||||
ImGui::BulletText(
|
||||
"IsWindowHovered() = %d\n"
|
||||
"IsWindowHovered(_AllowWhenBlockedByPopup) = %d\n"
|
||||
"IsWindowHovered(_AllowWhenBlockedByActiveItem) = %d\n"
|
||||
"IsWindowHovered(_FlattenChilds) = %d\n",
|
||||
"IsWindowHovered(_ChildWindows) = %d\n"
|
||||
"IsWindowHovered(_ChildWindows|_RootWindow) = %d\n"
|
||||
"IsWindowHovered(_RootWindow) = %d\n",
|
||||
ImGui::IsWindowHovered(),
|
||||
ImGui::IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup),
|
||||
ImGui::IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem),
|
||||
ImGui::IsWindowHovered(ImGuiHoveredFlags_FlattenChilds));
|
||||
ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows),
|
||||
ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_RootWindow),
|
||||
ImGui::IsWindowHovered(ImGuiHoveredFlags_RootWindow));
|
||||
|
||||
// Testing IsItemHovered() function (because BulletText is an item itself and that would affect the output of IsItemHovered, we pass all lines in a single items to shorten the code)
|
||||
ImGui::Button("ITEM");
|
||||
@ -1825,6 +1845,13 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenOverlapped),
|
||||
ImGui::IsItemHovered(ImGuiHoveredFlags_RectOnly));
|
||||
|
||||
ImGui::BeginChild("child", ImVec2(0,50), true);
|
||||
ImGui::Text("This is another child window for testing IsWindowHovered() flags.");
|
||||
ImGui::EndChild();
|
||||
|
||||
if (embed_all_inside_a_child_window)
|
||||
EndChild();
|
||||
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
@ -1832,7 +1859,8 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
{
|
||||
ImGui::TextWrapped("You can use ImGui::GetMouseDragDelta(0) to query for the dragged amount on any widget.");
|
||||
for (int button = 0; button < 3; button++)
|
||||
ImGui::Text("IsMouseDragging(%d) = %d", button, ImGui::IsMouseDragging(button));
|
||||
ImGui::Text("IsMouseDragging(%d):\n w/ default threshold: %d,\n w/ zero threshold: %d\n w/ large threshold: %d",
|
||||
button, ImGui::IsMouseDragging(button), ImGui::IsMouseDragging(button, 0.0f), ImGui::IsMouseDragging(button, 20.0f));
|
||||
ImGui::Button("Drag Me");
|
||||
if (ImGui::IsItemActive())
|
||||
{
|
||||
@ -1841,6 +1869,9 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
draw_list->PushClipRectFullScreen();
|
||||
draw_list->AddLine(ImGui::CalcItemRectClosestPoint(io.MousePos, true, -2.0f), io.MousePos, ImColor(ImGui::GetStyle().Colors[ImGuiCol_Button]), 4.0f);
|
||||
draw_list->PopClipRect();
|
||||
|
||||
// Drag operations gets "unlocked" when the mouse has moved past a certain threshold (the default threshold is stored in io.MouseDragThreshold)
|
||||
// You can request a lower or higher threshold using the second parameter of IsMouseDragging() and GetMouseDragDelta()
|
||||
ImVec2 value_raw = ImGui::GetMouseDragDelta(0, 0.0f);
|
||||
ImVec2 value_with_lock_threshold = ImGui::GetMouseDragDelta(0);
|
||||
ImVec2 mouse_delta = io.MouseDelta;
|
||||
@ -2507,7 +2538,7 @@ struct ExampleAppConsole
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::BeginChild("ScrollingRegion", ImVec2(0, -ImGui::GetStyle().ItemSpacing.y - ImGui::GetItemsLineHeightWithSpacing()), false, ImGuiWindowFlags_HorizontalScrollbar); // Leave room for 1 separator + 1 InputText
|
||||
ImGui::BeginChild("ScrollingRegion", ImVec2(0, -ImGui::GetStyle().ItemSpacing.y - ImGui::GetFrameHeightWithSpacing()), false, ImGuiWindowFlags_HorizontalScrollbar); // Leave room for 1 separator + 1 InputText
|
||||
if (ImGui::BeginPopupContextWindow())
|
||||
{
|
||||
if (ImGui::Selectable("Clear")) ClearLog();
|
||||
@ -2829,7 +2860,7 @@ static void ShowExampleAppLayout(bool* p_open)
|
||||
|
||||
// right
|
||||
ImGui::BeginGroup();
|
||||
ImGui::BeginChild("item view", ImVec2(0, -ImGui::GetItemsLineHeightWithSpacing())); // Leave room for 1 line below us
|
||||
ImGui::BeginChild("item view", ImVec2(0, -ImGui::GetFrameHeightWithSpacing())); // Leave room for 1 line below us
|
||||
ImGui::Text("MyObject: %d", selected);
|
||||
ImGui::Separator();
|
||||
ImGui::TextWrapped("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ");
|
||||
|
Reference in New Issue
Block a user