|
htmlTableCaption
Table caption class | [Previous] [Main] [Next] |
| htmlCaption encapsulates the <CAPTION></CAPTION> tags. It is used to create captions within tables.
| |
|
| |
| The alignment option in the constructor controls placement of the caption within the table:
| |
|
|
| |
| #include <dcmicro/htmlpp/caption.h>
| |
|
| |
| |
|
| |
| htmlTable, htmlTableRow, htmlTableCell
| |
|
| |
| typedef enum {
| |
| valign_default = 0,
| |
| valign_top = align_justify + 1,
| |
| valign_middle,
| |
| valign_bottom,
| |
| valign_baseline
| |
| } VerticalAlignment ;
| |
|
| |
| htmlTableCaption( VerticalAlignment v_align = valign_default )
| |
| Constructs an empty table caption using the specified alignment.
| |
|
| |
| htmlTableCaption( | const htmlObject& element,
| |
| VerticalAlignment v_align = valign_default )
| ||
| Constructs a table caption object from element, using the specified alignment.
| |
|
| |
| htmlTableCaption( | const String& text,
| |
| VerticalAlignment v_align = valign_default )
| ||
| Constructs a table caption object from text, using the specified alignment.
| |
|
| |
| htmlTableCaption( const htmlTableCaption& rhs )
| |
| Copy constructor.
| |
|
| |
| virtual ~htmlTableCaption()
| |
| Destroys the object.
| |
|
| |
| 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>
| |
|
| |
| // Define a structure to hold data
| |
| // about each employee.
| |
| typedef struct {
| |
| char * name ;
| |
| char * phone ;
| |
| char * city ;
| |
| } EmployeeInfo, * PEmployeeInfo ;
| |
|
| |
| // Create an array of all employees
| |
| EmployeeInfo Employee_Table[] = {
| |
| { "John Smith", "245-7748", "Lexington" },
| |
| { "Larry Jenkins", "233-4456", "Lexington" },
| |
| { "Susan Wall", "294-3345", "Georgetown" }
| |
| } ;
| |
|
| |
| int main( void )
| |
| {
| |
| htmlCgi server ;
| |
| htmlPage page( "html++ example application" ) ;
| |
|
| |
| // Create a table object with a caption
| |
| htmlTableCaption caption( "Employee Information" ) ;
| |
| htmlTable table( caption ) ;
| |
|
| |
| // Set the table width to 80% of the display
| |
| table.Width( "80%" ) ;
| |
|
| |
| // Use a border two pixels wide
| |
| table.Border( 2 ) ;
| |
|
| |
| // Loop for each element in the array
| |
| for ( int i = 0 ;
| |
| i < NUMBER_OF_ELEMENTS(Employee_Table) ;
| |
| i++ )
| |
| {
| |
| // Create a pointer to the particular
| |
| // array element for easier access.
| |
| PEmployeeInfo emp = &Employee_Table[i] ;
| |
|
| |
| // Create a row object, specifying that
| |
| // the cells in this row will be centered.
| |
| htmlTableRow row ;
| |
| row.Align( align_center ) ;
| |
|
| |
| // Add each member of the array in a
| |
| // separate cell.
| |
| row << htmlTableCell( emp->name )
| |
| << htmlTableCell( emp->phone )
| |
| << htmlTableCell( emp->city ) ;
| |
|
| |
| // Add the new row to the table.
| |
| table << row ;
| |
| }
| |
|
| |
| // Add the newly constructed table to the page
| |
| page << table ;
| |
|
| |
| server << page ;
| |
| return 0 ;
| |
| }
| |
|
| |
|
| |
| Content-Type: text/html
| |
| <HTML>
| |
| <HEAD>
| |
| <TITLE>html++ example application</TITLE>
| |
| </HEAD>
| |
| <BODY>
| |
| <TABLE WIDTH="80%" BORDER="2">
| |
| <CAPTION>Employee Information</CAPTION>
| |
| <TR ALIGN="CENTER"><TD>John Smith</TD>
| |
| <TD>245-7748</TD>
| |
| <TD>Lexington</TD>
| |
| </TR>
| |
| <TR ALIGN="CENTER"><TD>Larry Jenkins</TD>
| |
| <TD>233-4456</TD>
| |
| <TD>Lexington</TD>
| |
| </TR>
| |
| <TR ALIGN="CENTER"><TD>Susan Wall</TD>
| |
| <TD>294-3345</TD>
| |
| <TD>Georgetown</TD>
| |
| </TR>
| |
| </TABLE>
| |
| </BODY>
| |
| </HTML>
| |
|
| |
| |
