home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / lib / mac / UserInterface / CGrayBevelView.cp < prev    next >
Encoding:
Text File  |  1998-04-08  |  3.3 KB  |  113 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  20. //
  21. //        A beveled gray view that can draw raised, recessed or no bevel
  22. //        for any of its subviews.
  23. //
  24. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  25.  
  26. #ifdef PowerPlant_PCH
  27. #include PowerPlant_PCH
  28. #endif
  29.  
  30. #include <LStream.h>
  31. #include <UDrawingState.h>
  32. #include <UDrawingUtils.h>
  33. #include <URegions.h>
  34.  
  35. #include "UStdBevels.h"
  36. #include "UGraphicGizmos.h"
  37. #include "CGrayBevelView.h"
  38.  
  39. #ifndef __PALETTES__
  40. #include <Palettes.h>
  41. #endif
  42.  
  43. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  44. //    Ñ    
  45. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  46. CGrayBevelView::CGrayBevelView(LStream *inStream)
  47.     :    CBevelView(inStream)
  48. {
  49.     ResIDT theBevelTraitsID;
  50.     *inStream >> theBevelTraitsID;
  51.     UGraphicGizmos::LoadBevelTraits(theBevelTraitsID, mBevelColors);
  52. }
  53.  
  54. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  55. //    Ñ    
  56. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  57.  
  58. CGrayBevelView::~CGrayBevelView()
  59. {
  60. }
  61.  
  62. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  63. //    Ñ    
  64. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  65.  
  66. void CGrayBevelView::DrawBeveledFill(void)
  67. {
  68.     Rect theFrame;
  69.     CalcLocalFrameRect(theFrame);
  70.     
  71.     ::PmForeColor(mBevelColors.fillColor);
  72.     ::PaintRgn(mBevelRegion);
  73. }
  74.  
  75. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  76. //    Ñ    
  77. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  78.  
  79. void CGrayBevelView::DrawBeveledFrame(void)
  80. {
  81.     Rect theFrame;
  82.     CalcLocalFrameRect(theFrame);
  83.     
  84.     UGraphicGizmos::BevelRect(theFrame, mMainBevel, mBevelColors.topBevelColor, mBevelColors.bottomBevelColor);
  85. }
  86.  
  87. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  88. //    Ñ    
  89. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  90.  
  91. void CGrayBevelView::DrawBeveledSub(const SSubBevel& inDesc)
  92. {
  93.     Rect subFrame = inDesc.cachedLocalFrame;
  94.     Int16 theInsetLevel = inDesc.bevelLevel;
  95.     
  96.     if (theInsetLevel == 0)
  97.         {
  98.         ApplyForeAndBackColors();
  99.         ::EraseRect(&subFrame);
  100.         }
  101.     else
  102.         {
  103.         if (theInsetLevel < 0)
  104.             theInsetLevel = -theInsetLevel;
  105.                     
  106.         ::InsetRect(&subFrame, -(theInsetLevel), -(theInsetLevel));
  107.                     
  108.         UGraphicGizmos::BevelRect(subFrame, inDesc.bevelLevel,
  109.                     mBevelColors.topBevelColor, mBevelColors.bottomBevelColor);
  110.         }
  111. }
  112.  
  113.