00001 #ifndef CSHTMLPanel_h 00002 #define CSHTMLPanel_h 00003 00004 // USES SDL_Surface 00005 00006 #ifdef WIN32 00007 #pragma warning(disable : 4786 ) 00008 #endif 00009 00010 #include <vector> 00011 #include <string> 00012 #include <map> 00013 #include "CSTypes.h" 00014 00015 #include "CSGrafikElement.h" 00016 #include "CSLog.h" 00017 #include "CSTypes.h" 00018 #include "CSStringlist.h" 00019 #include "CSIcon.h" 00020 #include "CSHTMLHelper.h" 00021 #include "CSPicture.h" 00022 #include "CSMessageListener.h" 00023 #include "CSMessageBox.h" 00024 #include "CSHTMLElement.h" 00025 00026 class CSHTMLPanel; 00027 00028 typedef std::vector<CSHTMLPanel *> CSHTMLPanels; 00029 00030 class CSHTMLPanel : public CSGrafikElement 00031 { 00032 private: 00033 CSMessageBox *mMessageBox; 00034 HTMLElements mHTMLElements; 00035 CSHTMLHelper *mHelper; 00036 bool mCleared; 00037 00038 int mBackgroundColor; 00039 std::string mFilename; 00040 std::string mBaseDirectory; 00041 void deleteOldPage(); 00042 void getHTMLSize(int &w, int &h); 00043 void initHTMLPanel(); 00044 int mHTMLHeightInPixel; 00045 int mHTMLWidthInPixel; 00046 00047 std::string getBaseDirectory(const std::string &filename); 00048 std::string extractAnker(std::string &filename); 00049 void startAtAnker(const std::string &anker); 00050 int getBackgroundColorHTML(); 00051 void clearElements(); 00052 00053 protected: 00054 virtual void layoutSetupHTMLPanel(); 00055 virtual void rebuildElement(); 00056 00057 public: 00058 CSHTMLPanel(int height, int width, const std::string &filename); 00059 virtual ~CSHTMLPanel(); 00060 static const char *CLASS; 00061 virtual std::string getType() {return (std::string) CLASS;} 00062 00063 virtual void setPage(const std::string &filename); 00064 00065 void reactOnMessageHTMLPanel(CSMessage *message); 00066 virtual void reactOnMessage(CSMessage *message); 00067 00068 virtual void paint(SDL_Surface *destination, SDL_Rect *parentViewport); 00069 virtual void layoutSetup(){layoutSetupHTMLPanel();} 00070 }; 00071 00072 #endif // CSHTMLPanel_h