Open3D (C++ API)  0.13.0
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
MenuImgui.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // The MIT License (MIT)
5 //
6 // Copyright (c) 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 class MenuImgui : public MenuBase {
36 public:
37  MenuImgui();
38  virtual ~MenuImgui();
39 
40  void AddItem(const char* name,
41  ItemId item_id = NO_ITEM,
42  KeyName key = KEY_NONE) override;
43  void AddMenu(const char* name, std::shared_ptr<MenuBase> submenu) override;
44  void AddSeparator() override;
45 
46  void InsertItem(int index,
47  const char* name,
48  ItemId item_id = NO_ITEM,
49  KeyName key = KEY_NONE) override;
50  void InsertMenu(int index,
51  const char* name,
52  std::shared_ptr<MenuBase> submenu) override;
53  void InsertSeparator(int index) override;
54 
55  int GetNumberOfItems() const override;
56 
57  bool IsEnabled(ItemId item_id) const override;
58  void SetEnabled(ItemId item_id, bool enabled) override;
59 
60  bool IsChecked(ItemId item_id) const override;
61  void SetChecked(ItemId item_id, bool checked) override;
62 
63  int CalcHeight(const Theme& theme) const override;
64 
65  bool CheckVisibilityChange() const override;
66 
67  ItemId DrawMenuBar(const DrawContext& context, bool is_enabled) override;
68  ItemId Draw(const DrawContext& context,
69  const char* name,
70  bool is_enabled) override;
71 
72  void* GetNativePointer() override;
73 
74 private:
75  struct Impl;
76  std::unique_ptr<Impl> impl_;
77 };
78 
79 } // namespace gui
80 } // namespace visualization
81 } // namespace open3d
Definition: Theme.h:39
MenuImgui()
Definition: MenuImgui.cpp:98
bool IsChecked(ItemId item_id) const override
Definition: MenuImgui.cpp:172
void InsertMenu(int index, const char *name, std::shared_ptr< MenuBase > submenu) override
Definition: MenuImgui.cpp:130
void AddSeparator() override
Definition: MenuImgui.cpp:114
int CalcHeight(const Theme &theme) const override
Definition: MenuImgui.cpp:187
Definition: MenuImgui.h:35
void SetEnabled(ItemId item_id, bool enabled) override
Definition: MenuImgui.cpp:165
bool CheckVisibilityChange() const override
Returns true if submenu visibility changed on last call to DrawMenuBar.
Definition: MenuImgui.cpp:193
const Theme * theme
Definition: Window.cpp:93
void InsertItem(int index, const char *name, ItemId item_id=NO_ITEM, KeyName key=KEY_NONE) override
Definition: MenuImgui.cpp:116
void SetChecked(ItemId item_id, bool checked) override
Definition: MenuImgui.cpp:180
int ItemId
Definition: MenuBase.h:47
Definition: MenuBase.h:45
void InsertSeparator(int index) override
Definition: MenuImgui.cpp:144
ImGuiContext * context
Definition: Window.cpp:95
void AddMenu(const char *name, std::shared_ptr< MenuBase > submenu) override
Definition: MenuImgui.cpp:110
bool IsEnabled(ItemId item_id) const override
Definition: MenuImgui.cpp:157
ItemId Draw(const DrawContext &context, const char *name, bool is_enabled) override
Definition: MenuImgui.cpp:240
int GetNumberOfItems() const override
Definition: MenuImgui.cpp:155
virtual ~MenuImgui()
Definition: MenuImgui.cpp:100
Definition: PinholeCameraIntrinsic.cpp:35
ItemId DrawMenuBar(const DrawContext &context, bool is_enabled) override
Definition: MenuImgui.cpp:197
std::string name
Definition: FilePCD.cpp:58
static constexpr ItemId NO_ITEM
Definition: MenuBase.h:48
void AddItem(const char *name, ItemId item_id=NO_ITEM, KeyName key=KEY_NONE) override
Definition: MenuImgui.cpp:104
KeyName
Definition: Events.h:115
Definition: Events.h:116
void * GetNativePointer() override
Definition: MenuImgui.cpp:102