MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / drawInternal

Method drawInternal

Examples/SCExample/HotReloadSystem.h:282–379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

280 void drawSettings() { SC_TRUST_RESULT(drawInternal()); }
281
282 Result drawInternal()
283 {
284 ImGui::Text("Sysroot Location:");
285 ImGui::PushItemWidth(ImGui::GetWindowWidth() - ImGui::GetStyle().WindowPadding.x * 2);
286 if (ImGui::InputText("##-isysroot", state.isysroot, sizeof(state.isysroot)))
287 {
288 StringView text = StringView::fromNullTerminated(state.isysroot, StringEncoding::Utf8);
289 if (FileSystem().existsAndIsDirectory(text) or text.isEmpty())
290 {
291 system.setSysroot(text);
292 }
293 }
294 ImGui::PopItemWidth();
295
296 ImGui::Text("Include Paths:");
297 bool includePathsModified = false;
298 const ImVec2 includePathsSize(ImGui::GetWindowWidth() - ImGui::GetStyle().WindowPadding.x * 2,
299 ImGui::GetTextLineHeightWithSpacing() * 6.0f);
300 SC_TRY(InputTextMultiline("##-include-paths", state.includePathsBuffer, state.includePathsText,
301 includePathsSize, includePathsModified));
302 if (includePathsModified)
303 {
304 SC_TRY(system.rebuildCompilerIncludePaths());
305 }
306
307 if (ImGui::Button("Sync Registry"))
308 {
309 SC_TRY(system.syncRegistry());
310 }
311 const size_t numberOfEntries = system.registry.getNumberOfEntries();
312 if (ImGui::BeginTable("Table", 4))
313 {
314 ImGui::TableSetupColumn("Example");
315 ImGui::TableSetupColumn("Reloads", ImGuiTableColumnFlags_WidthFixed);
316 ImGui::TableSetupColumn("Time", ImGuiTableColumnFlags_WidthFixed);
317 ImGui::TableSetupColumn("Actions");
318 ImGui::TableHeadersRow();
319
320 for (size_t idx = 0; idx < numberOfEntries; ++idx)
321 {
322 ImGui::PushID(static_cast<int>(idx));
323 const PluginDynamicLibrary& library = system.registry.getPluginDynamicLibraryAt(idx);
324
325 ImGui::TableNextColumn();
326 if (not library.lastErrorLog.isEmpty())
327 {
328 ImGui::PushStyleColor(ImGuiCol_Text, 0xff0000ff);
329 }
330 SmallString<256> pluginUTF8 = StringEncoding::Utf8;
331 (void)StringConverter::appendEncodingTo(StringEncoding::Utf8, library.definition.identity.name.view(),
332 pluginUTF8, StringConverter::NullTerminate);
333 ImGui::Text("%s", pluginUTF8.view().bytesIncludingTerminator());
334 if (library.lastErrorLog.isEmpty())
335 {
336 if (ImGui::IsItemHovered())
337 {
338 ImGui::SetTooltip("%s", library.definition.description.view().bytesIncludingTerminator());
339 }

Callers

nothing calls this directly

Calls 15

InputTextFunction · 0.85
fromNullTerminatedFunction · 0.85
InputTextMultilineFunction · 0.85
appendEncodingToFunction · 0.85
AbsoluteClass · 0.85
existsAndIsDirectoryMethod · 0.80
setSysrootMethod · 0.80
getNumberOfEntriesMethod · 0.80
parseLocalMethod · 0.80
formatFunction · 0.50
ResultClass · 0.50

Tested by

no test coverage detected