Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
InexorLayerManager.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <list> // for list, list<>:...
4 #include <string> // for string
5 
6 #include "include/cef_app.h"
7 #include "include/cef_base.h" // for CefRefPtr
8 #include "include/cef_browser.h" // for CefBrowserHost
9 #include "include/cef_v8.h" // for CefV8Value (p...
10 #include "inexor/ui/context/InexorContextProvider.hpp" // for InexorContext...
11 #include "inexor/ui/layer/InexorLayer.hpp" // for InexorLayer
13 
14 namespace inexor {
15 namespace ui {
16 namespace layer {
17 
18 class InexorLayerProvider;
19 
21 {
22 
23  public:
25 
26  // Rendering
27  // void Render();
28  // void RenderLayer(std::string name);
29  void SetScreenSize(int width, int height);
30  int GetScreenWidth() { return width; };
31  int GetScreenHeight() { return height; };
32 
33  // Layers
34  void InitializeLayers();
35  void InitializeLayer(CefRefPtr<InexorLayerProvider> layer_provider);
36  void DestroyLayers();
37  void AddLayerProvider(CefRefPtr<InexorLayerProvider> layer_provider);
38 
39  CefRefPtr<InexorLayer> CreateLayer(std::string name, std::string url);
40  CefRefPtr<InexorLayer> CreateLayer(std::string name, int x, int y, int width, int height, std::string url);
41  CefRefPtr<InexorLayer> GetLayer(std::string name);
42  std::list<std::string> GetLayers();
43  std::list<CefRefPtr<InexorLayer> > GetLayerList() { return layers; };
44  bool LayerExists(std::string name);
45  void ShowLayer(std::string name);
46  void HideLayer(std::string name);
47  void BringToFront(std::string name);
48  void SendToBack(std::string name);
49  void BringForward(std::string name);
50  void SendBackward(std::string name);
51 
52  // Input events
53  void SendKeyEvent(CefKeyEvent event);
54  void SendMouseClickEvent(const CefMouseEvent& event, CefBrowserHost::MouseButtonType type, bool mouseUp, int clickCount);
55  void SendMouseMoveEvent(const CefMouseEvent& event, bool mouseLeave);
56  void SendMouseWheelEvent(const CefMouseEvent& event, int deltaX, int deltaY);
57 
58  // InexorContextProvider
59  void InitializeContext() override;
60  bool Execute(const CefString& name, CefRefPtr<CefV8Value> object, const CefV8ValueList& arguments, CefRefPtr<CefV8Value>& retval, CefString& exception) override;
61  bool Get(const CefString& name, const CefRefPtr<CefV8Value> object, CefRefPtr<CefV8Value>& retval, CefString& exception) override;
62  bool Set(const CefString& name, const CefRefPtr<CefV8Value> object, const CefRefPtr<CefV8Value> value, CefString& exception) override;
63  std::string GetContextName() override { return "layer"; };
64 
65  private:
66  std::list<CefRefPtr<InexorLayer> > layers;
67  std::list<CefRefPtr<InexorLayerProvider> > layer_providers;
68 
69  int width;
70  int height;
71 
72  std::list<CefRefPtr<InexorLayer> >::iterator GetIterator(std::string name);
73  void _CreateLayer(std::string name, std::string url);
74 
75  // Include the default reference counting implementation.
77 
78 };
79 
80 }
81 }
82 }
bool Get(const CefString &name, const CefRefPtr< CefV8Value > object, CefRefPtr< CefV8Value > &retval, CefString &exception) override
Definition: InexorLayerManager.cpp:68
InexorLayerManager(int width, int height)
Definition: InexorLayerManager.cpp:18
void ShowLayer(std::string name)
Definition: InexorLayerManager.cpp:155
std::list< CefRefPtr< InexorLayer > >::iterator GetIterator(std::string name)
Returns an iterator instance pointing to the layer element with the given name.
Definition: InexorLayerManager.cpp:127
GLenum GLsizei GLsizei height
Definition: glexts.hpp:291
int GetScreenHeight()
Definition: InexorLayerManager.hpp:31
void InitializeLayers()
Definition: InexorLayerManager.cpp:23
CefRefPtr< InexorLayer > GetLayer(std::string name)
Definition: InexorLayerManager.cpp:111
void BringForward(std::string name)
Definition: InexorLayerManager.cpp:185
void InitializeLayer(CefRefPtr< InexorLayerProvider > layer_provider)
Definition: InexorLayerManager.cpp:32
GLenum GLsizei width
Definition: glexts.hpp:291
void SendMouseWheelEvent(const CefMouseEvent &event, int deltaX, int deltaY)
Definition: InexorLayerManager.cpp:266
Definition: InexorContextProvider.hpp:16
std::list< CefRefPtr< InexorLayerProvider > > layer_providers
Definition: InexorLayerManager.hpp:67
Definition: InexorLayerManager.hpp:20
void SendMouseMoveEvent(const CefMouseEvent &event, bool mouseLeave)
Definition: InexorLayerManager.cpp:254
void InitializeContext() override
Definition: InexorLayerManager.cpp:58
void BringToFront(std::string name)
Definition: InexorLayerManager.cpp:171
int GetScreenWidth()
Definition: InexorLayerManager.hpp:30
void _CreateLayer(std::string name, std::string url)
Definition: InexorLayerManager.cpp:86
CefRefPtr< InexorLayer > CreateLayer(std::string name, std::string url)
Definition: InexorLayerManager.cpp:99
std::string GetContextName() override
Definition: InexorLayerManager.hpp:63
void DestroyLayers()
Definition: InexorLayerManager.cpp:42
void HideLayer(std::string name)
Definition: InexorLayerManager.cpp:163
int height
Definition: InexorLayerManager.hpp:70
void SetScreenSize(int width, int height)
Definition: InexorLayerManager.cpp:80
std::list< CefRefPtr< InexorLayer > > layers
Definition: InexorLayerManager.hpp:63
bool Set(const CefString &name, const CefRefPtr< CefV8Value > object, const CefRefPtr< CefV8Value > value, CefString &exception) override
Definition: InexorLayerManager.cpp:74
IMPLEMENT_REFCOUNTING(InexorLayerManager)
std::list< std::string > GetLayers()
Definition: InexorLayerManager.cpp:144
bool Execute(const CefString &name, CefRefPtr< CefV8Value > object, const CefV8ValueList &arguments, CefRefPtr< CefV8Value > &retval, CefString &exception) override
Definition: InexorLayerManager.cpp:62
char string[MAXSTRLEN]
cube-strings (char arrays of fixed size).
Definition: cube_types.hpp:18
GLsizei GLboolean const GLfloat * value
Definition: glexts.hpp:57
void SendMouseClickEvent(const CefMouseEvent &event, CefBrowserHost::MouseButtonType type, bool mouseUp, int clickCount)
Definition: InexorLayerManager.cpp:242
std::list< CefRefPtr< InexorLayer > > GetLayerList()
Definition: InexorLayerManager.hpp:43
bool LayerExists(std::string name)
Definition: InexorLayerManager.cpp:139
int width
Definition: InexorLayerManager.hpp:69
void AddLayerProvider(CefRefPtr< InexorLayerProvider > layer_provider)
Definition: InexorLayerManager.cpp:54
void SendKeyEvent(CefKeyEvent event)
Definition: InexorLayerManager.cpp:230
void SendToBack(std::string name)
Definition: InexorLayerManager.cpp:178
void SendBackward(std::string name)
Definition: InexorLayerManager.cpp:196