Merge branch 'features/viewport_in_master' into docking (WIP need adding code for new ImGuiViewportFlags values)

# Conflicts:
#	imgui.cpp
#	imgui.h
#	imgui_demo.cpp
#	imgui_internal.h
#	imgui_widgets.cpp
This commit is contained in:
ocornut
2021-02-10 16:33:00 +01:00
6 changed files with 220 additions and 133 deletions

View File

@ -7113,14 +7113,21 @@ static void ShowExampleAppSimpleOverlay(bool* p_open)
// Demonstrate creating a window covering the entire screen/viewport
static void ShowExampleAppFullscreen(bool* p_open)
{
// May use viewport->WorkPos and viewport->WorkSize to avoid menu-bar/task-bar
const ImGuiViewport* viewport = ImGui::GetMainViewport();
ImGui::SetNextWindowPos(viewport->Pos);
ImGui::SetNextWindowSize(viewport->Size);
static bool use_work_area = true;
static ImGuiWindowFlags flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings;
// We demonstrate using the full viewport area or the work area (without menu-bars, task-bars etc.)
// Based on your use case you may want one of the other.
const ImGuiViewport* viewport = ImGui::GetMainViewport();
ImGui::SetNextWindowPos(use_work_area ? viewport->WorkPos : viewport->Pos);
ImGui::SetNextWindowSize(use_work_area ? viewport->WorkSize : viewport->Size);
if (ImGui::Begin("Example: Fullscreen window", p_open, flags))
{
ImGui::Checkbox("Use work area instead of main area", &use_work_area);
ImGui::SameLine();
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.");
ImGui::CheckboxFlags("ImGuiWindowFlags_NoBackground", &flags, ImGuiWindowFlags_NoBackground);
ImGui::CheckboxFlags("ImGuiWindowFlags_NoDecoration", &flags, ImGuiWindowFlags_NoDecoration);
ImGui::Indent();
@ -7128,6 +7135,9 @@ static void ShowExampleAppFullscreen(bool* p_open)
ImGui::CheckboxFlags("ImGuiWindowFlags_NoCollapse", &flags, ImGuiWindowFlags_NoCollapse);
ImGui::CheckboxFlags("ImGuiWindowFlags_NoScrollbar", &flags, ImGuiWindowFlags_NoScrollbar);
ImGui::Unindent();
if (p_open && ImGui::Button("Close this window"))
*p_open = false;
}
ImGui::End();
}
@ -7141,8 +7151,8 @@ static void ShowExampleAppFullscreen(bool* p_open)
// Read FAQ section "How can I have multiple widgets with the same label?" for details.
static void ShowExampleAppWindowTitles(bool*)
{
ImGuiViewport* viewport = ImGui::GetMainViewport();
ImVec2 base_pos = viewport->WorkPos;
const ImGuiViewport* viewport = ImGui::GetMainViewport();
const ImVec2 base_pos = viewport->Pos;
// By default, Windows are uniquely identified by their title.
// You can use the "##" and "###" markers to manipulate the display/ID.