window menu button == collapse button when not in a dock node. FIXME: This is similar to RenderWindowTitleBarContents(), may want to share code.
| 19761 | // window menu button == collapse button when not in a dock node. |
| 19762 | // FIXME: This is similar to RenderWindowTitleBarContents(), may want to share code. |
| 19763 | static void ImGui::DockNodeCalcTabBarLayout(const ImGuiDockNode* node, ImRect* out_title_rect, ImRect* out_tab_bar_rect, ImVec2* out_window_menu_button_pos, ImVec2* out_close_button_pos) |
| 19764 | { |
| 19765 | ImGuiContext& g = *GImGui; |
| 19766 | ImGuiStyle& style = g.Style; |
| 19767 | |
| 19768 | ImRect r = ImRect(node->Pos.x, node->Pos.y, node->Pos.x + node->Size.x, node->Pos.y + g.FontSize + g.Style.FramePadding.y * 2.0f); |
| 19769 | if (out_title_rect) { *out_title_rect = r; } |
| 19770 | |
| 19771 | r.Min.x += style.WindowBorderSize; |
| 19772 | r.Max.x -= style.WindowBorderSize; |
| 19773 | |
| 19774 | float button_sz = g.FontSize; |
| 19775 | r.Min.x += style.FramePadding.x; |
| 19776 | r.Max.x -= style.FramePadding.x; |
| 19777 | ImVec2 window_menu_button_pos = ImVec2(r.Min.x, r.Min.y + style.FramePadding.y); |
| 19778 | if (node->HasCloseButton) |
| 19779 | { |
| 19780 | if (out_close_button_pos) *out_close_button_pos = ImVec2(r.Max.x - button_sz, r.Min.y + style.FramePadding.y); |
| 19781 | r.Max.x -= button_sz + style.ItemInnerSpacing.x; |
| 19782 | } |
| 19783 | if (node->HasWindowMenuButton && style.WindowMenuButtonPosition == ImGuiDir_Left) |
| 19784 | { |
| 19785 | r.Min.x += button_sz + style.ItemInnerSpacing.x; |
| 19786 | } |
| 19787 | else if (node->HasWindowMenuButton && style.WindowMenuButtonPosition == ImGuiDir_Right) |
| 19788 | { |
| 19789 | window_menu_button_pos = ImVec2(r.Max.x - button_sz, r.Min.y + style.FramePadding.y); |
| 19790 | r.Max.x -= button_sz + style.ItemInnerSpacing.x; |
| 19791 | } |
| 19792 | if (out_tab_bar_rect) { *out_tab_bar_rect = r; } |
| 19793 | if (out_window_menu_button_pos) { *out_window_menu_button_pos = window_menu_button_pos; } |
| 19794 | } |
| 19795 | |
| 19796 | void ImGui::DockNodeCalcSplitRects(ImVec2& pos_old, ImVec2& size_old, ImVec2& pos_new, ImVec2& size_new, ImGuiDir dir, ImVec2 size_new_desired) |
| 19797 | { |