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