comparison Framework/Viewport/WidgetViewport.cpp @ 726:4f2416d519b4

moving layers, widgets and loaders to Deprecated namespace
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 21 May 2019 11:43:25 +0200
parents 1201b12eb9f8
children
comparison
equal deleted inserted replaced
714:d2c0e347ddc2 726:4f2416d519b4
22 #include "WidgetViewport.h" 22 #include "WidgetViewport.h"
23 23
24 #include <Core/Images/ImageProcessing.h> 24 #include <Core/Images/ImageProcessing.h>
25 #include <Core/OrthancException.h> 25 #include <Core/OrthancException.h>
26 26
27 namespace OrthancStone 27 namespace Deprecated
28 { 28 {
29 WidgetViewport::WidgetViewport(MessageBroker& broker) : 29 WidgetViewport::WidgetViewport(OrthancStone::MessageBroker& broker) :
30 IViewport(broker), 30 IViewport(broker),
31 statusBar_(NULL), 31 statusBar_(NULL),
32 isMouseOver_(false), 32 isMouseOver_(false),
33 lastMouseX_(0), 33 lastMouseX_(0),
34 lastMouseY_(0), 34 lastMouseY_(0),
137 return true; 137 return true;
138 } 138 }
139 139
140 void WidgetViewport::TouchStart(const std::vector<Touch>& displayTouches) 140 void WidgetViewport::TouchStart(const std::vector<Touch>& displayTouches)
141 { 141 {
142 MouseDown(MouseButton_Left, (int)displayTouches[0].x, (int)displayTouches[0].y, KeyboardModifiers_None, displayTouches); // one touch is equivalent to a mouse tracker without left button -> set the mouse coordinates to the first touch coordinates 142 MouseDown(OrthancStone::MouseButton_Left, (int)displayTouches[0].x, (int)displayTouches[0].y, OrthancStone::KeyboardModifiers_None, displayTouches); // one touch is equivalent to a mouse tracker without left button -> set the mouse coordinates to the first touch coordinates
143 } 143 }
144 144
145 void WidgetViewport::TouchMove(const std::vector<Touch>& displayTouches) 145 void WidgetViewport::TouchMove(const std::vector<Touch>& displayTouches)
146 { 146 {
147 MouseMove((int)displayTouches[0].x, (int)displayTouches[0].y, displayTouches); // one touch is equivalent to a mouse tracker without left button -> set the mouse coordinates to the first touch coordinates 147 MouseMove((int)displayTouches[0].x, (int)displayTouches[0].y, displayTouches); // one touch is equivalent to a mouse tracker without left button -> set the mouse coordinates to the first touch coordinates
152 // note: TouchEnd is not triggered when a single touch gesture ends (it is only triggered when 152 // note: TouchEnd is not triggered when a single touch gesture ends (it is only triggered when
153 // going from 2 touches to 1 touch, ...) 153 // going from 2 touches to 1 touch, ...)
154 MouseUp(); 154 MouseUp();
155 } 155 }
156 156
157 void WidgetViewport::MouseDown(MouseButton button, 157 void WidgetViewport::MouseDown(OrthancStone::MouseButton button,
158 int x, 158 int x,
159 int y, 159 int y,
160 KeyboardModifiers modifiers, 160 OrthancStone::KeyboardModifiers modifiers,
161 const std::vector<Touch>& displayTouches 161 const std::vector<Touch>& displayTouches
162 ) 162 )
163 { 163 {
164 lastMouseX_ = x; 164 lastMouseX_ = x;
165 lastMouseY_ = y; 165 lastMouseY_ = y;
239 239
240 NotifyContentChanged(); 240 NotifyContentChanged();
241 } 241 }
242 242
243 243
244 void WidgetViewport::MouseWheel(MouseWheelDirection direction, 244 void WidgetViewport::MouseWheel(OrthancStone::MouseWheelDirection direction,
245 int x, 245 int x,
246 int y, 246 int y,
247 KeyboardModifiers modifiers) 247 OrthancStone::KeyboardModifiers modifiers)
248 { 248 {
249 if (centralWidget_.get() != NULL && 249 if (centralWidget_.get() != NULL &&
250 mouseTracker_.get() == NULL) 250 mouseTracker_.get() == NULL)
251 { 251 {
252 centralWidget_->MouseWheel(direction, x, y, modifiers); 252 centralWidget_->MouseWheel(direction, x, y, modifiers);
253 } 253 }
254 } 254 }
255 255
256 256
257 void WidgetViewport::KeyPressed(KeyboardKeys key, 257 void WidgetViewport::KeyPressed(OrthancStone::KeyboardKeys key,
258 char keyChar, 258 char keyChar,
259 KeyboardModifiers modifiers) 259 OrthancStone::KeyboardModifiers modifiers)
260 { 260 {
261 if (centralWidget_.get() != NULL && 261 if (centralWidget_.get() != NULL &&
262 mouseTracker_.get() == NULL) 262 mouseTracker_.get() == NULL)
263 { 263 {
264 centralWidget_->KeyPressed(key, keyChar, modifiers); 264 centralWidget_->KeyPressed(key, keyChar, modifiers);