UGrayFillAdorner.cp

//  Copyright © 1991-92 Apple Computer, Inc. All rights reserved.
//  UGrayfillAdorner.cp
//  Kent Sandvik DTS
//  This file is used for specifying the TGrayFill member functions,
//  i.e. drawing gray in the views in forms of an adorner.
//
//  <1>     khs     1.0     First final version
 
 
#ifndef __UGRAYFILLADORNER__
#include "UGrayfillAdorner.h"
#endif
 
//  Globals
// Setup the KS-look&feel gray global
CRGBColor gKSRGBGray(36000,
                     40500,
                     37500);
 
 
//  Empty constructor - for avoiding ptabs in global data space
 
#undef Inherited
#define Inherited TAdorner
 
#pragma segment ARes
DefineClass(TGrayFill, TAdorner);
 
TGrayFill::TGrayFill()
{
}
 
 
//  Draw TGrayFill Adorner method
#pragma segment ARes
void TGrayFill::Draw(TView* itsView,
                            const VRect&        /*area*/)
{
    CRGBColor saveColor;
    PenState savePenState;
    VRect adornArea;
    CRect QDArea;
    CRect tempRect;
 
    // save off the current pen state and the foreground color
    GetPenState(&savePenState);
    GetIfColor(saveColor);
    PenNormal();
 
    // get area
    itsView->GetAdornExtent(adornArea);
    itsView->ViewToQDRect(adornArea, QDArea);
    tempRect = QDArea;
 
    // colorize it
    SetIfColor(gKSRGBGray);
    PaintRect(tempRect);
 
    // restore the foreground color and the pen
    SetIfColor(saveColor);
    SetPenState(&savePenState);
}