Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 #ifndef __SP_UTILITY_WEBPAGE_RENDERER_H__
00009 #define __SP_UTILITY_WEBPAGE_RENDERER_H__
00010 
00011 
00012 #include "Base/spStandard.hpp"
00013 
00014 #ifdef SP_COMPILE_WITH_WEBPAGERENDERER
00015 
00016 
00017 #include "Framework/Tools/spToolXMLParser.hpp"
00018 #include "RenderSystem/spTextureBase.hpp"
00019 #include "RenderSystem/spRenderSystemFont.hpp"
00020 
00021 #include <stack>
00022 #include <map>
00023 
00024 
00025 namespace sp
00026 {
00027 namespace tool
00028 {
00029 
00030 
00035 class SP_EXPORT WebPageRenderer
00036 {
00037     
00038     public:
00039         
00040         WebPageRenderer();
00041         ~WebPageRenderer();
00042         
00043         
00044         
00045         void renderWebPage(video::Texture* Tex, const SXMLTag &RootTag);
00046         
00047     private:
00048         
00049         
00050         
00051         struct SFontDesc
00052         {
00053             SFontDesc() :
00054                 Face        ("arial"),
00055                 Size        (12     ),
00056                 Bold        (false  ),
00057                 Italic      (false  ),
00058                 Underlined  (false  )
00059             {
00060             }
00061             ~SFontDesc()
00062             {
00063             }
00064 
00065             
00066             io::stringc Face;
00067             video::color Color;
00068             s32 Size;
00069             bool Bold;
00070             bool Italic;
00071             bool Underlined;
00072         };
00073         
00074         struct SRenderStates
00075         {
00076             SRenderStates() :
00077                 ActiveFont(0)
00078             {
00079             }
00080             ~SRenderStates()
00081             {
00082             }
00083             
00084             
00085             dim::point2di TextPos;
00086             video::Font* ActiveFont;
00087         };
00088         
00089         
00090         
00091         void parseTag(const SXMLTag &Tag);
00092         void parseFontTag(const SXMLTag &Tag);
00093         void parseImageTag(const SXMLTag &Tag);
00094         
00095         void pushFont(const io::stringc &Face, const video::color &Color, s32 Size); 
00096         void pushFontBold();        
00097         void pushFontItalic();      
00098         void pushFontUnderlined();  
00099         void popFont();             
00100         
00101         
00102         
00103         dim::size2di ViewSize_; 
00104         
00105         std::stack<video::Font*> FontStack_;
00106         
00107         std::map<SFontDesc, video::Font*> FontMap_;
00108         std::map<std::string, video::Texture*> ImageMap_;
00109         
00110         SRenderStates States_;
00111         
00112 };
00113 
00114 
00115 } 
00116 
00117 } 
00118 
00119 
00120 #endif
00121 
00122 #endif
00123 
00124 
00125 
00126