Mercurial > hg > orthanc-stone
diff Applications/Generic/GuiAdapter.h @ 880:9953f16c304d am-dev
Merge
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Fri, 05 Jul 2019 15:33:02 +0200 |
parents | 12b591d5d63c f0bf971a1e31 |
children | 401808e7ff2e |
line wrap: on
line diff
--- a/Applications/Generic/GuiAdapter.h Fri Jul 05 14:52:43 2019 +0200 +++ b/Applications/Generic/GuiAdapter.h Fri Jul 05 15:33:02 2019 +0200 @@ -75,12 +75,14 @@ }; - enum GuiAdapterMouseEventType + enum GuiAdapterHidEventType { GUIADAPTER_EVENT_MOUSEDOWN = 1973, GUIADAPTER_EVENT_MOUSEMOVE = 1974, GUIADAPTER_EVENT_MOUSEUP = 1975, - GUIADAPTER_EVENT_WHEEL = 1976 + GUIADAPTER_EVENT_WHEEL = 1976, + GUIADAPTER_EVENT_KEYDOWN = 1977, + GUIADAPTER_EVENT_KEYUP = 1978, }; const unsigned int GUIADAPTER_DELTA_PIXEL = 2973; @@ -124,8 +126,9 @@ #endif #endif - struct GuiAdapterMouseEvent { - GuiAdapterMouseEventType type; + struct GuiAdapterMouseEvent + { + GuiAdapterHidEventType type; //double timestamp; //long screenX; //long screenY; @@ -168,6 +171,8 @@ // EmscriptenKeyboardEvent struct GuiAdapterKeyboardEvent { + GuiAdapterHidEventType type; + char sym[32]; bool ctrlKey; bool shiftKey; bool altKey; @@ -193,37 +198,21 @@ FROM: https://codingrepo.com/javascript/2017/05/19/javascript-difference-mousedown-mouseup-click-events/ */ #if ORTHANC_ENABLE_WASM == 1 - void ConvertFromPlatform( - GuiAdapterUiEvent& dest, - int eventType, - const EmscriptenUiEvent& src); + void ConvertFromPlatform(GuiAdapterUiEvent& dest, int eventType, const EmscriptenUiEvent& src); - void ConvertFromPlatform( - GuiAdapterMouseEvent& dest, - int eventType, - const EmscriptenMouseEvent& src); + void ConvertFromPlatform(GuiAdapterMouseEvent& dest, int eventType, const EmscriptenMouseEvent& src); - void ConvertFromPlatform( - GuiAdapterWheelEvent& dest, - int eventType, - const EmscriptenWheelEvent& src); + void ConvertFromPlatform(GuiAdapterWheelEvent& dest, int eventType, const EmscriptenWheelEvent& src); - void ConvertFromPlatform( - GuiAdapterKeyboardEvent& dest, - const EmscriptenKeyboardEvent& src); - + void ConvertFromPlatform(GuiAdapterKeyboardEvent& dest, const EmscriptenKeyboardEvent& src); #else # if ORTHANC_ENABLE_SDL == 1 - void ConvertFromPlatform( - GuiAdapterMouseEvent& dest, - bool ctrlPressed, bool shiftPressed, bool altPressed, - const SDL_Event& source); + void ConvertFromPlatform(GuiAdapterMouseEvent& dest, bool ctrlPressed, bool shiftPressed, bool altPressed, const SDL_Event& source); - void ConvertFromPlatform( - GuiAdapterWheelEvent& dest, - bool ctrlPressed, bool shiftPressed, bool altPressed, - const SDL_Event& source); + void ConvertFromPlatform(GuiAdapterWheelEvent& dest, bool ctrlPressed, bool shiftPressed, bool altPressed, const SDL_Event& source); + + void ConvertFromPlatform(GuiAdapterKeyboardEvent& dest, const SDL_Event& source); # endif @@ -342,14 +331,17 @@ std::vector<EventHandlerData<OnMouseEventFunc > > mouseMoveHandlers_; std::vector<EventHandlerData<OnMouseEventFunc > > mouseUpHandlers_; std::vector<EventHandlerData<OnMouseWheelFunc > > mouseWheelHandlers_; - + std::vector<EventHandlerData<OnKeyDownFunc > > keyDownHandlers_; + std::vector<EventHandlerData<OnKeyUpFunc > > keyUpHandlers_; /** This executes all the registered headers if needed (in wasm, the browser deals with this) */ void OnMouseEvent(uint32_t windowID, const GuiAdapterMouseEvent& event); - + + void OnKeyboardEvent(uint32_t windowID, const GuiAdapterKeyboardEvent& event); + /** Same remark as OnMouseEvent */