| 5634 | } |
| 5635 | |
| 5636 | static void ShowDemoWindowMisc() |
| 5637 | { |
| 5638 | IMGUI_DEMO_MARKER("Filtering"); |
| 5639 | if (ImGui::CollapsingHeader("Filtering")) |
| 5640 | { |
| 5641 | // Helper class to easy setup a text filter. |
| 5642 | // You may want to implement a more feature-full filtering scheme in your own application. |
| 5643 | static ImGuiTextFilter filter; |
| 5644 | ImGui::Text("Filter usage:\n" |
| 5645 | " \"\" display all lines\n" |
| 5646 | " \"xxx\" display lines containing \"xxx\"\n" |
| 5647 | " \"xxx,yyy\" display lines containing \"xxx\" or \"yyy\"\n" |
| 5648 | " \"-xxx\" hide lines containing \"xxx\""); |
| 5649 | filter.Draw(); |
| 5650 | const char* lines[] = { "aaa1.c", "bbb1.c", "ccc1.c", "aaa2.cpp", "bbb2.cpp", "ccc2.cpp", "abc.h", "hello, world" }; |
| 5651 | for (int i = 0; i < IM_ARRAYSIZE(lines); i++) |
| 5652 | if (filter.PassFilter(lines[i])) |
| 5653 | ImGui::BulletText("%s", lines[i]); |
| 5654 | } |
| 5655 | |
| 5656 | IMGUI_DEMO_MARKER("Inputs, Navigation & Focus"); |
| 5657 | if (ImGui::CollapsingHeader("Inputs, Navigation & Focus")) |
| 5658 | { |
| 5659 | ImGuiIO& io = ImGui::GetIO(); |
| 5660 | |
| 5661 | // Display ImGuiIO output flags |
| 5662 | ImGui::Text("WantCaptureMouse: %d", io.WantCaptureMouse); |
| 5663 | ImGui::Text("WantCaptureMouseUnlessPopupClose: %d", io.WantCaptureMouseUnlessPopupClose); |
| 5664 | ImGui::Text("WantCaptureKeyboard: %d", io.WantCaptureKeyboard); |
| 5665 | ImGui::Text("WantTextInput: %d", io.WantTextInput); |
| 5666 | ImGui::Text("WantSetMousePos: %d", io.WantSetMousePos); |
| 5667 | ImGui::Text("NavActive: %d, NavVisible: %d", io.NavActive, io.NavVisible); |
| 5668 | |
| 5669 | // Display Mouse state |
| 5670 | IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Mouse State"); |
| 5671 | if (ImGui::TreeNode("Mouse State")) |
| 5672 | { |
| 5673 | if (ImGui::IsMousePosValid()) |
| 5674 | ImGui::Text("Mouse pos: (%g, %g)", io.MousePos.x, io.MousePos.y); |
| 5675 | else |
| 5676 | ImGui::Text("Mouse pos: <INVALID>"); |
| 5677 | ImGui::Text("Mouse delta: (%g, %g)", io.MouseDelta.x, io.MouseDelta.y); |
| 5678 | |
| 5679 | int count = IM_ARRAYSIZE(io.MouseDown); |
| 5680 | ImGui::Text("Mouse down:"); for (int i = 0; i < count; i++) if (ImGui::IsMouseDown(i)) { ImGui::SameLine(); ImGui::Text("b%d (%.02f secs)", i, io.MouseDownDuration[i]); } |
| 5681 | ImGui::Text("Mouse clicked:"); for (int i = 0; i < count; i++) if (ImGui::IsMouseClicked(i)) { ImGui::SameLine(); ImGui::Text("b%d (%d)", i, ImGui::GetMouseClickedCount(i)); } |
| 5682 | ImGui::Text("Mouse released:"); for (int i = 0; i < count; i++) if (ImGui::IsMouseReleased(i)) { ImGui::SameLine(); ImGui::Text("b%d", i); } |
| 5683 | ImGui::Text("Mouse wheel: %.1f", io.MouseWheel); |
| 5684 | ImGui::Text("Pen Pressure: %.1f", io.PenPressure); // Note: currently unused |
| 5685 | ImGui::TreePop(); |
| 5686 | } |
| 5687 | |
| 5688 | // Display Keyboard/Mouse state |
| 5689 | IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Keyboard & Navigation State"); |
| 5690 | if (ImGui::TreeNode("Keyboard & Navigation State")) |
| 5691 | { |
| 5692 | ImGui::Text("Keys down:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (ImGui::IsKeyDown(i)) { ImGui::SameLine(); ImGui::Text("%d (0x%X) (%.02f secs)", i, i, io.KeysDownDuration[i]); } |
| 5693 | ImGui::Text("Keys pressed:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (ImGui::IsKeyPressed(i)) { ImGui::SameLine(); ImGui::Text("%d (0x%X)", i, i); } |
no test coverage detected