home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / macfe / gui / CDeviceLoop.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.9 KB  |  103 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. #ifndef __H_CDeviceLoop
  20. #define __H_CDeviceLoop
  21. #pragma once
  22.  
  23. /*======================================================================================
  24.  
  25.     DESCRIPTION:    Implements an optimized stack-based device loop object.
  26.                     
  27.                     Example:
  28.  
  29.                         Int16 depth;
  30.                         TDeviceLoop theLoop(frame, depth);
  31.                     
  32.                         if ( depth ) do {
  33.                             switch ( depth ) {
  34.             
  35.                                 case 1:        // Black & white
  36.                                     break;
  37.             
  38.                                 case 4:        // 16 colors
  39.                                     break;
  40.             
  41.                                 case 8:        // 256 colors
  42.                                     break;
  43.             
  44.                                 case 16:    // Thousands of colors
  45.                                     break;
  46.                 
  47.                                 case 32:    // Millions of colors
  48.                                     break;
  49.                             }
  50.                         } while ( theLoop.NextDepth(depth) );
  51.                     
  52.     MODIFICATIONS:
  53.  
  54.     Date            Person            Description
  55.     ----            ------            -----------
  56. ======================================================================================*/
  57.  
  58.  
  59. /*====================================================================================*/
  60.     #pragma mark INCLUDE FILES
  61. /*====================================================================================*/
  62.  
  63.  
  64. /*====================================================================================*/
  65.     #pragma mark TYPEDEFS
  66. /*====================================================================================*/
  67.  
  68.  
  69. /*====================================================================================*/
  70.     #pragma mark CONSTANTS
  71. /*====================================================================================*/
  72.  
  73.  
  74. /*====================================================================================*/
  75.     #pragma mark CLASS DECLARATIONS
  76. /*====================================================================================*/
  77.  
  78. #pragma mark -
  79.  
  80. class CDeviceLoop {
  81.  
  82. public:
  83.  
  84.                     CDeviceLoop(const Rect &inLocalRect, Int16 &outFirstDepth);
  85.                     ~CDeviceLoop(void);
  86.  
  87.     Boolean            NextDepth(Int16 &outNextDepth);
  88.  
  89. protected:
  90.  
  91.     void            ClipToIntersection(const Rect &inLocalRect);
  92.     
  93.     // Instance variables
  94.  
  95.     Rect            mGlobalRect;
  96.     GDHandle        mCurrentDevice;
  97.     RgnHandle        mSaveClip;
  98.  
  99. };
  100.  
  101. #endif // __H_CDeviceLoop
  102.  
  103.