VTK  9.7.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 "vtkRenderingVRModule.h" // For export macro
16 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
17 #include <deque> // for ivar
18 
19 VTK_ABI_NAMESPACE_BEGIN
20 class vtkEventData;
22 
23 class VTKRENDERINGVR_EXPORT VTK_MARSHALAUTO vtkVRMenuWidget : public vtkAbstractWidget
24 {
25 public:
29  static vtkVRMenuWidget* New();
30 
32 
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
60  {
61  Start = 0,
62  Active
63  };
64 
66 
69  void PushFrontMenuItem(const char* name, const char* text, vtkCommand* cmd);
70  void RenameMenuItem(const char* name, const char* text);
71  void RemoveMenuItem(const char* name);
72  void RemoveAllMenuItems();
74 
75  void Show(vtkEventData* ed);
76  void ShowSubMenu(vtkVRMenuWidget*);
77 
78 protected:
80  ~vtkVRMenuWidget() override;
81 
83 
84  class InternalElement;
85  std::deque<InternalElement*> Menus;
86 
87  // These are the callbacks for this widget
88  static void StartMenuAction(vtkAbstractWidget*);
89  static void SelectMenuAction(vtkAbstractWidget*);
90  static void MoveAction(vtkAbstractWidget*);
91 
93  static void EventCallback(
94  vtkObject* object, unsigned long event, void* clientdata, void* calldata);
95 
99  static void Update(vtkAbstractWidget*);
100 
101 private:
102  vtkVRMenuWidget(const vtkVRMenuWidget&) = delete;
103  void operator=(const vtkVRMenuWidget&) = delete;
104 };
105 VTK_ABI_NAMESPACE_END
106 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:52
void PrintSelf(ostream &os, vtkIndent indent) override
Standard macros implementing standard VTK methods.
virtual void CreateDefaultRepresentation()=0
Create the default widget representation if one is not set.
superclass for callback/observer methods
Definition: vtkCommand.h:384
supports function callbacks
a simple class to control print indentation
Definition: vtkIndent.h:28
Widget representation for vtkVRMenuWidget Implementation of the popup panel representation for the vt...
std::deque< InternalElement * > Menus
3D widget to display a menu in VR
define the API for widget / widget representation
vtkCallbackCommand * EventCommand
#define VTK_MARSHALAUTO
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...