MeVisLab Toolbox Reference
SoFocusElement.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_FOCUS_ELEMENT_H
14 #define SO_FOCUS_ELEMENT_H
15 
16 
18 
19 #include "SoUtilsSystem.h"
20 
21 #include <Inventor/elements/SoReplacedElement.h>
22 #include <Inventor/events/SoEvent.h>
23 
25 enum FocusState {
28 };
31 {
32  public:
35 
40  SbVec2f normClickCoords;
41 
45  normClickCoords = SbVec2f(0,0);
46  }
47 
50  this->state = state;
51  this->normClickCoords = normClickCoords;
52  }
53 
55  int operator==(const SbFocusInfo &i) const {
56  return ( (state == i.state) &&
58  }
59 };
60 
62 class SOUTILS_EXPORT SoFocusElement : public SoReplacedElement {
63 
64  SO_ELEMENT_HEADER(SoFocusElement);
65 
66  public:
68  void init(SoState *state) override;
69 
72  static const SbFocusInfo& get(SoState *state);
73 
76 
78  static void set(SoState *state, SoNode *node, const SbFocusInfo& focusInfo);
79 
80  SoINTERNAL public:
82  static void initClass();
83 
84  protected:
87 };
88 
89 #endif
FocusState
Administrates the current focus state.
@ FS_FOCUS
@ FS_NO_FOCUS
#define SOUTILS_EXPORT
System dependent includes. Disables some compiler/linker warnings.
Definition: SoUtilsSystem.h:31
Class transporting focus information for one sub graph.
SbFocusInfo()
Constructor.
SbVec2f normClickCoords
Normalized coordinates of click event that caused the focus state.
SbFocusInfo(FocusState state, SbVec2f normClickCoords)
Constructor.
int operator==(const SbFocusInfo &i) const
Operator to compare two instances.
FocusState state
Is the sub graph currently selected?
Open Inventor Element defining if the currently rendered Graph has the focus.
SbFocusInfo getDefault()
Returns a default SbFocusInfo.
void init(SoState *state) override
See inventor element documentation. Not to be called directly.
static const SbFocusInfo & get(SoState *state)
Returns focus state.
static void initClass()
Initializes the class.
static void set(SoState *state, SoNode *node, const SbFocusInfo &focusInfo)
Set element state. Usually called in action routines of self written inventor nodes.
SbFocusInfo _focusInfo
Stores the current focus state.