1 /////////////////////////////////////////////////////////////////////////////
2 // Name: html/htmlcell.h
3 // Purpose: documentation for wxHtmlColourCell class
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxHtmlColourCell
11 @headerfile htmlcell.h wx/html/htmlcell.h
13 This cell changes the colour of either the background or the foreground.
18 class wxHtmlColourCell
: public wxHtmlCell
28 Can be one of following:
38 change background color
40 wxHtmlColourCell(wxColour clr
, int flags
= wxHTML_CLR_FOREGROUND
);
45 @class wxHtmlWidgetCell
46 @headerfile htmlcell.h wx/html/htmlcell.h
48 wxHtmlWidgetCell is a class that provides a connection between HTML cells and
49 widgets (an object derived
50 from wxWindow). You can use it to display things like forms, input boxes etc.
53 wxHtmlWidgetCell takes care of resizing and moving window.
58 class wxHtmlWidgetCell
: public wxHtmlCell
65 Connected window. It is parent window must be the wxHtmlWindow object within
66 which it is displayed!
69 Floating width. If non-zero width of wnd window is adjusted so that it is
70 always w percents of parent container's width. (For example w = 100 means that
72 will always have same width as parent container)
74 wxHtmlWidgetCell(wxWindow
* wnd
, int w
= 0);
80 @headerfile htmlcell.h wx/html/htmlcell.h
82 Internal data structure. It represents fragments of parsed HTML
83 page, the so-called @b cell - a word, picture, table, horizontal line and so on.
84 It is used by wxHtmlWindow and
85 wxHtmlWinParser to represent HTML page in memory.
87 You can divide cells into two groups : @e visible cells with non-zero width and
88 height and @e helper cells (usually with zero width and height) that
89 perform special actions such as color or font change.
95 @ref overview_cells "Cells Overview", wxHtmlContainerCell
97 class wxHtmlCell
: public wxObject
106 This method is used to adjust pagebreak position. The parameter is
107 variable that contains y-coordinate of page break (= horizontal line that
108 should not be crossed by words, images etc.). If this cell cannot be divided
109 into two pieces (each one on another page) then it moves the pagebreak
112 Returns @true if pagebreak was modified, @false otherwise
116 virtual bool AdjustPagebreak(int * pagebreak
);
122 Device context to which the cell is to be drawn
125 Coordinates of parent's upper left corner (origin). You must
126 add this to m_PosX,m_PosY when passing coordinates to dc's methods
127 Example : dc - DrawText("hello", x + m_PosX, y + m_PosY)
130 y-coord of the first line visible in window. This is
131 used to optimize rendering speed
134 y-coord of the last line visible in window. This is
135 used to optimize rendering speed
137 virtual void Draw(wxDC
& dc
, int x
, int y
, int view_y1
,
141 This method is called instead of Draw() when the
142 cell is certainly out of the screen (and thus invisible). This is not
143 nonsense - some tags (like wxHtmlColourCell
144 or font setter) must be drawn even if they are invisible!
147 Device context to which the cell is to be drawn
150 Coordinates of parent's upper left corner. You must
151 add this to m_PosX,m_PosY when passing coordinates to dc's methods
152 Example : dc - DrawText("hello", x + m_PosX, y + m_PosY)
154 virtual void DrawInvisible(wxDC
& dc
, int x
, int y
);
157 Returns pointer to itself if this cell matches condition (or if any of the cells
158 following in the list matches), @NULL otherwise.
159 (In other words if you call top-level container's Find it will
160 return pointer to the first cell that matches the condition)
162 It is recommended way how to obtain pointer to particular cell or
163 to cell of some type (e.g. wxHtmlAnchorCell reacts on
164 wxHTML_COND_ISANCHOR condition)
167 Unique integer identifier of condition
172 virtual const wxHtmlCell
* Find(int condition
, const void* param
);
175 Returns descent value of the cell (m_Descent member).
181 Returns pointer to the first cell in the list.
182 You can then use child's GetNext()
183 method to obtain pointer to the next cell in list.
185 @b Note: This shouldn't be used by the end user. If you need some way of
186 finding particular cell in the list, try Find() method
189 wxHtmlCell
* GetFirstChild();
192 Returns height of the cell (m_Height member).
197 Returns unique cell identifier if there is any, empty string otherwise.
199 virtual wxString
GetId();
202 Returns hypertext link if associated with this cell or @NULL otherwise.
204 (Note: this makes sense only for visible tags).
207 Coordinates of position where the user pressed mouse button.
208 These coordinates are used e.g. by COLORMAP. Values are relative to the
209 upper left corner of THIS cell (i.e. from 0 to m_Width or m_Height)
211 virtual wxHtmlLinkInfo
* GetLink(int x
= 0, int y
= 0);
214 Returns cursor to show when mouse pointer is over the cell.
217 interface to the parent HTML window
219 virtual wxCursor
GetMouseCursor(wxHtmlWindowInterface
* window
);
222 Returns pointer to the next cell in list (see htmlcell.h if you're
223 interested in details).
225 wxHtmlCell
* GetNext();
228 Returns pointer to parent container.
230 wxHtmlContainerCell
* GetParent();
233 Returns X position within parent (the value is relative to parent's
234 upper left corner). The returned value is meaningful only if
235 parent's Layout() was called before!
240 Returns Y position within parent (the value is relative to parent's
241 upper left corner). The returned value is meaningful only if
242 parent's Layout() was called before!
247 Returns width of the cell (m_Width member).
252 This method performs two actions:
254 adjusts the cell's width according to the fact that maximal possible width is
256 (this has sense when working with horizontal lines, tables etc.)
257 prepares layout (=fill-in m_PosX, m_PosY (and sometimes m_Height) members)
258 based on actual width @e w
260 It must be called before displaying cells structure because
261 m_PosX and m_PosY are undefined (or invalid)
262 before calling Layout.
264 virtual void Layout(int w
);
267 This function is simple event handler. Each time the user clicks mouse button
268 over a cell within wxHtmlWindow this method of that
269 cell is called. Default behavior is to call
270 wxHtmlWindow::LoadPage.
273 interface to the parent HTML window
276 coordinates of mouse click (this is relative to cell's origin
279 mouse event that triggered the call
281 @returns @true if a link was clicked, @false otherwise.
283 virtual bool ProcessMouseClick(wxHtmlWindowInterface
* window
,
285 const wxMouseEvent
& event
);
288 Sets unique cell identifier. Default value is no identifier, i.e. empty string.
290 void SetId(const wxString
& id
);
293 Sets the hypertext link associated with this cell. (Default value
294 is wxHtmlLinkInfo("", "") (no link))
296 void SetLink(const wxHtmlLinkInfo
& link
);
299 Sets the next cell in the list. This shouldn't be called by user - it is
300 to be used only by wxHtmlContainerCell::InsertCell.
302 void SetNext(wxHtmlCell cell
);
305 Sets parent container of this cell. This is called from
306 wxHtmlContainerCell::InsertCell.
308 void SetParent(wxHtmlContainerCell p
);
311 Sets the cell's position within parent container.
313 void SetPos(int x
, int y
);
318 @class wxHtmlContainerCell
319 @headerfile htmlcell.h wx/html/htmlcell.h
321 The wxHtmlContainerCell class is an implementation of a cell that may
322 contain more cells in it. It is heavily used in the wxHTML layout algorithm.
328 @ref overview_cells "Cells Overview"
330 class wxHtmlContainerCell
: public wxHtmlCell
334 Constructor. @e parent is pointer to parent container or @NULL.
336 wxHtmlContainerCell(wxHtmlContainerCell parent
);
339 Returns container's horizontal alignment.
344 Returns container's vertical alignment.
349 Returns the background colour of the container or @c wxNullColour if no
353 wxColour
GetBackgroundColour();
356 Returns the indentation. @e ind is one of the @b wxHTML_INDENT_* constants.
358 @b Note: You must call GetIndentUnits()
359 with same @e ind parameter in order to correctly interpret the returned integer
361 It is NOT always in pixels!
363 int GetIndent(int ind
);
366 Returns the units of indentation for @e ind where @e ind is one
367 of the @b wxHTML_INDENT_* constants.
369 int GetIndentUnits(int ind
);
372 Inserts new cell into the container.
374 void InsertCell(wxHtmlCell cell
);
377 Sets the container's alignment (both horizontal and vertical) according to
378 the values stored in @e tag. (Tags @c ALIGN parameter is extracted.) In fact
379 it is only a front-end to SetAlignHor()
382 void SetAlign(const wxHtmlTag
& tag
);
385 Sets the container's @e horizontal alignment. During wxHtmlCell::Layout
386 each line is aligned according to @e al value.
389 new horizontal alignment. May be one of these values:
394 lines are left-aligned (default)
409 lines are right-aligned
411 void SetAlignHor(int al
);
414 Sets the container's @e vertical alignment. This is per-line alignment!
417 new vertical alignment. May be one of these values:
422 cells are over the line (default)
427 cells are centered on line
432 cells are under the line
434 void SetAlignVer(int al
);
437 Sets the background colour for this container.
439 void SetBackgroundColour(const wxColour
& clr
);
442 Sets the border (frame) colours. A border is a rectangle around the container.
445 Colour of top and left lines
448 Colour of bottom and right lines
450 void SetBorder(const wxColour
& clr1
, const wxColour
& clr2
);
453 Sets the indentation (free space between borders of container and subcells).
459 Determines which of the four borders we're setting. It is OR
460 combination of following constants:
482 wxHTML_INDENT_HORIZONTAL
487 wxHTML_INDENT_VERTICAL
499 Units of i. This parameter affects interpretation of value.
504 i is number of pixels
509 i is interpreted as percents of width
512 void SetIndent(int i
, int what
, int units
= wxHTML_UNITS_PIXELS
);
515 Sets minimal height of the container.
517 When container's wxHtmlCell::Layout is called, m_Height
518 is set depending on layout of subcells to the height of area covered
519 by layed-out subcells. Calling this method guarantees you that the height
520 of container is never smaller than @e h - even if the subcells cover
527 If height of the container is lower than the minimum height, empty space must
529 somewhere in order to ensure minimal height. This parameter is one of
531 wxHTML_ALIGN_BOTTOM, wxHTML_ALIGN_CENTER. It refers to the contents, not to the
534 void SetMinHeight(int h
, int align
= wxHTML_ALIGN_TOP
);
538 Sets floating width adjustment.
540 The normal behaviour of container is that its width is the same as the width of
541 parent container (and thus you can have only one sub-container per line).
542 You can change this by setting FWA.
544 @e pixel_scale is number of real pixels that equals to 1 HTML pixel.
547 Width of the container. If the value is negative it means
548 complement to full width of parent container (e.g.
549 SetWidthFloat(-50, wxHTML_UNITS_PIXELS) sets the width
550 of container to parent's width minus 50 pixels. This is useful when
551 creating tables - you can call SetWidthFloat(50) and SetWidthFloat(-50))
554 Units of w This parameter affects the interpretation of value.
559 w is number of pixels
564 w is interpreted as percents of width
568 In the second version of method, w and units
569 info is extracted from tag's WIDTH parameter.
571 void SetWidthFloat(int w
, int units
);
572 void SetWidthFloat(const wxHtmlTag
& tag
,
573 double pixel_scale
= 1.0);
579 @class wxHtmlLinkInfo
580 @headerfile htmlcell.h wx/html/htmlcell.h
582 This class stores all necessary information about hypertext
583 links (as represented by @c A tag in HTML documents). In
584 current implementation it stores URL and target frame name.
585 @e Note that frames are not currently supported by wxHTML!
590 class wxHtmlLinkInfo
: public wxObject
595 Construct hypertext link from HREF (aka URL) and TARGET (name of target
599 wxHtmlLinkInfo(const wxString
& href
,
600 const wxString
& target
= wxEmptyString
);
604 Return pointer to event that generated OnLinkClicked event. Valid
605 only within wxHtmlWindow::OnLinkClicked,
608 const wxMouseEvent
* GetEvent();
611 Return @e HREF value of the @c A tag.
616 Return pointer to the cell that was clicked. Valid
617 only within wxHtmlWindow::OnLinkClicked,
620 const wxHtmlCell
* GetHtmlCell();
623 Return @e TARGET value of the @c A tag (this value
624 is used to specify in which frame should be the page pointed
625 by @ref gethref() Href opened).
627 wxString
GetTarget();