Open3D (C++ API)  0.16.1
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
31namespace open3d {
32namespace visualization {
33namespace gui {
34
35struct DrawContext;
36struct Theme;
37
43class Menu : public MenuBase {
44 friend class Application;
45
46public:
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
89private:
90 struct Impl;
91 std::unique_ptr<Impl> impl_;
92};
93
94} // namespace gui
95} // namespace visualization
96} // namespace open3d
ImGuiContext * context
Definition: Window.cpp:95
const Theme * theme
Definition: Window.cpp:93
Definition: Application.h:58
Definition: MenuBase.h:45
static constexpr ItemId NO_ITEM
Definition: MenuBase.h:48
int ItemId
Definition: MenuBase.h:47
bool IsEnabled(ItemId item_id) const override
Definition: Menu.cpp:91
int GetNumberOfItems() const override
Definition: Menu.cpp:89
ItemId DrawMenuBar(const DrawContext &context, bool is_enabled) override
Definition: Menu.cpp:115
int CalcHeight(const Theme &theme) const override
Definition: Menu.cpp:107
Menu()
Definition: Menu.cpp:43
void SetEnabled(ItemId item_id, bool enabled) override
Definition: Menu.cpp:95
virtual ~Menu()
Definition: Menu.cpp:48
void InsertSeparator(int index) override
Definition: Menu.cpp:87
void SetChecked(ItemId item_id, bool checked) override
Definition: Menu.cpp:103
bool IsChecked(ItemId item_id) const override
Definition: Menu.cpp:99
void InsertMenu(int index, const char *name, std::shared_ptr< MenuBase > submenu) override
Definition: Menu.cpp:75
void InsertItem(int index, const char *name, ItemId item_id=NO_ITEM, KeyName key=KEY_NONE) override
Definition: Menu.cpp:68
bool CheckVisibilityChange() const override
Returns true if submenu visibility changed on last call to DrawMenuBar.
Definition: Menu.cpp:111
void * GetNativePointer() override
Definition: Menu.cpp:126
ItemId Draw(const DrawContext &context, const char *name, bool is_enabled) override
Definition: Menu.cpp:120
void AddMenu(const char *name, std::shared_ptr< MenuBase > submenu) override
Definition: Menu.cpp:56
void AddSeparator() override
Definition: Menu.cpp:66
void AddItem(const char *name, ItemId item_id=NO_ITEM, KeyName key=KEY_NONE) override
Definition: Menu.cpp:50
std::string name
Definition: FilePCD.cpp:58
KeyName
Definition: Events.h:115
@ KEY_NONE
Definition: Events.h:116
Definition: PinholeCameraIntrinsic.cpp:35
Definition: Theme.h:39