Open3D (C++ API)  0.17.0
ListView.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2023 www.open3d.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <functional>
11 #include <string>
12 
14 
15 namespace open3d {
16 namespace visualization {
17 namespace gui {
18 
19 class ListView : public Widget {
20  using Super = Widget;
21 
22 public:
23  ListView();
24  virtual ~ListView();
25 
26  void SetItems(const std::vector<std::string>& items);
27 
29  int GetSelectedIndex() const;
31  const char* GetSelectedValue() const;
33  void SetSelectedIndex(int index);
38  void SetMaxVisibleItems(int num);
39 
41  const Constraints& constraints) const override;
42 
43  Size CalcMinimumSize(const LayoutContext& context) const override;
44 
45  DrawResult Draw(const DrawContext& context) override;
46 
49  void SetOnValueChanged(
50  std::function<void(const char*, bool)> on_value_changed);
51 
52 private:
53  struct Impl;
54  std::unique_ptr<Impl> impl_;
55 };
56 
57 } // namespace gui
58 } // namespace visualization
59 } // namespace open3d
ImGuiContext * context
Definition: Window.cpp:76
Definition: ListView.h:19
DrawResult Draw(const DrawContext &context) override
Definition: ListView.cpp:104
void SetOnValueChanged(std::function< void(const char *, bool)> on_value_changed)
Definition: ListView.cpp:70
const char * GetSelectedValue() const
Returns the value of the currently selected item in the list.
Definition: ListView.cpp:49
int GetSelectedIndex() const
Returns the currently selected item in the list.
Definition: ListView.cpp:47
Size CalcMinimumSize(const LayoutContext &context) const override
Definition: ListView.cpp:100
void SetSelectedIndex(int index)
Selects the indicated row of the list. Does not call onValueChanged.
Definition: ListView.cpp:66
virtual ~ListView()
Definition: ListView.cpp:40
void SetMaxVisibleItems(int num)
Definition: ListView.cpp:58
ListView()
Definition: ListView.cpp:36
void SetItems(const std::vector< std::string > &items)
Definition: ListView.cpp:42
Size CalcPreferredSize(const LayoutContext &context, const Constraints &constraints) const override
Definition: ListView.cpp:75
Definition: Widget.h:49
Widget()
Definition: Widget.cpp:34
DrawResult
Definition: Widget.h:95
Definition: PinholeCameraIntrinsic.cpp:16