os_heading


A heading.

An os_heading is a section heading. Web<ToolKit> supports six levels of headings ranging between 1 and 6. The heading level is specified in the constructor. If a heading level less than 1 is specified, the level is set to 1. If a heading level greater than 6 is specified, the level is set to 6.

An os_heading is rendered according to its level. Typical renderings for each level are described in the following table.
 
Level Rendering

1

Bold, very large font, centered with one or two blank lines above and below.

2

Bold, large font, flush with left margin, with one or two blank lines above and below.

3

Italic, large font, slightly indented from left margin, with one or two blank lines above and below.

4

Bold, normal font, indented more than level 3, with one blank line above and below.

5

Italic, normal font, indented the same as level 4, with one blank line above.

6

Bold, indented same as normal text, more than level 5, with one blank line above.

The default alignment of an os_heading can be overridden by specifying an alignment in a constructor or through the align() member function. Note that the alignment specification supports a feature proposed for HTML 3.0 and may not be supported by all browsers.

Declaration

#include <ospace/web/heading.h>
class os_heading : public os_element_group

Enums

enum os_heading::alignment
  {
  left,    // Aligns the heading against the left margin.
  center,  // Centers the heading between the left and right margins.
  right,   // Aligns the heading against the right margin.
  justify  // Justifies the heading between the left and right margins, falling back to left alignment if the heading is too short.
  };
	

Interface

Constructor
os_heading( int level )
Constructs an empty heading of level level .
Constructor
os_heading( int level , const os_element& element )
Constructs a heading of level level containing a copy of element .
Constructor
os_heading( int level , const os_element& element , alignment
align )
Constructs a heading of level level , with alignment align , containing a copy of element .
Constructor
os_heading( _int level , const string& text )
Constructs a heading of level level containing an os_text element created from text .
Constructor
os_heading( int level , const string& text , alignment align )
Constructs a heading of level level , with alignment align , containing an os_text element created from text .
align
os_heading& align ( alignment align )
Sets the alignment to align and returns a reference to the heading.
align
int align() const
Returns the alignment, or os_element::use_default if not set.
clone
/* virtual */ os_element* clone() const
Returns a base class pointer to a heap-based deep copy of the heading.
print
/* virtual */ void print( ostream& os ) const
Prints the heading to os .
level
int level() const
Returns the level.

Copyright©1994-2026 Recursion Software LLC
All Rights Reserved