comparison OrthancStone/Sources/Viewport/DefaultViewportInteractor.h @ 1561:cf652990abb1

tunable mouse actions
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 20 Aug 2020 17:44:35 +0200
parents a6f339d8e4c2
children e731e62692a9
comparison
equal deleted inserted replaced
1560:b4ccd4963d37 1561:cf652990abb1
25 namespace OrthancStone 25 namespace OrthancStone
26 { 26 {
27 class DefaultViewportInteractor : public IViewportInteractor 27 class DefaultViewportInteractor : public IViewportInteractor
28 { 28 {
29 private: 29 private:
30 // Index of the layer whose windowing is altered by clicking the 30 // Index of the layer whose windowing is altered by grayscale windowing action
31 // left mouse button 31 int windowingLayer_;
32 int windowingLayer_; 32 MouseAction leftButtonAction_;
33 MouseAction middleButtonAction_;
34 MouseAction rightButtonAction_;
35
36 IFlexiblePointerTracker* CreateTrackerInternal(boost::shared_ptr<IViewport> viewport,
37 MouseAction action,
38 const PointerEvent& event,
39 unsigned int viewportWidth,
40 unsigned int viewportHeight);
33 41
34 public: 42 public:
35 DefaultViewportInteractor() : 43 DefaultViewportInteractor() :
36 windowingLayer_(0) 44 windowingLayer_(0),
45 leftButtonAction_(MouseAction_GrayscaleWindowing),
46 middleButtonAction_(MouseAction_Pan),
47 rightButtonAction_(MouseAction_Zoom)
37 { 48 {
38 } 49 }
39 50
40 int GetWindowingLayer() const 51 int GetWindowingLayer() const
41 { 52 {
44 55
45 void SetWindowingLayer(int layerIndex) 56 void SetWindowingLayer(int layerIndex)
46 { 57 {
47 windowingLayer_ = layerIndex; 58 windowingLayer_ = layerIndex;
48 } 59 }
60
61 MouseAction GetLeftButtonAction() const
62 {
63 return leftButtonAction_;
64 }
65
66 void SetLeftButtonAction(MouseAction action)
67 {
68 leftButtonAction_ = action;
69 }
70
71 MouseAction GetMiddleButtonAction() const
72 {
73 return middleButtonAction_;
74 }
75
76 void SetMiddleButtonAction(MouseAction action)
77 {
78 middleButtonAction_ = action;
79 }
80
81 MouseAction GetRightButtonAction() const
82 {
83 return rightButtonAction_;
84 }
85
86 void SetRightButtonAction(MouseAction action)
87 {
88 rightButtonAction_ = action;
89 }
49 90
50 virtual IFlexiblePointerTracker* CreateTracker(boost::shared_ptr<IViewport> viewport, 91 virtual IFlexiblePointerTracker* CreateTracker(boost::shared_ptr<IViewport> viewport,
51 const PointerEvent& event, 92 const PointerEvent& event,
52 unsigned int viewportWidth, 93 unsigned int viewportWidth,
53 unsigned int viewportHeight) ORTHANC_OVERRIDE; 94 unsigned int viewportHeight) ORTHANC_OVERRIDE;