| 858 | |
| 859 | |
| 860 | void RibbonMenu::drawActiveList_() |
| 861 | { |
| 862 | auto pressed = activeListPressed_; |
| 863 | activeListPressed_ = false; |
| 864 | |
| 865 | auto nameWindow = "##ActiveList"; |
| 866 | bool popupOpened = ImGui::IsPopupOpen( nameWindow ); |
| 867 | |
| 868 | // manage search popup |
| 869 | if ( pressed && !popupOpened ) |
| 870 | ImGui::OpenPopup( nameWindow ); |
| 871 | |
| 872 | if ( !popupOpened ) |
| 873 | return; |
| 874 | if ( ImGuiWindow* menuWindow = ImGui::FindWindowByName( nameWindow ) ) |
| 875 | if ( menuWindow->WasActive ) |
| 876 | { |
| 877 | ImRect frame; |
| 878 | frame.Min = activeListPos_; |
| 879 | frame.Min.x -= 6 * UI::scale(); |
| 880 | frame.Min.y += 10 * UI::scale(); |
| 881 | frame.Max = ImVec2( frame.Min.x + ImGui::GetFrameHeight(), frame.Min.y + ImGui::GetFrameHeight() ); |
| 882 | ImVec2 expectedSize = ImGui::CalcWindowNextAutoFitSize( menuWindow ); |
| 883 | menuWindow->AutoPosLastDirection = ImGuiDir_Down; |
| 884 | ImRect rectOuter = ImGui::GetPopupAllowedExtentRect( menuWindow ); |
| 885 | ImVec2 pos = ImGui::FindBestWindowPosForPopupEx( frame.GetBL(), expectedSize, &menuWindow->AutoPosLastDirection, rectOuter, frame, ImGuiPopupPositionPolicy_ComboBox ); |
| 886 | ImGui::SetNextWindowPos( pos ); |
| 887 | } |
| 888 | |
| 889 | ImGuiWindowFlags window_flags = |
| 890 | ImGuiWindowFlags_AlwaysAutoResize | |
| 891 | ImGuiWindowFlags_Popup | |
| 892 | ImGuiWindowFlags_NoTitleBar | |
| 893 | ImGuiWindowFlags_NoResize | |
| 894 | ImGuiWindowFlags_NoSavedSettings | |
| 895 | ImGuiWindowFlags_NoMove; |
| 896 | ImGui::PushStyleVar( ImGuiStyleVar_PopupBorderSize, 0.0f ); |
| 897 | ImGui::PushStyleColor( ImGuiCol_PopupBg, ImVec4( 0, 0, 0, 0 ) ); |
| 898 | ImGui::SetNextWindowViewport( ImGui::GetMainViewport()->ID ); |
| 899 | ImGui::Begin( nameWindow, NULL, window_flags ); |
| 900 | if ( popupOpened ) |
| 901 | { |
| 902 | bool closeBlocking = false; |
| 903 | std::vector<bool> closeNonBlocking( activeNonBlockingItems_.size(), false ); |
| 904 | |
| 905 | auto winPadding = ImVec2( 6 * UI::scale(), 4 * UI::scale() ); |
| 906 | auto itemSpacing = ImVec2( 10 * UI::scale(), 4 * UI::scale() ); |
| 907 | ImGui::PushStyleVar( ImGuiStyleVar_WindowPadding, winPadding ); |
| 908 | ImGui::PushStyleVar( ImGuiStyleVar_ChildRounding, 4 * UI::scale() ); |
| 909 | ImGui::PushStyleVar( ImGuiStyleVar_ItemSpacing, itemSpacing ); |
| 910 | |
| 911 | ImVec2 btnSize = ImVec2( 56.0f * UI::scale(), 24.0f * UI::scale() ); |
| 912 | float maxSize = 0.0f; |
| 913 | |
| 914 | RibbonFontHolder sbFont( RibbonFontManager::FontType::SemiBold ); |
| 915 | if ( activeBlockingItem_.item ) |
| 916 | maxSize = ImGui::CalcTextSize( getItemCaption( activeBlockingItem_.item->name() ).c_str() ).x; |
| 917 | for ( const auto& nonBlockItem : activeNonBlockingItems_ ) |
nothing calls this directly
no test coverage detected