mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Window: Added ImGuiWindowFlags_NoBackground flag for consistency and to ease creating new flag combinations. Added ImGuiWindowFlags_NoDecoration helper flag which is essentially NoTitleBar+NoResize+NoScrollbar+NoCollapse. (#1660)
This commit is contained in:
parent
8606d9fa11
commit
90b50bd4c3
@ -53,6 +53,9 @@ Other Changes:
|
||||
- Window: Resizing from edges (with io.ConfigResizeWindowsFromEdges Beta flag) extends the hit region
|
||||
of root floating windows outside the window, making it easier to resize windows. Resize grips are also
|
||||
extended accordingly so there are no discontinuity when hovering between borders and corners. (#1495, #822)
|
||||
- Window: Added ImGuiWindowFlags_NoBackground flag to avoid rendering window background. This is mostly to allow
|
||||
the creation of new flag combinations, as we could already use SetNextWindowBgAlpha(0.0f). (#1660) [@biojppm, @ocornut]
|
||||
- Window: Added ImGuiWindowFlags_NoDecoration helper flag which is essentially NoTitleBar+NoResize+NoScrollbar+NoCollapse.
|
||||
- Window, Inputs: Fixed resizing from edges when io.MousePos is not pixel-rounded by rounding mouse position input. (#2110)
|
||||
- BeginChild(): Fixed BeginChild(const char*, ...) variation erroneously not applying the ID stack
|
||||
to the provided string to uniquely identify the child window. This was undoing an intentional change
|
||||
|
@ -4901,13 +4901,14 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
else
|
||||
{
|
||||
// Window background
|
||||
if (!(flags & ImGuiWindowFlags_NoBackground))
|
||||
{
|
||||
ImU32 bg_col = GetColorU32(GetWindowBgColorIdxFromFlags(flags));
|
||||
if (g.NextWindowData.BgAlphaCond != 0)
|
||||
{
|
||||
bg_col = (bg_col & ~IM_COL32_A_MASK) | (IM_F32_TO_INT8_SAT(g.NextWindowData.BgAlphaVal) << IM_COL32_A_SHIFT);
|
||||
g.NextWindowData.BgAlphaCond = 0;
|
||||
}
|
||||
window->DrawList->AddRectFilled(window->Pos + ImVec2(0, window->TitleBarHeight()), window->Pos + window->Size, bg_col, window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? ImDrawCornerFlags_All : ImDrawCornerFlags_Bot);
|
||||
}
|
||||
g.NextWindowData.BgAlphaCond = 0;
|
||||
|
||||
// Title bar
|
||||
ImU32 title_bar_col = GetColorU32(window->Collapsed ? ImGuiCol_TitleBgCollapsed : title_bar_is_highlight ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg);
|
||||
@ -4945,7 +4946,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
}
|
||||
|
||||
// Borders
|
||||
if (window_border_size > 0.0f)
|
||||
if (window_border_size > 0.0f && !(flags & ImGuiWindowFlags_NoBackground))
|
||||
window->DrawList->AddRect(window->Pos, window->Pos + window->Size, GetColorU32(ImGuiCol_Border), window_rounding, ImDrawCornerFlags_All, window_border_size);
|
||||
if (border_held != -1)
|
||||
{
|
||||
|
4
imgui.h
4
imgui.h
@ -229,7 +229,7 @@ namespace ImGui
|
||||
IMGUI_API void SetNextWindowContentSize(const ImVec2& size); // set next window content size (~ enforce the range of scrollbars). not including window decorations (title bar, menu bar, etc.). set an axis to 0.0f to leave it automatic. call before Begin()
|
||||
IMGUI_API void SetNextWindowCollapsed(bool collapsed, ImGuiCond cond = 0); // set next window collapsed state. call before Begin()
|
||||
IMGUI_API void SetNextWindowFocus(); // set next window to be focused / front-most. call before Begin()
|
||||
IMGUI_API void SetNextWindowBgAlpha(float alpha); // set next window background color alpha. helper to easily modify ImGuiCol_WindowBg/ChildBg/PopupBg.
|
||||
IMGUI_API void SetNextWindowBgAlpha(float alpha); // set next window background color alpha. helper to easily modify ImGuiCol_WindowBg/ChildBg/PopupBg. you may also use ImGuiWindowFlags_NoBackground.
|
||||
IMGUI_API void SetWindowPos(const ImVec2& pos, ImGuiCond cond = 0); // (not recommended) set current window position - call within Begin()/End(). prefer using SetNextWindowPos(), as this may incur tearing and side-effects.
|
||||
IMGUI_API void SetWindowSize(const ImVec2& size, ImGuiCond cond = 0); // (not recommended) set current window size - call within Begin()/End(). set to ImVec2(0,0) to force an auto-fit. prefer using SetNextWindowSize(), as this may incur tearing and minor side-effects.
|
||||
IMGUI_API void SetWindowCollapsed(bool collapsed, ImGuiCond cond = 0); // (not recommended) set current window collapsed state. prefer using SetNextWindowCollapsed().
|
||||
@ -620,6 +620,7 @@ enum ImGuiWindowFlags_
|
||||
ImGuiWindowFlags_NoScrollWithMouse = 1 << 4, // Disable user vertically scrolling with mouse wheel. On child window, mouse wheel will be forwarded to the parent unless NoScrollbar is also set.
|
||||
ImGuiWindowFlags_NoCollapse = 1 << 5, // Disable user collapsing window by double-clicking on it
|
||||
ImGuiWindowFlags_AlwaysAutoResize = 1 << 6, // Resize every window to its content every frame
|
||||
ImGuiWindowFlags_NoBackground = 1 << 7, // Disable drawing background color (WindowBg, etc.) and outside border. Similar as using SetNextWindowBgAlpha(0.0f).
|
||||
ImGuiWindowFlags_NoSavedSettings = 1 << 8, // Never load/save settings in .ini file
|
||||
ImGuiWindowFlags_NoInputs = 1 << 9, // Disable catching mouse or keyboard inputs, hovering test with pass through.
|
||||
ImGuiWindowFlags_MenuBar = 1 << 10, // Has a menu-bar
|
||||
@ -632,6 +633,7 @@ enum ImGuiWindowFlags_
|
||||
ImGuiWindowFlags_NoNavInputs = 1 << 18, // No gamepad/keyboard navigation within the window
|
||||
ImGuiWindowFlags_NoNavFocus = 1 << 19, // No focusing toward this window with gamepad/keyboard navigation (e.g. skipped by CTRL+TAB)
|
||||
ImGuiWindowFlags_NoNav = ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus,
|
||||
ImGuiWindowFlags_NoDecoration = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoCollapse,
|
||||
|
||||
// [Internal]
|
||||
ImGuiWindowFlags_NavFlattened = 1 << 23, // [BETA] Allow gamepad/keyboard navigation to cross over parent border to this child (only use on child that have no scrolling!)
|
||||
|
@ -207,6 +207,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
static bool no_collapse = false;
|
||||
static bool no_close = false;
|
||||
static bool no_nav = false;
|
||||
static bool no_background = false;
|
||||
static bool no_bring_to_front = false;
|
||||
|
||||
ImGuiWindowFlags window_flags = 0;
|
||||
@ -217,6 +218,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
if (no_resize) window_flags |= ImGuiWindowFlags_NoResize;
|
||||
if (no_collapse) window_flags |= ImGuiWindowFlags_NoCollapse;
|
||||
if (no_nav) window_flags |= ImGuiWindowFlags_NoNav;
|
||||
if (no_background) window_flags |= ImGuiWindowFlags_NoBackground;
|
||||
if (no_bring_to_front) window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus;
|
||||
if (no_close) p_open = NULL; // Don't pass our bool* to Begin
|
||||
|
||||
@ -362,6 +364,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
ImGui::Checkbox("No collapse", &no_collapse);
|
||||
ImGui::Checkbox("No close", &no_close); ImGui::SameLine(150);
|
||||
ImGui::Checkbox("No nav", &no_nav); ImGui::SameLine(300);
|
||||
ImGui::Checkbox("No background", &no_background);
|
||||
ImGui::Checkbox("No bring to front", &no_bring_to_front);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user