htmlArea
Image map area class
[Previous] [Main] [Next]


Description
htmlArea encapsulates the <AREA> tag, and is used to identify an area within an image map associated with a particular URL. Image maps are created using the htmlImageMap class. htmlArea objects are intended to be added to htmlImageMap objects using the << insertion operator or Add() method. They can also be added directly to htmlImage objects.  
 
Declaration
#include <dcmicro/htmlpp/area.h>  
 
Hierarchy
htmlarea.gif  

See Also
htmlImageMap  
 
Related Constants/Definitions
ShapeType  
 
Constructors
htmlArea()  
Constructs an empty area object.  
 
htmlArea(const String& url,  
   ShapeType shape_type,  
   const String& coordinates )  
Constructs an area object of the specified shape_type and coordinates, referencing the document location url. coordinates must be a string of comma-separated integer coordinates definding the shape. Refer to the Coordinates() method for additional details.  
 
htmlArea(const String& url,  
   const String& target_window,  
   ShapeType shape_type,  
   const String& coordinates )  
Constructs an area object of the specified shape_type and coordinates, referencing the document location url. If the area is selected by the user, the document will be displayed in the specified target_window. coordinates must be a string of comma-separated integer coordinates definding the shape. Refer to the Coordinates() method for additional details.  
 
htmlArea( const htmlArea& rhs )  
Copy constructor.  
 
Destructor
virtual ~htmlArea()  
Destroys the object.  
 
Member Methods
URL   htmlArea& URL( const String& url )  
Set the URL to invoke when the user clicks the area to url, then returns a reference to the object.  
 
URL   String URL() const  
Returns the URL that will be invoked when the user clicks the area, or an empty string if not set.  
 
ShapehtmlArea& Shape( ShapeType shape_type )  
Defines the shape described by the coordinates for the area to shape_type, and returns a reference to the object.  
 
ShapeShapeType Shape() const  
Returns the shape type of the area, or shape_rectangle if not set.  
 
CoordinateshtmlArea& Coordinates( const String& coordinates )  
Sets the coordinates defining the shape to coordinates, and returns a reference to the object. coordinates is a string of comma-separated x,y coordinate pairs. The number of x,y pairs in the string is dependent upon the shape of the area being defined:  
  • shape_circle The coordinates must have the form "x,y,r", where x and y are coordinates of the center of the circle, and r is the length of the radius.
  • shape_rectangle The coordinates must have the form "x1,y1, x2,y2", where x1,y1 are the coordinates of the upper left corner and x2,y2 are the coordinates of the lower left corner.
  • shape_polygon The coordinates must have the form "x1,y1, x2,y2 ... xn,yn", where each x,y pair is a point where two sides of the polygon meet. A polygon may have up to 100 sides.
 
CoordinatesString Coordinates() const  
Returns the coordinates defining the area as a string, or an empty string if not set.  
 
TargethtmlArea& Target( const String& target_window )  
Sets the frame or window into which the destination url document is loaded to target_window. If the named window is not already open, a new window with that name opens. See Target Windows for additional details.  
 
TargetString Coordinates() const  
Returns the coordinates defining the area as a string, or an empty string if not set.  
 
NamehtmlArea& Name( const String& area_name )  
Sets the JavaScript-accessible name of the area to area_name, and returns a reference to the object.  
 
NameString Name() const  
Returns the name of the area, or an empty string if not set.  
 
Print   void Print( ostream& os ) const  
Outputs the object to os.  
 
ClonehtmlObject FAR * Clone() const  
Returns a base-class pointer to a deep copy of the object.  
 
Example Use
 
#include <stdio.h>  
#include <stdlib.h>  
#include <dcmicro/htmlpp/htmlpp.h>  
 
int main( void )  
{  
   htmlCgi    server ;  
   htmlPage   page( "html++ example application" ) ;  
 
   server << page ;  
   return 0 ;  
}  
 
Program Output
 
Content-Type: text/html  
<HTML>  
<HEAD>  
<TITLE>html++ example application</TITLE>  
</HEAD>  
<BODY>  
</BODY>  
</HTML>  
 
 


©1998 DC Micro Development. All rights reserved.
No portion of this document may be c opied or reproduced without expressed written consent.
html++ is a trademark of DC Micro Development.