|
htmlListItem
List item class | [Previous] [Main] [Next] |
| htmlListItem encapsulates the <LI> tag, and is used to define itemized element in a list, which is usually preceded by a bullet, a number, or a letter.
| |
|
| |
| htmlListItem is used in conjunction with the htmlList class, which produces ordered and unordered lists. htmlListItem objects are added to htmlList objects using htmlList::Add() or htmlList::operator<<.
| |
|
| |
| #include <dcmicro/htmlpp/listitem.h>
| |
|
| |
| |
|
| |
| htmlList
| |
|
| |
| typedef enum {
| |
| number_default = 0,
| |
| number_standard_arabic, // Numbering styles
| |
| number_uppercase_letter,
| |
| number_lowercase_letter,
| |
| number_uppercase_roman,
| |
| number_lowercase_roman,
| |
| bullet_disc, // Bullet styles
| |
| bullet_circle,
| |
| bullet_square
| |
| } NumberStyle ;
| |
|
| |
| htmlListItem()
| |
| Constructs an empty list item object.
| |
|
| |
| htmlListItem( NumberStyle number_style = number_default )
| |
| Constructs an empty list item using the specified number_style.
| |
|
| |
| htmlListItem( | const htmlObject& element,
| |
| NumberStyle number_style = number_default )
| ||
| Constructs a list item from element, using the specified number_style.
| |
|
| |
| htmlListItem( | const String& text,
| |
| NumberStyle number_style = number_default )
| ||
| Constructs a list item from text, using the specified number_style.
| |
|
| |
| htmlListItem( const htmlText& rhs )
| |
| Copy constructor.
| |
|
| |
| virtual ~htmlListItem()
| |
| Destroys the object.
| |
|
| |
| = | htmlListItem& operator= ( const htmlListItem& rhs )
| |
| Replaces object contents with rhs, and returns a reference to it.
| |
|
| |
| Bullet | htmlListItem& Bullet( NumberStyle number_style )
| |
| Sets the type of symbol or numbering sequence to use for the list item to number_style, then returns a reference to the object.
| |
|
| |
| Bullet | int Bullet() const
| |
| Returns the type of symbol or numbering sequence set to use for the list item, or number_default if not set.
| |
|
| |
| Number | htmlListItem& Number( int counter_value )
| |
| Sets the counter number for the item as it will appear in an ordered list, then returns a reference to the object. This method is only applicable for for an ordered list.
| |
|
| |
| Number | int Number() const
| |
| Returns the counter number for the item, or zero if not set.
| |
|
| |
| 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" ) ;
| |
|
| |
| // Create four separate lists, each one using
| |
| // slightly different formatting options.
| |
| htmlList list1 ;
| |
| list1 << htmlListItem("One", number_standard_arabic)
| |
| << htmlListItem("Two", number_uppercase_letter)
| |
| << htmlListItem("Three", number_uppercase_roman) ;
| |
|
| |
| htmlList list2 ;
| |
| list2 << htmlListItem( "One" ).Number(10)
| |
| << htmlListItem( "Two" )
| |
| << htmlListItem( "Three" ) ;
| |
|
| |
| htmlList list3( unordered_list ) ;
| |
| list3 << htmlListItem( "One" ).Bullet( bullet_disc )
| |
| << htmlListItem( "Two" )
| |
| << htmlListItem( "Three" ) ;
| |
|
| |
| htmlList list4( unordered_list ) ;
| |
| list4 << htmlListItem( "One" ).Bullet( bullet_square )
| |
| << htmlListItem( "Two" )
| |
| << htmlListItem( "Three" ) ;
| |
|
| |
| // Create a 2x2 table to hold the four lists
| |
| htmlTable table( htmlCenter("Example use of htmlListItem") ) ;
| |
| table.CellPadding( 10 ) ;
| |
|
| |
| // Add the lists as cells in the rows of the table.
| |
| // Note how parentheses are used to create row and
| |
| // cell objects on the stack without any local
| |
| // variables.
| |
| table << ( htmlTableRow() << list1 << list3 )
| |
| << ( htmlTableRow() << list2 << list4 ) ;
| |
|
| |
| // Output the table to the page
| |
| page << table ;
| |
|
| |
| // Display the results
| |
| server << page ;
| |
| return 0 ;
| |
| }
| |
|
| |
|
| |
| Content-Type: text/html
| |
| <HTML>
| |
| <HEAD>
| |
| <TITLE>html++ example application</TITLE>
| |
| </HEAD>
| |
| <BODY>
| |
|
| |
| <TABLE CELLPADDING="10">
| |
| <CAPTION><CENTER>Example use of htmlListItem</CENTER></CAPTION>
| |
|
| |
| <TR>
| |
| <TD><OL><LI TYPE="1">One</LI>
| |
| <LI TYPE="A">Two</LI>
| |
| <LI TYPE="I">Three</LI>
| |
| </OL>
| |
| </TD>
| |
| <TD><UL><LI TYPE="DISC">One</LI>
| |
| <LI>Two</LI>
| |
| <LI>Three</LI>
| |
| </UL>
| |
| </TD>
| |
| </TR>
| |
|
| |
| <TR>
| |
| <TD><OL><LI VALUE="10">One</LI>
| |
| <LI>Two</LI>
| |
| <LI>Three</LI>
| |
| </OL>
| |
| </TD>
| |
| <TD><UL><LI TYPE="SQUARE">One</LI>
| |
| <LI>Two</LI>
| |
| <LI>Three</LI>
| |
| </UL>
| |
| </TD>
| |
| </TR>
| |
|
| |
| </TABLE>
| |
| </BODY>
| |
| </HTML>
| |
|
| |
|
| |
| |
