comparison Framework/Scene2DViewport/IFlexiblePointerTracker.h @ 698:8b6adfb62a2f refactor-viewport-controller

Code is broken -- stashing ongoing work in a branch
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 15 May 2019 16:56:17 +0200
parents
children 059e1fd05fd6
comparison
equal deleted inserted replaced
660:cb3b76d16234 698:8b6adfb62a2f
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 virtual void PointerDown(const PointerEvent& event) = 0;
58
59 /**
60 This method will be repeatedly called by the tracker owner (for instance,
61 the application) to check whether the tracker must keep on receiving
62 interaction or if its job is done and it should be deleted.
63 */
64 virtual bool IsActive() const = 0;
65
66 /**
67 This will be called if the tracker needs to be dismissed without committing
68 its changes to the underlying model. If the model has been modified during
69 tracker lifetime, it must be restored to its initial value
70 */
71 virtual void Cancel() = 0;
72 };
73
74
75 /**
76 This factory adopts the supplied simple tracker and creates a flexible
77 tracker wrapper around it.
78 */
79 FlexiblePointerTrackerPtr CreateSimpleTrackerAdapter(PointerTrackerPtr);
80 }
81