htmlImageMap
Client-side image map class
[Previous] [Main] [Next]


Description
htmlImageMap encapsulates the <MAP></MAP> tags, and is used to define information about active areas within an image. An image map divides a graphic image into multiple areas, each one referencing a different URL. When a user clicks on a specific area in the image, the web browser will use the image map to determine which URL should will be loaded and displayed.  
 
There are two kinds of image maps: server-side and client-side. Server-side image maps use mapping information stored in a file residing on the server.  
 
Client-side image maps use mapping information (the image map) stored in the HTML document containing the image. An image map may contain one or more htmlArea objects, each describing a different area in the image and the URL it references. htmlArea objects are added to htmlImageMap objects using the Add() method or << insertion operator.  
 
htmlImageMap objects may be inserted anywhere within a document. You must associate images with image maps by name using the htmlImage::UseMap() method. Alternatively, you may bypass use of the UseMap() method by adding htmlImageMap objects to an htmlImage object directly via the << insertion operator or the Add() method. In such cases, you do not need to name the image map nor do you have to explicitly add it to the page in which the image appears.  
 
To use an image map, create an image object using htmlImage. The htmlImage::UseMap() method is used to specify the image map:  
1) as a location and/or name of a MAP tag in a document, or  
2) as a name of an htmlImageMap object  
3) as an htmlImageMap object  
 
Declaration
#include <dcmicro/htmlpp/imagemap.h>  
 
Hierarchy
htmlimagemap.gif  
 
See Also
htmlImage, htmlArea  
 
Related Constants/Definitions
None.  
 
Constructors
htmlImageMap()  
Constructs an empty image map object.  
 
htmlImageMap( const String& name )  
Constructs an empty image map object, assigning it the specified name.  
 
htmlImageMap( const htmlImageMap& rhs )  
Copy constructor.  
 
Destructor
virtual ~htmlImageMap()  
Destroys the object.  
 
Member Methods
<<   htmlImageMap& operator<< ( const htmlArea& area )  
Adds the area object to the map and returns a reference to the map object.  
 
Add   htmlObject FAR * Add( const htmlArea& area )  
Adds area to the map, returning a pointer to the new object.  
 
NamehtmlImageMap& Name( const String& name )  
Sets the map name to name, and returns a reference to the object.  
 
NameString Name() const  
Returns the map name as a string, or an empty string if not set.  
 
ClonehtmlObject FAR * Clone() const  
Returns a base-class pointer to a deep copy of the object.  
 
Print   void Print( ostream& os ) const  
Outputs the object to os.  
 
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.