Loading [MathJax]/extensions/TeX/AMSsymbols.js
Open3D (C++ API)  0.14.1
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Menu.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // The MIT License (MIT)
5 //
6 // Copyright (c) 2018-2021 www.open3d.org
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 // ----------------------------------------------------------------------------
26 
27 #pragma once
28 
30 
31 namespace open3d {
32 namespace visualization {
33 namespace gui {
34 
35 struct DrawContext;
36 struct Theme;
37 
43 class Menu : public MenuBase {
44  friend class Application;
45 
46 public:
47  Menu();
48  virtual ~Menu();
49 
50  void AddItem(const char* name,
51  ItemId item_id = NO_ITEM,
52  KeyName key = KEY_NONE) override;
53  void AddMenu(const char* name, std::shared_ptr<MenuBase> submenu) override;
54  void AddSeparator() override;
55 
56  void InsertItem(int index,
57  const char* name,
58  ItemId item_id = NO_ITEM,
59  KeyName key = KEY_NONE) override;
60  void InsertMenu(int index,
61  const char* name,
62  std::shared_ptr<MenuBase> submenu) override;
63  void InsertSeparator(int index) override;
64 
65  int GetNumberOfItems() const override;
66 
69  bool IsEnabled(ItemId item_id) const override;
72  void SetEnabled(ItemId item_id, bool enabled) override;
73 
74  bool IsChecked(ItemId item_id) const override;
75  void SetChecked(ItemId item_id, bool checked) override;
76 
77  int CalcHeight(const Theme& theme) const override;
78 
80  bool CheckVisibilityChange() const override;
81 
82  ItemId DrawMenuBar(const DrawContext& context, bool is_enabled) override;
84  const char* name,
85  bool is_enabled) override;
86 
87  void* GetNativePointer() override; // nullptr if not using native menus
88 
89 private:
90  struct Impl;
91  std::unique_ptr<Impl> impl_;
92 };
93 
94 } // namespace gui
95 } // namespace visualization
96 } // namespace open3d
void SetEnabled(ItemId item_id, bool enabled) override
Definition: Menu.cpp:95
Definition: Theme.h:39
Definition: Application.h:58
ItemId Draw(const DrawContext &context, const char *name, bool is_enabled) override
Definition: Menu.cpp:120
void InsertMenu(int index, const char *name, std::shared_ptr< MenuBase > submenu) override
Definition: Menu.cpp:75
virtual ~Menu()
Definition: Menu.cpp:48
const Theme * theme
Definition: Window.cpp:93
int ItemId
Definition: MenuBase.h:47
void AddSeparator() override
Definition: Menu.cpp:66
Definition: MenuBase.h:45
bool IsChecked(ItemId item_id) const override
Definition: Menu.cpp:99
ImGuiContext * context
Definition: Window.cpp:95
void * GetNativePointer() override
Definition: Menu.cpp:126
void AddMenu(const char *name, std::shared_ptr< MenuBase > submenu) override
Definition: Menu.cpp:56
ItemId DrawMenuBar(const DrawContext &context, bool is_enabled) override
Definition: Menu.cpp:115
void AddItem(const char *name, ItemId item_id=NO_ITEM, KeyName key=KEY_NONE) override
Definition: Menu.cpp:50
bool IsEnabled(ItemId item_id) const override
Definition: Menu.cpp:91
void SetChecked(ItemId item_id, bool checked) override
Definition: Menu.cpp:103
int GetNumberOfItems() const override
Definition: Menu.cpp:89
Definition: PinholeCameraIntrinsic.cpp:35
void InsertSeparator(int index) override
Definition: Menu.cpp:87
static constexpr ItemId NO_ITEM
Definition: MenuBase.h:48
Menu()
Definition: Menu.cpp:43
int CalcHeight(const Theme &theme) const override
Definition: Menu.cpp:107
KeyName
Definition: Events.h:115
void InsertItem(int index, const char *name, ItemId item_id=NO_ITEM, KeyName key=KEY_NONE) override
Definition: Menu.cpp:68
Definition: Events.h:116
bool CheckVisibilityChange() const override
Returns true if submenu visibility changed on last call to DrawMenuBar.
Definition: Menu.cpp:111
std::string name
Definition: FilePCD.cpp:58