mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
Demo: moved WantCapture overrides items + various comments related to ImGuiKey, ImGuiMod
This commit is contained in:
@ -5727,18 +5727,6 @@ static void ShowDemoWindowInputs()
|
||||
IMGUI_DEMO_MARKER("Inputs & Focus/Outputs");
|
||||
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
||||
if (ImGui::TreeNode("Outputs"))
|
||||
{
|
||||
ImGui::Text("io.WantCaptureMouse: %d", io.WantCaptureMouse);
|
||||
ImGui::Text("io.WantCaptureMouseUnlessPopupClose: %d", io.WantCaptureMouseUnlessPopupClose);
|
||||
ImGui::Text("io.WantCaptureKeyboard: %d", io.WantCaptureKeyboard);
|
||||
ImGui::Text("io.WantTextInput: %d", io.WantTextInput);
|
||||
ImGui::Text("io.WantSetMousePos: %d", io.WantSetMousePos);
|
||||
ImGui::Text("io.NavActive: %d, io.NavVisible: %d", io.NavActive, io.NavVisible);
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
IMGUI_DEMO_MARKER("Inputs & Focus/IO Output: Capture override");
|
||||
if (ImGui::TreeNode("IO Output: Capture override"))
|
||||
{
|
||||
HelpMarker(
|
||||
"The value of io.WantCaptureMouse and io.WantCaptureKeyboard are normally set by Dear ImGui "
|
||||
@ -5747,28 +5735,35 @@ static void ShowDemoWindowInputs()
|
||||
"The most typical case is: when hovering a window, Dear ImGui set io.WantCaptureMouse to true, "
|
||||
"and underlying application should ignore mouse inputs (in practice there are many and more subtle "
|
||||
"rules leading to how those flags are set).");
|
||||
|
||||
ImGui::Text("io.WantCaptureMouse: %d", io.WantCaptureMouse);
|
||||
ImGui::Text("io.WantCaptureMouseUnlessPopupClose: %d", io.WantCaptureMouseUnlessPopupClose);
|
||||
ImGui::Text("io.WantCaptureKeyboard: %d", io.WantCaptureKeyboard);
|
||||
ImGui::Text("io.WantTextInput: %d", io.WantTextInput);
|
||||
ImGui::Text("io.WantSetMousePos: %d", io.WantSetMousePos);
|
||||
ImGui::Text("io.NavActive: %d, io.NavVisible: %d", io.NavActive, io.NavVisible);
|
||||
|
||||
HelpMarker(
|
||||
"Hovering the colored canvas will override io.WantCaptureXXX fields.\n"
|
||||
"Notice how normally (when set to none), the value of io.WantCaptureKeyboard would be false when hovering and true when clicking.");
|
||||
static int capture_override_mouse = -1;
|
||||
static int capture_override_keyboard = -1;
|
||||
const char* capture_override_desc[] = { "None", "Set to false", "Set to true" };
|
||||
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 15);
|
||||
ImGui::SliderInt("SetNextFrameWantCaptureMouse()", &capture_override_mouse, -1, +1, capture_override_desc[capture_override_mouse + 1], ImGuiSliderFlags_AlwaysClamp);
|
||||
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 15);
|
||||
ImGui::SliderInt("SetNextFrameWantCaptureKeyboard()", &capture_override_keyboard, -1, +1, capture_override_desc[capture_override_keyboard + 1], ImGuiSliderFlags_AlwaysClamp);
|
||||
IMGUI_DEMO_MARKER("Inputs & Focus/Outputs/Capture override");
|
||||
if (ImGui::TreeNode("WantCapture override"))
|
||||
{
|
||||
HelpMarker(
|
||||
"Hovering the colored canvas will override io.WantCaptureXXX fields.\n"
|
||||
"Notice how normally (when set to none), the value of io.WantCaptureKeyboard would be false when hovering and true when clicking.");
|
||||
static int capture_override_mouse = -1;
|
||||
static int capture_override_keyboard = -1;
|
||||
const char* capture_override_desc[] = { "None", "Set to false", "Set to true" };
|
||||
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 15);
|
||||
ImGui::SliderInt("SetNextFrameWantCaptureMouse() on hover", &capture_override_mouse, -1, +1, capture_override_desc[capture_override_mouse + 1], ImGuiSliderFlags_AlwaysClamp);
|
||||
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 15);
|
||||
ImGui::SliderInt("SetNextFrameWantCaptureKeyboard() on hover", &capture_override_keyboard, -1, +1, capture_override_desc[capture_override_keyboard + 1], ImGuiSliderFlags_AlwaysClamp);
|
||||
|
||||
ImGui::ColorButton("##panel", ImVec4(0.7f, 0.1f, 0.7f, 1.0f), ImGuiColorEditFlags_NoTooltip | ImGuiColorEditFlags_NoDragDrop, ImVec2(256.0f, 192.0f)); // Dummy item
|
||||
if (ImGui::IsItemHovered() && capture_override_mouse != -1)
|
||||
ImGui::SetNextFrameWantCaptureMouse(capture_override_mouse == 1);
|
||||
if (ImGui::IsItemHovered() && capture_override_keyboard != -1)
|
||||
ImGui::SetNextFrameWantCaptureKeyboard(capture_override_keyboard == 1);
|
||||
ImGui::ColorButton("##panel", ImVec4(0.7f, 0.1f, 0.7f, 1.0f), ImGuiColorEditFlags_NoTooltip | ImGuiColorEditFlags_NoDragDrop, ImVec2(128.0f, 96.0f)); // Dummy item
|
||||
if (ImGui::IsItemHovered() && capture_override_mouse != -1)
|
||||
ImGui::SetNextFrameWantCaptureMouse(capture_override_mouse == 1);
|
||||
if (ImGui::IsItemHovered() && capture_override_keyboard != -1)
|
||||
ImGui::SetNextFrameWantCaptureKeyboard(capture_override_keyboard == 1);
|
||||
|
||||
ImGui::TreePop();
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user