home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-06-19 | 3.5 KB | 103 lines | [TEXT/CWIE] |
- //
- // UGrayscaleAppearance.h
- //
- // Utilities for supporting the Apple Grayscale Appearance for System 7.5
- //
- // Note: The Attachments can't paint to the edges of dialogs.
- // For dialogs, use ResEdit to set the Content Color of the WIND's wctb
- // to ga_Background = { 56797, 56797, 56797 }
- //
- // Note: Most references to ga_2 or ga_Background might be ignored since
- // the background will usually have been erased.
- //
- //
- // Copyright © 1996 by James Jennings. All rights reserved.
- //
-
- #pragma once
-
- class UGrayscaleAppearance {
- // really just a namespace for our basic utilities.
- public:
- typedef enum {
- ga_White = 0xF,
- ga_1 = 0xE,
- ga_2 = 0xD,
- ga_3 = 0xC,
- ga_4 = 0xB,
- ga_5 = 0xA,
- ga_6 = 0x9,
- ga_7 = 0x8,
- ga_8 = 0x7,
- ga_9 = 0x6,
- ga_10 = 0x5,
- ga_11 = 0x4,
- ga_12 = 0x2,
- ga_Black = 0x0,
- ga_Hilite = ga_White,
- ga_Background = ga_2,
- ga_Shadow = ga_6
- } EGAColor;
- static void GetColor( EGAColor in, RGBColor & out )
- { out.red = out.green = out.blue = in * 0x1111; }
- static void SetForeColor( EGAColor in )
- { RGBColor c; GetColor( in, c ); ::RGBForeColor( &c ); }
- static void SetBackColor( EGAColor in )
- { RGBColor c; GetColor( in, c ); ::RGBBackColor( &c ); }
-
- static void PaintRect( Rect &inFrame, EGAColor inFill )
- { SetForeColor( inFill ); ::PaintRect( &inFrame ); }
- static void EraseRect( Rect &inFrame, EGAColor inFill = ga_Background )
- { SetBackColor( inFill ); ::EraseRect( &inFrame ); }
- static void FrameRect( const Rect &inFrame,
- EGAColor inTopLeft, EGAColor inBottomRight, EGAColor inCorners);
-
- static void PrimaryGroupRect( Rect inFrame, EGAColor inTopLeft, EGAColor inBottomRight );
-
- static void PrimaryActiveGroupRect( const Rect &inFrame )
- { PrimaryGroupRect( inFrame, ga_7, ga_White ); }
- static void PrimaryInactiveGroupRect( const Rect &inFrame ) // note: text should be ga_7
- { PrimaryGroupRect( inFrame, ga_4, ga_1 ); }
- static void SecondaryActiveGroupRect( const Rect &inFrame )
- { FrameRect( inFrame, ga_7, ga_White, ga_Background ); }
- static void SecondaryInactiveGroupRect( const Rect &inFrame )// note: text should be ga_7
- { FrameRect( inFrame, ga_4, ga_1, ga_Background ); }
- };
-
- // A base class for all Grayscale Appearance attachments.
- // ExecuteSelf() determines the kind of device, and calls one of the Draw... methods.
- // Sub-classes override the draw methods.
- class CGABaseAttachment : public LAttachment, public UGrayscaleAppearance {
- protected:
- CGABaseAttachment() : LAttachment( msg_DrawOrPrint ) {}
- public:
- virtual void ExecuteSelf(
- MessageT inMessage,
- void *ioParam);
- virtual void DrawColor( Rect &inFrame ) {}
- virtual void DrawBlackAndWhite( Rect &inFrame ) {}
- protected:
- virtual void AdjustClipRect( Rect &inRect ) { ::InsetRect( &inRect, -1, -1 ); }
- };
-
- // An attachment that adds a Grayscale Appearance to a basic pane.
- // (Background fill, convex bevel)
- class CGAPaneAttachment : public CGABaseAttachment {
- public:
- virtual void DrawColor( Rect &inFrame );
- };
-
- // An attachment that adds the Grayscale Appearance of a movable modal dialog box.
- // (Background fill, 2 pixel convex bevel, no black outline)
- class CGADeepPaneAttachment : public CGABaseAttachment {
- public:
- virtual void DrawColor( Rect &inFrame );
- };
-
- // An attachment that adds a Grayscale Appearance to things like LEditField.
- // (No fill, concave bevel)
- class CGATextFieldAttachment : public CGABaseAttachment {
- public:
- virtual void DrawColor( Rect &inFrame );
- };
-