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
27
35
37{
38 SO_NODE_HEADER(SoView2DButton);
39
40public:
42 ~SoView2DButton() override;
43
44 static void initClass();
45
46 SoSFTypedEnum<DeviceCoordinateMode> deviceCoordinateMode;
48 SoSFVec2f deviceSize;
49
50 SoSFString defaultIconFile;
51 SoSFString pressedIconFile;
54
59
60 SoSFTrigger clickedTrigger;
61 SoSFBool isPressed;
62 SoSFBool isMouseOver;
63
64protected:
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 bool computeIconPosition(View2DSliceList* sliceList, int z, SbVec2f& minIconPosition, SbVec2f& maxIconPosition);
97 bool 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
#define SOVIEW2D_API
File to resolve system dependencies in View2D library.
SoPointerPosition manages the current position of the mouse cursor.
bool isSensitiveAt(const SoPointerPosition &pos) override
SoSFString mouseOverIconFile
void dragMoveTo(const SoPointerPosition &pos) override
bool isMouseOverButton(const SoPointerPosition &pos)
SoSFString defaultInternalIconFile
bool computeIconPosition(View2DSliceList *sliceList, int z, SbVec2f &minIconPosition, SbVec2f &maxIconPosition)
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
SoSFString pressedIconFile
bool implementsManagedInteractionAndClassicEventHandling() const override
~SoView2DButton() override
bool fillVisibleDeviceRect(View2DSliceList *sliceList, int z, SbVec2f &minDeviceRect, SbVec2f &maxDeviceRect)
SoSFString defaultIconFile
SoSFString pressedAndMouseOverInternalIconFile
SoPointingAction * endPress(int clickCount) override
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
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
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(const std::string &actionID, bool positionSensitive=true)
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