Files
serial-imgui/sources/LogWindow.cpp
T
Ivan I. Ovchinnikov 5a702fe0f8 style refactor
2026-07-27 21:29:50 +03:00

27 lines
728 B
C++

#include "../include/LogWindow.h"
#include "../include/ConnectionWindow.h"
#include "imgui.h"
void LogWindow::render(bool* paramOpen, ConnectionWindow& connectionWindow) {
if (!ImGui::Begin("Transaction Log", paramOpen)) {
ImGui::End();
return;
}
std::string& log_ref = connectionWindow.getSharedLog();
ImGui::BeginChild("ScrollingRegion", ImVec2(0, -ImGui::GetFrameHeightWithSpacing()), true, ImGuiWindowFlags_HorizontalScrollbar);
ImGui::TextUnformatted(log_ref.c_str());
if (ImGui::GetScrollY() >= ImGui::GetScrollMaxY()) {
ImGui::SetScrollHereY(1.0f);
}
ImGui::EndChild();
if (ImGui::Button("Clear Log")) {
log_ref.clear();
}
ImGui::End();
}