ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
WidgetStack.h
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 
8 #pragma once
9 
10 #include <functional>
11 #include <memory>
12 
14 
15 namespace cloudViewer {
16 namespace visualization {
17 namespace gui {
18 
32 class WidgetStack : public WidgetProxy {
33 public:
34  WidgetStack();
35  ~WidgetStack() override;
36 
43  void PushWidget(std::shared_ptr<Widget> widget);
44 
51  std::shared_ptr<Widget> PopWidget();
52 
58  void SetOnTop(std::function<void(std::shared_ptr<Widget>)> onTopCallback);
59 
60 private:
61  struct Impl;
62  std::unique_ptr<Impl> impl_;
63 };
64 
65 } // namespace gui
66 } // namespace visualization
67 } // namespace cloudViewer
Widget container to delegate any widget dynamically.
Definition: WidgetProxy.h:47
WidgetStack manages multiple widgets in a stack.
Definition: WidgetStack.h:32
std::shared_ptr< Widget > PopWidget()
Pop the top most widget.
Definition: WidgetStack.cpp:28
void PushWidget(std::shared_ptr< Widget > widget)
Push a widget into stack so the it be the topmost widget.
Definition: WidgetStack.cpp:23
void SetOnTop(std::function< void(std::shared_ptr< Widget >)> onTopCallback)
Setup a callback while a widget is popped out and a new widget becomes the topmost one.
Definition: WidgetStack.cpp:44
Generic file read and write utility for python interface.