Mercurial > hg > orthanc-stone
comparison Applications/Generic/GuiAdapter.h @ 1318:cbfdba08e039 broker
removed SDL code in wasm + added undostack CTOR in Wasm viewport + build fix + ORTHANC_OVERRIDE
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 17 Mar 2020 08:40:13 +0100 |
parents | f30905f5d246 |
children | d80a3e3cc800 |
comparison
equal
deleted
inserted
replaced
1317:8981bfca3457 | 1318:cbfdba08e039 |
---|---|
51 #include <boost/shared_ptr.hpp> | 51 #include <boost/shared_ptr.hpp> |
52 #include <boost/weak_ptr.hpp> | 52 #include <boost/weak_ptr.hpp> |
53 | 53 |
54 namespace OrthancStone | 54 namespace OrthancStone |
55 { | 55 { |
56 #if ORTHANC_ENABLE_WASM != 1 | 56 #if ORTHANC_ENABLE_SDL == 1 |
57 class SdlViewport; | 57 class SdlViewport; |
58 #endif | 58 #endif |
59 | 59 |
60 #if 0 | 60 #if 0 |
61 | 61 |
71 class IGuiAdapterWidget | 71 class IGuiAdapterWidget |
72 { | 72 { |
73 public: | 73 public: |
74 virtual ~IGuiAdapterWidget() {} | 74 virtual ~IGuiAdapterWidget() {} |
75 | 75 |
76 #if ORTHANC_ENABLE_WASM != 1 | 76 #if #if ORTHANC_ENABLE_SDL == 1 |
77 /** | 77 /** |
78 Returns the SdlViewport that this widget contains. If the underlying | 78 Returns the SdlViewport that this widget contains. If the underlying |
79 viewport type is *not* SDL, then an error is returned. | 79 viewport type is *not* SDL, then an error is returned. |
80 */ | 80 */ |
81 virtual SdlViewport& GetSdlViewport() = 0; | 81 virtual SdlViewport& GetSdlViewport() = 0; |
116 typedef bool (*OnMouseEventFunc) (std::string canvasId, const GuiAdapterMouseEvent* mouseEvent, void* userData); | 116 typedef bool (*OnMouseEventFunc) (std::string canvasId, const GuiAdapterMouseEvent* mouseEvent, void* userData); |
117 typedef bool (*OnMouseWheelFunc) (std::string canvasId, const GuiAdapterWheelEvent* wheelEvent, void* userData); | 117 typedef bool (*OnMouseWheelFunc) (std::string canvasId, const GuiAdapterWheelEvent* wheelEvent, void* userData); |
118 typedef bool (*OnKeyDownFunc) (std::string canvasId, const GuiAdapterKeyboardEvent* keyEvent, void* userData); | 118 typedef bool (*OnKeyDownFunc) (std::string canvasId, const GuiAdapterKeyboardEvent* keyEvent, void* userData); |
119 typedef bool (*OnKeyUpFunc) (std::string canvasId, const GuiAdapterKeyboardEvent* keyEvent, void* userData); | 119 typedef bool (*OnKeyUpFunc) (std::string canvasId, const GuiAdapterKeyboardEvent* keyEvent, void* userData); |
120 typedef bool (*OnAnimationFrameFunc)(double time, void* userData); | 120 typedef bool (*OnAnimationFrameFunc)(double time, void* userData); |
121 | |
122 #if ORTHANC_ENABLE_SDL == 1 | |
121 typedef bool (*OnSdlEventCallback) (std::string canvasId, const SDL_Event& sdlEvent, void* userData); | 123 typedef bool (*OnSdlEventCallback) (std::string canvasId, const SDL_Event& sdlEvent, void* userData); |
122 | 124 |
123 #if ORTHANC_ENABLE_WASM != 1 | |
124 typedef bool (*OnSdlWindowResizeFunc)(std::string canvasId, | 125 typedef bool (*OnSdlWindowResizeFunc)(std::string canvasId, |
125 const GuiAdapterUiEvent* uiEvent, | 126 const GuiAdapterUiEvent* uiEvent, |
126 unsigned int width, | 127 unsigned int width, |
127 unsigned int height, | 128 unsigned int height, |
128 void* userData); | 129 void* userData); |
277 void SetMouseMoveCallback (std::string canvasId, void* userData, bool capture, OnMouseEventFunc func); | 278 void SetMouseMoveCallback (std::string canvasId, void* userData, bool capture, OnMouseEventFunc func); |
278 void SetMouseUpCallback (std::string canvasId, void* userData, bool capture, OnMouseEventFunc func); | 279 void SetMouseUpCallback (std::string canvasId, void* userData, bool capture, OnMouseEventFunc func); |
279 void SetWheelCallback (std::string canvasId, void* userData, bool capture, OnMouseWheelFunc func); | 280 void SetWheelCallback (std::string canvasId, void* userData, bool capture, OnMouseWheelFunc func); |
280 void SetKeyDownCallback (std::string canvasId, void* userData, bool capture, OnKeyDownFunc func); | 281 void SetKeyDownCallback (std::string canvasId, void* userData, bool capture, OnKeyDownFunc func); |
281 void SetKeyUpCallback (std::string canvasId, void* userData, bool capture, OnKeyUpFunc func); | 282 void SetKeyUpCallback (std::string canvasId, void* userData, bool capture, OnKeyUpFunc func); |
283 | |
284 #if ORTHANC_ENABLE_SDL == 1 | |
285 | |
282 void SetGenericSdlEventCallback (std::string canvasId, void* userData, bool capture, OnSdlEventCallback func); | 286 void SetGenericSdlEventCallback (std::string canvasId, void* userData, bool capture, OnSdlEventCallback func); |
283 | 287 |
284 typedef bool (*OnSdlEventCallback) (std::string canvasId, const SDL_Event& sdlEvent, void* userData); | 288 typedef bool (*OnSdlEventCallback) (std::string canvasId, const SDL_Event& sdlEvent, void* userData); |
285 | 289 |
286 | |
287 #if ORTHANC_ENABLE_WASM != 1 | |
288 // if you pass "#window", then any Window resize will trigger the callback | 290 // if you pass "#window", then any Window resize will trigger the callback |
289 void SetSdlResizeCallback(std::string canvasId, | 291 void SetSdlResizeCallback(std::string canvasId, |
290 void* userData, | 292 void* userData, |
291 bool capture, | 293 bool capture, |
292 OnSdlWindowResizeFunc func); | 294 OnSdlWindowResizeFunc func); |
304 */ | 306 */ |
305 void Run(GuiAdapterRunFunc func = NULL, void* cookie = NULL); | 307 void Run(GuiAdapterRunFunc func = NULL, void* cookie = NULL); |
306 | 308 |
307 private: | 309 private: |
308 | 310 |
309 #if ORTHANC_ENABLE_WASM != 1 | 311 #if ORTHANC_ENABLE_SDL == 1 |
310 /** | 312 /** |
311 Gives observers a chance to react based on generic event handlers. This | 313 Gives observers a chance to react based on generic event handlers. This |
312 is used, for instance, when the viewport lock interface is invalidated. | 314 is used, for instance, when the viewport lock interface is invalidated. |
313 */ | 315 */ |
314 void OnSdlGenericEvent(const SDL_Event& sdlEvent); | 316 void OnSdlGenericEvent(const SDL_Event& sdlEvent); |