Mercurial > hg > orthanc-stone
comparison Samples/Common/IFlexiblePointerTracker.h @ 644:f939f449482c
Ongoing tracker work.
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Fri, 10 May 2019 16:15:55 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
634:6a144a45b2d8 | 644:f939f449482c |
---|---|
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 <Framework/Scene2D/PointerEvent.h> | |
25 #include <boost/shared_ptr.hpp> | |
26 | |
27 namespace OrthancStone | |
28 { | |
29 class IPointerTracker; | |
30 typedef boost::shared_ptr<IPointerTracker> PointerTrackerPtr; | |
31 | |
32 /** | |
33 This interface represents a flexible mouse tracker that can respond to | |
34 several events and is not automatically deleted upon mouse up or when touch | |
35 interaction is suspended : for instance, a stateful tracker with a two-step | |
36 interaction like: click & drag --> mouse up --> drag --> mouse click | |
37 (for instance, for an angle measuring tracker or an ellipse tracker) | |
38 */ | |
39 class IFlexiblePointerTracker : public boost::noncopyable | |
40 { | |
41 public: | |
42 virtual ~IFlexiblePointerTracker() {} | |
43 | |
44 /** | |
45 This method will be repeatedly called during user interaction | |
46 */ | |
47 virtual void PointerMove(const PointerEvent& event) = 0; | |
48 | |
49 /** | |
50 This method will be called when a touch/pointer is removed (mouse up, | |
51 pen lift, finger removed...) | |
52 */ | |
53 virtual void PointerUp(const PointerEvent& event) = 0; | |
54 | |
55 /** | |
56 This method will be called when a touch/pointer is added (mouse down, | |
57 pen or finger press) | |
58 */ | |
59 virtual void PointerDown(const PointerEvent& event) = 0; | |
60 | |
61 /** | |
62 This method will be repeatedly called by the tracker owner (for instance, | |
63 the application) to check whether the tracker must keep on receiving | |
64 interaction or if its job is done and it should be deleted. | |
65 */ | |
66 virtual bool IsActive() const = 0; | |
67 | |
68 /** | |
69 This will be called if the tracker needs to be dismissed without committing | |
70 its changes to the underlying model. If the model has been modified during | |
71 tracker lifetime, it must be restored to its initial value | |
72 */ | |
73 virtual void Cancel() = 0; | |
74 }; | |
75 | |
76 typedef boost::shared_ptr<IFlexiblePointerTracker> FlexiblePointerTrackerPtr; | |
77 | |
78 /** | |
79 This factory adopts the supplied simple tracker and creates a flexible | |
80 tracker wrapper around it. | |
81 */ | |
82 FlexiblePointerTrackerPtr CreateSimpleTrackerAdapter(PointerTrackerPtr); | |
83 } | |
84 |