-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathClassicWebCore.h
94 lines (75 loc) · 2.31 KB
/
ClassicWebCore.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#ifndef __CLASSIC_WEB_CORE__
#define __CLASSIC_WEB_CORE__
#include <omega.h>
#include <omegaToolkit.h>
#include <Awesomium/STLHelpers.h>
#include <Awesomium/WebKeyboardCodes.h>
#include <Awesomium/WebKeyboardEvent.h>
#include <Awesomium/BitmapSurface.h>
#include <Awesomium/WebCore.h>
#include <Awesomium/WebView.h>
#include <Awesomium/JSObject.h>
#include <Awesomium/WebViewListener.h>
#include "LocalDataSource.h"
using namespace omega;
using namespace omegaToolkit;
using namespace omegaToolkit::ui;
class WebView;
///////////////////////////////////////////////////////////////////////////////
// Internal Awesomium rendering core and web view manager. User code never
// accesses this directly.
class ClassicWebCore : public EngineModule
{
public:
static ClassicWebCore* instance();
ClassicWebCore();
virtual ~ClassicWebCore();
WebView* createView(int width, int height);
void destroyView(WebView*);
virtual void update(const UpdateContext& context);
private:
LocalDataSource* myDataSource;
Awesomium::WebCore* myCore;
Awesomium::WebSession* mySession;
List<WebView*> myViews;
};
///////////////////////////////////////////////////////////////////////////////
class WebView: public PixelData
{
public:
// Static creation function, to keep consistent with the rest of the
// omegalib python API.
static WebView* create(int width, int height);
WebView(ClassicWebCore* core, Awesomium::WebView* internalView, int width, int height);
virtual ~WebView();
void resize(int width, int height);
void update();
void evaljs(const String& code);
void loadUrl(const String& url);
void setZoom(int zoom);
int getZoom();
Awesomium::WebView* getInternalView()
{ return myView; }
private:
Awesomium::WebView* myView;
int myWidth;
int myHeight;
};
///////////////////////////////////////////////////////////////////////////////
class WebFrame: public Image
{
public:
static WebFrame* create(Container* container);
WebFrame(Engine* srv);
virtual void handleEvent(const omega::Event& evt);
virtual void update(const omega::UpdateContext& context);
void setView(WebView* view);
WebView* getView()
{ return myView; }
protected:
virtual void activate();
virtual void deactivate();
private:
Ref<WebView> myView;
};
#endif