comparison OrthancStone/Sources/Scene2DViewport/IFlexiblePointerTracker.h @ 1512:244ad1e4e76a

reorganization of folders
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 07 Jul 2020 16:21:02 +0200
parents Framework/Scene2DViewport/IFlexiblePointerTracker.h@2d8ab34c8c91
children 97b34cb88600
comparison
equal deleted inserted replaced
1511:9dfeee74c1e6 1512:244ad1e4e76a
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-2020 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 "PredeclaredTypes.h"
25
26 #include "../Scene2D/PointerEvent.h"
27
28
29 namespace OrthancStone
30 {
31 /**
32 This interface represents a flexible mouse tracker that can respond to
33 several events and is not automatically deleted upon mouse up or when touch
34 interaction is suspended : for instance, a stateful tracker with a two-step
35 interaction like: click & drag --> mouse up --> drag --> mouse click
36 (for instance, for an angle measuring tracker or an ellipse tracker)
37 */
38 class IFlexiblePointerTracker : public boost::noncopyable
39 {
40 public:
41 virtual ~IFlexiblePointerTracker() {}
42
43 /**
44 This method will be repeatedly called during user interaction
45 */
46 virtual void PointerMove(const PointerEvent& event) = 0;
47
48 /**
49 This method will be called when a touch/pointer is removed (mouse up,
50 pen lift, finger removed...)
51 */
52 virtual void PointerUp(const PointerEvent& event) = 0;
53
54 /**
55 This method will be called when a touch/pointer is added (mouse down,
56 pen or finger press)
57
58 Important note: the initial pointer down that leads to creating the
59 tracker is NOT sent to the tracker.
60
61 Thus, if you count the PointerDown vs PointerUp, there will be an extra
62 PointerUp.
63 */
64 virtual void PointerDown(const PointerEvent& event) = 0;
65
66 /**
67 This method will be repeatedly called by the tracker owner (for instance,
68 the application) to check whether the tracker must keep on receiving
69 interaction or if its job is done and it should be deleted.
70 */
71 virtual bool IsAlive() const = 0;
72
73 /**
74 This will be called if the tracker needs to be dismissed without committing
75 its changes to the underlying model. If the model has been modified during
76 tracker lifetime, it must be restored to its initial value
77 */
78 virtual void Cancel() = 0;
79 };
80
81
82 /**
83 This factory adopts the supplied simple tracker and creates a flexible
84 tracker wrapper around it.
85 */
86 boost::shared_ptr<IFlexiblePointerTracker> CreateSimpleTrackerAdapter(boost::shared_ptr<IPointerTracker>);
87 }
88