Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
InexorKeyboardManager.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <SDL.h>
4 #include <string> // for string
5 #include <utility> // for move
6 
7 #include "SDL_events.h" // for SDL_Event
8 #include "include/cef_app.h"
9 #include "include/cef_base.h" // for CefRefPtr
10 #include "include/cef_keyboard_handler.h" // for CefKeyboardHa...
11 #include "include/cef_v8.h" // for CefV8Value (p...
12 #include "inexor/ui/context/InexorContextProvider.hpp" // for InexorContext...
13 #include "inexor/ui/layer/InexorLayerManager.hpp" // for InexorLayerMa...
14 
15 class CefBrowser;
16 
17 namespace inexor {
18 namespace ui {
19 namespace input {
20 
22  public CefKeyboardHandler
23 {
24 
25  public:
26  InexorKeyboardManager(CefRefPtr<inexor::ui::layer::InexorLayerManager> layer_manager) : layer_manager(std::move(layer_manager)) {}
27 
30  void SendKeyEvent(SDL_Event &e) ;
31 
32  // InexorCefContextProvider
33  void InitializeContext() override {}
34  bool Execute(const CefString& name, CefRefPtr<CefV8Value> object, const CefV8ValueList& arguments, CefRefPtr<CefV8Value>& retval, CefString& exception) override;
35  bool Get(const CefString& name, const CefRefPtr<CefV8Value> object, CefRefPtr<CefV8Value>& retval, CefString& exception) override;
36  bool Set(const CefString& name, const CefRefPtr<CefV8Value> object, const CefRefPtr<CefV8Value> value, CefString& exception) override;
37  std::string GetContextName() override { return "keyboard"; };
38 
39  // CefKeyboardHandler
40  bool OnPreKeyEvent(CefRefPtr<CefBrowser> browser, const CefKeyEvent& key_event, CefEventHandle os_event, bool* is_keyboard_shortcut) override;
41  bool OnKeyEvent(CefRefPtr<CefBrowser> browser, const CefKeyEvent& key_event, CefEventHandle os_event) override;
42 
43  private:
44 
45  // Layer Manager
46  CefRefPtr<inexor::ui::layer::InexorLayerManager> layer_manager;
47 
48  // Include the default reference counting implementation.
50 
51 };
52 
53 } } } // ns inexor::ui::input
IMPLEMENT_REFCOUNTING(InexorKeyboardManager)
void SendKeyEvent(SDL_Event &e)
Forward text input and key events to CEF.
Definition: InexorKeyboardManager.cpp:54
bool Execute(const CefString &name, CefRefPtr< CefV8Value > object, const CefV8ValueList &arguments, CefRefPtr< CefV8Value > &retval, CefString &exception) override
Definition: InexorKeyboardManager.cpp:21
Definition: InexorKeyboardManager.hpp:21
CefRefPtr< inexor::ui::layer::InexorLayerManager > layer_manager
Definition: InexorKeyboardManager.hpp:46
Definition: InexorContextProvider.hpp:16
void InitializeContext() override
Definition: InexorKeyboardManager.hpp:33
InexorKeyboardManager(CefRefPtr< inexor::ui::layer::InexorLayerManager > layer_manager)
Definition: InexorKeyboardManager.hpp:26
std::string GetContextName() override
Definition: InexorKeyboardManager.hpp:37
bool Set(const CefString &name, const CefRefPtr< CefV8Value > object, const CefRefPtr< CefV8Value > value, CefString &exception) override
Definition: InexorKeyboardManager.cpp:33
bool move(physent *d, vec &dir)
Definition: physics.cpp:1342
bool OnPreKeyEvent(CefRefPtr< CefBrowser > browser, const CefKeyEvent &key_event, CefEventHandle os_event, bool *is_keyboard_shortcut) override
Definition: InexorKeyboardManager.cpp:97
bool OnKeyEvent(CefRefPtr< CefBrowser > browser, const CefKeyEvent &key_event, CefEventHandle os_event) override
Definition: InexorKeyboardManager.cpp:104
char string[MAXSTRLEN]
cube-strings (char arrays of fixed size).
Definition: cube_types.hpp:18
GLsizei GLboolean const GLfloat * value
Definition: glexts.hpp:57
bool Get(const CefString &name, const CefRefPtr< CefV8Value > object, CefRefPtr< CefV8Value > &retval, CefString &exception) override
Definition: InexorKeyboardManager.cpp:27