gwenhywfar  4.3.3
fox16_htmlctx.hpp
Go to the documentation of this file.
00001 /***************************************************************************
00002  begin       : Mon Feb 22 2010
00003  copyright   : (C) 2010 by Martin Preuss
00004  email       : martin@libchipcard.de
00005 
00006  ***************************************************************************
00007  *          Please see toplevel file COPYING for license details           *
00008  ***************************************************************************/
00009 
00010 #ifndef FOX16_HTMLCTX_HPP
00011 #define FOX16_HTMLCTX_HPP
00012 
00013 
00014 #include <gwen-gui-fox16/cppgui.hpp>
00015 #include <gwenhywfar/htmlobject_be.h>
00016 #include <gwenhywfar/htmlfont_be.h>
00017 #include <gwenhywfar/htmlctx_be.h>
00018 
00019 #include <fx.h>
00020 
00021 
00022 class FOX16GUI_API FOX16_HtmlCtx {
00023     friend class FOX16_HtmlCtxLinker;
00024 
00025 public:
00026   FOX16_HtmlCtx(uint32_t flags);
00027   ~FOX16_HtmlCtx();
00028 
00029   void setText(const char *s);
00030 
00031   int getWidth();
00032   int getHeight();
00033 
00034   HTML_FONT *getFont(const char *fontName,
00035                      int fontSize,
00036                      uint32_t fontFlags);
00037 
00038   HTML_IMAGE *getImage(const char *imageName);
00039 
00040   void addMediaPath(const char *s);
00041 
00042   int layout(int width, int height);
00043   void dump();
00044 
00045   void paint(FXDC *dc, int xOffset, int yOffset);
00046   void paintAt(FXDC *dc,
00047                int xOffset, int yOffset,
00048                int xText, int yText,
00049                int w, int h);
00050 
00051   void setBackgroundColor(FXColor c);
00052   void setForegroundColor(FXColor c);
00053 
00054 protected:
00055   GWEN_XML_CONTEXT *_context;
00056   FXFont *_font;
00057   FXColor _fgColor;
00058   FXColor _bgColor;
00059   FXIconSource *m_iconSource;
00060 
00061   FXFont *_getFoxFont(HTML_FONT *fnt);
00062   void _paint(FXDC *dc, HTML_OBJECT *o, int xOffset, int yOffset);
00063   void _paintAt(FXDC *dc, HTML_OBJECT *o,
00064                 int xOffset, int yOffset,
00065                 int xText, int yText,
00066                 int w, int h);
00067 
00068   int getTextWidth(HTML_FONT *fnt,
00069                    const char *s);
00070 
00071   int getTextHeight(HTML_FONT *fnt,
00072                     const char *s);
00073 
00074   uint32_t getColorFromName(const char *name);
00075 
00076 };
00077 
00078 
00079 
00080 
00081 #endif
00082 
00083