Mercurial > hg > orthanc-stone
annotate Applications/Generic/GuiAdapter.h @ 1344:00c8322bbe69 broker
Ability to force a re-slice of the structure set volume.
This is a fix for the fact that the structure set does not
increase the slice revision when new polygons are added.
This should be fixed in the slicer but this is a temporary
fix until this is done properly.
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Mon, 06 Apr 2020 08:44:10 +0200 |
parents | d80a3e3cc800 |
children | 28eb7106ef44 |
rev | line source |
---|---|
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
1 /** |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
2 * Stone of Orthanc |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
1270
2d8ab34c8c91
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1020
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
6 * |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Affero General Public License |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
10 * the License, or (at your option) any later version. |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
11 * |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
15 * Affero General Public License for more details. |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
16 * |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Affero General Public License |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
19 **/ |
858
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
20 #pragma once |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
21 |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
22 #include <string> |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
23 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
24 #if ORTHANC_ENABLE_WASM != 1 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
25 # ifdef __EMSCRIPTEN__ |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
26 # error __EMSCRIPTEN__ is defined and ORTHANC_ENABLE_WASM != 1 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
27 # endif |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
28 #endif |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
29 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
30 #if ORTHANC_ENABLE_WASM == 1 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
31 # ifndef __EMSCRIPTEN__ |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
32 # error __EMSCRIPTEN__ is not defined and ORTHANC_ENABLE_WASM == 1 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
33 # endif |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
34 #endif |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
35 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
36 #if ORTHANC_ENABLE_WASM == 1 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
37 # include <emscripten/html5.h> |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
38 #else |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
39 # if ORTHANC_ENABLE_SDL == 1 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
40 # include <SDL.h> |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
41 # endif |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
42 #endif |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
43 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
44 #include "../../Framework/StoneException.h" |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
45 |
1226
05d05cba0f4f
explicitely tagging LockingEmitter as deprecated
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1097
diff
changeset
|
46 #if ORTHANC_ENABLE_THREADS == 1 |
05d05cba0f4f
explicitely tagging LockingEmitter as deprecated
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1097
diff
changeset
|
47 # include "../../Framework/Deprecated/Messages/LockingEmitter.h" |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
48 #endif |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
49 |
845
cdba0dbb4682
removed some c++11 for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
843
diff
changeset
|
50 #include <vector> |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
51 #include <boost/shared_ptr.hpp> |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
52 #include <boost/weak_ptr.hpp> |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
53 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
54 namespace OrthancStone |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
55 { |
1318
cbfdba08e039
removed SDL code in wasm + added undostack CTOR in Wasm viewport + build fix + ORTHANC_OVERRIDE
Benjamin Golinvaux <bgo@osimis.io>
parents:
1313
diff
changeset
|
56 #if ORTHANC_ENABLE_SDL == 1 |
1313
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
57 class SdlViewport; |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
58 #endif |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
59 |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
60 #if 0 |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
61 |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
62 /** |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
63 This interface is used to store the widgets that are controlled by the |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
64 GuiAdapter and receive event callbacks. |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
65 The callbacks may possibly be downcast (using dynamic_cast, for safety) \ |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
66 to the actual widget type |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
67 */ |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
68 class IGuiAdapterWidget |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
69 { |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
70 public: |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
71 virtual ~IGuiAdapterWidget() {} |
1313
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
72 |
1318
cbfdba08e039
removed SDL code in wasm + added undostack CTOR in Wasm viewport + build fix + ORTHANC_OVERRIDE
Benjamin Golinvaux <bgo@osimis.io>
parents:
1313
diff
changeset
|
73 #if #if ORTHANC_ENABLE_SDL == 1 |
1313
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
74 /** |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
75 Returns the SdlViewport that this widget contains. If the underlying |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
76 viewport type is *not* SDL, then an error is returned. |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
77 */ |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
78 virtual SdlViewport& GetSdlViewport() = 0; |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
79 #endif |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
80 }; |
858
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
81 |
1313
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
82 #endif |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
83 |
879 | 84 enum GuiAdapterMouseButtonType |
85 { | |
86 GUIADAPTER_MOUSEBUTTON_LEFT = 0, | |
87 GUIADAPTER_MOUSEBUTTON_MIDDLE = 1, | |
88 GUIADAPTER_MOUSEBUTTON_RIGHT = 2 | |
89 }; | |
90 | |
91 | |
861
f0bf971a1e31
Keyboard event routing (handling done in app)
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
92 enum GuiAdapterHidEventType |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
93 { |
1020
ac88989817e3
TrackerCommand --> MeasureCommand + fuse against exception in MeasureTool dtor
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
94 GUIADAPTER_EVENT_MOUSEDOWN = 1973, |
ac88989817e3
TrackerCommand --> MeasureCommand + fuse against exception in MeasureTool dtor
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
95 GUIADAPTER_EVENT_MOUSEMOVE = 1974, |
ac88989817e3
TrackerCommand --> MeasureCommand + fuse against exception in MeasureTool dtor
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
96 GUIADAPTER_EVENT_MOUSEDBLCLICK = 1975, |
ac88989817e3
TrackerCommand --> MeasureCommand + fuse against exception in MeasureTool dtor
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
97 GUIADAPTER_EVENT_MOUSEUP = 1976, |
ac88989817e3
TrackerCommand --> MeasureCommand + fuse against exception in MeasureTool dtor
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
98 GUIADAPTER_EVENT_WHEEL = 1977, |
ac88989817e3
TrackerCommand --> MeasureCommand + fuse against exception in MeasureTool dtor
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
99 GUIADAPTER_EVENT_KEYDOWN = 1978, |
ac88989817e3
TrackerCommand --> MeasureCommand + fuse against exception in MeasureTool dtor
Benjamin Golinvaux <bgo@osimis.io>
parents:
937
diff
changeset
|
100 GUIADAPTER_EVENT_KEYUP = 1979, |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
101 }; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
102 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
103 const unsigned int GUIADAPTER_DELTA_PIXEL = 2973; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
104 const unsigned int GUIADAPTER_DELTA_LINE = 2974; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
105 const unsigned int GUIADAPTER_DELTA_PAGE = 2975; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
106 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
107 struct GuiAdapterUiEvent; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
108 struct GuiAdapterMouseEvent; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
109 struct GuiAdapterWheelEvent; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
110 struct GuiAdapterKeyboardEvent; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
111 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
112 #if 1 |
1313
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
113 typedef bool (*OnMouseEventFunc) (std::string canvasId, const GuiAdapterMouseEvent* mouseEvent, void* userData); |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
114 typedef bool (*OnMouseWheelFunc) (std::string canvasId, const GuiAdapterWheelEvent* wheelEvent, void* userData); |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
115 typedef bool (*OnKeyDownFunc) (std::string canvasId, const GuiAdapterKeyboardEvent* keyEvent, void* userData); |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
116 typedef bool (*OnKeyUpFunc) (std::string canvasId, const GuiAdapterKeyboardEvent* keyEvent, void* userData); |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
117 typedef bool (*OnAnimationFrameFunc)(double time, void* userData); |
1318
cbfdba08e039
removed SDL code in wasm + added undostack CTOR in Wasm viewport + build fix + ORTHANC_OVERRIDE
Benjamin Golinvaux <bgo@osimis.io>
parents:
1313
diff
changeset
|
118 |
cbfdba08e039
removed SDL code in wasm + added undostack CTOR in Wasm viewport + build fix + ORTHANC_OVERRIDE
Benjamin Golinvaux <bgo@osimis.io>
parents:
1313
diff
changeset
|
119 #if ORTHANC_ENABLE_SDL == 1 |
1313
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
120 typedef bool (*OnSdlEventCallback) (std::string canvasId, const SDL_Event& sdlEvent, void* userData); |
1318
cbfdba08e039
removed SDL code in wasm + added undostack CTOR in Wasm viewport + build fix + ORTHANC_OVERRIDE
Benjamin Golinvaux <bgo@osimis.io>
parents:
1313
diff
changeset
|
121 |
1312
4f8c9065ee52
coping with both viewport and loader changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1297
diff
changeset
|
122 typedef bool (*OnSdlWindowResizeFunc)(std::string canvasId, |
4f8c9065ee52
coping with both viewport and loader changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1297
diff
changeset
|
123 const GuiAdapterUiEvent* uiEvent, |
4f8c9065ee52
coping with both viewport and loader changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1297
diff
changeset
|
124 unsigned int width, |
4f8c9065ee52
coping with both viewport and loader changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1297
diff
changeset
|
125 unsigned int height, |
4f8c9065ee52
coping with both viewport and loader changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1297
diff
changeset
|
126 void* userData); |
1313
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
127 |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
128 |
1312
4f8c9065ee52
coping with both viewport and loader changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1297
diff
changeset
|
129 #endif |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
130 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
131 #else |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
132 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
133 #if ORTHANC_ENABLE_WASM == 1 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
134 typedef EM_BOOL (*OnMouseEventFunc)(int eventType, const EmscriptenMouseEvent* mouseEvent, void* userData); |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
135 typedef EM_BOOL (*OnMouseWheelFunc)(int eventType, const EmscriptenWheelEvent* wheelEvent, void* userData); |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
136 typedef EM_BOOL (*OnKeyDownFunc) (int eventType, const EmscriptenKeyboardEvent* keyEvent, void* userData); |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
137 typedef EM_BOOL (*OnKeyUpFunc) (int eventType, const EmscriptenKeyboardEvent* keyEvent, void* userData); |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
138 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
139 typedef EM_BOOL (*OnAnimationFrameFunc)(double time, void* userData); |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
140 typedef EM_BOOL (*OnWindowResizeFunc)(int eventType, const EmscriptenUiEvent* uiEvent, void* userData); |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
141 #else |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
142 typedef bool (*OnMouseEventFunc)(int eventType, const SDL_Event* mouseEvent, void* userData); |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
143 typedef bool (*OnMouseWheelFunc)(int eventType, const SDL_Event* wheelEvent, void* userData); |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
144 typedef bool (*OnKeyDownFunc) (int eventType, const SDL_Event* keyEvent, void* userData); |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
145 typedef bool (*OnKeyUpFunc) (int eventType, const SDL_Event* keyEvent, void* userData); |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
146 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
147 typedef bool (*OnAnimationFrameFunc)(double time, void* userData); |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
148 typedef bool (*OnWindowResizeFunc)(int eventType, const GuiAdapterUiEvent* uiEvent, void* userData); |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
149 #endif |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
150 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
151 #endif |
861
f0bf971a1e31
Keyboard event routing (handling done in app)
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
152 struct GuiAdapterMouseEvent |
f0bf971a1e31
Keyboard event routing (handling done in app)
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
153 { |
f0bf971a1e31
Keyboard event routing (handling done in app)
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
154 GuiAdapterHidEventType type; |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
155 //double timestamp; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
156 //long screenX; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
157 //long screenY; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
158 //long clientX; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
159 //long clientY; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
160 bool ctrlKey; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
161 bool shiftKey; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
162 bool altKey; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
163 //bool metaKey; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
164 unsigned short button; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
165 //unsigned short buttons; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
166 //long movementX; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
167 //long movementY; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
168 long targetX; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
169 long targetY; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
170 // canvasX and canvasY are deprecated - there no longer exists a Module['canvas'] object, so canvasX/Y are no longer reported (register a listener on canvas directly to get canvas coordinates, or translate manually) |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
171 //long canvasX; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
172 //long canvasY; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
173 //long padding; |
879 | 174 |
175 public: | |
176 GuiAdapterMouseEvent() | |
177 : ctrlKey(false), | |
178 shiftKey(false), | |
179 altKey(false) | |
180 { | |
181 } | |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
182 }; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
183 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
184 struct GuiAdapterWheelEvent { |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
185 GuiAdapterMouseEvent mouse; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
186 double deltaX; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
187 double deltaY; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
188 unsigned long deltaMode; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
189 }; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
190 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
191 // we don't use any data now |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
192 struct GuiAdapterUiEvent {}; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
193 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
194 // EmscriptenKeyboardEvent |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
195 struct GuiAdapterKeyboardEvent |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
196 { |
861
f0bf971a1e31
Keyboard event routing (handling done in app)
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
197 GuiAdapterHidEventType type; |
f0bf971a1e31
Keyboard event routing (handling done in app)
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
198 char sym[32]; |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
199 bool ctrlKey; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
200 bool shiftKey; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
201 bool altKey; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
202 }; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
203 |
879 | 204 std::ostream& operator<<(std::ostream& os, const GuiAdapterKeyboardEvent& event); |
858
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
205 |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
206 /* |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
207 Mousedown event trigger when either the left or right (or middle) mouse is pressed |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
208 on the object; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
209 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
210 Mouseup event trigger when either the left or right (or middle) mouse is released |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
211 above the object after triggered mousedown event and held. |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
212 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
213 Click event trigger when the only left mouse button is pressed and released on the |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
214 same object, requires the Mousedown and Mouseup event happened before Click event. |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
215 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
216 The normal expect trigger order: onMousedown >> onMouseup >> onClick |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
217 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
218 Testing in Chrome v58, the time between onMouseup and onClick events are around |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
219 7ms to 15ms |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
220 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
221 FROM: https://codingrepo.com/javascript/2017/05/19/javascript-difference-mousedown-mouseup-click-events/ |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
222 */ |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
223 #if ORTHANC_ENABLE_WASM == 1 |
861
f0bf971a1e31
Keyboard event routing (handling done in app)
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
224 void ConvertFromPlatform(GuiAdapterUiEvent& dest, int eventType, const EmscriptenUiEvent& src); |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
225 |
861
f0bf971a1e31
Keyboard event routing (handling done in app)
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
226 void ConvertFromPlatform(GuiAdapterMouseEvent& dest, int eventType, const EmscriptenMouseEvent& src); |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
227 |
861
f0bf971a1e31
Keyboard event routing (handling done in app)
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
228 void ConvertFromPlatform(GuiAdapterWheelEvent& dest, int eventType, const EmscriptenWheelEvent& src); |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
229 |
861
f0bf971a1e31
Keyboard event routing (handling done in app)
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
230 void ConvertFromPlatform(GuiAdapterKeyboardEvent& dest, const EmscriptenKeyboardEvent& src); |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
231 #else |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
232 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
233 # if ORTHANC_ENABLE_SDL == 1 |
861
f0bf971a1e31
Keyboard event routing (handling done in app)
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
234 void ConvertFromPlatform(GuiAdapterMouseEvent& dest, bool ctrlPressed, bool shiftPressed, bool altPressed, const SDL_Event& source); |
858
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
235 |
861
f0bf971a1e31
Keyboard event routing (handling done in app)
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
236 void ConvertFromPlatform(GuiAdapterWheelEvent& dest, bool ctrlPressed, bool shiftPressed, bool altPressed, const SDL_Event& source); |
f0bf971a1e31
Keyboard event routing (handling done in app)
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
237 |
f0bf971a1e31
Keyboard event routing (handling done in app)
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
238 void ConvertFromPlatform(GuiAdapterKeyboardEvent& dest, const SDL_Event& source); |
858
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
239 |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
240 # endif |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
241 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
242 #endif |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
243 |
937
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
935
diff
changeset
|
244 typedef void (*GuiAdapterRunFunc)(void*); |
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
935
diff
changeset
|
245 |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
246 class GuiAdapter |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
247 { |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
248 public: |
850
df0c73ee7afa
Prevent creation of multiple GuiAdapter instances
Benjamin Golinvaux <bgo@osimis.io>
parents:
845
diff
changeset
|
249 GuiAdapter() |
df0c73ee7afa
Prevent creation of multiple GuiAdapter instances
Benjamin Golinvaux <bgo@osimis.io>
parents:
845
diff
changeset
|
250 { |
df0c73ee7afa
Prevent creation of multiple GuiAdapter instances
Benjamin Golinvaux <bgo@osimis.io>
parents:
845
diff
changeset
|
251 static int instanceCount = 0; |
df0c73ee7afa
Prevent creation of multiple GuiAdapter instances
Benjamin Golinvaux <bgo@osimis.io>
parents:
845
diff
changeset
|
252 ORTHANC_ASSERT(instanceCount == 0); |
df0c73ee7afa
Prevent creation of multiple GuiAdapter instances
Benjamin Golinvaux <bgo@osimis.io>
parents:
845
diff
changeset
|
253 instanceCount = 1; |
df0c73ee7afa
Prevent creation of multiple GuiAdapter instances
Benjamin Golinvaux <bgo@osimis.io>
parents:
845
diff
changeset
|
254 } |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
255 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
256 /** |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
257 emscripten_set_resize_callback("#window", NULL, false, OnWindowResize); |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
258 |
858
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
259 emscripten_set_wheel_callback("mycanvas1", widget1_.get(), false, OnXXXMouseWheel); |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
260 emscripten_set_wheel_callback("mycanvas2", widget2_.get(), false, OnXXXMouseWheel); |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
261 emscripten_set_wheel_callback("mycanvas3", widget3_.get(), false, OnXXXMouseWheel); |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
262 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
263 emscripten_set_keydown_callback("#window", NULL, false, OnKeyDown); |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
264 emscripten_set_keyup_callback("#window", NULL, false, OnKeyUp); |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
265 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
266 emscripten_request_animation_frame_loop(OnAnimationFrame, NULL); |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
267 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
268 SDL: |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
269 see https://wiki.libsdl.org/SDL_CaptureMouse |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
270 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
271 */ |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
272 |
1313
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
273 void SetMouseDownCallback (std::string canvasId, void* userData, bool capture, OnMouseEventFunc func); |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
274 void SetMouseDblClickCallback (std::string canvasId, void* userData, bool capture, OnMouseEventFunc func); |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
275 void SetMouseMoveCallback (std::string canvasId, void* userData, bool capture, OnMouseEventFunc func); |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
276 void SetMouseUpCallback (std::string canvasId, void* userData, bool capture, OnMouseEventFunc func); |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
277 void SetWheelCallback (std::string canvasId, void* userData, bool capture, OnMouseWheelFunc func); |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
278 void SetKeyDownCallback (std::string canvasId, void* userData, bool capture, OnKeyDownFunc func); |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
279 void SetKeyUpCallback (std::string canvasId, void* userData, bool capture, OnKeyUpFunc func); |
1318
cbfdba08e039
removed SDL code in wasm + added undostack CTOR in Wasm viewport + build fix + ORTHANC_OVERRIDE
Benjamin Golinvaux <bgo@osimis.io>
parents:
1313
diff
changeset
|
280 |
cbfdba08e039
removed SDL code in wasm + added undostack CTOR in Wasm viewport + build fix + ORTHANC_OVERRIDE
Benjamin Golinvaux <bgo@osimis.io>
parents:
1313
diff
changeset
|
281 #if ORTHANC_ENABLE_SDL == 1 |
cbfdba08e039
removed SDL code in wasm + added undostack CTOR in Wasm viewport + build fix + ORTHANC_OVERRIDE
Benjamin Golinvaux <bgo@osimis.io>
parents:
1313
diff
changeset
|
282 |
1313
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
283 void SetGenericSdlEventCallback (std::string canvasId, void* userData, bool capture, OnSdlEventCallback func); |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
284 |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
285 typedef bool (*OnSdlEventCallback) (std::string canvasId, const SDL_Event& sdlEvent, void* userData); |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
286 |
1312
4f8c9065ee52
coping with both viewport and loader changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1297
diff
changeset
|
287 // if you pass "#window", then any Window resize will trigger the callback |
4f8c9065ee52
coping with both viewport and loader changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1297
diff
changeset
|
288 void SetSdlResizeCallback(std::string canvasId, |
4f8c9065ee52
coping with both viewport and loader changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1297
diff
changeset
|
289 void* userData, |
4f8c9065ee52
coping with both viewport and loader changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1297
diff
changeset
|
290 bool capture, |
4f8c9065ee52
coping with both viewport and loader changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1297
diff
changeset
|
291 OnSdlWindowResizeFunc func); |
4f8c9065ee52
coping with both viewport and loader changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1297
diff
changeset
|
292 #endif |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
293 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
294 void RequestAnimationFrame(OnAnimationFrameFunc func, void* userData); |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
295 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
296 // TODO: implement and call to remove canvases [in SDL, although code should be generic] |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
297 void SetOnExitCallback(); |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
298 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
299 /** |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
300 Under SDL, this function does NOT return until all windows have been closed. |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
301 Under wasm, it returns without doing anything, since the event loop is managed |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
302 by the browser. |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
303 */ |
937
86ac61a040c9
Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents:
935
diff
changeset
|
304 void Run(GuiAdapterRunFunc func = NULL, void* cookie = NULL); |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
305 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
306 private: |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
307 |
1318
cbfdba08e039
removed SDL code in wasm + added undostack CTOR in Wasm viewport + build fix + ORTHANC_OVERRIDE
Benjamin Golinvaux <bgo@osimis.io>
parents:
1313
diff
changeset
|
308 #if ORTHANC_ENABLE_SDL == 1 |
1313
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
309 /** |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
310 Gives observers a chance to react based on generic event handlers. This |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
311 is used, for instance, when the viewport lock interface is invalidated. |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
312 */ |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
313 void OnSdlGenericEvent(const SDL_Event& sdlEvent); |
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
314 #endif |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
315 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
316 /** |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
317 In SDL, this executes all the registered headers |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
318 */ |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
319 void OnAnimationFrame(); |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
320 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
321 //void RequestAnimationFrame(OnAnimationFrameFunc func, void* userData); |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
322 std::vector<std::pair<OnAnimationFrameFunc, void*> > |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
323 animationFrameHandlers_; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
324 |
1312
4f8c9065ee52
coping with both viewport and loader changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1297
diff
changeset
|
325 void OnResize(unsigned int width, unsigned int height); |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
326 |
858
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
327 #if ORTHANC_ENABLE_SDL == 1 |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
328 template<typename Func> |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
329 struct EventHandlerData |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
330 { |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
331 EventHandlerData(std::string canvasName, Func func, void* userData) |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
332 : canvasName(canvasName) |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
333 , func(func) |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
334 , userData(userData) |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
335 { |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
336 } |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
337 |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
338 std::string canvasName; |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
339 Func func; |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
340 void* userData; |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
341 }; |
1312
4f8c9065ee52
coping with both viewport and loader changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1297
diff
changeset
|
342 std::vector<EventHandlerData<OnSdlWindowResizeFunc> > resizeHandlers_; |
4f8c9065ee52
coping with both viewport and loader changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1297
diff
changeset
|
343 std::vector<EventHandlerData<OnMouseEventFunc > > mouseDownHandlers_; |
4f8c9065ee52
coping with both viewport and loader changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1297
diff
changeset
|
344 std::vector<EventHandlerData<OnMouseEventFunc > > mouseDblCickHandlers_; |
4f8c9065ee52
coping with both viewport and loader changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1297
diff
changeset
|
345 std::vector<EventHandlerData<OnMouseEventFunc > > mouseMoveHandlers_; |
4f8c9065ee52
coping with both viewport and loader changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1297
diff
changeset
|
346 std::vector<EventHandlerData<OnMouseEventFunc > > mouseUpHandlers_; |
4f8c9065ee52
coping with both viewport and loader changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1297
diff
changeset
|
347 std::vector<EventHandlerData<OnMouseWheelFunc > > mouseWheelHandlers_; |
4f8c9065ee52
coping with both viewport and loader changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1297
diff
changeset
|
348 std::vector<EventHandlerData<OnKeyDownFunc > > keyDownHandlers_; |
4f8c9065ee52
coping with both viewport and loader changes
Benjamin Golinvaux <bgo@osimis.io>
parents:
1297
diff
changeset
|
349 std::vector<EventHandlerData<OnKeyUpFunc > > keyUpHandlers_; |
1313
f30905f5d246
Added support for OnGenericSdlEvent to GuiAdapter.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1312
diff
changeset
|
350 std::vector<EventHandlerData<OnSdlEventCallback > > sdlEventHandlers_; |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
351 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
352 /** |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
353 This executes all the registered headers if needed (in wasm, the browser |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
354 deals with this) |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
355 */ |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
356 void OnMouseEvent(uint32_t windowID, const GuiAdapterMouseEvent& event); |
861
f0bf971a1e31
Keyboard event routing (handling done in app)
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
357 |
f0bf971a1e31
Keyboard event routing (handling done in app)
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
358 void OnKeyboardEvent(uint32_t windowID, const GuiAdapterKeyboardEvent& event); |
f0bf971a1e31
Keyboard event routing (handling done in app)
Benjamin Golinvaux <bgo@osimis.io>
parents:
858
diff
changeset
|
359 |
858
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
360 /** |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
361 Same remark as OnMouseEvent |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
362 */ |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
363 void OnMouseWheelEvent(uint32_t windowID, const GuiAdapterWheelEvent& event); |
e3c56d4f863f
GuiAdapter : mouse event routing in SDL + split the undo stack from the
Benjamin Golinvaux <bgo@osimis.io>
parents:
850
diff
changeset
|
364 |
843
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
365 #endif |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
366 |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
367 /** |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
368 This executes all the registered headers if needed (in wasm, the browser |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
369 deals with this) |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
370 */ |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
371 void ViewportsUpdateSize(); |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
372 }; |
67f9c27214c5
Removed extra logging + doc + added GuiAdapter and LockingEmitter
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
373 } |