Mercurial > hg > orthanc-stone
annotate Framework/Viewport/WidgetViewport.h @ 378:814fa32e2fcc
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 06 Nov 2018 14:21:02 +0100 |
parents | 7a364e44fbb4 |
children | 6cc3ce74dc05 |
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. | |
16 * | |
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 "IViewport.h" | |
25 #include "../Toolbox/ObserversRegistry.h" | |
26 #include "../Widgets/IWidget.h" | |
27 | |
53
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
28 #include <memory> |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
29 |
0 | 30 namespace OrthancStone |
31 { | |
61
ca644004d2ee
MAJOR - removal of Start/Stop and observers in IWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
53
diff
changeset
|
32 class WidgetViewport : public IViewport |
0 | 33 { |
34 private: | |
35 std::auto_ptr<IWidget> centralWidget_; | |
36 IStatusBar* statusBar_; | |
37 ObserversRegistry<IViewport> observers_; | |
38 std::auto_ptr<IMouseTracker> mouseTracker_; | |
39 bool isMouseOver_; | |
40 int lastMouseX_; | |
41 int lastMouseY_; | |
42 CairoSurface background_; | |
43 bool backgroundChanged_; | |
44 | |
45 public: | |
46 WidgetViewport(); | |
47 | |
330 | 48 virtual void FitContent(); |
0 | 49 |
50 virtual void SetStatusBar(IStatusBar& statusBar); | |
51 | |
52 IWidget& SetCentralWidget(IWidget* widget); // Takes ownership | |
53 | |
278 | 54 virtual void NotifyContentChanged(const IWidget& widget); |
0 | 55 |
91 | 56 virtual void Register(IObserver& observer) |
0 | 57 { |
58 observers_.Register(observer); | |
59 } | |
60 | |
61 virtual void SetSize(unsigned int width, | |
62 unsigned int height); | |
63 | |
64 virtual bool Render(Orthanc::ImageAccessor& surface); | |
65 | |
66 virtual void MouseDown(MouseButton button, | |
67 int x, | |
68 int y, | |
69 KeyboardModifiers modifiers); | |
70 | |
71 virtual void MouseUp(); | |
72 | |
73 virtual void MouseMove(int x, | |
74 int y); | |
75 | |
76 virtual void MouseEnter(); | |
77 | |
78 virtual void MouseLeave(); | |
79 | |
80 virtual void MouseWheel(MouseWheelDirection direction, | |
81 int x, | |
82 int y, | |
83 KeyboardModifiers modifiers); | |
84 | |
327 | 85 virtual void KeyPressed(KeyboardKeys key, |
86 char keyChar, | |
0 | 87 KeyboardModifiers modifiers); |
46
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
88 |
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
89 virtual bool HasUpdateContent(); |
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
90 |
766d31dc5716
removing threads for wasm
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
91 virtual void UpdateContent(); |
0 | 92 }; |
93 } |