MeVisLab Toolbox Reference
SoViewerElement.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef SO_VIEWER_ELEMENT_H
14#define SO_VIEWER_ELEMENT_H
15
17
19#include "SoViewerProxy.h"
20
21#include <ThirdPartyWarningsDisable.h>
22#include <Inventor/elements/SoSubElement.h>
23#include <ThirdPartyWarningsRestore.h>
24
25class SoAction;
26
28class INVENTORWRAPPER_API SoViewerElement : public SoElement
29{
30 SO_ELEMENT_HEADER(SoViewerElement);
31
32 public:
34 void init(SoState *state) override;
35
38 SbBool matches(const SoElement *elt) const override;
39
41 SoElement* copyMatchInfo() const override;
42
44 static void set(SoState *state, SoViewerProxy* proxy);
45
47 static SoViewerProxy* get(SoState *state);
48
51 static void setCursor (SoState *state, int shapeID);
52
55 static double getDevicePixelRatio (SoState *state);
56
59 static void setViewerProxyCB (void* userData, SoAction* action);
60
61 SoINTERNAL public:
63 static void initClass();
64
65 protected:
68
69 ~SoViewerElement() override;
70};
71
74#define SO_NODE_DEFINE_CURSOR_SHAPE_ENUM(enumType) { \
75 int _value_false= 0; \
76 do { \
77 SO__NODE_CHECK_CONSTRUCT(__FILE__); \
78 if (firstInstance) { \
79 for (int i=SoViewerProxy::UNDEFINED_CURSOR;i<SoViewerProxy::getPredefinedCursorCount();++i) { \
80 fieldData->addEnumValue(SO__QUOTE(enumType), \
81 SoViewerProxy::cursorShapeNames()[i+1], i); \
82 } \
83 } \
84 } while (_value_false); \
85 }
86
87#endif /* __SoViewerElement_H */
#define INVENTORWRAPPER_API
Library initialization and export macros for platform independecy of project.
Element that stores a proxy object to the currently active viewer.
void init(SoState *state) override
Initializes element.
static void set(SoState *state, SoViewerProxy *proxy)
Sets the proxy for the currently active viewer.
SoViewerProxy * _proxy
Pointer to the proxy for the active viewer.
SoElement * copyMatchInfo() const override
Create and return a copy of this element.
SbBool matches(const SoElement *elt) const override
Always returns TRUE, since this element should never be a criterion for cache invalidation.
static void setCursor(SoState *state, int shapeID)
Convenience method which calls the corresponding method of SoViewerProxy (or does nothing if the prox...
static void initClass()
Initializes the SoViewerElement class.
~SoViewerElement() override
static SoViewerProxy * get(SoState *state)
Returns the proxy for the currently active viewer (might be NULL!)
static void setViewerProxyCB(void *userData, SoAction *action)
this callback can be used with SoCallback nodes and simply sets the SoViewerProxy given as userData
This class gives access to state of a viewer during scene graph traversal.
static double getDevicePixelRatio(SoState *state)
Convenience method which calls the corresponding method of SoViewerProxy.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.