Mercurial > hg > orthanc-stone
comparison Framework/Scene2DViewport/IFlexiblePointerTracker.h @ 728:8190213e2279 am-dev
Merged default into am-dev
author | Alain Mazy <am@osimis.io> |
---|---|
date | Tue, 21 May 2019 13:25:58 +0200 |
parents | 28b9e3a54200 |
children | c0fcb2757b0a |
comparison
equal
deleted
inserted
replaced
690:f185cfcb72a0 | 728:8190213e2279 |
---|---|
1 /** | |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium | |
6 * | |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #pragma once | |
23 | |
24 #include "PointerTypes.h" | |
25 | |
26 #include <Framework/Scene2D/PointerEvent.h> | |
27 | |
28 namespace OrthancStone | |
29 { | |
30 /** | |
31 This interface represents a flexible mouse tracker that can respond to | |
32 several events and is not automatically deleted upon mouse up or when touch | |
33 interaction is suspended : for instance, a stateful tracker with a two-step | |
34 interaction like: click & drag --> mouse up --> drag --> mouse click | |
35 (for instance, for an angle measuring tracker or an ellipse tracker) | |
36 */ | |
37 class IFlexiblePointerTracker : public boost::noncopyable | |
38 { | |
39 public: | |
40 virtual ~IFlexiblePointerTracker() {} | |
41 | |
42 /** | |
43 This method will be repeatedly called during user interaction | |
44 */ | |
45 virtual void PointerMove(const PointerEvent& event) = 0; | |
46 | |
47 /** | |
48 This method will be called when a touch/pointer is removed (mouse up, | |
49 pen lift, finger removed...) | |
50 */ | |
51 virtual void PointerUp(const PointerEvent& event) = 0; | |
52 | |
53 /** | |
54 This method will be called when a touch/pointer is added (mouse down, | |
55 pen or finger press) | |
56 | |
57 Important note: the initial pointer down that leads to creating the | |
58 tracker is NOT sent to the tracker. | |
59 | |
60 Thus, if you count the PointerDown vs PointerUp, there will be an extra | |
61 PointerUp. | |
62 */ | |
63 virtual void PointerDown(const PointerEvent& event) = 0; | |
64 | |
65 /** | |
66 This method will be repeatedly called by the tracker owner (for instance, | |
67 the application) to check whether the tracker must keep on receiving | |
68 interaction or if its job is done and it should be deleted. | |
69 */ | |
70 virtual bool IsAlive() const = 0; | |
71 | |
72 /** | |
73 This will be called if the tracker needs to be dismissed without committing | |
74 its changes to the underlying model. If the model has been modified during | |
75 tracker lifetime, it must be restored to its initial value | |
76 */ | |
77 virtual void Cancel() = 0; | |
78 }; | |
79 | |
80 | |
81 /** | |
82 This factory adopts the supplied simple tracker and creates a flexible | |
83 tracker wrapper around it. | |
84 */ | |
85 FlexiblePointerTrackerPtr CreateSimpleTrackerAdapter(PointerTrackerPtr); | |
86 } | |
87 |