# wx.html.HtmlContainerCell¶

The wx.html.HtmlContainerCell class is an implementation of a cell that may contain more cells in it.

It is heavily used in the HTML layout algorithm.

## Class Hierarchy¶

Inheritance diagram for class HtmlContainerCell:

## Methods Summary¶

 __init__ Constructor. Detach Detach a child cell. GetAlignHor Returns container’s horizontal alignment. GetAlignVer Returns container’s vertical alignment. GetBackgroundColour Returns the background colour of the container or NullColour if no background colour is set. GetIndent Returns the indentation. GetIndentUnits Returns the units of indentation for ind where ind is one of the HTML_INDENT_ constants. InsertCell Inserts a new cell into the container. SetAlign Sets the container’s alignment (both horizontal and vertical) according to the values stored in tag. SetAlignHor Sets the container’s horizontal alignment. SetAlignVer Sets the container’s vertical alignment. SetBackgroundColour Sets the background colour for this container. SetBorder Sets the border (frame) colours. SetIndent Sets the indentation (free space between borders of container and subcells). SetMinHeight Sets minimal height of the container. SetWidthFloat Sets floating width adjustment.

## Class API¶

class wx.html.HtmlContainerCell(HtmlCell)

Possible constructors:

HtmlContainerCell(parent)


The HtmlContainerCell class is an implementation of a cell that may contain more cells in it.

### Methods¶

__init__(self, parent)

Constructor.

parent is pointer to parent container or None.

Parameters

parent (wx.html.HtmlContainerCell) –

Detach(self, cell)

Detach a child cell.

Detaching a cell removes it from this container and allows reattaching it to another one by using InsertCell . Alternatively, this method can be used to selectively remove some elements of the HTML document tree by deleting the cell after calling it.

Parameters

cell (wx.html.HtmlCell) – Must be non-null and an immediate child of this cell.

New in version 4.1/wxWidgets-3.1.2.

GetAlignHor(self)

Returns container’s horizontal alignment.

Return type

int

GetAlignVer(self)

Returns container’s vertical alignment.

Return type

int

GetBackgroundColour(self)

Returns the background colour of the container or NullColour if no background colour is set.

Return type

Colour

GetIndent(self, ind)

Returns the indentation.

ind is one of the HTML_INDENT_ constants.

Parameters

ind (int) –

Return type

int

Note

You must call GetIndentUnits with same ind parameter in order to correctly interpret the returned integer value. It is NOT always in pixels!

GetIndentUnits(self, ind)

Returns the units of indentation for ind where ind is one of the HTML_INDENT_ constants.

Parameters

ind (int) –

Return type

int

InsertCell(self, cell)

Inserts a new cell into the container.

Note that the container takes ownership of the cell and will delete it when it itself is destroyed.

Parameters

cell (wx.html.HtmlCell) –

SetAlign(self, tag)

Sets the container’s alignment (both horizontal and vertical) according to the values stored in tag.

(Tags ALIGN parameter is extracted.) In fact it is only a front-end to SetAlignHor and SetAlignVer .

Parameters

tag (wx.html.HtmlTag) –

SetAlignHor(self, al)

Sets the container’s horizontal alignment.

During wx.html.HtmlCell.Layout each line is aligned according to al value.

Parameters

al (int) – new horizontal alignment. May be one of these values:

• wx.html.HTML_ALIGN_LEFT: lines are left-aligned (default)

• wx.html.HTML_ALIGN_JUSTIFY: lines are justified

• wx.html.HTML_ALIGN_CENTER: lines are centered

• wx.html.HTML_ALIGN_RIGHT: lines are right-aligned

SetAlignVer(self, al)

Sets the container’s vertical alignment.

This is per-line alignment!

Parameters

al (int) – new vertical alignment. May be one of these values:

• wx.html.HTML_ALIGN_BOTTOM: cells are over the line (default)

• wx.html.HTML_ALIGN_CENTER: cells are centered on line

• wx.html.HTML_ALIGN_TOP: cells are under the line

SetBackgroundColour(self, clr)

Sets the background colour for this container.

Parameters

clr (wx.Colour) –

SetBorder(self, clr1, clr2, border=1)

Sets the border (frame) colours.

A border is a rectangle around the container.

Parameters
• clr1 (wx.Colour) – Colour of top and left lines

• clr2 (wx.Colour) – Colour of bottom and right lines

• border (int) – Size of the border in pixels

SetIndent(self, i, what, units=HTML_UNITS_PIXELS)

Sets the indentation (free space between borders of container and subcells).

Parameters
• i (int) – Indentation value.

• what (int) – Determines which of the four borders we’re setting. It is wx.OR combination of following constants:

• wx.html.HTML_INDENT_TOP: top border

• wx.html.HTML_INDENT_BOTTOM: bottom

• wx.html.HTML_INDENT_LEFT: left

• wx.html.HTML_INDENT_RIGHT: right

• wx.html.HTML_INDENT_HORIZONTAL: left and right

• wx.html.HTML_INDENT_VERTICAL: top and bottom

• wx.html.HTML_INDENT_ALL: all 4 borders

• units (int) – Units of i. This parameter affects interpretation of value.

• wx.html.HTML_UNITS_PIXELS: i is number of pixels

• wx.html.HTML_UNITS_PERCENT: i is interpreted as percents of width of parent container

SetMinHeight(self, h, align=HTML_ALIGN_TOP)

Sets minimal height of the container.

When container’s wx.html.HtmlCell.Layout is called, m_Height is set depending on layout of subcells to the height of area covered by layed-out subcells. Calling this method guarantees you that the height of container is never smaller than h - even if the subcells cover much smaller area.

Parameters
• h (int) – The minimal height.

• align (int) – If height of the container is lower than the minimum height, empty space must be inserted somewhere in order to ensure minimal height. This parameter is one of HTML_ALIGN_TOP , HTML_ALIGN_BOTTOM , HTML_ALIGN_CENTER . It refers to the contents, not to the empty place.

SetWidthFloat(self, *args, **kw)

SetWidthFloat (self, w, units)

The normal behaviour of container is that its width is the same as the width of parent container (and thus you can have only one sub-container per line). You can change this by setting the floating width adjustment.

Parameters
• w (int) – Width of the container. If the value is negative it means complement to full width of parent container. E.g.:

SetWidthFloat(-50, wx.html.HTML_UNITS_PIXELS)


sets the width of container to parent’s width minus 50 pixels. This is useful when creating tables - you can call SetWidthFloat(50) and SetWidthFloat(-50).

• units (int) – Units of w This parameter affects the interpretation of value.

• wx.html.HTML_UNITS_PIXELS: w is number of pixels

• wx.html.HTML_UNITS_PERCENT: w is interpreted as percents of width of parent container

SetWidthFloat (self, tag, pixel_scale=1.0)

The normal behaviour of container is that its width is the same as the width of parent container (and thus you can have only one sub-container per line). You can change this by setting the floating width adjustment.

Parameters
• tag (wx.html.HtmlTag) – In the second version of method, w and units info is extracted from tag’s WIDTH parameter.

• pixel_scale (float) – This is number of real pixels that equals to 1 HTML pixel.

### Properties¶

AlignHor

AlignVer

BackgroundColour