ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
Dialog.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
9 
10 #include <string>
11 
13 
14 namespace cloudViewer {
15 namespace visualization {
16 namespace gui {
17 
18 struct Dialog::Impl {
19  std::string title;
20  Window *parent = nullptr;
21 };
22 
23 Dialog::Dialog(const char *title) : impl_(new Dialog::Impl()) {}
24 
26 
28  const Constraints &constraints) const {
29  if (GetChildren().size() == 1) {
30  auto child = GetChildren()[0];
31  return child->CalcPreferredSize(context, constraints);
32  } else {
33  return Super::CalcPreferredSize(context, constraints);
34  }
35 }
36 
38  if (GetChildren().size() == 1) {
39  auto child = GetChildren()[0];
40  child->SetFrame(GetFrame());
41  child->Layout(context);
42  } else {
44  }
45 }
46 
48 
50  return Super::Draw(context);
51 }
52 
53 } // namespace gui
54 } // namespace visualization
55 } // namespace cloudViewer
int size
Base class for dialogs.
Definition: Dialog.h:19
DrawResult Draw(const DrawContext &context) override
Definition: Dialog.cpp:49
void Layout(const LayoutContext &context) override
Definition: Dialog.cpp:37
Size CalcPreferredSize(const LayoutContext &context, const Constraints &constraints) const override
Definition: Dialog.cpp:27
virtual DrawResult Draw(const DrawContext &context)
Definition: Widget.cpp:92
virtual Size CalcPreferredSize(const LayoutContext &context, const Constraints &constraints) const
Definition: Widget.cpp:77
virtual const std::vector< std::shared_ptr< Widget > > GetChildren() const
Definition: Widget.cpp:47
virtual void Layout(const LayoutContext &context)
Definition: Widget.cpp:86
virtual const Rect & GetFrame() const
Returns the frame size in pixels.
Definition: Widget.cpp:51
ImGuiContext * context
Definition: Window.cpp:76
Generic file read and write utility for python interface.