Demonstrate creating a window covering the entire screen/viewport
| 9747 | |
| 9748 | // Demonstrate creating a window covering the entire screen/viewport |
| 9749 | static void ShowExampleAppFullscreen(bool* p_open) |
| 9750 | { |
| 9751 | static bool use_work_area = true; |
| 9752 | static ImGuiWindowFlags flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings; |
| 9753 | |
| 9754 | // We demonstrate using the full viewport area or the work area (without menu-bars, task-bars etc.) |
| 9755 | // Based on your use case you may want one or the other. |
| 9756 | const ImGuiViewport* viewport = ImGui::GetMainViewport(); |
| 9757 | ImGui::SetNextWindowPos(use_work_area ? viewport->WorkPos : viewport->Pos); |
| 9758 | ImGui::SetNextWindowSize(use_work_area ? viewport->WorkSize : viewport->Size); |
| 9759 | |
| 9760 | if (ImGui::Begin("Example: Fullscreen window", p_open, flags)) |
| 9761 | { |
| 9762 | ImGui::Checkbox("Use work area instead of main area", &use_work_area); |
| 9763 | ImGui::SameLine(); |
| 9764 | 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."); |
| 9765 | |
| 9766 | ImGui::CheckboxFlags("ImGuiWindowFlags_NoBackground", &flags, ImGuiWindowFlags_NoBackground); |
| 9767 | ImGui::CheckboxFlags("ImGuiWindowFlags_NoDecoration", &flags, ImGuiWindowFlags_NoDecoration); |
| 9768 | ImGui::Indent(); |
| 9769 | ImGui::CheckboxFlags("ImGuiWindowFlags_NoTitleBar", &flags, ImGuiWindowFlags_NoTitleBar); |
| 9770 | ImGui::CheckboxFlags("ImGuiWindowFlags_NoCollapse", &flags, ImGuiWindowFlags_NoCollapse); |
| 9771 | ImGui::CheckboxFlags("ImGuiWindowFlags_NoScrollbar", &flags, ImGuiWindowFlags_NoScrollbar); |
| 9772 | ImGui::Unindent(); |
| 9773 | |
| 9774 | if (p_open && ImGui::Button("Close this window")) |
| 9775 | *p_open = false; |
| 9776 | } |
| 9777 | ImGui::End(); |
| 9778 | } |
| 9779 | |
| 9780 | //----------------------------------------------------------------------------- |
| 9781 | // [SECTION] Example App: Manipulating Window Titles / ShowExampleAppWindowTitles() |
no test coverage detected