]>
Commit | Line | Data |
---|---|---|
5526e819 VS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: htmlcell.h | |
3 | // Purpose: wxHtmlCell class is used by wxHtmlWindow/wxHtmlWinParser | |
4 | // as a basic visual element of HTML page | |
5 | // Author: Vaclav Slavik | |
69941f05 | 6 | // RCS-ID: $Id$ |
5526e819 VS |
7 | // Copyright: (c) 1999 Vaclav Slavik |
8 | // Licence: wxWindows Licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | ||
69941f05 VS |
12 | #ifndef _WX_HTMLCELL_H_ |
13 | #define _WX_HTMLCELL_H_ | |
5526e819 | 14 | |
af49c4b8 | 15 | #if defined(__GNUG__) && !defined(__APPLE__) |
97494971 | 16 | #pragma interface "htmlcell.h" |
5526e819 VS |
17 | #endif |
18 | ||
19 | #include "wx/defs.h" | |
5526e819 | 20 | |
4dcaf11a | 21 | #if wxUSE_HTML |
5526e819 | 22 | |
4dcaf11a RR |
23 | #include "wx/html/htmltag.h" |
24 | #include "wx/html/htmldefs.h" | |
25 | #include "wx/window.h" | |
5526e819 | 26 | |
846914d1 | 27 | |
ffef2bde RD |
28 | class WXDLLEXPORT wxHtmlLinkInfo; |
29 | class WXDLLEXPORT wxHtmlCell; | |
30 | class WXDLLEXPORT wxHtmlContainerCell; | |
5526e819 | 31 | |
f65a786f VS |
32 | |
33 | // wxHtmlSelection is data holder with information about text selection. | |
34 | // Selection is defined by two positions (beginning and end of the selection) | |
35 | // and two leaf(!) cells at these positions. | |
36 | class WXDLLEXPORT wxHtmlSelection | |
37 | { | |
38 | public: | |
39 | wxHtmlSelection() | |
40 | : m_fromPos(wxDefaultPosition), m_toPos(wxDefaultPosition), | |
41 | m_fromCell(NULL), m_toCell(NULL) {} | |
42 | ||
43 | void Set(const wxPoint& fromPos, wxHtmlCell *fromCell, | |
44 | const wxPoint& toPos, wxHtmlCell *toCell) | |
45 | { | |
46 | m_fromCell = fromCell; | |
47 | m_toCell = toCell; | |
48 | m_fromPos = fromPos; | |
49 | m_toPos = toPos; | |
50 | } | |
51 | ||
7d96264c VZ |
52 | const wxHtmlCell *GetFromCell() const { return m_fromCell; } |
53 | const wxHtmlCell *GetToCell() const { return m_toCell; } | |
f65a786f VS |
54 | |
55 | // these values are *relative* to From/To cell's origin: | |
56 | const wxPoint& GetFromPos() const { return m_fromPos; } | |
57 | const wxPoint& GetToPos() const { return m_toPos; } | |
58 | ||
59 | const bool IsEmpty() const | |
60 | { return m_fromPos == wxDefaultPosition && | |
61 | m_toPos == wxDefaultPosition; } | |
62 | ||
63 | private: | |
64 | wxPoint m_fromPos, m_toPos; | |
65 | wxHtmlCell *m_fromCell, *m_toCell; | |
66 | }; | |
67 | ||
68 | ||
69 | ||
70 | enum wxHtmlSelectionState | |
71 | { | |
72 | wxHTML_SEL_OUT, // currently rendered cell is outside the selection | |
73 | wxHTML_SEL_IN, // ... is inside selection | |
74 | wxHTML_SEL_CHANGING // ... is the cell on which selection state changes | |
75 | }; | |
76 | ||
77 | // Selection state is passed to wxHtmlCell::Draw so that it can render itself | |
78 | // differently e.g. when inside text selection or outside it. | |
79 | class WXDLLEXPORT wxHtmlRenderingState | |
80 | { | |
81 | public: | |
6fac75c3 | 82 | wxHtmlRenderingState(wxHtmlSelection *s = NULL) |
f65a786f | 83 | : m_selection(s), m_selState(wxHTML_SEL_OUT) {} |
6fac75c3 | 84 | void SetSelection(wxHtmlSelection *s) { m_selection = s; } |
f65a786f VS |
85 | wxHtmlSelection *GetSelection() const { return m_selection; } |
86 | ||
87 | void SetSelectionState(wxHtmlSelectionState s) { m_selState = s; } | |
88 | wxHtmlSelectionState GetSelectionState() const { return m_selState; } | |
89 | ||
90 | void SetFgColour(const wxColour& c) { m_fgColour = c; } | |
91 | const wxColour& GetFgColour() const { return m_fgColour; } | |
92 | void SetBgColour(const wxColour& c) { m_bgColour = c; } | |
93 | const wxColour& GetBgColour() const { return m_bgColour; } | |
94 | ||
95 | private: | |
96 | wxHtmlSelection *m_selection; | |
97 | wxHtmlSelectionState m_selState; | |
98 | wxColour m_fgColour, m_bgColour; | |
99 | }; | |
100 | ||
101 | // Flags for wxHtmlCell::FindCellByPos | |
102 | enum | |
103 | { | |
adf2eb2d VS |
104 | wxHTML_FIND_EXACT = 1, |
105 | wxHTML_FIND_NEAREST_BEFORE = 2, | |
106 | wxHTML_FIND_NEAREST_AFTER = 4, | |
f65a786f VS |
107 | }; |
108 | ||
109 | ||
110 | // --------------------------------------------------------------------------- | |
5526e819 | 111 | // wxHtmlCell |
f65a786f VS |
112 | // Internal data structure. It represents fragments of parsed |
113 | // HTML page - a word, picture, table, horizontal line and so | |
114 | // on. It is used by wxHtmlWindow to represent HTML page in | |
115 | // memory. | |
116 | // --------------------------------------------------------------------------- | |
5526e819 VS |
117 | |
118 | ||
119 | class WXDLLEXPORT wxHtmlCell : public wxObject | |
120 | { | |
97494971 VS |
121 | public: |
122 | wxHtmlCell(); | |
123 | virtual ~wxHtmlCell(); | |
124 | ||
125 | void SetParent(wxHtmlContainerCell *p) {m_Parent = p;} | |
126 | wxHtmlContainerCell *GetParent() const {return m_Parent;} | |
127 | ||
128 | int GetPosX() const {return m_PosX;} | |
129 | int GetPosY() const {return m_PosY;} | |
130 | int GetWidth() const {return m_Width;} | |
131 | int GetHeight() const {return m_Height;} | |
132 | int GetDescent() const {return m_Descent;} | |
d50d561a | 133 | |
8938133d VS |
134 | const wxString& GetId() const { return m_id; } |
135 | void SetId(const wxString& id) { m_id = id; } | |
97494971 | 136 | |
f65a786f VS |
137 | // returns the link associated with this cell. The position is position |
138 | // within the cell so it varies from 0 to m_Width, from 0 to m_Height | |
97494971 VS |
139 | virtual wxHtmlLinkInfo* GetLink(int WXUNUSED(x) = 0, int WXUNUSED(y) = 0) const |
140 | { return m_Link; } | |
141 | ||
142 | // members access methods | |
143 | wxHtmlCell *GetNext() const {return m_Next;} | |
144 | ||
f6010d8f | 145 | // members writing methods |
97494971 VS |
146 | virtual void SetPos(int x, int y) {m_PosX = x, m_PosY = y;} |
147 | void SetLink(const wxHtmlLinkInfo& link); | |
148 | void SetNext(wxHtmlCell *cell) {m_Next = cell;} | |
149 | ||
f65a786f VS |
150 | // 1. adjust cell's width according to the fact that maximal possible width |
151 | // is w. (this has sense when working with horizontal lines, tables | |
152 | // etc.) | |
153 | // 2. prepare layout (=fill-in m_PosX, m_PosY (and sometime m_Height) | |
154 | // members) = place items to fit window, according to the width w | |
97494971 VS |
155 | virtual void Layout(int w); |
156 | ||
157 | // renders the cell | |
f65a786f VS |
158 | virtual void Draw(wxDC& WXUNUSED(dc), |
159 | int WXUNUSED(x), int WXUNUSED(y), | |
160 | int WXUNUSED(view_y1), int WXUNUSED(view_y2), | |
161 | wxHtmlRenderingState& WXUNUSED(state)) {} | |
97494971 | 162 | |
f65a786f VS |
163 | // proceed drawing actions in case the cell is not visible (scrolled out of |
164 | // screen). This is needed to change fonts, colors and so on. | |
165 | virtual void DrawInvisible(wxDC& WXUNUSED(dc), | |
166 | int WXUNUSED(x), int WXUNUSED(y), | |
167 | wxHtmlRenderingState& WXUNUSED(state)) {} | |
97494971 VS |
168 | |
169 | // This method returns pointer to the FIRST cell for that | |
170 | // the condition | |
171 | // is true. It first checks if the condition is true for this | |
172 | // cell and then calls m_Next->Find(). (Note: it checks | |
173 | // all subcells if the cell is container) | |
174 | // Condition is unique condition identifier (see htmldefs.h) | |
175 | // (user-defined condition IDs should start from 10000) | |
176 | // and param is optional parameter | |
177 | // Example : m_Cell->Find(wxHTML_COND_ISANCHOR, "news"); | |
178 | // returns pointer to anchor news | |
179 | virtual const wxHtmlCell* Find(int condition, const void* param) const; | |
180 | ||
181 | // This function is called when mouse button is clicked over the cell. | |
f6010d8f | 182 | // |
97494971 VS |
183 | // Parent is pointer to wxHtmlWindow that generated the event |
184 | // HINT: if this handling is not enough for you you should use | |
f7b23958 | 185 | // wxHtmlWidgetCell |
97494971 VS |
186 | virtual void OnMouseClick(wxWindow *parent, int x, int y, const wxMouseEvent& event); |
187 | ||
f65a786f VS |
188 | // This method used to adjust pagebreak position. The parameter is variable |
189 | // that contains y-coordinate of page break (= horizontal line that should | |
190 | // not be crossed by words, images etc.). If this cell cannot be divided | |
97494971 VS |
191 | // into two pieces (each one on another page) then it moves the pagebreak |
192 | // few pixels up. | |
193 | // | |
194 | // Returned value : true if pagebreak was modified, false otherwise | |
195 | // Usage : while (container->AdjustPagebreak(&p)) {} | |
f65a786f VS |
196 | virtual bool AdjustPagebreak(int *pagebreak, |
197 | int *known_pagebreaks = NULL, | |
198 | int number_of_pages = 0) const; | |
97494971 VS |
199 | |
200 | // Sets cell's behaviour on pagebreaks (see AdjustPagebreak). Default | |
201 | // is true - the cell can be split on two pages | |
79d6c018 | 202 | void SetCanLiveOnPagebreak(bool can) { m_CanLiveOnPagebreak = can; } |
97494971 | 203 | |
d50d561a | 204 | // Returns y-coordinates that contraint the cell, i.e. left is highest |
79d6c018 VS |
205 | // and right lowest coordinate such that the cell lays between then. |
206 | // Note: this method does not return meaningful values if you haven't | |
207 | // called Layout() before! | |
208 | virtual void GetHorizontalConstraints(int *left, int *right) const; | |
97494971 | 209 | |
f6010d8f VZ |
210 | // Returns true for simple == terminal cells, i.e. not composite ones. |
211 | // This if for internal usage only and may disappear in future versions! | |
8938133d | 212 | virtual bool IsTerminalCell() const { return TRUE; } |
f6010d8f | 213 | |
f65a786f VS |
214 | // Find a cell inside this cell positioned at the given coordinates |
215 | // (relative to this's positions). Returns NULL if no such cell exists. | |
216 | // The flag can be used to specify whether to look for terminal or | |
217 | // nonterminal cells or both. In either case, returned cell is deepest | |
218 | // cell in cells tree that contains [x,y]. | |
219 | virtual wxHtmlCell *FindCellByPos(wxCoord x, wxCoord y, | |
adf2eb2d VS |
220 | unsigned flags = wxHTML_FIND_EXACT) const; |
221 | ||
222 | // Returns absolute position of the cell on HTML canvas | |
223 | wxPoint GetAbsPos() const; | |
224 | ||
225 | // Returns first (last) terminal cell inside this cell. It may return NULL, | |
226 | // but it is rare -- only if there are no terminals in the tree. | |
227 | virtual wxHtmlCell *GetFirstTerminal() const | |
228 | { return wxConstCast(this, wxHtmlCell); } | |
229 | virtual wxHtmlCell *GetLastTerminal() const | |
230 | { return wxConstCast(this, wxHtmlCell); } | |
f6010d8f | 231 | |
97494971 VS |
232 | protected: |
233 | wxHtmlCell *m_Next; | |
234 | // pointer to the next cell | |
235 | wxHtmlContainerCell *m_Parent; | |
f6010d8f | 236 | // pointer to parent cell |
97494971 VS |
237 | long m_Width, m_Height, m_Descent; |
238 | // dimensions of fragment | |
239 | // m_Descent is used to position text&images.. | |
240 | long m_PosX, m_PosY; | |
241 | // position where the fragment is drawn | |
242 | wxHtmlLinkInfo *m_Link; | |
f6010d8f | 243 | // destination address if this fragment is hypertext link, NULL otherwise |
97494971 VS |
244 | bool m_CanLiveOnPagebreak; |
245 | // true if this cell can be placed on pagebreak, false otherwise | |
8938133d VS |
246 | wxString m_id; |
247 | // unique identifier of the cell, generated from "id" property of tags | |
22f3361e VZ |
248 | |
249 | DECLARE_NO_COPY_CLASS(wxHtmlCell) | |
5526e819 VS |
250 | }; |
251 | ||
252 | ||
253 | ||
254 | ||
255 | //-------------------------------------------------------------------------------- | |
256 | // Inherited cells: | |
257 | //-------------------------------------------------------------------------------- | |
258 | ||
259 | ||
260 | //-------------------------------------------------------------------------------- | |
261 | // wxHtmlWordCell | |
262 | // Single word in input stream. | |
263 | //-------------------------------------------------------------------------------- | |
264 | ||
265 | class WXDLLEXPORT wxHtmlWordCell : public wxHtmlCell | |
266 | { | |
97494971 VS |
267 | public: |
268 | wxHtmlWordCell(const wxString& word, wxDC& dc); | |
f65a786f VS |
269 | void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2, |
270 | wxHtmlRenderingState& state); | |
60e87cb1 | 271 | |
97494971 VS |
272 | protected: |
273 | wxString m_Word; | |
5526e819 VS |
274 | }; |
275 | ||
276 | ||
277 | ||
278 | ||
279 | ||
f65a786f VS |
280 | // Container contains other cells, thus forming tree structure of rendering |
281 | // elements. Basic code of layout algorithm is contained in this class. | |
5526e819 VS |
282 | class WXDLLEXPORT wxHtmlContainerCell : public wxHtmlCell |
283 | { | |
97494971 VS |
284 | public: |
285 | wxHtmlContainerCell(wxHtmlContainerCell *parent); | |
286 | ~wxHtmlContainerCell(); | |
287 | ||
288 | virtual void Layout(int w); | |
f65a786f VS |
289 | virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2, |
290 | wxHtmlRenderingState& state); | |
291 | virtual void DrawInvisible(wxDC& dc, int x, int y, | |
292 | wxHtmlRenderingState& state); | |
f2034f1b | 293 | virtual bool AdjustPagebreak(int *pagebreak, int *known_pagebreaks = NULL, int number_of_pages = 0) const; |
97494971 VS |
294 | |
295 | // insert cell at the end of m_Cells list | |
296 | void InsertCell(wxHtmlCell *cell); | |
297 | ||
298 | // sets horizontal/vertical alignment | |
299 | void SetAlignHor(int al) {m_AlignHor = al; m_LastLayout = -1;} | |
300 | int GetAlignHor() const {return m_AlignHor;} | |
301 | void SetAlignVer(int al) {m_AlignVer = al; m_LastLayout = -1;} | |
302 | int GetAlignVer() const {return m_AlignVer;} | |
303 | ||
304 | // sets left-border indentation. units is one of wxHTML_UNITS_* constants | |
305 | // what is combination of wxHTML_INDENT_* | |
306 | void SetIndent(int i, int what, int units = wxHTML_UNITS_PIXELS); | |
307 | // returns the indentation. ind is one of wxHTML_INDENT_* constants | |
308 | int GetIndent(int ind) const; | |
309 | // returns type of value returned by GetIndent(ind) | |
310 | int GetIndentUnits(int ind) const; | |
311 | ||
312 | // sets alignment info based on given tag's params | |
313 | void SetAlign(const wxHtmlTag& tag); | |
314 | // sets floating width adjustment | |
315 | // (examples : 32 percent of parent container, | |
316 | // -15 pixels percent (this means 100 % - 15 pixels) | |
317 | void SetWidthFloat(int w, int units) {m_WidthFloat = w; m_WidthFloatUnits = units; m_LastLayout = -1;} | |
318 | void SetWidthFloat(const wxHtmlTag& tag, double pixel_scale = 1.0); | |
319 | // sets minimal height of this container. | |
320 | void SetMinHeight(int h, int align = wxHTML_ALIGN_TOP) {m_MinHeight = h; m_MinHeightAlign = align; m_LastLayout = -1;} | |
321 | ||
322 | void SetBackgroundColour(const wxColour& clr) {m_UseBkColour = TRUE; m_BkColour = clr;} | |
2b5f62a0 VZ |
323 | // returns background colour (of wxNullColour if none set), so that widgets can |
324 | // adapt to it: | |
325 | wxColour GetBackgroundColour(); | |
97494971 VS |
326 | void SetBorder(const wxColour& clr1, const wxColour& clr2) {m_UseBorder = TRUE; m_BorderColour1 = clr1, m_BorderColour2 = clr2;} |
327 | virtual wxHtmlLinkInfo* GetLink(int x = 0, int y = 0) const; | |
328 | virtual const wxHtmlCell* Find(int condition, const void* param) const; | |
329 | virtual void OnMouseClick(wxWindow *parent, int x, int y, const wxMouseEvent& event); | |
79d6c018 | 330 | virtual void GetHorizontalConstraints(int *left, int *right) const; |
97494971 VS |
331 | |
332 | // returns pointer to the first cell in container or NULL | |
333 | wxHtmlCell* GetFirstCell() const {return m_Cells;} | |
334 | ||
f6010d8f | 335 | // see comment in wxHtmlCell about this method |
d50d561a | 336 | virtual bool IsTerminalCell() const { return FALSE; } |
f6010d8f | 337 | |
f65a786f | 338 | virtual wxHtmlCell *FindCellByPos(wxCoord x, wxCoord y, |
adf2eb2d VS |
339 | unsigned flags = wxHTML_FIND_EXACT) const; |
340 | ||
341 | virtual wxHtmlCell *GetFirstTerminal() const; | |
342 | virtual wxHtmlCell *GetLastTerminal() const; | |
f6010d8f | 343 | |
f65a786f VS |
344 | protected: |
345 | void UpdateRenderingStatePre(wxHtmlRenderingState& state, | |
346 | wxHtmlCell *cell) const; | |
347 | void UpdateRenderingStatePost(wxHtmlRenderingState& state, | |
348 | wxHtmlCell *cell) const; | |
349 | ||
97494971 VS |
350 | protected: |
351 | int m_IndentLeft, m_IndentRight, m_IndentTop, m_IndentBottom; | |
352 | // indentation of subcells. There is always m_Indent pixels | |
353 | // big space between given border of the container and the subcells | |
354 | // it m_Indent < 0 it is in PERCENTS, otherwise it is in pixels | |
355 | int m_MinHeight, m_MinHeightAlign; | |
356 | // minimal height. | |
357 | wxHtmlCell *m_Cells, *m_LastCell; | |
358 | // internal cells, m_Cells points to the first of them, m_LastCell to the last one. | |
359 | // (LastCell is needed only to speed-up InsertCell) | |
360 | int m_AlignHor, m_AlignVer; | |
361 | // alignment horizontal and vertical (left, center, right) | |
362 | int m_WidthFloat, m_WidthFloatUnits; | |
363 | // width float is used in adjustWidth | |
364 | bool m_UseBkColour; | |
365 | wxColour m_BkColour; | |
366 | // background color of this container | |
367 | bool m_UseBorder; | |
368 | wxColour m_BorderColour1, m_BorderColour2; | |
369 | // borders color of this container | |
370 | int m_LastLayout; | |
371 | // if != -1 then call to Layout may be no-op | |
372 | // if previous call to Layout has same argument | |
22f3361e VZ |
373 | |
374 | DECLARE_NO_COPY_CLASS(wxHtmlContainerCell) | |
5526e819 VS |
375 | }; |
376 | ||
377 | ||
378 | ||
379 | ||
380 | ||
381 | //-------------------------------------------------------------------------------- | |
382 | // wxHtmlColourCell | |
383 | // Color changer. | |
384 | //-------------------------------------------------------------------------------- | |
385 | ||
386 | class WXDLLEXPORT wxHtmlColourCell : public wxHtmlCell | |
387 | { | |
97494971 VS |
388 | public: |
389 | wxHtmlColourCell(const wxColour& clr, int flags = wxHTML_CLR_FOREGROUND) : wxHtmlCell() {m_Colour = clr; m_Flags = flags;} | |
f65a786f VS |
390 | virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2, |
391 | wxHtmlRenderingState& state); | |
392 | virtual void DrawInvisible(wxDC& dc, int x, int y, | |
393 | wxHtmlRenderingState& state); | |
97494971 VS |
394 | |
395 | protected: | |
396 | wxColour m_Colour; | |
397 | unsigned m_Flags; | |
5526e819 VS |
398 | }; |
399 | ||
400 | ||
401 | ||
402 | ||
403 | //-------------------------------------------------------------------------------- | |
404 | // wxHtmlFontCell | |
405 | // Sets actual font used for text rendering | |
406 | //-------------------------------------------------------------------------------- | |
407 | ||
408 | class WXDLLEXPORT wxHtmlFontCell : public wxHtmlCell | |
409 | { | |
97494971 VS |
410 | public: |
411 | wxHtmlFontCell(wxFont *font) : wxHtmlCell() { m_Font = (*font); } | |
f65a786f VS |
412 | virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2, |
413 | wxHtmlRenderingState& state); | |
414 | virtual void DrawInvisible(wxDC& dc, int x, int y, | |
415 | wxHtmlRenderingState& state); | |
60e87cb1 | 416 | |
97494971 VS |
417 | protected: |
418 | wxFont m_Font; | |
5526e819 VS |
419 | }; |
420 | ||
421 | ||
422 | ||
423 | ||
424 | ||
425 | ||
426 | //-------------------------------------------------------------------------------- | |
427 | // wxHtmlwidgetCell | |
428 | // This cell is connected with wxWindow object | |
429 | // You can use it to insert windows into HTML page | |
430 | // (buttons, input boxes etc.) | |
431 | //-------------------------------------------------------------------------------- | |
432 | ||
433 | class WXDLLEXPORT wxHtmlWidgetCell : public wxHtmlCell | |
434 | { | |
97494971 VS |
435 | public: |
436 | // !!! wnd must have correct parent! | |
437 | // if w != 0 then the m_Wnd has 'floating' width - it adjust | |
438 | // it's width according to parent container's width | |
439 | // (w is percent of parent's width) | |
440 | wxHtmlWidgetCell(wxWindow *wnd, int w = 0); | |
441 | ~wxHtmlWidgetCell() { m_Wnd->Destroy(); } | |
f65a786f VS |
442 | virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2, |
443 | wxHtmlRenderingState& state); | |
444 | virtual void DrawInvisible(wxDC& dc, int x, int y, | |
445 | wxHtmlRenderingState& state); | |
97494971 VS |
446 | virtual void Layout(int w); |
447 | ||
448 | protected: | |
449 | wxWindow* m_Wnd; | |
450 | int m_WidthFloat; | |
451 | // width float is used in adjustWidth (it is in percents) | |
22f3361e VZ |
452 | |
453 | DECLARE_NO_COPY_CLASS(wxHtmlWidgetCell) | |
5526e819 VS |
454 | }; |
455 | ||
456 | ||
457 | ||
846914d1 VS |
458 | //-------------------------------------------------------------------------------- |
459 | // wxHtmlLinkInfo | |
460 | // Internal data structure. It represents hypertext link | |
461 | //-------------------------------------------------------------------------------- | |
462 | ||
ffef2bde | 463 | class WXDLLEXPORT wxHtmlLinkInfo : public wxObject |
846914d1 | 464 | { |
97494971 VS |
465 | public: |
466 | wxHtmlLinkInfo() : wxObject() | |
467 | { m_Href = m_Target = wxEmptyString; m_Event = NULL, m_Cell = NULL; } | |
468 | wxHtmlLinkInfo(const wxString& href, const wxString& target = wxEmptyString) : wxObject() | |
469 | { m_Href = href; m_Target = target; m_Event = NULL, m_Cell = NULL; } | |
470 | wxHtmlLinkInfo(const wxHtmlLinkInfo& l) : wxObject() | |
471 | { m_Href = l.m_Href, m_Target = l.m_Target, m_Event = l.m_Event; | |
472 | m_Cell = l.m_Cell; } | |
473 | wxHtmlLinkInfo& operator=(const wxHtmlLinkInfo& l) | |
474 | { m_Href = l.m_Href, m_Target = l.m_Target, m_Event = l.m_Event; | |
475 | m_Cell = l.m_Cell; return *this; } | |
476 | ||
477 | void SetEvent(const wxMouseEvent *e) { m_Event = e; } | |
478 | void SetHtmlCell(const wxHtmlCell *e) { m_Cell = e; } | |
479 | ||
480 | wxString GetHref() const { return m_Href; } | |
481 | wxString GetTarget() const { return m_Target; } | |
482 | const wxMouseEvent* GetEvent() const { return m_Event; } | |
483 | const wxHtmlCell* GetHtmlCell() const { return m_Cell; } | |
484 | ||
485 | private: | |
486 | wxString m_Href, m_Target; | |
487 | const wxMouseEvent *m_Event; | |
488 | const wxHtmlCell *m_Cell; | |
846914d1 VS |
489 | }; |
490 | ||
491 | ||
492 | ||
493 | ||
494 | #endif // wxUSE_HTML | |
5526e819 | 495 | |
69941f05 | 496 | #endif // _WX_HTMLCELL_H_ |
5526e819 | 497 |