Internal data structure. It represents fragments of parsed HTML page, the so-called cell – a word, picture, table, horizontal line and so on. It is used by HtmlWindow and HtmlWinParser to represent HTML page in memory.
You can divide cells into two groups : visible cells with non-zero width and height and helper cells (usually with zero width and height) that perform special actions such as color or font change.
Cells Overview, HtmlContainerCell
Boolean adjust_pagebreak(Integer pagebreak)
This method is used to adjust pagebreak position. The parameter is variable that contains y-coordinate of page break (= horizontal line that should not be crossed by words, images etc.). If this cell cannot be divided into two pieces (each one on another page) then it moves the pagebreak few pixels up.
Returns true if pagebreak was modified, false otherwise
Usage:
while (container->AdjustPagebreak(&p)) {}
draw(DC dc, Integer x, Integer y,
Integer view_y1,
Integer view_y2)
Renders the cell.
dc -> DrawText("hello", x + m_PosX, y + m_PosY)draw_invisible(DC dc, Integer x, Integer y)
This method is called instead of Draw when the cell is certainly out of the screen (and thus invisible). This is not nonsense – some tags (like HtmlColourCell or font setter) must be drawn even if they are invisible!
dc -> DrawText("hello", x + m_PosX, y + m_PosY)HtmlCell find(Integer condition, (arg-type) param)
Returns pointer to itself if this cell matches condition (or if any of the cells following in the list matches), NULL otherwise. (In other words if you call top-level container’s Find it will return pointer to the first cell that matches the condition)
It is recommended way how to obtain pointer to particular cell or to cell of some type (e.g. HtmlAnchorCell reacts on HTML_COND_ISANCHOR condition)
| HTML_COND_ISANCHOR | Finds particular anchor. param is pointer to String with name of the anchor. |
| HTML_COND_USER | User-defined conditions startfrom this number. |
Integer get_descent()
Returns descent value of the cell (m_Descent member). See explanation:
descent.bmp
HtmlCell get_first_child()
Returns pointer to the first cell in the list. You can then use child’s get_next method to obtain pointer to the next cell in list.
Note: This shouldn’t be used by the end user. If you need some way of finding particular cell in the list, try Find method instead.
Integer get_height()
Returns height of the cell (m_Height member).
String get_id()
Returns unique cell identifier if there is any, empty string otherwise.
HtmlLinkInfo get_link(Integer x = 0, Integer y = 0)
Returns hypertext link if associated with this cell or NULL otherwise. See HtmlLinkInfo. (Note: this makes sense only for visible tags).
HtmlCell get_next()
Returns pointer to the next cell in list (see htmlcell.h if you’re interested in details).
HtmlContainerCell get_parent()
Returns pointer to parent container.
Integer get_pos_x()
Returns X position within parent (the value is relative to parent’s upper left corner). The returned value is meaningful only if parent’s Layout was called before!
Integer get_pos_y()
Returns Y position within parent (the value is relative to parent’s upper left corner). The returned value is meaningful only if parent’s Layout was called before!
Integer get_width()
Returns width of the cell (m_Width member).
layout(Integer w)
This method performs two actions:
It must be called before displaying cells structure because m_PosX and m_PosY are undefined (or invalid) before calling Layout.
on_mouse_click(Window parent, Integer x, Integer y,
MouseEvent event)
This function is simple event handler. Each time the user clicks mouse button over a cell within HtmlWindow this method of that cell is called. Default behavior is that it calls HtmlWindow#load_page.
If you need more “advanced” event handling you should use HtmlBinderCell instead.
set_id(String id)
Sets unique cell identifier. Default value is no identifier, i.e. empty string.
set_link(HtmlLinkInfo link)
Sets the hypertext link associated with this cell. (Default value is HtmlLinkInfo(””, ””) (no link))
set_next(HtmlCell cell)
Sets the next cell in the list. This shouldn’t be called by user – it is to be used only by HtmlContainerCell#insert_cell.
set_parent(HtmlContainerCell p)
Sets parent container of this cell. This is called from HtmlContainerCell#insert_cell.
set_pos(Integer x, Integer y)
Sets the cell’s position within parent container.
[This page automatically generated from the Textile source at Thu Aug 28 20:29:11 +0100 2008]