00001
00002
00003 #ifndef _GHTML_H
00004 #define _GHTML_H
00005
00006 #include "GMap.h"
00007 #include "GDocView.h"
00008 #include "GHtmlStatic.h"
00009
00010 class GTag;
00011 class GFontCache;
00012
00026 class GHtml :
00027 public GDocView,
00028 public ResObject
00029 {
00030 friend class GTag;
00031 friend class GFlowRegion;
00032 class GHtmlPrivate *d;
00033
00034 protected:
00035
00036 GFontCache *FontCache;
00037 GTag *Tag;
00038 GTag *Cursor;
00039 GTag *Selection;
00040 List<GTag> OpenTags;
00041 char *Source;
00042 char *DocCharSet;
00043 char IsHtml;
00044 int ViewWidth;
00045 GToolTip Tip;
00046 GTag *PrevTip;
00047 GMap<char*,char*> CssMap;
00048
00049
00050 GSurface *MemDC;
00051
00052
00053 void _New();
00054 void _Delete();
00055 GFont *DefFont();
00056 GTag *GetOpenTag(char *Tag);
00057 void Parse();
00058 void AddCss(char *Css);
00059 int ScrollY();
00060 void SetCursorVis(bool b);
00061 bool GetCursorVis();
00062 GRect *GetCursorPos();
00063 bool IsCursorFirst();
00064 int GetTagDepth(GTag *Tag);
00065 GTag *PrevTag(GTag *t);
00066 GTag *NextTag(GTag *t);
00067 GTag *GetLastChild(GTag *t);
00068
00069 friend bool FindCallback(GFindReplaceCommon *Dlg, bool Replace, void *User);
00070 bool OnFind(class GFindReplaceCommon *Params);
00071
00072 public:
00073 GHtml(int Id, int x, int y, int cx, int cy, GDocumentEnv *system = 0);
00074 ~GHtml();
00075
00076
00077 const char *GetClass() { return "GHtml"; }
00078
00080 GTag *GetTagByPos(int x, int y, int *Index);
00082 GdcPt2 Layout();
00083
00084
00085 bool GetLinkDoubleClick();
00086 void SetLinkDoubleClick(bool b);
00087
00088
00089
00091 bool Copy();
00093 bool HasSelection();
00095 void UnSelectAll();
00097 void SelectAll();
00099 char *GetSelection();
00100
00101
00102 void SetLoadImages(bool i);
00103
00104
00105
00107 bool Name(const char *s);
00109 char *Name();
00111 bool NameW(const char16 *s);
00113 char16 *NameW();
00114
00115
00116 void OnPaint(GSurface *pDC);
00117 void OnMouseClick(GMouse &m);
00118 void OnMouseMove(GMouse &m);
00119 void OnMouseWheel(double Lines);
00120 bool OnKey(GKey &k);
00121 int OnNotify(GViewI *c, int f);
00122 void OnPosChange();
00123 void OnPulse();
00124 int OnEvent(GMessage *Msg);
00125 const char *GetMimeType() { return "text/html"; }
00126
00127
00128 GDom *getElementById(char *Id);
00129 };
00130
00131
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
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
00183 enum CssAlign
00184 {
00185 AlignInherit,
00186 AlignLeft,
00187 AlignCenter,
00188 AlignRight,
00189 AlignJustify,
00190 AlignTop,
00191 AlignMiddle,
00192 AlignBottom,
00193 };
00194
00196 enum CssBackgroundRepeat
00197 {
00198 BgInherit,
00199 BgRepeat,
00200 BgRepeatX,
00201 BgRepeatY,
00202 BgNoRepeat,
00203 };
00204
00205
00206 #endif