MeVisLab Toolbox Reference
SoView2DButton.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2016, 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 #pragma once
14 
15 #include "SoView2DSystem.h"
17 #include "SoView2D.h"
18 
19 #include "../View2DIcons.h"
20 
21 
23 {
26 };
27 
29 {
34 };
35 
37 {
38  SO_NODE_HEADER(SoView2DButton);
39 
40 public:
42  ~SoView2DButton() override;
43 
44  static void initClass();
45 
46  SoSFTypedEnum<DeviceCoordinateMode> deviceCoordinateMode;
48  SoSFVec2f deviceSize;
49 
50  SoSFString defaultIconFile;
51  SoSFString pressedIconFile;
52  SoSFString mouseOverIconFile;
54 
59 
60  SoSFTrigger clickedTrigger;
61  SoSFBool isPressed;
62  SoSFBool isMouseOver;
63 
64 protected:
65  void draw(View2DSliceList* dsl, View2DSlice* dslice, int slice) override;
66  bool evalEvent(SoView2D* , View2DSliceList* , View2DEvent* , View2DEventPhase ) override { return false; }
67  bool ignoreEvent(View2DEvent* ) override { return false; }
68  bool implementsManagedInteractionAndClassicEventHandling() const override { return false; }
69 
70  bool isSensitiveAt(const SoPointerPosition& pos) override;
71  void unsetHighlight() override;
72  void startPressAt(const SoPointerPosition& pos) override;
73  void dragMoveTo(const SoPointerPosition& pos) override;
74  SoPointingAction* endPress(int clickCount) override;
75 
77 
82 
83  void defaultIconChanged(SoField*);
84  void pressedIconChanged(SoField*);
85  void mouseOverIconChanged(SoField*);
87 
89 
94 
95  void setupIcon(View2DIcons* & icons, const std::string& filename);
96  void computeIconPosition(View2DSliceList* sliceList, int z, SbVec2f& minIconPosition, SbVec2f& maxIconPosition);
97  void fillVisibleDeviceRect(View2DSliceList* sliceList, int z, SbVec2f& minDeviceRect, SbVec2f& maxDeviceRect);
98 };
ButtonState
@ BUTTON_PRESSED_AND_MOUSE_OVER
@ BUTTON_MOUSE_OVER
@ BUTTON_PRESSED
@ BUTTON_DEFAULT
DeviceCoordinateMode
@ DEVICE_COORDINATES_ABSOLUTE
@ DEVICE_COORDINATES_RELATIVE
View2DEventPhase
event phase for simple extensions that grab the focus, do something (motion) and are released afterwa...
#define SOVIEW2D_API
File to resolve system dependencies in View2D library.
SoPointerPosition manages the current position of the mouse cursor.
SoPointingAction is the base class for any mouse based interaction.
bool isSensitiveAt(const SoPointerPosition &pos) override
SoPointingAction * endPress(int clickCount) override
SoSFString mouseOverIconFile
void dragMoveTo(const SoPointerPosition &pos) override
bool isMouseOverButton(const SoPointerPosition &pos)
SoSFString defaultInternalIconFile
void setupPressedAndMouseOverIcon()
SoSFBool isMouseOver
View2DIcons * _mouseOverIcon
ButtonState _buttonRenderingState
void setupIcon(View2DIcons *&icons, const std::string &filename)
View2DIcons * _defaultIcon
SoSFTypedEnum< DeviceCoordinateMode > deviceCoordinateMode
SoSFVec2f deviceCoordinatePosition
SoSFTrigger clickedTrigger
void computeIconPosition(View2DSliceList *sliceList, int z, SbVec2f &minIconPosition, SbVec2f &maxIconPosition)
SoSFString pressedIconFile
bool implementsManagedInteractionAndClassicEventHandling() const override
return true if this node is a hybrid module providing managed interaction and classic event handling ...
~SoView2DButton() override
SoSFString defaultIconFile
SoSFString pressedAndMouseOverInternalIconFile
SoSFString pressedInternalIconFile
void pressedAndMouseOverIconChanged(SoField *)
bool evalEvent(SoView2D *, View2DSliceList *, View2DEvent *, View2DEventPhase) override
Called by the SoView2D for each event that happens on the viewer.
void setupDefaultIcon()
void unsetHighlight() override
SoSFBool isPressed
SoSFString mouseOverInternalIconFile
View2DIcons * _pressedIcon
void pressedIconChanged(SoField *)
View2DIcons * _pressedAndMouseOverIcon
bool ignoreEvent(View2DEvent *) override
Return true if ec has been handled before and if ignoreHandledEvents is True.
static void initClass()
void defaultIconChanged(SoField *)
void setupPressedIcon()
void setupMouseOverIcon()
void startPressAt(const SoPointerPosition &pos) override
SoSFVec2f deviceSize
void fillVisibleDeviceRect(View2DSliceList *sliceList, int z, SbVec2f &minDeviceRect, SbVec2f &maxDeviceRect)
SoSFString pressedAndMouseOverIconFile
void mouseOverIconChanged(SoField *)
void draw(View2DSliceList *dsl, View2DSlice *dslice, int slice) override
Called by the SoView2D for each slice that is rendered.
SoView2DInteractionExtension is base class for all SoView2DExtensions that want to support the Manage...
SoView2D is a 2D viewer for image data.
Definition: SoView2D.h:62
View2DEvent stores all information on an event on a SoView2D.
Defines and implements a class to store multiple images and draw them via OpenGL.
Definition: View2DIcons.h:24
a list that holds all View2DSlice objects (lazily created) of a SoView2D
a single slice that is stored in a View2DSliceList, typically created by a View2DSliceList
Definition: View2DSlice.h:48