27 lines
706 B
C++
27 lines
706 B
C++
#include "../include/LogWindow.h"
|
|
#include "../include/ConnectionWindow.h"
|
|
#include "imgui.h"
|
|
|
|
void LogWindow::Render(bool* p_open, ConnectionWindow& conn_win) {
|
|
if (!ImGui::Begin("Transaction Log", p_open)) {
|
|
ImGui::End();
|
|
return;
|
|
}
|
|
|
|
std::string& log_ref = conn_win.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();
|
|
}
|