Demonstrate creating a window covering the entire screen/viewport
| 7828 | |
| 7829 | // Demonstrate creating a window covering the entire screen/viewport |
| 7830 | static void ShowExampleAppFullscreen(bool* p_open) |
| 7831 | { |
| 7832 | static bool use_work_area = true; |
| 7833 | static ImGuiWindowFlags flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings; |
| 7834 | |
| 7835 | // We demonstrate using the full viewport area or the work area (without menu-bars, task-bars etc.) |
| 7836 | // Based on your use case you may want one or the other. |
| 7837 | const ImGuiViewport* viewport = ImGui::GetMainViewport(); |
| 7838 | ImGui::SetNextWindowPos(use_work_area ? viewport->WorkPos : viewport->Pos); |
| 7839 | ImGui::SetNextWindowSize(use_work_area ? viewport->WorkSize : viewport->Size); |
| 7840 | |
| 7841 | if (ImGui::Begin("Example: Fullscreen window", p_open, flags)) |
| 7842 | { |
| 7843 | ImGui::Checkbox("Use work area instead of main area", &use_work_area); |
| 7844 | ImGui::SameLine(); |
| 7845 | HelpMarker("Main Area = entire viewport,\nWork Area = entire viewport minus sections used by the main menu bars, task bars etc.\n\nEnable the main-menu bar in Examples menu to see the difference."); |
| 7846 | |
| 7847 | ImGui::CheckboxFlags("ImGuiWindowFlags_NoBackground", &flags, ImGuiWindowFlags_NoBackground); |
| 7848 | ImGui::CheckboxFlags("ImGuiWindowFlags_NoDecoration", &flags, ImGuiWindowFlags_NoDecoration); |
| 7849 | ImGui::Indent(); |
| 7850 | ImGui::CheckboxFlags("ImGuiWindowFlags_NoTitleBar", &flags, ImGuiWindowFlags_NoTitleBar); |
| 7851 | ImGui::CheckboxFlags("ImGuiWindowFlags_NoCollapse", &flags, ImGuiWindowFlags_NoCollapse); |
| 7852 | ImGui::CheckboxFlags("ImGuiWindowFlags_NoScrollbar", &flags, ImGuiWindowFlags_NoScrollbar); |
| 7853 | ImGui::Unindent(); |
| 7854 | |
| 7855 | if (p_open && ImGui::Button("Close this window")) |
| 7856 | *p_open = false; |
| 7857 | } |
| 7858 | ImGui::End(); |
| 7859 | } |
| 7860 | |
| 7861 | //----------------------------------------------------------------------------- |
| 7862 | // [SECTION] Example App: Manipulating Window Titles / ShowExampleAppWindowTitles() |
no test coverage detected