Adding Shadows to a Window

Adding shadows to a window gives depth to the flat video display. Shadows are useful for giving the user an indication of what window is the active or top window when several windows are on the screen at once. Figure 25.2 shows a window with a shadow.


Figure 25.2: Example of a Window with Shadows

Designer: You can add shadows to your windows with the Designer. You can also add shadows to Designer windows in your code, by calling the functions described below.

Code: To add shadows to a window, call the set window shadow function sw_shad():

int sw_shad(fill_ch, att, location, wnp)
 
UCHAR fill_ch;
/* Character to use to draw shadows
*/
UCHAR att;
/* Color to make shadow
*/
UINT location;
/* Location of shadows
*/
WINDOWPTR wnp;
/* Pointer to window to add shadows to
*/

For fill_ch, you can specify to create transparent shadows. Transparent shadows allow characters covered by the shadow to show through by changing their attribute. Otherwise, specify the character you want to use to draw the shadows.

Under PCDOS, you can use the graphics blocks to achieve different effects. The following characters are defined for your convenience:

CH_LIGHTSHADE
CH_MEDSHADE
CH_DARKSHADE
CH_BLOCK
CH_BOTBLOCK
CH_TOPBLOCK
CH_LFTBLOCK

CH_RTBLOCK

For att, specify the color that you want to make the shadows. The logical attribute LSHADOW has been pre-defined to use for shadows.

For location, specify the two sides that you want the shadows to appear, either:

TOPLEFT

TOPRIGHT

BOTTOMLEFT

BOTTOMRIGHT

The call that created the shadow in Figure 25.2 is as follows:

sw_shad(CH_MEDSHADE, LREVERSE, BOTTOMRIGHT, wnp);

More:

Creating Custom Shadows

Displaying and Removing Shadows from the Screen

Removing Shadows from a Window


Home Contents Previous Next