VTK: Rendering/VR/vtkVRMenuWidget.h Source File

| VTK 9.3.1

vtkVRMenuWidget.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
11 #ifndef vtkVRMenuWidget_h
12 #define vtkVRMenuWidget_h
13
14 #include "vtkAbstractWidget.h"
15 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
16 #include "vtkRenderingVRModule.h" // For export macro
17 #include <deque> // for ivar
18
19 VTK_ABI_NAMESPACE_BEGIN
20 class vtkEventData;
21 class vtkVRMenuRepresentation;
22
23 class VTKRENDERINGVR_EXPORT vtkVRMenuWidget : public vtkAbstractWidget
24 {
25 public:
29 static vtkVRMenuWidget* New();
30
32
35 vtkTypeMacro(vtkVRMenuWidget, vtkAbstractWidget);
36 void PrintSelf(ostream& os, vtkIndent indent) override;
38
44 void SetRepresentation(vtkVRMenuRepresentation* rep);
45
49 void CreateDefaultRepresentation() override;
50
52
55 vtkGetMacro(WidgetState, int);
57
58 // Manage the state of the widget
59 enum WidgetStateType
60 {
61 Start = 0,
62 Active
63 };
64 #if !defined(VTK_LEGACY_REMOVE)
65 VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
66 typedef WidgetStateType _WidgetState;
67 #endif
68
70
73 void PushFrontMenuItem(const char* name, const char* text, vtkCommand* cmd);
74 void RenameMenuItem(const char* name, const char* text);
75 void RemoveMenuItem(const char* name);
76 void RemoveAllMenuItems();
78
79 void Show(vtkEventData* ed);
80 void ShowSubMenu(vtkVRMenuWidget*);
81
82 protected:
83 vtkVRMenuWidget();
84 ~vtkVRMenuWidget() override;
85
86 int WidgetState;
87
88 class InternalElement;
89 std::deque<InternalElement*> Menus;
90
91 // These are the callbacks for this widget
92 static void StartMenuAction(vtkAbstractWidget*);
93 static void SelectMenuAction(vtkAbstractWidget*);
94 static void MoveAction(vtkAbstractWidget*);
95
96 vtkCallbackCommand* EventCommand;
97 static void EventCallback(
98 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
99
103 static void Update(vtkAbstractWidget*);
104
105 private:
106 vtkVRMenuWidget(const vtkVRMenuWidget&) = delete;
107 void operator=(const vtkVRMenuWidget&) = delete;
108 };
109 VTK_ABI_NAMESPACE_END
110 #endif
vtkAbstractWidget
define the API for widget / widget representation
Definition: vtkAbstractWidget.h:64
vtkCallbackCommand
supports function callbacks
Definition: vtkCallbackCommand.h:49
vtkCommand
superclass for callback/observer methods
Definition: vtkCommand.h:384
vtkEventData
Definition: vtkEventData.h:58
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:61
vtkVRMenuRepresentation
Widget representation for vtkVRMenuWidget Implementation of the popup panel representation for the vt...
Definition: vtkVRMenuRepresentation.h:25
vtkVRMenuWidget
3D widget to display a menu in VR
Definition: vtkVRMenuWidget.h:24
vtkVRMenuWidget::CreateDefaultRepresentation
void CreateDefaultRepresentation() override
Create the default widget representation if one is not set.
vtkVRMenuWidget::Update
static void Update(vtkAbstractWidget *)
Update callback to check for the hovered prop.
vtkVRMenuWidget::SetRepresentation
void SetRepresentation(vtkVRMenuRepresentation *rep)
Specify an instance of vtkWidgetRepresentation used to represent this widget in the scene.
vtkVRMenuWidget::MoveAction
static void MoveAction(vtkAbstractWidget *)
vtkVRMenuWidget::SelectMenuAction
static void SelectMenuAction(vtkAbstractWidget *)
vtkVRMenuWidget::RemoveMenuItem
void RemoveMenuItem(const char *name)
Methods to add/remove items to the menu, called by the menu widget.
vtkVRMenuWidget::~vtkVRMenuWidget
~vtkVRMenuWidget() override
vtkVRMenuWidget::EventCommand
vtkCallbackCommand * EventCommand
Definition: vtkVRMenuWidget.h:96
vtkVRMenuWidget::WidgetState
int WidgetState
Definition: vtkVRMenuWidget.h:86
vtkVRMenuWidget::New
static vtkVRMenuWidget * New()
Instantiate the object.
vtkVRMenuWidget::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Standard vtkObject methods.
vtkVRMenuWidget::WidgetStateType
WidgetStateType
Definition: vtkVRMenuWidget.h:60
vtkVRMenuWidget::Menus
std::deque< InternalElement * > Menus
Definition: vtkVRMenuWidget.h:88
vtkVRMenuWidget::RenameMenuItem
void RenameMenuItem(const char *name, const char *text)
Methods to add/remove items to the menu, called by the menu widget.
vtkVRMenuWidget::vtkVRMenuWidget
vtkVRMenuWidget()
vtkVRMenuWidget::ShowSubMenu
void ShowSubMenu(vtkVRMenuWidget *)
vtkVRMenuWidget::PushFrontMenuItem
void PushFrontMenuItem(const char *name, const char *text, vtkCommand *cmd)
Methods to add/remove items to the menu, called by the menu widget.
vtkVRMenuWidget::EventCallback
static void EventCallback(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
vtkVRMenuWidget::RemoveAllMenuItems
void RemoveAllMenuItems()
Methods to add/remove items to the menu, called by the menu widget.
vtkVRMenuWidget::Show
void Show(vtkEventData *ed)
vtkVRMenuWidget::StartMenuAction
static void StartMenuAction(vtkAbstractWidget *)
vtkX3D::name
@ name
Definition: vtkX3D.h:219
vtkAbstractWidget.h
vtkDeprecation.h
VTK_DEPRECATED_IN_9_2_0
#define VTK_DEPRECATED_IN_9_2_0(reason)
Definition: vtkDeprecation.h:108