3#include "absl/strings/str_format.h"
4#include "imgui/imgui.h"
5#include "imgui/imgui_internal.h"
11 const std::string& type) {
21 metrics.
rect_min = ImGui::GetItemRectMin();
22 metrics.
rect_max = ImGui::GetItemRectMax();
61 float end_x = ImGui::GetCursorPosX();
82 float available_width)
const {
84 return toolbar_width > available_width;
88 const std::string& toolbar_id)
const {
89 static const std::vector<WidgetMetrics> empty;
103 std::string json =
"{\n \"toolbars\": {\n";
105 bool first_toolbar =
true;
107 if (!first_toolbar) json +=
",\n";
108 first_toolbar =
false;
110 json += absl::StrFormat(
" \"%s\": {\n", toolbar_id);
111 json += absl::StrFormat(
" \"total_width\": %.1f,\n",
113 json +=
" \"widgets\": [\n";
115 bool first_widget =
true;
116 for (
const auto& metric : metrics) {
117 if (!first_widget) json +=
",\n";
118 first_widget =
false;
121 json += absl::StrFormat(
" \"id\": \"%s\",\n", metric.widget_id);
122 json += absl::StrFormat(
" \"type\": \"%s\",\n", metric.type);
123 json += absl::StrFormat(
" \"width\": %.1f,\n", metric.size.x);
124 json += absl::StrFormat(
" \"height\": %.1f,\n", metric.size.y);
125 json += absl::StrFormat(
" \"x\": %.1f,\n", metric.position.x);
126 json += absl::StrFormat(
" \"y\": %.1f\n", metric.position.y);
Main namespace for the application.