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 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
00093
00094
00096 bool Copy();
00098 bool HasSelection();
00100 void UnSelectAll();
00102 void SelectAll();
00104 char *GetSelection();
00105
00106
00107 void SetLoadImages(bool i);
00108
00109
00110
00112 bool Name(char *s);
00114 char *Name();
00116 bool NameW(char16 *s);
00118 char16 *NameW();
00119
00120
00121 void OnPaint(GSurface *pDC);
00122 void OnMouseClick(GMouse &m);
00123 void OnMouseMove(GMouse &m);
00124 int OnHitTest(int x, int y);
00125 void OnMouseWheel(double Lines);
00126 bool OnKey(GKey &k);
00127 int OnNotify(GViewI *c, int f);
00128 void OnPosChange();
00129 void OnPulse();
00130 int OnEvent(GMessage *Msg);
00131 char *GetMimeType() { return "text/html"; }
00132 void OnContent(GDocumentEnv::LoadJob *Res);
00133 bool GotoAnchor(char *Name);
00134
00135
00136 GDom *getElementById(char *Id);
00137
00138
00139 bool OnFind(class GFindReplaceCommon *Params);
00140 virtual void OnCursorChanged() {}
00141 };
00142
00143
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194 }
00195 #endif