Mercurial > hg > orthanc-stone
comparison Framework/Deprecated/Widgets/WorldSceneWidget.h @ 754:92c400a09f1b
Merge from default
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Wed, 22 May 2019 16:13:46 +0200 |
parents | c35e98d22764 |
children | 2d8ab34c8c91 |
comparison
equal
deleted
inserted
replaced
753:a386bbc955dc | 754:92c400a09f1b |
---|---|
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 "CairoWidget.h" | |
25 #include "IWorldSceneInteractor.h" | |
26 | |
27 #include "../Toolbox/ViewportGeometry.h" | |
28 | |
29 namespace Deprecated | |
30 { | |
31 class WorldSceneWidget : public CairoWidget | |
32 { | |
33 private: | |
34 class SceneMouseTracker; | |
35 | |
36 ViewportGeometry view_; | |
37 IWorldSceneInteractor* interactor_; | |
38 bool hasDefaultMouseEvents_; | |
39 | |
40 protected: | |
41 virtual OrthancStone::Extent2D GetSceneExtent() = 0; | |
42 | |
43 virtual bool RenderScene(OrthancStone::CairoContext& context, | |
44 const ViewportGeometry& view) = 0; | |
45 | |
46 // From CairoWidget | |
47 virtual bool RenderCairo(OrthancStone::CairoContext& context); | |
48 | |
49 // From CairoWidget | |
50 virtual void RenderMouseOverCairo(OrthancStone::CairoContext& context, | |
51 int x, | |
52 int y); | |
53 | |
54 void SetSceneExtent(ViewportGeometry& geometry); | |
55 | |
56 public: | |
57 WorldSceneWidget(const std::string& name) : | |
58 CairoWidget(name), | |
59 interactor_(NULL), | |
60 hasDefaultMouseEvents_(true) | |
61 { | |
62 } | |
63 | |
64 void SetDefaultMouseEvents(bool value) | |
65 { | |
66 hasDefaultMouseEvents_ = value; | |
67 } | |
68 | |
69 bool HasDefaultMouseEvents() const | |
70 { | |
71 return hasDefaultMouseEvents_; | |
72 } | |
73 | |
74 void SetInteractor(IWorldSceneInteractor& interactor); | |
75 | |
76 void SetView(const ViewportGeometry& view); | |
77 | |
78 const ViewportGeometry& GetView() const | |
79 { | |
80 return view_; | |
81 } | |
82 | |
83 virtual void SetSize(unsigned int width, | |
84 unsigned int height); | |
85 | |
86 virtual void FitContent(); | |
87 | |
88 virtual IMouseTracker* CreateMouseTracker(OrthancStone::MouseButton button, | |
89 int x, | |
90 int y, | |
91 OrthancStone::KeyboardModifiers modifiers, | |
92 const std::vector<Touch>& touches); | |
93 | |
94 virtual void MouseWheel(OrthancStone::MouseWheelDirection direction, | |
95 int x, | |
96 int y, | |
97 OrthancStone::KeyboardModifiers modifiers); | |
98 | |
99 virtual void KeyPressed(OrthancStone::KeyboardKeys key, | |
100 char keyChar, | |
101 OrthancStone::KeyboardModifiers modifiers); | |
102 }; | |
103 } |