MeVisLab Resolution Independence API
Loading...
Searching...
No Matches
SoViewerNode.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_NODE_H
14#define SO_VIEWER_NODE_H
15
17#include "XVInventor.h"
18#include "XVcallbacks.h"
19
20#include <Inventor/nodes/SoSubNode.h>
21#include <Inventor/nodes/SoSeparator.h>
22
23#include <SoViewerProxy.h>
24
25
26class SoWinRenderArea;
27
28//=============================================================
30
41class INVENTORGUIWRAPPER_API SoViewerNode : public SoSeparator
42{
43
44 SO_NODE_HEADER(SoViewerNode);
45
46public:
47 static void initClass();
48
50
52
56 virtual void* createViewer(void* hwnd, SoNode* scene);
57
59 virtual void deleteViewer(void* viewer);
60
62 virtual void* getCurrentViewer()
63 {
64 return _currentViewer;
65 };
66
68 virtual void syncFromViewerNode(SoViewerNode* /* node */) {};
69
71 void setKeyPressedCB(InvHandleEventCB* cb, void* data)
72 {
73 _keyPressedCB = cb;
74 _keyPressedCBData = data;
75 };
76
78 bool keyPressedNotify(void* message)
79 {
80 if (_keyPressedCB)
81 return (*_keyPressedCB)(_keyPressedCBData, this, message) ? true : false;
82 else
83 return false;
84 }
85
87 void setHandleEventCB(InvHandleEventCB* cb, void* data)
88 {
89 _handleEventCB = cb;
90 _handleEventCBData = data;
91 };
92
94 bool handleEventNotify(void* message)
95 {
97 return (*_handleEventCB)(_handleEventCBData, this, message) ? true : false;
98 else
99 return false;
100 }
101
104 {
105 _movieCB = cb;
106 _movieCBData = data;
107 };
108
110 void generateMovie(const char* name, const char* extension, int count, float framerate,
111 const char* targetFile = nullptr)
112 {
113 if (_movieCB)
114 (*_movieCB)(_movieCBData, this, name, extension, count, framerate, targetFile);
115 }
116
117protected:
122
123 ~SoViewerNode() override;
124
137};
138
139#endif
#define INVENTORGUIWRAPPER_API
void InvGenerateMovieCB(void *data, void *component, const char *name, const char *extension, int count, float framerate, const char *targetFile)
Callback used for movie generation.
Definition XVcallbacks.h:29
int InvHandleEventCB(void *data, void *component, void *message)
Definition XVcallbacks.h:26
InvHandleEventCB * _keyPressedCB
Callback for key pressed.
void * _movieCBData
Callback data for movie generation.
void * _currentViewer
Pointer to the current viewer (void, as the concrete type is unknown).
SoViewerProxy * _viewerProxy
Pointer to the proxy for this viewer.
void * _handleEventCBData
Callback data for handleEvent.
virtual void deleteViewer(void *viewer)
Deletes the viewer that was created with createViewer.
virtual void * createViewer(void *hwnd, SoNode *scene)
Creates a viewer in the given window, the scene is shown in the viewer.
static void initClass()
virtual void * getCurrentViewer()
Returns the currently viewer (or NULL if none was created).
virtual void syncFromViewerNode(SoViewerNode *)
Syncs field from given src viewer node (derive to add more synched fields).
InvHandleEventCB * _handleEventCB
Callback for handleEvent.
~SoViewerNode() override
void setKeyPressedCB(InvHandleEventCB *cb, void *data)
Sets a keypressed callback.
void generateMovie(const char *name, const char *extension, int count, float framerate, const char *targetFile=nullptr)
Runs move generation callback.
void * _keyPressedCBData
Callback data for key pressed.
bool keyPressedNotify(void *message)
Runs callback for keypressed event.
InvGenerateMovieCB * _movieCB
Callback for movie generation.
void setHandleEventCB(InvHandleEventCB *cb, void *data)
Sets a handle event callback.
bool handleEventNotify(void *message)
Runs handle event callback.
void setGenerateMovieCB(InvGenerateMovieCB *cb, void *data)
Sets movie generation callback.