if(center_y_ratio<=0.0f&&window->ScrollTargetRelY<=window->WindowPadding.y)// Minor hack to make "scroll to top" take account of WindowPadding, else it would scroll to (WindowPadding.y - ItemSpacing.y)
if(center_y_ratio<=0.0f&&window->ScrollTarget.y<=window->WindowPadding.y)// Minor hack to make "scroll to top" take account of WindowPadding, else it would scroll to (WindowPadding.y - ItemSpacing.y)
window->ScrollTarget.y=0.0f;
window->ScrollTargetCenterRatio.y=center_y_ratio;
}
// center_y_ratio: 0.0f top of last item, 0.5f vertical center of last item, 1.0f bottom of last item.
IMGUI_APIvoidSetWindowCollapsed(constchar*name,boolcollapsed,ImGuiSetCondcond=0);// set named window collapsed state
IMGUI_APIvoidSetWindowFocus(constchar*name);// set named window to be focused / front-most. use NULL to remove focus.
IMGUI_APIfloatGetScrollX();// get scrolling amount [0..GetScrollMaxX()]
IMGUI_APIfloatGetScrollY();// get scrolling amount [0..GetScrollMaxY()]
IMGUI_APIfloatGetScrollMaxY();// get maximum scrolling amount == ContentSize.Y - WindowSize.Y
IMGUI_APIfloatGetScrollMaxX();// get maximum scrolling amount ~~ ContentSize.X - WindowSize.X
IMGUI_APIfloatGetScrollMaxY();// get maximum scrolling amount ~~ ContentSize.Y - WindowSize.Y
IMGUI_APIvoidSetScrollX(floatscroll_x);// set scrolling amount [0..GetScrollMaxX()]
IMGUI_APIvoidSetScrollY(floatscroll_y);// set scrolling amount [0..GetScrollMaxY()]
IMGUI_APIvoidSetScrollHere(floatcenter_y_ratio=0.5f);// adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom.
IMGUI_APIvoidSetScrollFromPosY(floatpos_y,floatcenter_y_ratio=0.5f);// adjust scrolling amount to make given position valid. use GetCursorPos() or GetCursorStartPos()+offset to get valid positions.
ImGui::BeginChild("scrolling");// Demonstrate a trick: you can use Begin to set yourself in the context of another window (here we are already out of your child window)
ImVec2WindowPadding;// Window padding at the time of begin. We need to lock it, in particular manipulation of the ShowBorder would have an effect
ImGuiIDMoveID;// == window->GetID("#MOVE")
ImVec2Scroll;
floatScrollTargetRelY;// target scroll position. stored as cursor position with scrolling canceled out, so the highest point is always 0.0f. (FLT_MAX for no change)
floatScrollTargetCenterRatioY;// 0.0f = scroll so that target position is at top, 0.5f = scroll so that target position is centered
ImVec2ScrollTarget;// target scroll position. stored as cursor position with scrolling canceled out, so the highest point is always 0.0f. (FLT_MAX for no change)
ImVec2ScrollTargetCenterRatio;// 0.0f = scroll so that target position is at top, 0.5f = scroll so that target position is centered