11 #include <imgui_internal.h>
17 namespace visualization {
38 impl_->children_ = children;
44 impl_->children_.push_back(child);
48 return impl_->children_;
62 impl_->bg_color_ =
color;
87 for (
auto& child : impl_->children_) {
93 if (!impl_->is_visible_) {
98 for (
auto& child : impl_->children_) {
99 if (child->IsVisible()) {
113 ImGui::PushItemFlag(ImGuiItemFlags_Disabled,
true);
114 ImGui::PushStyleVar(ImGuiStyleVar_Alpha,
115 ImGui::GetStyle().Alpha * 0.5f);
123 impl_->pop_disabled_flags_at_end_of_draw_ = !
IsEnabled();
127 if (impl_->pop_disabled_flags_at_end_of_draw_) {
128 ImGui::PopStyleVar();
129 ImGui::PopItemFlag();
134 if (!impl_->tooltip_.empty() &&
IsEnabled() &&
135 (ImGui::IsItemActive() || ImGui::IsItemHovered())) {
144 float border_radius = std::round(0.2f * ImGui::GetFont()->FontSize);
145 float margin = 0.25f * ImGui::GetFont()->FontSize;
146 float old_radius = ImGui::GetStyle().WindowRounding;
147 ImVec2 old_padding = ImGui::GetStyle().WindowPadding;
148 ImGui::GetStyle().WindowPadding = ImVec2(2.0f * margin, margin);
149 ImGui::GetStyle().WindowRounding = border_radius;
151 ImGui::BeginTooltip();
152 ImGui::Text(
"%s", impl_->tooltip_.c_str());
156 ImGui::GetStyle().WindowPadding = old_padding;
157 ImGui::GetStyle().WindowRounding = old_radius;
162 if (!impl_->is_visible_) {
167 for (
auto it = impl_->children_.rbegin(); it != impl_->children_.rend();
169 if ((*it)->GetFrame().Contains(e.
x, e.
y)) {
170 auto result = (*it)->Mouse(e);
191 for (
auto child : impl_->children_) {
static const Color DEFAULT_BGCOLOR(0.001f, 0.001f, 0.001f, 0.0f)
Generic file read and write utility for python interface.