|
htmlHeading
Section heading class | [Previous] [Main] [Next] |
| htmlHeading encapsulates the <H1></H1> series of tags. Headings are useful to organize text into topics and subtopics.
| |
|
| |
| There are six levels (sizes) of headings in the HTML specification, numbered one through six. Level 1 headings are rendered in the browser's largest font, while level 6 headings are rendered in the smallest font. Paragraph breaks are also placed before and after headings.
| |
|
| |
| HTML 3.0 defines allows alignment of headings, supported by the Align() method or constructor arguments. Alignment may not supported by all browsers.
| |
|
| |
| #include <dcmicro/htmlpp/heading.h>
| |
|
| |
| |
|
| |
| None.
| |
|
| |
| typedef enum {
| |
| align_default = 0,
| |
| align_left,
| |
| align_center,
| |
| align_right,
| |
| align_justify
| |
| } Alignment ;
| |
|
| |
| htmlHeading( int level = 1 )
| |
| Constructs an empty heading object using level as the specified size. level may range from 1 (largest) to 6 (smallest).
| |
|
| |
| htmlHeading( | int level,
| |
| const htmlObject& element,
| ||
| Alignment align = align_default )
| ||
| Constructs a heading object of the specified size and horizontal alignment, inserting element into it.
| |
|
| |
| htmlHeading( | int level,
| |
| const String& text,
| ||
| Alignment align = align_default )
| ||
| Constructs a heading object of the specified size and horizontal alignment, inserting text into it.
| |
|
| |
| htmlHeading( const htmlHead& rhs )
| |
| Copy constructor.
| |
|
| |
| virtual ~htmlHeading()
| |
| Destroys the object.
| |
|
| |
| = | htmlHeading& operator= ( const htmlHeading& rhs )
| |
| Replaces the contents with rhs and returns a pointer to the object.
| |
|
| |
| = | htmlHeading& operator= ( const String& text )
| |
| Replaces the contents with text and returns a pointer to the object.
| |
|
| |
| Level | htmlHeading& Level( int level )
| |
| Sets the heading size to level, which may vary from 1 (largest font) to 6 (smallest font), then returns a reference to the object.
| |
|
| |
| Level | int Level() const
| |
| Returns the level setting for the heading.
| |
|
| |
| Align | htmlHeading& Align( Alignment align )
| |
| Set the horizontal alignment for the heading to align, and returns a reference to the object.
| |
|
| |
| Align | int Align() const
| |
| Returns the horizontal alignment setting for the heading as an integer.
| |
|
| |
| void Print( ostream& os ) const
| ||
| Outputs the object to os.
| |
|
| |
| Clone | htmlObject FAR * Clone() const
| |
| Returns a base-class pointer to a deep copy of the object.
| |
|
| |
|
| |
| #include <stdio.h>
| |
| #include <stdlib.h>
| |
| #include <dcmicro/htmlpp/htmlpp.h>
| |
|
| |
| int main( void )
| |
| {
| |
| htmlCgi server ;
| |
| htmlPage page( "html++ example application" ) ;
| |
|
| |
| int level ;
| |
| for ( level = 1 ; level <= 6 ; level++ )
| |
| {
| |
| page << htmlHeading( level,
| |
| "Level " + String(level),
| |
| align_center ) ;
| |
| }
| |
|
| |
| server << page ;
| |
| return 0 ;
| |
| }
| |
|
| |
|
| |
| Content-Type: text/html
| |
| <HTML>
| |
| <HEAD>
| |
| <TITLE>html++ example application</TITLE>
| |
| </HEAD>
| |
| <BODY>
| |
| <H1 ALIGN="CENTER">Level 1</H1>
| |
| <H2 ALIGN="CENTER">Level 2</H2>
| |
| <H3 ALIGN="CENTER">Level 3</H3>
| |
| <H4 ALIGN="CENTER">Level 4</H4>
| |
| <H5 ALIGN="CENTER">Level 5</H5>
| |
| <H6 ALIGN="CENTER">Level 6</H6>
| |
| </BODY>
| |
| </HTML>
| |
|
| |
| |
