Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages | Examples

Visibility.cpp

#include "whiptk/whip_toolkit.h"

extern WT_File whip_file; //Assume this has been opened for writing elsewhere.

WT_Result Visibility()
{
    //Store the current visibility and color.
    WT_Boolean previous_visibility = whip_file.desired_rendition().visibility().visible();
    WT_Color previous_color = whip_file.desired_rendition().color();
    //Define a polygon to be used as an invisible link target.
    int x=0,y=0;
    WT_Logical_Point vP[4];
    vP[0] = WT_Logical_Point(x-100,y-100);
    vP[1] = WT_Logical_Point(x-100,y+100);
    vP[2] = WT_Logical_Point(x+100,y+100);
    vP[3] = WT_Logical_Point(x+100,y-100);
    WT_Polygon polygon(4, vP, WD_True);

    //Set the current visibility to off, and the color to transparent black.
    whip_file.desired_rendition().visibility() = WD_False;
    whip_file.desired_rendition().color() = WT_Color(0,0,0,0);
    //Add a hyperlink and serialize the invisible polygon.
    WT_URL_Item  url(0, "http://www.autodesk.com/viewers", "Autodesk Viewers Page");
    whip_file.desired_rendition().url().add_url_optimized(url, whip_file);
    WD_CHECK(polygon.serialize(whip_file));
    whip_file.desired_rendition().url().clear();

    //Draw something on top of the invisible polygon.
    //Set the visibility and color back.
    whip_file.desired_rendition().visibility() = previous_visibility;
    whip_file.desired_rendition().color() = previous_color;
    //Create a text object.
    WT_Text text(WT_Logical_Point(x-10, y), WT_String("CLICK"));
    WD_CHECK(text.serialize(whip_file));

    return WT_Result::Success;
}

Generated on Mon May 9 23:00:10 2005 for Autodesk DWF Whip 2D Toolkit by  doxygen 1.4.1