Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

GHtml.h

Go to the documentation of this file.
00001 
00002 
00003 #ifndef _GHTML_H
00004 #define _GHTML_H
00005 
00006 #include "GMap.h"
00007 #include "GDocView.h"
00008 
00009 class GTag;
00010 class GFontCache;
00011 
00013 class GHtmlStatic
00014 {
00015     friend class GHtmlStaticInst;
00016     static GHtmlStatic *Inst;
00017 
00018 public:
00019     int Refs;
00020     GMap<char16*,int>   VarMap;
00021     GMap<char*,int>     StyleMap;
00022     GMap<char*,int>     ColourMap;
00023 
00024     GHtmlStatic();
00025     ~GHtmlStatic();
00026 };
00027 
00029 class GHtmlStaticInst
00030 {
00031 public:
00032     GHtmlStatic *Static;
00033 
00034     GHtmlStaticInst()
00035     {
00036         if (NOT GHtmlStatic::Inst)
00037         {
00038             GHtmlStatic::Inst = NEW(GHtmlStatic);
00039         }
00040         if (GHtmlStatic::Inst)
00041         {
00042             GHtmlStatic::Inst->Refs++;
00043         }
00044         Static = GHtmlStatic::Inst;
00045     }
00046 
00047     ~GHtmlStaticInst()
00048     {
00049         if (GHtmlStatic::Inst)
00050         {
00051             GHtmlStatic::Inst->Refs--;
00052             if (GHtmlStatic::Inst->Refs == 0)
00053             {
00054                 DeleteObj(GHtmlStatic::Inst);
00055             }
00056         }
00057     }
00058 };
00059 
00073 class GHtml :
00074     public GDocView,
00075     public ResObject
00076 {
00077     friend class GTag;
00078     friend class GFlowRegion;
00079     class GHtmlPrivate *d;
00080 
00081 protected:  
00082     // Data
00083     GFontCache          *FontCache;
00084     GTag                *Tag;               // Tree root
00085     GTag                *Cursor;            // Cursor location..
00086     GTag                *Selection;         // Edge of selection or NULL
00087     List<GTag>          OpenTags;
00088     char                *Source;
00089     char                *DocCharSet;
00090     char                IsHtml;
00091     int                 ViewWidth;
00092     GToolTip            Tip;
00093     GTag                *PrevTip;
00094     GMap<char*,char*>   CssMap;
00095 
00096     // Display
00097     GSurface            *MemDC;
00098 
00099     // Methods
00100     void _New();
00101     void _Delete();
00102     GFont *DefFont();
00103     GTag *GetOpenTag(char *Tag);
00104     void Parse();
00105     void AddCss(char *Css);
00106     int ScrollY();
00107     void SetCursorVis(bool b);
00108     bool GetCursorVis();
00109     GRect *GetCursorPos();
00110 
00111 public:
00112     GHtml(int Id, int x, int y, int cx, int cy, GDocumentEnv *system = 0);
00113     ~GHtml();
00114 
00115     // Html
00116 
00118     GTag *GetTagByPos(int x, int y, int *Index);
00119 
00120     // GDocView
00121     
00123     bool Copy();
00125     bool HasSelection();
00127     void UnSelectAll();
00129     void SelectAll();
00131     char *GetSelection();
00132     
00133     // Prop
00134     void SetLoadImages(bool i);
00135 
00136     // Window
00137 
00139     bool Name(char *s);
00141     char *Name();
00142 
00143     // Impl
00144     void OnPaint(GSurface *pDC);
00145     void OnMouseClick(GMouse &m);
00146     void OnMouseMove(GMouse &m);
00147     void OnMouseWheel(double Lines);
00148     bool OnKey(GKey &k);
00149     int OnNotify(GViewI *c, int f);
00150     void OnPosChange();
00151     void OnPulse();
00152     int OnEvent(GMessage *Msg);
00153     char *GetMimeType() { return "text/html"; }
00154 };
00155 
00157 enum CssStyle
00158 {
00159     CSS_NULL = 0,
00160 
00161     // Colour
00162     CSS_COLOUR,
00163     CSS_BACKGROUND,
00164     CSS_BACKGROUND_COLOUR,
00165     CSS_BACKGROUND_REPEAT,
00166 
00167     // Font
00168     CSS_FONT,
00169     CSS_FONT_SIZE,
00170     CSS_FONT_WEIGHT,
00171     CSS_FONT_FAMILY,
00172     CSS_FONT_STYLE,
00173 
00174     // Dimensions
00175     CSS_WIDTH,
00176     CSS_HEIGHT,
00177 
00178     // Margin
00179     CSS_MARGIN,
00180     CSS_MARGIN_LEFT,
00181     CSS_MARGIN_RIGHT,
00182     CSS_MARGIN_TOP,
00183     CSS_MARGIN_BOTTOM,
00184 
00185     // Padding
00186     CSS_PADDING,
00187     CSS_PADDING_LEFT,
00188     CSS_PADDING_TOP,
00189     CSS_PADDING_RIGHT,
00190     CSS_PADDING_BOTTOM,
00191 
00192     // Border
00193     CSS_BORDER,
00194     CSS_BORDER_LEFT,
00195     CSS_BORDER_TOP,
00196     CSS_BORDER_RIGHT,
00197     CSS_BORDER_BOTTOM,
00198 
00199     // Alignment
00200     CSS_ALIGN,
00201     CSS_VERTICAL_ALIGN,
00202     CSS_TEXT_ALIGN,
00203 };
00204 
00206 enum CssAlign
00207 {
00208     AlignInherit,
00209     AlignLeft,
00210     AlignCenter,
00211     AlignRight,
00212     AlignJustify,
00213     AlignTop,
00214     AlignMiddle,
00215     AlignBottom,
00216 };
00217 
00219 enum CssBackgroundRepeat
00220 {
00221     BgInherit,
00222     BgRepeat,
00223     BgRepeatX,
00224     BgRepeatY,
00225     BgNoRepeat,
00226 };
00227 
00228 
00229 #endif

Generated on Tue May 2 10:24:41 2006 for Lgi by  doxygen 1.4.1