home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / lib / mac / UserInterface / CPatternBevelView.cp < prev    next >
Encoding:
Text File  |  1998-04-08  |  3.3 KB  |  109 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. #ifdef PowerPlant_PCH
  20. #include PowerPlant_PCH
  21. #endif
  22.  
  23. #include "CPatternBevelView.h"
  24. #include "UGraphicGizmos.h"
  25. #include "CSharedPatternWorld.h"
  26.  
  27. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  28. //    Ñ    
  29. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  30. CPatternBevelView::CPatternBevelView(LStream *inStream)
  31.     :    CBevelView(inStream)
  32. {
  33.     ResIDT theBevelTraitsID;
  34.     *inStream >> theBevelTraitsID;
  35.     UGraphicGizmos::LoadBevelTraits(theBevelTraitsID, mArithBevelColors);
  36.     
  37.     ResIDT thePatternResID;
  38.     *inStream >> thePatternResID;
  39.     
  40.     mPatternWorld = CSharedPatternWorld::CreateSharedPatternWorld(thePatternResID);
  41.     ThrowIfNULL_(mPatternWorld);
  42.     mPatternWorld->AddUser(this);
  43.     
  44.     *inStream >> mPatternOrientation;
  45. }
  46.  
  47. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  48. //    Ñ    
  49. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  50.  
  51. CPatternBevelView::~CPatternBevelView()
  52. {
  53.     mPatternWorld->RemoveUser(this);
  54. }
  55.  
  56. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  57. //    Ñ    
  58. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  59.  
  60. void CPatternBevelView::DrawBeveledFill(void)
  61. {
  62.     Rect theFrame;
  63.     CalcLocalFrameRect(theFrame);
  64.     
  65.     Point theAlignment;
  66.     CSharedPatternWorld::CalcRelativePoint(this, CSharedPatternWorld::eOrientation_Port, theAlignment);
  67.     
  68.     CGrafPtr thePort = (CGrafPtr)GetMacPort();
  69.  
  70.     StClipRgnState theClipSaver(mBevelRegion);
  71.     mPatternWorld->Fill(thePort, theFrame, theAlignment);
  72. }
  73.  
  74. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  75. //    Ñ    
  76. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  77.  
  78. void CPatternBevelView::DrawBeveledFrame(void)
  79. {
  80.     Rect theFrame;
  81.     CalcLocalFrameRect(theFrame);
  82.     UGraphicGizmos::BevelTintRect(theFrame, mMainBevel, 0x4000, 0x4000);
  83. }
  84.  
  85. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  86. //    Ñ    
  87. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  88.  
  89. void CPatternBevelView::DrawBeveledSub(const SSubBevel&    inDesc)
  90. {
  91.     Rect subFrame = inDesc.cachedLocalFrame;
  92.     Int16 theInsetLevel = inDesc.bevelLevel;
  93.  
  94.     if (theInsetLevel == 0)
  95.         {
  96.         ApplyForeAndBackColors();
  97.         ::EraseRect(&subFrame);
  98.         }
  99.     else
  100.         {
  101.         if (theInsetLevel < 0)
  102.             theInsetLevel = -theInsetLevel;
  103.                     
  104.         ::InsetRect(&subFrame, -(theInsetLevel), -(theInsetLevel));
  105.         UGraphicGizmos::BevelTintRect(subFrame, inDesc.bevelLevel, 0x4000, 0x4000);
  106.         }
  107. }
  108.  
  109.