VTK
vtkOpenVRMenuWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3 Program: Visualization Toolkit
4 Module: vtkOpenVRMenuWidget.h
5 
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
21 #ifndef vtkOpenVRMenuWidget_h
22 #define vtkOpenVRMenuWidget_h
23 
24 #include "vtkRenderingOpenVRModule.h" // For export macro
25 #include "vtkAbstractWidget.h"
26 #include <deque> // for ivar
27 
28 class vtkEventData;
30 class vtkPropMap;
31 class vtkProp;
32 
33 
34 class VTKRENDERINGOPENVR_EXPORT vtkOpenVRMenuWidget : public vtkAbstractWidget
35 {
36 public:
40  static vtkOpenVRMenuWidget *New();
41 
43 
47  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
55  void SetRepresentation(vtkOpenVRMenuRepresentation *rep);
56 
60  void CreateDefaultRepresentation() override;
61 
63 
66  vtkGetMacro( WidgetState, int );
68 
69  // Manage the state of the widget
70  enum _WidgetState {Start=0,Active};
71 
77  void AddTooltip(vtkProp *prop, vtkStdString* str);
78  void AddTooltip(vtkProp *prop, const char* str);
79 
81 
84  void PushFrontMenuItem(const char *name, const char *text, vtkCommand *cmd);
85  void RenameMenuItem(const char *name, const char *text);
86  void RemoveMenuItem(const char *name);
87  void RemoveAllMenuItems();
89 
90  void Show(vtkEventData *ed);
91  void ShowSubMenu(vtkOpenVRMenuWidget *);
92 
93 protected:
95  ~vtkOpenVRMenuWidget() override;
96 
98 
99  class InternalElement;
100  std::deque<InternalElement *> Menus;
101 
102  // These are the callbacks for this widget
103  static void StartMenuAction(vtkAbstractWidget*);
104  static void SelectMenuAction(vtkAbstractWidget*);
105  static void MoveAction(vtkAbstractWidget*);
106 
108  static void EventCallback(vtkObject* object,
109  unsigned long event,
110  void* clientdata,
111  void* calldata);
112 
116  static void Update(vtkAbstractWidget*);
117 
118 private:
119  vtkOpenVRMenuWidget(const vtkOpenVRMenuWidget&) = delete;
120  void operator=(const vtkOpenVRMenuWidget&) = delete;
121 };
122 #endif
std::deque< InternalElement * > Menus
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:50
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:40
abstract base class for most VTK objects
Definition: vtkObject.h:59
3D widget to display a menu in VR
Widget representation for vtkOpenVRPanelWidget Implementation of the popup panel representation for t...
void PrintSelf(ostream &os, vtkIndent indent) override
Standard macros implementing standard VTK methods.
virtual void Update()
Updates the extensions string.
virtual void CreateDefaultRepresentation()=0
Create the default widget representation if one is not set.
superclass for callback/observer methods
Definition: vtkCommand.h:356
supports function callbacks
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkCallbackCommand * EventCommand
define the API for widget / widget representation
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...