home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C ++ / Applications / FlyThrough 1.1.2 / src / Source / Grayscale Classes / CBevelAttachment.h < prev    next >
Encoding:
Text File  |  1997-03-19  |  2.5 KB  |  80 lines  |  [TEXT/CWIE]

  1. //
  2. //    CBevelAttachment.h
  3. //
  4. //    A Constructor-aware, PowerPlant Attachment for adding 
  5. //    an Apple Grayscale Appearance-like bevel to an LView.
  6. //
  7. //    Copyright ©1996 by James Jennings. All rights reserved.
  8. //    September 1, 1996
  9. //
  10.  
  11. #pragma once
  12.  
  13. #include "UGrayscaleAppearance.h"
  14.  
  15. // A base class for all Grayscale Appearance attachments.
  16. // ExecuteSelf() determines the kind of device, and calls one of the Draw... methods.
  17. // Sub-classes override the draw methods.
  18. class CGABaseAttachment : public LAttachment, public UGrayscaleAppearance {
  19. protected:
  20.     CGABaseAttachment() : LAttachment( msg_DrawOrPrint ) {}
  21.     CGABaseAttachment( LStream */*inStream*/ );
  22. public:
  23.     virtual void    ExecuteSelf(
  24.                             MessageT        inMessage,
  25.                             void            *ioParam);
  26.     virtual void    DrawColor( Rect /*inFrame*/ ) {}
  27.     virtual void    DrawBlackAndWhite( Rect /*inFrame*/ ) {}
  28. protected:
  29.     virtual void    AdjustClipRect( Rect &/*inRect*/ ) {}    
  30. };
  31.  
  32. // A Grayscale Appearance attachment that can be Reanimated.
  33. class CBevelAttachment : public CGABaseAttachment {
  34. public:
  35.     enum { class_ID = 'Bevl' };
  36.     static CBevelAttachment* CreateFromStream(LStream *inStream);
  37.     static    void    Register(void)
  38.         {     URegistrar::RegisterClass(class_ID, (ClassCreatorFunc) CreateFromStream);  }
  39.             
  40.         CBevelAttachment(LStream *inStream);
  41.         CBevelAttachment( Boolean inBevelIn, Int16 inWidth = 1, Boolean inErase = false );
  42.         
  43.     virtual void    DrawColor( Rect inFrame );
  44. protected:
  45.     virtual void    AdjustClipRect( Rect &inRect ) 
  46.             { if (mWidth<0) ::InsetRect( &inRect, mWidth, mWidth ); }
  47.     
  48.     Boolean mBevelIn;    // bevel goes in or out?
  49.     Int16    mWidth;        // width of the bevel (usually 1)
  50.     Boolean mErase;        // erase the center to white?
  51. };
  52.  
  53. /*
  54.  *    Some really simple attachments. Can be replaced with a CBevelAttachment.
  55.  *    (Included for backward compatibility.)
  56.  */
  57.  
  58. // An attachment that adds a Grayscale Appearance to a basic pane.
  59. // (Background fill, convex bevel)
  60. class CGAPaneAttachment : public CGABaseAttachment {
  61. public:
  62.     virtual void    DrawColor( Rect inFrame );
  63. };
  64.  
  65. // An attachment that adds the Grayscale Appearance of a movable modal dialog box.
  66. // (Background fill, 2 pixel convex bevel, no black outline)
  67. class CGADeepPaneAttachment : public CGABaseAttachment {
  68. public:
  69.     virtual void    DrawColor( Rect inFrame );
  70. };
  71.  
  72. // An attachment that adds a Grayscale Appearance to things like LEditField.
  73. // (No fill, concave bevel)
  74. class CGATextFieldAttachment : public CGABaseAttachment {
  75. public:
  76.     virtual void    DrawColor( Rect inFrame );
  77. protected:
  78.     virtual void    AdjustClipRect( Rect &inRect ) { ::InsetRect( &inRect, -1, -1 ); }    
  79. };
  80.