Panda3D

awWebCore.h

00001 // Filename: awWebCore.h
00002 // Created by:  rurbino (12Oct09)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 #ifndef AWWEBCORE_H
00015 #define AWWEBCORE_H
00016 
00017 #include "pandabase.h"
00018 #include "typedReferenceCount.h"
00019 #include "luse.h"
00020 
00021 #include "awesomium_includes.h"
00022 
00023 class AwWebView;
00024 ////////////////////////////////////////////////////////////////////
00025 //       Class : AwWebCore
00026 // Description : Thin wrappings arround WebCore.h
00027 ////////////////////////////////////////////////////////////////////
00028 class EXPCL_PANDAAWESOMIUM AwWebCore : public TypedReferenceCount, public Awesomium::WebCore {
00029 PUBLISHED:
00030   /**
00031   * An enumeration of the three verbosity settings for the Awesomium Log.
00032   */
00033   enum LogLevel
00034   {
00035     LOG_NONE ,      // No log is created
00036     LOG_NORMAL ,        // Logs only errors
00037     LOG_VERBOSE         // Logs everything
00038   };
00039 
00040   /**
00041   * An enumeration of the two output pixel formats that WebView::render will use.
00042   */
00043   enum PixelFormat
00044   {
00045     PF_BGRA,    // BGRA byte ordering [Blue, Green, Red, Alpha]
00046     PF_RGBA     // RGBA byte ordering [Red, Green, Blue, Alpha]
00047   };
00048 
00049   AwWebCore(LogLevel level = LOG_NORMAL, bool enablePlugins = true, PixelFormat pixelFormat = PF_BGRA);
00050 
00051   virtual ~AwWebCore();
00052 
00053   static Awesomium::WebCore& Get();
00054 
00055   static Awesomium::WebCore* GetPointer();
00056 
00057   INLINE void setBaseDirectory(const std::string& baseDirectory);
00058 
00059   AwWebView * createWebView(int width, int height, bool isTransparent = false, bool enableAsyncRendering = false, int maxAsyncRenderPerSec = 70);
00060 
00061   INLINE void setCustomResponsePage(int statusCode, const std::string& filePath);
00062 
00063   INLINE void update();
00064 
00065   INLINE const std::string& getBaseDirectory() const;
00066 
00067   AwWebCore::PixelFormat getPixelFormat() const;
00068 
00069   INLINE bool arePluginsEnabled() const;
00070 
00071   INLINE void pause();
00072 
00073   INLINE void resume();
00074 
00075 public:
00076   static TypeHandle get_class_type() {
00077     return _type_handle;
00078   }
00079   static void init_type() {
00080     TypedReferenceCount::init_type();
00081     register_type(_type_handle, "AwWebCore",
00082                   TypedReferenceCount::get_class_type());
00083   }
00084   virtual TypeHandle get_type() const {
00085     return get_class_type();
00086   }
00087   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00088 
00089 private:
00090   static TypeHandle _type_handle;
00091 };
00092 
00093 #include "awWebCore.I"
00094 
00095 #endif
 All Classes Functions Variables Enumerations