htmlPlugIn
Embedded plug-in class
[Previous] [Main] [Next]


Description
htmlPlugIn encapsultes the <EMBED> tag. It is used to display output from a plug-in application. The output is displayed as part of the HTML document in a rectangular area of the page. This attribute first appeared in Netscape Navigator 2.0, and is not supported by all browsers.  
 
A plug-in is a small application that acts as an extension to the browser. When loaded, an embedded plug-in is displayed as part of the HTML document in a rectangular region of the page, similar to the way of GIF image is embedded, except that the plug-in is a real application and can repond to user events. Numerous plug-in's are available from various software vendors, and can be used to add sophisticated features, such as audio and video streaming, to web sites.  
 
The htmlPlugIn class contains a htmlNoEmbed object as an internal member variable. The NoEmbed() method is used to access the object, and can be used provide content for display by browsers that cannot display plug-in's. If the browser can display plug-in's, any content specified using the NoEmbed() method will be ignored. If preferred, you can also manually add htmlNoEmbed objects to any page instead of using htmlPlugIn::NoEmbed().  
 
The Source() method specifies the file to run. The MimeType() method specifies the MIME type of the plug-in needed to run the file. The browser will use either the suffix of the source filename or type to determine which plug-in to use. You must use either the Source() or the MimeType() method.  
 
If the appropriate plug-in is installed on the browser, the it's embedded contents are automatically displayed. If the plug-in is not installed on the browser, the browser may prompt the user to install it. The HelpURL() method defines the location of a page containing instructions for installing the plug-in, should the browser decide installation instructions must be displayed.  
 
Declaration
#include <dcmicro/htmlpp/plugin.h>  
 
Hierarchy
htmlobject.gif  
 
See Also
htmlNoEmbed, htmlApplet, htmlScript  
 
Related Constants/Definitions
typedef enum {  
   unit_default = 0,   // usually pixels on most browsers  
   unit_pixel,      // pixels  
   unit_en      // half the point size  
} UnitType ;  
 
typedef enum {  
   default_palette = 0   // browser default palette  
   background_palette,  
   foreground_palette  
} PaletteType ;  
 
Constructors
htmlPlugIn()  
Constructs an empty object.  
 
htmlPlugIn(const String& source_url,  
   const String& mime_type,  
   int width = 0,  
   int height = 0 )  
Constructs an object, using the specified source_url or mime_type, optionally including height and width dimensions (default unit is pixels). Either source_url or mime_type may be specified; the unused parameter should be an empty string (e.g., "").  
 
htmlPlugIn( const htmlPlugIn& rhs )  
Copy constructor.  
 
Destructor
virtual ~htmlPlugIn()  
Destroys the object.  
 
Member Methods
=   htmlPlugIn& operator= ( const htmlPlugIn& rhs )  
Replaces the object contents with rhs, then returns a reference to the object.  
 
SourcehtmlPlugIn& Source( const String& source_url )  
Defines the location of the plug-in data file as source_url, then returns a reference to the object. The browser will typically determine the MIME type based upon the filename suffix. If Source() is not specified, the MimeType() method must be used instead.  
 
SourceString Source() const  
Returns the source URL of the location of the plug-in data file, or an empty string if not set.  
 
MimeTypehtmlPlugIn& MimeType( const String& mime_type )  
Sets the MIME type of the plug-in to mime_type (which the browsers uses to determine which plug-in to load) then returns a reference to the object. If MimeType() is not specified, the Source() method must be used instead.  
 
This method is typically used for plug-in's that require no data, such as a plug-in that displays a clock or obtains it's data on it's own. If the plug-in is to visible, both the Height() and Width() methods must be used to specify the display dimensions.  
 
MimeTypeString MimeType() const  
Returns the MIME type of the plug-in, or an empty string if not set.  
 
WidthhtmlPlugIn& Width( int width )  
Sets the width of the display area used by the plug-in to width, then returns a reference to the object. The units are determined by the Units() method (default is pixels). If width is a negative value, the attribute is cleared.  
 
Widthint Width() const  
Returns the width of the display area used by the plug-in, or zero if not set.  
 
HeighthtmlPlugIn& Height( int height )  
Sets the height of the display area used by the plug-in to height, then returns a reference to the object. The units are determined by the Units() method (default is pixels). If height is a negative value, the attribute is cleared.  
 
Heightint Height() const  
Returns the height of the display area used by the plug-in, or zero if not set.  
 
NoEmbedhtmlNoEmbed& NoEmbed()  
Returns a reference to the internal htmlNoEmbed object for the plug-in. You can use this method to add alternative content for display by browsers that cannot display plug-in's. If the browser can display plug-in's, any content specified will be ignored.  
 
HelpURLhtmlPlugIn& HelpURL( const String& url )  
Sets the location URL of a page containing instructions for installing the plug-in if it is not already installed on the browser, then returns a reference to the object.  
 
HelpURLString HelpURL() const  
Returns the URL containing instructions for installing the plug-in, or an empty string if not set.  
 
Align   htmlPlugIn& Align( Alignment align )  
Sets the alignment for the plug-in to align, then returns a reference to the object.  
  • align_left aligns text flush left (default)
  • align_right aligns text flush right
  • align_top aligns text to the top
  • align_bottom aligns text to the bottom
 
Align   int Align() const  
Returns the alignment for the plug-in as an integer, or align_default if not set.  
 
BorderhtmlPlugIn& Border( int border_pixels )  
Sets the border around the plug-in to border_pixels pixels, then returns a reference to the object. If border_pixels is a negative value, the attribute is cleared.  
 
Borderint Border() const  
Returns the number of pixels specified for the border around the plug-in, or zero if not set.  
 
Units htmlPlugIn& Units( UnitType unit_type )  
Defines the measurement units used by the Height() and Width() methods to unit_type, then returns a reference to the object.  
  • unit_default browser unit default (usually pixels)
  • unit_pixel pixels
  • unit_en half the point size
 
Units UnitType Units() const  
Returns the measurement units used by the Height() and Width() methods.  
 
Hide   htmlPlugIn& Hide( Boolean hide )  
Controls whether the plug-in is visible on the page and returns a reference to the object. If hide is TRUE, the plug-in will be hidden. Otherwise, the plug-in will be visible.  
 
IsHiddenBoolean IsHidden() const  
Returns TRUE if the plug-in is hidden on the page, or FALSE if it is visible.  
 
HSpacehtmlPlugIn& HSpace( int pixels )  
Sets the horizontal margin between the left and right edges of the plug-in and it's surroudings to pixels, then returns a reference to the object. If pixels is a negative value, the attribute is cleared.  
 
HSpaceint HSpace() const  
Returns the horizontal space setting in pixels, or zero if not set.  
 
VSpacehtmlPlugIn& VSpace( int pixels )  
Sets the vertical margin between the top and bottom edges of the plug-in and it's surroudings to pixels, then returns a reference to the object. If pixels is a negative value, the attribute is cleared.  
 
VSpaceint VSpace() const  
Returns the vertical space setting in pixels, or zero if not set.  
 
PalettehtmlPlugIn& Palette( PaletteType palette_type )  
Determines which palette the plug-in will use, then returns a reference to the object. Relevent only for browsers running on Windows platforms.  
  • default_palette uses the browser's default palette (usually the background)
  • background_palette makes the plug-in use the background palette
  • foreground_palette makes the plug-in use the foreground palette
 
NamehtmlPlugIn& Name( const String& name )  
Sets the name that JavaScript can use to reference the plug-in to name, then returns a reference to the object.  
 
NameString Name() const  
Returns the name of the plug-in, 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.