home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / lib / mac / UserInterface / CPatternTabControl.cp < prev    next >
Encoding:
Text File  |  1998-04-08  |  2.8 KB  |  81 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. #include "CPatternTabControl.h"
  20. #include "CSharedPatternWorld.h"
  21. #include "UGraphicGizmos.h"
  22.  
  23. //-----------------------------------
  24. CPatternTabControl::CPatternTabControl(LStream* inStream)
  25. //-----------------------------------
  26.     :    Inherited(inStream)
  27. {
  28.     ResIDT theBevelTraitsID;
  29.     *inStream >> theBevelTraitsID;
  30.     UGraphicGizmos::LoadBevelTraits(theBevelTraitsID, mArithBevelColors);
  31.     
  32.     ResIDT thePatternResID;
  33.     *inStream >> thePatternResID;
  34.     
  35.     mPatternWorld = CSharedPatternWorld::CreateSharedPatternWorld(thePatternResID);
  36.     ThrowIfNULL_(mPatternWorld);
  37.     mPatternWorld->AddUser(this);
  38.     
  39.     *inStream >> mPatternOrientation;
  40. } // CPatternTabControl::CPatternTabControl
  41.  
  42. //-----------------------------------
  43. CPatternTabControl::~CPatternTabControl()
  44. //-----------------------------------
  45. {
  46.     mPatternWorld->RemoveUser(this);
  47. } // CPatternTabControl::~CPatternTabControl()
  48.  
  49. //-----------------------------------
  50. void CPatternTabControl::DrawOneTabBackground(
  51.     RgnHandle inRegion,
  52.     Boolean inCurrentTab)
  53. //-----------------------------------
  54. {
  55.     Point theAlignment;
  56.     CSharedPatternWorld::CalcRelativePoint(this, CSharedPatternWorld::eOrientation_Port, theAlignment);
  57.     GrafPtr thePort;
  58.     ::GetPort(&thePort);
  59.     mPatternWorld->Fill((CGrafPtr)thePort, inRegion, theAlignment);
  60. } // CPatternTabControl::DrawOneTabBackground
  61.  
  62. //-----------------------------------
  63. void CPatternTabControl::DrawOneTabFrame(RgnHandle inRegion, Boolean inCurrentTab)
  64. //-----------------------------------
  65. {
  66.     ::FrameRgn(inRegion);
  67. } // CPatternTabControl::DrawOneTabFrame
  68.  
  69. //-----------------------------------
  70. void CPatternTabControl::DrawCurrentTabSideClip(RgnHandle inRegion)
  71. //-----------------------------------
  72. {
  73.     ::SetClip(inRegion);
  74.     Point theAlignment;
  75.     CSharedPatternWorld::CalcRelativePoint(this, CSharedPatternWorld::eOrientation_Port, theAlignment);
  76.     GrafPtr thePort;
  77.     ::GetPort(&thePort);
  78.     mPatternWorld->Fill((CGrafPtr)thePort, mSideClipFrame, theAlignment);
  79. } // CPatternTabControl::DrawOneTabSideClip
  80.  
  81.