Panda3D
awWebCore.h
1 // Filename: awWebCore.h
2 // Created by: rurbino (12Oct09)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 #ifndef AWWEBCORE_H
15 #define AWWEBCORE_H
16 
17 #include "pandabase.h"
18 #include "typedReferenceCount.h"
19 #include "luse.h"
20 
21 #include "awesomium_includes.h"
22 
23 class AwWebView;
24 ////////////////////////////////////////////////////////////////////
25 // Class : AwWebCore
26 // Description : Thin wrappings arround WebCore.h
27 ////////////////////////////////////////////////////////////////////
28 class EXPCL_PANDAAWESOMIUM AwWebCore : public TypedReferenceCount, public Awesomium::WebCore {
29 PUBLISHED:
30  /**
31  * An enumeration of the three verbosity settings for the Awesomium Log.
32  */
33  enum LogLevel
34  {
35  LOG_NONE , // No log is created
36  LOG_NORMAL , // Logs only errors
37  LOG_VERBOSE // Logs everything
38  };
39 
40  /**
41  * An enumeration of the two output pixel formats that WebView::render will use.
42  */
44  {
45  PF_BGRA, // BGRA byte ordering [Blue, Green, Red, Alpha]
46  PF_RGBA // RGBA byte ordering [Red, Green, Blue, Alpha]
47  };
48 
49  AwWebCore(LogLevel level = LOG_NORMAL, bool enablePlugins = true, PixelFormat pixelFormat = PF_BGRA);
50 
51  virtual ~AwWebCore();
52 
53  static Awesomium::WebCore& Get();
54 
55  static Awesomium::WebCore* GetPointer();
56 
57  INLINE void setBaseDirectory(const std::string& baseDirectory);
58 
59  AwWebView * createWebView(int width, int height, bool isTransparent = false, bool enableAsyncRendering = false, int maxAsyncRenderPerSec = 70);
60 
61  INLINE void setCustomResponsePage(int statusCode, const std::string& filePath);
62 
63  INLINE void update();
64 
65  INLINE const std::string& getBaseDirectory() const;
66 
67  AwWebCore::PixelFormat getPixelFormat() const;
68 
69  INLINE bool arePluginsEnabled() const;
70 
71  INLINE void pause();
72 
73  INLINE void resume();
74 
75 public:
76  static TypeHandle get_class_type() {
77  return _type_handle;
78  }
79  static void init_type() {
80  TypedReferenceCount::init_type();
81  register_type(_type_handle, "AwWebCore",
82  TypedReferenceCount::get_class_type());
83  }
84  virtual TypeHandle get_type() const {
85  return get_class_type();
86  }
87  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
88 
89 private:
90  static TypeHandle _type_handle;
91 };
92 
93 #include "awWebCore.I"
94 
95 #endif
Thin wrappings arround WebCore.h.
Definition: awWebCore.h:28
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
PixelFormat
An enumeration of the two output pixel formats that WebView::render will use.
Definition: awWebCore.h:43
Thin bindings, wraps a WebView * returned from WebCore.createWebView.
Definition: awWebView.h:29
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
LogLevel
An enumeration of the three verbosity settings for the Awesomium Log.
Definition: awWebCore.h:33