Mercurial > hg > orthanc-stone
annotate Framework/Widgets/WorldSceneWidget.h @ 378:814fa32e2fcc
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 06 Nov 2018 14:21:02 +0100 |
parents | 08683537a227 |
children | 99e31898910e |
rev | line source |
---|---|
0 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
134
4cff7b1ed31d
upgrade to year 2018
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
47
diff
changeset
|
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium |
0 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
47 | 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. | |
0 | 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 | |
47 | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Affero General Public License for more details. | |
281 | 16 * |
47 | 17 * You should have received a copy of the GNU Affero General Public License |
0 | 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 **/ | |
20 | |
21 | |
22 #pragma once | |
23 | |
24 #include "CairoWidget.h" | |
25 #include "IWorldSceneInteractor.h" | |
26 | |
61
ca644004d2ee
MAJOR - removal of Start/Stop and observers in IWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
59
diff
changeset
|
27 #include "../Toolbox/ObserversRegistry.h" |
0 | 28 #include "../Toolbox/ViewportGeometry.h" |
29 | |
30 namespace OrthancStone | |
31 { | |
32 class WorldSceneWidget : public CairoWidget | |
33 { | |
34 private: | |
35 class SceneMouseTracker; | |
36 | |
53
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
37 ViewportGeometry view_; |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
38 IWorldSceneInteractor* interactor_; |
333
08683537a227
possibility to turn off default mouse events in WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
332
diff
changeset
|
39 bool hasDefaultMouseEvents_; |
0 | 40 |
331
7ccf919faff0
simplify WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
41 protected: |
112
948f86e61e83
start of SliceLocationSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
111
diff
changeset
|
42 virtual Extent2D GetSceneExtent() = 0; |
0 | 43 |
44 virtual bool RenderScene(CairoContext& context, | |
45 const ViewportGeometry& view) = 0; | |
46 | |
331
7ccf919faff0
simplify WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
47 // From CairoWidget |
0 | 48 virtual bool RenderCairo(CairoContext& context); |
49 | |
331
7ccf919faff0
simplify WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
50 // From CairoWidget |
0 | 51 virtual void RenderMouseOverCairo(CairoContext& context, |
52 int x, | |
53 int y); | |
54 | |
53
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
55 void SetSceneExtent(ViewportGeometry& geometry); |
0 | 56 |
57 public: | |
273
f21ba2468570
force all Widgets to have a name to ease debugging
am@osimis.io
parents:
196
diff
changeset
|
58 WorldSceneWidget(const std::string& name) : |
f21ba2468570
force all Widgets to have a name to ease debugging
am@osimis.io
parents:
196
diff
changeset
|
59 CairoWidget(name), |
333
08683537a227
possibility to turn off default mouse events in WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
332
diff
changeset
|
60 interactor_(NULL), |
08683537a227
possibility to turn off default mouse events in WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
332
diff
changeset
|
61 hasDefaultMouseEvents_(true) |
08683537a227
possibility to turn off default mouse events in WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
332
diff
changeset
|
62 { |
08683537a227
possibility to turn off default mouse events in WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
332
diff
changeset
|
63 } |
08683537a227
possibility to turn off default mouse events in WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
332
diff
changeset
|
64 |
08683537a227
possibility to turn off default mouse events in WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
332
diff
changeset
|
65 void SetDefaultMouseEvents(bool value) |
0 | 66 { |
333
08683537a227
possibility to turn off default mouse events in WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
332
diff
changeset
|
67 hasDefaultMouseEvents_ = value; |
08683537a227
possibility to turn off default mouse events in WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
332
diff
changeset
|
68 } |
08683537a227
possibility to turn off default mouse events in WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
332
diff
changeset
|
69 |
08683537a227
possibility to turn off default mouse events in WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
332
diff
changeset
|
70 bool HasDefaultMouseEvents() const |
08683537a227
possibility to turn off default mouse events in WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
332
diff
changeset
|
71 { |
08683537a227
possibility to turn off default mouse events in WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
332
diff
changeset
|
72 return hasDefaultMouseEvents_; |
0 | 73 } |
74 | |
75 void SetInteractor(IWorldSceneInteractor& interactor); | |
76 | |
77 void SetView(const ViewportGeometry& view); | |
78 | |
332
50e5ec1bdd46
separating ZoomMouseTracker and PanMouseTracker from WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
331
diff
changeset
|
79 const ViewportGeometry& GetView() const |
50e5ec1bdd46
separating ZoomMouseTracker and PanMouseTracker from WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
331
diff
changeset
|
80 { |
50e5ec1bdd46
separating ZoomMouseTracker and PanMouseTracker from WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
331
diff
changeset
|
81 return view_; |
50e5ec1bdd46
separating ZoomMouseTracker and PanMouseTracker from WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
331
diff
changeset
|
82 } |
0 | 83 |
331
7ccf919faff0
simplify WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
84 virtual void SetSize(unsigned int width, |
7ccf919faff0
simplify WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
85 unsigned int height); |
7ccf919faff0
simplify WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
86 |
7ccf919faff0
simplify WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
87 virtual void FitContent(); |
7ccf919faff0
simplify WorldSceneWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
88 |
0 | 89 virtual IMouseTracker* CreateMouseTracker(MouseButton button, |
90 int x, | |
91 int y, | |
92 KeyboardModifiers modifiers); | |
93 | |
94 virtual void MouseWheel(MouseWheelDirection direction, | |
95 int x, | |
96 int y, | |
97 KeyboardModifiers modifiers); | |
98 | |
327 | 99 virtual void KeyPressed(KeyboardKeys key, |
100 char keyChar, | |
0 | 101 KeyboardModifiers modifiers); |
102 }; | |
103 } |