00001
00002
00003 #ifndef _GHTML2_H
00004 #define _GHTML2_H
00005
00006 #include "GDocView.h"
00007 #include "GHtmlStatic.h"
00008
00009 namespace Html2
00010 {
00011
00012 class GTag;
00013 class GFontCache;
00014
00028 class GHtml2 :
00029 public GDocView,
00030 public ResObject
00031 {
00032 friend class GTag;
00033 friend class GFlowRegion;
00034
00035 class GHtmlPrivate2 *d;
00036
00037 protected:
00038
00039 GFontCache *FontCache;
00040 GTag *Tag;
00041 GTag *Cursor;
00042 GTag *Selection;
00043 List<GTag> OpenTags;
00044 char *Source;
00045 char *DocCharSet;
00046 char IsHtml;
00047 int ViewWidth;
00048 GToolTip Tip;
00049 GTag *PrevTip;
00050 GHashTbl<char*,char*> CssMap;
00051
00052
00053 GSurface *MemDC;
00054
00055
00056 GArray<GDocumentEnv::LoadJob*> Jobs;
00057
00058
00059 void _New();
00060 void _Delete();
00061 GFont *DefFont();
00062 GTag *GetOpenTag(char *Tag);
00063 void CloseTag(GTag *t);
00064 void Parse();
00065 void AddCss(char *Css);
00066 int ScrollY();
00067 void SetCursorVis(bool b);
00068 bool GetCursorVis();
00069 GRect *GetCursorPos();
00070 bool IsCursorFirst();
00071 int GetTagDepth(GTag *Tag);
00072 GTag *PrevTag(GTag *t);
00073 GTag *NextTag(GTag *t);
00074 GTag *GetLastChild(GTag *t);
00075
00076 public:
00077 GHtml2(int Id, int x, int y, int cx, int cy, GDocumentEnv *system = 0);
00078 ~GHtml2();
00079
00080
00081 const char *GetClass() { return "GHtml2"; }
00082 bool GetFormattedContent(char *MimeType, GAutoString &Out, GArray<GDocView::ContentMedia> *Media = 0);
00083
00085 GTag *GetTagByPos(int x, int y, int *Index);
00087 GdcPt2 Layout();
00088
00089
00090 bool GetLinkDoubleClick();
00091 void SetLinkDoubleClick(bool b);
00092 void SetLoadImages(bool i);
00093 bool GetEmoji();
00094 void SetEmoji(bool i);
00095
00096
00097
00099 bool Copy();
00101 bool HasSelection();
00103 void UnSelectAll();
00105 void SelectAll();
00107 char *GetSelection();
00108
00109
00110
00111
00112
00114 bool Name(const char *s);
00116 char *Name();
00118 bool NameW(const char16 *s);
00120 char16 *NameW();
00121
00122
00123 void OnPaint(GSurface *pDC);
00124 void OnMouseClick(GMouse &m);
00125 void OnMouseMove(GMouse &m);
00126 int OnHitTest(int x, int y);
00127 void OnMouseWheel(double Lines);
00128 bool OnKey(GKey &k);
00129 int OnNotify(GViewI *c, int f);
00130 void OnPosChange();
00131 void OnPulse();
00132 int OnEvent(GMessage *Msg);
00133 const char *GetMimeType() { return "text/html"; }
00134 void OnContent(GDocumentEnv::LoadJob *Res);
00135 bool GotoAnchor(char *Name);
00136
00137
00138 GDom *getElementById(char *Id);
00139
00140
00141 bool OnFind(class GFindReplaceCommon *Params);
00142 virtual void OnCursorChanged() {}
00143 };
00144
00145 }
00146 #endif