MCPcopy Create free account
hub / github.com/chrxh/alien / processShortenedText

Method processShortenedText

source/Gui/BrowserWindow.cpp:1139–1162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1137}
1138
1139void BrowserWindow::processShortenedText(std::string const& text, bool bold) {
1140 auto substrings = splitString(text);
1141 if (substrings.empty()) {
1142 return;
1143 }
1144 auto& styleRepository = StyleRepository::get();
1145 auto textSize = ImGui::CalcTextSize(substrings.at(0).c_str());
1146 auto needDetailButton = textSize.x > ImGui::GetContentRegionAvail().x || substrings.size() > 1;
1147 auto cursorPos = ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - styleRepository.scale(15.0f);
1148 if (bold) {
1149 ImGui::PushFont(styleRepository.getSmallBoldFont());
1150 }
1151 AlienImGui::Text(substrings.at(0));
1152 if (bold) {
1153 ImGui::PopFont();
1154 }
1155 if (needDetailButton) {
1156 ImGui::SameLine();
1157 ImGui::SetCursorPosX(cursorPos);
1158
1159 processDetailButton();
1160 AlienImGui::Tooltip(text.c_str(), false);
1161 }
1162}
1163
1164bool BrowserWindow::processActionButton(std::string const& text)
1165{

Callers

nothing calls this directly

Calls 4

splitStringFunction · 0.85
sizeMethod · 0.80
scaleMethod · 0.80
getSmallBoldFontMethod · 0.80

Tested by

no test coverage detected