Open3D (C++ API)  0.18.0
Menu.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 
11 
12 namespace open3d {
13 namespace visualization {
14 namespace gui {
15 
16 struct DrawContext;
17 struct Theme;
18 
24 class Menu : public MenuBase {
25  friend class Application;
26 
27 public:
28  Menu();
29  virtual ~Menu();
30 
31  void AddItem(const char* name,
32  ItemId item_id = NO_ITEM,
33  KeyName key = KEY_NONE) override;
34  void AddMenu(const char* name, std::shared_ptr<MenuBase> submenu) override;
35  void AddSeparator() override;
36 
37  void InsertItem(int index,
38  const char* name,
39  ItemId item_id = NO_ITEM,
40  KeyName key = KEY_NONE) override;
41  void InsertMenu(int index,
42  const char* name,
43  std::shared_ptr<MenuBase> submenu) override;
44  void InsertSeparator(int index) override;
45 
46  int GetNumberOfItems() const override;
47 
50  bool IsEnabled(ItemId item_id) const override;
53  void SetEnabled(ItemId item_id, bool enabled) override;
54 
55  bool IsChecked(ItemId item_id) const override;
56  void SetChecked(ItemId item_id, bool checked) override;
57 
58  int CalcHeight(const Theme& theme) const override;
59 
61  bool CheckVisibilityChange() const override;
62 
63  ItemId DrawMenuBar(const DrawContext& context, bool is_enabled) override;
65  const char* name,
66  bool is_enabled) override;
67 
68  void* GetNativePointer() override; // nullptr if not using native menus
69 
70 private:
71  struct Impl;
72  std::unique_ptr<Impl> impl_;
73 };
74 
75 } // namespace gui
76 } // namespace visualization
77 } // namespace open3d
ImGuiContext * context
Definition: Window.cpp:76
const Theme * theme
Definition: Window.cpp:74
Definition: Application.h:39
Definition: MenuBase.h:26
static constexpr ItemId NO_ITEM
Definition: MenuBase.h:29
int ItemId
Definition: MenuBase.h:28
bool IsEnabled(ItemId item_id) const override
Definition: Menu.cpp:72
int GetNumberOfItems() const override
Definition: Menu.cpp:70
ItemId DrawMenuBar(const DrawContext &context, bool is_enabled) override
Definition: Menu.cpp:96
int CalcHeight(const Theme &theme) const override
Definition: Menu.cpp:88
Menu()
Definition: Menu.cpp:24
void SetEnabled(ItemId item_id, bool enabled) override
Definition: Menu.cpp:76
virtual ~Menu()
Definition: Menu.cpp:29
void InsertSeparator(int index) override
Definition: Menu.cpp:68
void SetChecked(ItemId item_id, bool checked) override
Definition: Menu.cpp:84
bool IsChecked(ItemId item_id) const override
Definition: Menu.cpp:80
void InsertMenu(int index, const char *name, std::shared_ptr< MenuBase > submenu) override
Definition: Menu.cpp:56
void InsertItem(int index, const char *name, ItemId item_id=NO_ITEM, KeyName key=KEY_NONE) override
Definition: Menu.cpp:49
bool CheckVisibilityChange() const override
Returns true if submenu visibility changed on last call to DrawMenuBar.
Definition: Menu.cpp:92
void * GetNativePointer() override
Definition: Menu.cpp:107
ItemId Draw(const DrawContext &context, const char *name, bool is_enabled) override
Definition: Menu.cpp:101
void AddMenu(const char *name, std::shared_ptr< MenuBase > submenu) override
Definition: Menu.cpp:37
void AddSeparator() override
Definition: Menu.cpp:47
void AddItem(const char *name, ItemId item_id=NO_ITEM, KeyName key=KEY_NONE) override
Definition: Menu.cpp:31
std::string name
Definition: FilePCD.cpp:39
KeyName
Definition: Events.h:96
@ KEY_NONE
Definition: Events.h:97
Definition: PinholeCameraIntrinsic.cpp:16
Definition: Theme.h:20