Clarified behavior of SetNextWindowContentSize(). Content size is defined as the size available after removal of WindowPadding on each sides. So SetNextWindowContentSize(ImVec2(100,100)) + auto-resize will always allow submitting a 100x100 item without creating a scrollbar, regarding of WindowPadding.The exact meaning of ContentSize for decorated windows was previously ill-defined.
if(is_popup||is_menu)// Popups and menus bypass style.WindowMinSize by default, but we give then a non-zero minimum size to facilitate understanding problematic cases (e.g. empty popups)
window->DC.CursorMaxPos.x+=window->Scroll.x;// SizeContents is generally computed based on CursorMaxPos which is affected by scroll position, so we need to apply our change to it.
window->DC.CursorMaxPos.y+=window->Scroll.y;// SizeContents is generally computed based on CursorMaxPos which is affected by scroll position, so we need to apply our change to it.
window->DC.CursorPos+=(window->Pos-old_pos);// As we happen to move the window while it is being appended to (which is a bad idea - will smear) let's at least offset the cursor
window->DC.CursorMaxPos+=(window->Pos-old_pos);// And more importantly we need to adjust this so size calculation doesn't get affected.
ImVec2offset=window->Pos-old_pos;
window->DC.CursorPos+=offset;// As we happen to move the window while it is being appended to (which is a bad idea - will smear) let's at least offset the cursor
window->DC.CursorMaxPos+=offset;// And more importantly we need to offset CursorMaxPos/CursorStartPos this so SizeContents calculation doesn't get affected.
g.NextWindowData.ContentSizeVal=size;// In Begin() we will add the size of window decorations (title bar, menu etc.) to that to form a SizeContents value.
IMGUI_APIvoidSetNextWindowPos(constImVec2&pos,ImGuiCondcond=0,constImVec2&pivot=ImVec2(0,0));// set next window position. call before Begin(). use pivot=(0.5f,0.5f) to center on given point, etc.
IMGUI_APIvoidSetNextWindowSize(constImVec2&size,ImGuiCondcond=0);// set next window size. set axis to 0.0f to force an auto-fit on this axis. call before Begin()
IMGUI_APIvoidSetNextWindowSizeConstraints(constImVec2&size_min,constImVec2&size_max,ImGuiSizeCallbackcustom_callback=NULL,void*custom_callback_data=NULL);// set next window size limits. use -1,-1 on either X/Y axis to preserve the current size. Sizes will be rounded down. Use callback to apply non-trivial programmatic constraints.
IMGUI_APIvoidSetNextWindowContentSize(constImVec2&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_APIvoidSetNextWindowContentSize(constImVec2&size);// set next window content size (~ scrollable client area, which enforce the range of scrollbars). Not including window decorations (title bar, menu bar, etc.) nor WindowPadding. set an axis to 0.0f to leave it automatic. call before Begin()
IMGUI_APIvoidSetNextWindowCollapsed(boolcollapsed,ImGuiCondcond=0);// set next window collapsed state. call before Begin()
IMGUI_APIvoidSetNextWindowFocus();// set next window to be focused / front-most. call before Begin()
IMGUI_APIvoidSetNextWindowBgAlpha(floatalpha);// set next window background color alpha. helper to easily modify ImGuiCol_WindowBg/ChildBg/PopupBg. you may also use ImGuiWindowFlags_NoBackground.
ImVec2Pos;// Position (always rounded-up to nearest pixel)
ImVec2Size;// Current size (==SizeFull or collapsed title bar size)
ImVec2SizeFull;// Size when non collapsed
ImVec2SizeFullAtLastBegin;// Copy of SizeFull at the end of Begin. This is the reference value we'll use on the next frame to decide if we need scrollbars.
ImVec2SizeContents;// Size of contents (== extents reach of the drawing cursor) from previous frame. FIXME: Include decoration, window title, border, menu, etc. Ideally should remove them from this value?
ImVec2SizeContentsExplicit;// Size of contents explicitly set by the user via SetNextWindowContentSize(). EXCLUDE decorations. Making this not consistent with the above!
ImVec2SizeContents;// Size of contents/scrollable client area (calculated from the extents reach of the cursor) from previous frame. Does not include window decoration or window padding.
ImVec2SizeContentsExplicit;// Size of contents/scrollable client area explicitly request by the user via SetNextWindowContentSize().
ImVec2WindowPadding;// Window padding at the time of begin.
floatWindowRounding;// Window rounding at the time of begin.
floatWindowBorderSize;// Window border size at the time of begin.